-
Notifications
You must be signed in to change notification settings - Fork 340
fix(e2e): add explicit wait and visibility check for geo location search textbox #6822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…rch textbox
The map-with-location-search e2e tests were flaky due to race conditions
where cy.findByRole would attempt to interact with the search textbox
before it was fully rendered and visible.
Changes:
- Added timeout: 30000 to all textbox queries to allow more time for rendering
- Added .should('be.visible') assertion before interactions to ensure element is ready
- Applied fix to both common/geo.ts and map-with-location-search.steps.ts
This resolves the 'Unable to find an accessible element with the role textbox'
timeout errors that were causing test failures across multiple PRs.
|
Added explicit wait step in Background to ensure the map canvas and search input are rendered before tests attempt to interact with them. This addresses the flaky test failures where the component wasn't fully loaded in CI.
Adding debugging to understand root cause of flaky test: - Log current URL and page content - Capture console errors - Take screenshot before checking for map - Log body HTML length and text content This will help identify why the component isn't rendering in CI.
252f1ba to
52be13d
Compare
Cypress doesn't allow cy commands inside promise callbacks. Simplified debugging to just take screenshots which will show the page state when the test fails.
Using console.log instead of cy.log to avoid Cypress promise issues. This will output to the CI logs showing: - Current URL - Body HTML length - Body text content - Screenshot of page state
- Use cy.document() to access DOM directly without promise issues - Log page state, element existence, and content - Add full-page screenshots - Create custom workflow to run only geo tests for faster iteration
Description
Fixes flaky e2e tests in the map-with-location-search feature that were failing across multiple PRs with timeout errors.
Problem
The tests were experiencing race conditions where
cy.findByRolewould attempt to interact with the search textbox before it was fully rendered and visible, resulting in:Solution
timeout: 30000to all textbox queries to allow more time for rendering.should('be.visible')assertion before interactions to ensure element is readycommon/geo.tsandmap-with-location-search.steps.tsTesting
This fix addresses the flaky test failures seen in recent PRs. The tests should now wait properly for the search input to be visible before attempting to interact with it.
Related Issues
Fixes test failures in: