bcgov / bcgov/lcfs

LCFS - Fix Failing Cypress Tests - Multiple Step Definition Conflicts and Login Issues

Open
#2,973 0 comments 0 reactions 1 assignee Claimed by @AlexZorkin View on GitHub
High Tech Debt
Dominant language
Python
Stars
6
Forks
6
Avg merge
2d 4h
Merged PRs (30d)
87

Description

**Describe the task**
Fix multiple failing Cypress test suites that are currently blocking the daily CI/CD pipeline. The tests are failing due to duplicate step definitions, login flow issues, and missing UI elements.

**Purpose**
- Restore CI/CD pipeline reliability by fixing failing automated tests
- Ensure quality gates are functioning properly for deployments
- Prevent regression in critical user flows (login, transfers, transactions)
- Maintain test coverage for accessibility and core functionality

**Current Failing Tests**
- **Transaction Management**: Multiple matching step definitions for login steps
- **Transfer Flows**: Login request timeouts and missing elements
- **User Creation**: Duplicate step definitions for success messages
- **Login Flows**: BCeID login timeouts and authentication issues
- **Director Transfer Flow**: Origin mismatch errors with external auth

**Root Causes Identified**
1. **Duplicate Step Definitions**: Multiple definitions for common steps like "the analyst logs in with valid credentials" and "a success message is displayed"
2. **Login Flow Issues**: BCeID login requests timing out (30s timeout exceeded)
3. **Authentication Origin Conflicts**: Tests expecting localhost but redirected to `https://logontest7.gov.bc.ca`
4. **Missing UI Elements**: Elements like `#approve-btn` not found in expected contexts

**Acceptance Criteria**
- [ ] Resolve duplicate step definitions by consolidating or making them more specific
- [ ] Fix BCeID login flow timeouts by updating authentication handling
- [ ] Implement proper cross-origin handling for external authentication flows
- [ ] Update selectors for missing UI elements or fix timing issues
- [ ] Ensure all test suites pass consistently in CI environment
- [ ] Document any changes to test patterns or authentication flows
- [ ] Verify accessibility tests continue to pass (currently working)
- [ ] Verify organization management tests continue to pass (currently working)

**Additional context**
- 12 out of 29 tests are currently failing (70% failure rate)
- Accessibility and organization tests are passing, indicating infrastructure is sound
- Issue appears to be primarily with authentication flows and step definition conflicts
- Tests were likely broken by recent changes to login/authentication system
- Need to investigate recent changes to step definition files for conflicts

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.