-
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
Migrate 'meta-attribute-block' e2e tests to Playwright #55830
Conversation
Size Change: 0 B Total Size: 1.7 MB ℹ️ View Unchanged
|
Flaky tests detected in 79efbef. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6743297825
|
} ) => { | ||
await admin.createNewPost(); | ||
await editor.insertBlock( { name: blockName } ); | ||
await page.keyboard.type( 'Value' ); |
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'm wondering if typing immediately after inserting a block can potentially be flaky since we don't have a promise ensuring the block is there and focused (AFAIR there were issues with that before!). What if we returned the inserted block locator from the createBlock
so that we can do a simple await expect( block ).toBeFocused()
? I've drafted an implementation in #55851.
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.
Would look more less like this:
const paragraph = await editor.insertBlock( { name: 'core/paragraph' } );
await expect( paragraph ).toBeFocused();
await page.keyboard.type( 'Howdy hoo!');
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.
This should be okay. The editor will automatically focus first focusable element in newly inserted block.
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.
Is the block insertion synchronous, though? I can see that, e.g., window.wp.data.dispatch( 'core/block-editor' ).insertBlock( x )
returns a promise but we're not really awaiting 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.
Right, maybe we should await that. @kevin940726, WDYY?
I'll keep an eye on the flaky reports for this test, just in case.
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.
Just one non-blocking suggestion. Otherwise, is looks good as always! 🚀
What?
Part of #38851.
PR migrates
meta-attribute-block.test.js
e2e tests to PlaywrightWhy?
See #38851.
Testing Instructions