-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Route to published post instead of homepage on navigation e2e tests #52802
Conversation
… github e2e tests
Size Change: +279 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Flaky tests detected in 2367301. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5624393234
|
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.
Good catch, @jeryj!
requestUtils.deleteAllMenus(), | ||
requestUtils.activateTheme( 'twentytwentyone' ), | ||
] ); | ||
await Promise.all( [ requestUtils.deleteAllMenus() ] ); |
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 can remove Promise.all
just await for the single action.
Some of the navigation tests rely on routing to
/
to test a menu created in the post editor. This works because if there are no menus, the header navigation template in TT3 should grab the only available menu (the one just created) and put it in the header, like this:Locally, when I run these tests which deletes the menu, I end up with no menu in the header. I even deleted TT3 from my testing environment and reinstalled it.
In the header template state that has the "Navigation menu has been deleted or unavailable message".
I've tried enough strategies to get my test environment and the github e2e test environment inline without any success. This makes me want to redo the method since it seems flaky (or at least is annoying enough to me).
Also, since this test is relying on a side-effect of the TT3 theme that should have a header template and should populate the header navigation with the most recently created one, the test works due to a side-effect that we could remove.
I think a better test set-up is to route to the published post, but on the github e2e tests, it ends up having two identical menus and the locator isn't specific enough.
The Fix
Instead of relying on the header template to hopefully use the only created navigation, use a theme without a default header navigation (TT1, which is already active), and route directly to the published post to check the markup.
Testing Instructions
npm run test:e2e:playwright /navigation.spec.js