Skip to content

fix(ui): fix flaky selectNamespace race condition in cypress test#2664

Open
jonburdo wants to merge 1 commit intokubeflow:mainfrom
jonburdo:fix/flaky-select-namespace-cypress-test
Open

fix(ui): fix flaky selectNamespace race condition in cypress test#2664
jonburdo wants to merge 1 commit intokubeflow:mainfrom
jonburdo:fix/flaky-select-namespace-cypress-test

Conversation

@jonburdo
Copy link
Copy Markdown
Member

Wait for the namespace dropdown button to be enabled before clicking, removing force:true which bypassed actionability checks and caused intermittent failures when the namespace API response hadn't arrived yet.

Description

selectNamespace and shouldHaveNamespaceOptions use click({ force: true }), which bypasses Cypress's actionability checks. When the namespace API response hasn't arrived yet, the dropdown button is disabled (isDisabled={namespaces.length === 0}), but force: true clicks it anyway — no options render, and the test times out looking for role="option" elements.

This is timing-dependent: it only fails when the page takes slightly longer to load (e.g., after a preceding test navigates away from the register page).

All four failures produce the same error:

AssertionError: Timed out retrying after 10000ms: Unable to find an accessible element
with the role "option" and name "namespace-1"
  at RegisterAndStoreFields.selectNamespace (registerAndStoreFields.ts:52:7)

failures

Three failures across unrelated commits spanning a month:

Date Run Commit Branch
Mar 31 23800808381 3088da28 main
Apr 10 24249576848 8f5d7803 main
Apr 27 24991865315 6eb25cfb main

evidence this is a flaky test

Run 25053512145 on commit d911da74identical code, identical CI, different results:

Attempt Result Details
2 failure selectNamespace — 1 failing, 381 passing
3 success All 382 tests pass

Fix

  1. Wait for the dropdown to be enabled before interacting (.should('not.be.disabled'))
  2. Remove force: true so Cypress respects normal actionability checks
  3. Verify the listbox is visible after clicking before selecting an option

Tested locally

To ensure it doesn't break anything, I made sure this still passes:

cd clients/ui/frontend
npm run test:cypress-ci -- --spec "src/__tests__/cypress/cypress/tests/mocked/modelRegistry/registerAndStoreFields.cy.ts"

How Has This Been Tested?

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages
  • Automated tests are provided as part of the PR for major new functionalities; testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.
  • For first time contributors: Please reach out to the Reviewers to ensure all tests are being run, ensuring the label ok-to-test has been added to the PR.

If you have UI changes

  • The developer has added tests or explained why testing cannot be added.
  • Included any necessary screenshots or gifs if it was a UI change.
  • Verify that UI/UX changes conform the UX guidelines for Kubeflow.

Wait for the namespace dropdown button to be enabled before clicking,
removing force:true which bypassed actionability checks and caused
intermittent failures when the namespace API response hadn't arrived yet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Jon Burdo <jon@jonburdo.com>
@google-oss-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jonburdo. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the Cypress page-object helpers around the namespace dropdown in the Model Registry “Register model” flow to eliminate timing-related flakiness when namespaces haven’t loaded yet.

Changes:

  • Wait for the namespace select control to be enabled before interacting with it.
  • Remove click({ force: true }) so Cypress actionability checks are respected.
  • Add an explicit assertion that the dropdown listbox is visible before selecting an option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jonburdo jonburdo marked this pull request as ready for review May 1, 2026 01:04
@jonburdo
Copy link
Copy Markdown
Member Author

jonburdo commented May 1, 2026

/cc @manaswinidas @ppadti

Does this seem reasonable?

@google-oss-prow google-oss-prow Bot requested review from manaswinidas and ppadti May 1, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants