Remove 'Home' and 'End' key usage from Navigation Tests#77102
Conversation
Mac and Linux use different implementations for Home and End keypresses, which resulted in inconsistent behavior on playwright usage of Home and End.
|
Size Change: 0 B Total Size: 7.74 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 339768f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24141062525
|
|
Would it make sense to have this mapping supported via Searching the tests, there are more cases where similar changes might be needed. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Is it possible that tests using the await page.keyboard.press( 'Home' );
await page.keyboard.press( 'End' );
If so, I agree with this. |
|
Thanks for the reviews @t-hamano and @Mamaduka! I was hesitant to move this to the Playwright layer as I wasn't confident in the change yet. After your feedback, I tried moving the Home and End key mapping up to However, In the Navigation tests, I was using It seems like, unless we're really testing |
| // Move to the submenu item (only one ArrowUp needed - skips the | ||
| // submenu wrapper directly to Cat's content) | ||
| await page.keyboard.press( 'ArrowUp' ); | ||
| await page.keyboard.press( 'Home' ); |
There was a problem hiding this comment.
This one doesn't seem to do anything. The cursor is already at the right location with ArrowUp
That's a good point. |
What?
Fixes focus management navigation e2e tests failing in mac environments.
Why?
How?
Check platform for Home and End and use the correct one:
Home+Shift+Endwithprimary+aEndwithArrowDownTesting Instructions
npm run test:e2e test/e2e/specs/editor/blocks/navigation.spec.js
Testing Instructions for Keyboard
Screenshots or screencast
Use of AI Tools
Claude helped debug and find the solution.