-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add basic test coverage for Navigation Menu editing mode #56871
Conversation
Size Change: -15 kB (-1%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in 76e3ec5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7193818704
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests pass and look good. My only concern is whether the test is unnecessarily specific.
Co-authored-by: Ben Dwyer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're testing everything in one test:
- that the navigation to focus mode works
- that in focus mode the list viewworks
- that in focus mode the sidebar works as expected
- that the navigation is locked
We can either split into multiple tests or expect less things IMO
- that the navigation block in focus mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I like grouping similar assertions into one test in e2e testing as it makes them run faster. We could use the optional expect message to document each assertion. Or we could use test.step
if they make sense.
.getByRole( 'button', { | ||
name: 'Primary Menu', | ||
} ) | ||
.click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a test failure (possibly flaky) here. Could we look into it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was resolved by putting a expect on the selector above this one.
I tested by running the test 20 times and saw no failures.
npm run test:e2e:playwright -- -g "Editing Navigation Menus" --repeat-each 20
Thanks for the reviews @scruffian @draganescu and @kevin940726 👍
This was intentional. My thinking was that e2e tests are relatively expensive to run and spinning up multiple testing scenarios for asserting something whose setup is nearly identical is unnecessary overhead for a simple smoke test.
TIL. Nice! |
I've enabled auto merge here based on @scruffian's 👍 review. I recognise that folks had questions/concerns and I've tried to address most of the them. However, I think the value of shipping this and having some coverage exceeds the value of continuing to iterate here on this PR. We can easily follow up if folks feel strongly about any of the outstanding items. |
); | ||
|
||
// Wait for list of Navigations to appear. | ||
editorSidebar.getByRole( 'heading', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we missed this 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test still seems flaky. I'll take another look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to see if I can get the flaky test to happen in #57016
* Smoke test for key behaviours * Update test/e2e/specs/site-editor/navigation-editor.spec.js Co-authored-by: Ben Dwyer <[email protected]> * Use assertion * Prefer role selector * Use steps to break up test --------- Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: Ben Dwyer <[email protected]>
What?
Provided some high level tests for the key features that distinguish the Navigation Menu editing mode from editing other content types.
Why?
Guard against regressions such as that which occurred in #56856.
How?
Basic e2e test.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast