-
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
Migrate Is Typing Test to Playwright #56616
Conversation
For 'should not close the dropdown when typing in it' I switched the test method to use an existing block with a dropdown rather than add a dropdown with an input to the screen. This feels more like real e2e test usage.
Size Change: +453 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
Flaky tests detected in 7022a5f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7033389246
|
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.
Thank you! LGTM 👍. I left some nitpicks but none are blocking.
// Tab to Start Blank Button | ||
await page.keyboard.press( 'Tab' ); | ||
// Select the Start Blank Button | ||
await page.keyboard.press( 'Enter' ); | ||
// Select the First variation | ||
await page.keyboard.press( 'Enter' ); |
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.
Nit: Should we just move this setup inside insertBlock
to create the block we want?
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 it's not worth moving it to insertBlock
for this case. I didn't see insertBlock
accounting for other special circumstances, so I wouldn't want to change it for this instance.
// Moving the mouse shows the toolbar. | ||
await editor.showBlockToolbar(); | ||
// Open the dropdown. | ||
await page.getByLabel( 'Display settings' ).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.
Nit: Could we change this to getByRole
?
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.
Sure! I just used Playwright's locator picker for it. Is it preferable to use getByRole to force usage of a button here?
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.
Yep! getByRole
is always preferred and TBH I haven't found a need to use other query functions yet. It's preferred because it communicates the intent well for readers, that we're clicking on a button rather than anything else.
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.
That makes sense. Thanks for explaining!
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.
To simplify, the the test method for typing in dropdowns from a toolbar was switched to use an existing block with a dropdown rather than add a dropdown with an input to the toolbar manually.
What?
Migrating is-typing e2e tests from puppeteer to playwright
Why?
Part of the larger migration effort in #38851, also because this test is failing in #56335 because of how the block toolbar is defined as visible or not.
How?
Testing Instructions
npm run test:e2e:playwright test/e2e/specs/editor/various/is-typing.spec.js
Testing Instructions for Keyboard
Screenshots or screencast