OCPBUGS-83816: Fix race conditions in create-namespace Cypress tests#16306
Conversation
|
@rhamilto: This pull request references Jira Issue OCPBUGS-83816, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/jira refresh |
|
@rhamilto: This pull request references Jira Issue OCPBUGS-83816, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@rhamilto: This pull request references Jira Issue OCPBUGS-83816, which is valid. 3 validation(s) were run on this bug
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
📝 WalkthroughWalkthroughThese changes introduce explicit visibility assertions to the "A specific namespace" radio option interactions across two integration test files. The test file now asserts visibility before clicking the radio option, while the view file adds a visibility check before calling 🚥 Pre-merge checks | ✅ 10✅ Passed checks (10 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/packages/operator-lifecycle-manager/integration-tests/tests/create-namespace.cy.ts (1)
35-37: Consider asserting the radio is selected after the click.A post-click
be.checkedassertion makes this step more deterministic if a late re-render happens.Suggested tweak
-cy.byTestID('A specific namespace on the cluster-radio-input').should('be.visible').click(); +cy.byTestID('A specific namespace on the cluster-radio-input') + .should('be.visible') + .click() + .should('be.checked');🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/packages/operator-lifecycle-manager/integration-tests/tests/create-namespace.cy.ts` around lines 35 - 37, After ensuring the radio button is visible and clicking it via cy.byTestID('A specific namespace on the cluster-radio-input'), add a post-click assertion to confirm selection (e.g., assert it is checked) so late re-renders can't leave the radio unselected; update the test around the cy.byTestID(...).should('be.visible').click() step to follow the click with a .should('be.checked') assertion targeting the same test id.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@frontend/packages/operator-lifecycle-manager/integration-tests/tests/create-namespace.cy.ts`:
- Around line 35-37: After ensuring the radio button is visible and clicking it
via cy.byTestID('A specific namespace on the cluster-radio-input'), add a
post-click assertion to confirm selection (e.g., assert it is checked) so late
re-renders can't leave the radio unselected; update the test around the
cy.byTestID(...).should('be.visible').click() step to follow the click with a
.should('be.checked') assertion targeting the same test id.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 754df77f-5576-4cf6-a975-99b34a2abde9
📒 Files selected for processing (2)
frontend/packages/operator-lifecycle-manager/integration-tests/tests/create-namespace.cy.tsfrontend/packages/operator-lifecycle-manager/integration-tests/views/operator.view.ts
📜 Review details
🔇 Additional comments (1)
frontend/packages/operator-lifecycle-manager/integration-tests/views/operator.view.ts (1)
42-43: Solid flake fix for the single-namespace radio interaction.This is a good stability improvement for async form re-renders before selection.
|
/retest |
2 similar comments
|
/retest |
|
/retest |
990a6ff to
51d2b6c
Compare
|
/retest-required |
|
/retest |
The create-namespace.cy.ts test fails intermittently with a timeout
waiting for the Installation mode radio button. Investigation revealed
multiple race conditions:
1. The catalog modal Install button click could fail to navigate to the
install form. The button is conditionally rendered based on the
useCtaLink hook, which asynchronously processes the CTA href. Clicking
before the href attribute is set causes navigation to fail silently.
2. The Installation mode radio buttons re-render asynchronously after
the channel/version selectors load, causing the element to be
detached from the DOM before Cypress can interact with it.
This fix:
- Waits for catalog-details-modal-cta to have a valid href attribute
before clicking to ensure navigation will succeed
- Adds .should('be.visible') wait conditions before clicking/checking
radio buttons to ensure elements are stable
- Applies fixes to both create-namespace.cy.ts and operator.view.ts
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
51d2b6c to
ac1e448
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logonoff, rhamilto The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/verified by CI |
|
@logonoff: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@rhamilto: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@rhamilto: Jira Issue Verification Checks: Jira Issue OCPBUGS-83816 Jira Issue OCPBUGS-83816 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
What is this PR about?
Fixes intermittent failures in the
create-namespace.cy.tsCypress test caused by race conditions.Root Cause Analysis
Investigation revealed two distinct race conditions:
Install button navigation failure: The catalog modal Install button (
catalog-details-modal-cta) is conditionally rendered based on theuseCtaLinkhook, which asynchronously processes the CTA href by parsing query parameters. Clicking the button before thehrefattribute is fully set causes navigation to the install form to fail silently.Radio button detachment: The Installation mode radio buttons re-render asynchronously after the channel/version selectors load their data, causing the DOM element to be detached before Cypress can interact with it.
Changes
.should('have.attr', 'href')assertion to wait for the href attribute to be set before clicking, ensuring navigation will succeed.should('be.visible')wait conditions before clicking/checking to ensure elements are stable after async re-renderscreate-namespace.cy.tsandoperator.view.tsfor consistencyTesting
Related Issues
🤖 Generated with Claude Code