-
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 Splitting Merging test to Playwright #44916
Migrate Splitting Merging test to Playwright #44916
Conversation
Hi @Mamaduka, Could you please help me reviewing this PR? Do let me know if there are any suggestions. Thanks!! |
expect( | ||
await page.locator( '.block-editor-block-list__block' ) | ||
).toBeDefined(); |
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.
expect( | |
await page.locator( '.block-editor-block-list__block' ) | |
).toBeDefined(); | |
await expect( | |
page.locator( 'role=document[name=/Empty block/i]' ) | |
).toBeVisible(); | |
await expect( | |
page.locator( 'role=textbox[name="Add title"i]' ) | |
).toBeVisible(); |
Maybe we could write this as a role selector? What do you think?
const content = await editor.getEditedPostContent(); | ||
expect( content ).toBe( |
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.
Suggestion (non-blocking): When padding post content to inline snapshots, you can also use expect.poll
to auto-wait for assertion. It can be used in most of the tests in this suite.
await expect.poll( editor.getEditedPostContent ).toBe( '' )
Note: The method does not work with toMatchSnapshot
assertions.
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.
@pooja-muchandikar, sorry for miss understanding. There's no need to convert inline snapshot assertions to toMatchSnapshot
.
For small text nodes, I would always recommend inline snapshots.
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.
Hi @Mamaduka,
I tried the above suggestion but somehow its failing in local, so that's the reason I have added toMatchSnapshot
assertion.
Should I revert 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.
That's odd. Thanks for testing it locally. There's no need to revert. I will merge the PR once all checks are green.
Thanks again for the contribution!
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!
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.
Thanks for the PR, @pooja-muchandikar.
The migration looks good to me. I just left some minor suggestions.
Hi @Mamaduka, Rest other feedbacks are addressed.. |
await page.keyboard.type( '-' ); | ||
|
||
// Check the content. | ||
expect( await editor.getEditedPostContent() ).toMatchSnapshot(); |
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 test used to have two expect checks and now it only has one. Why have these tests been modified?
@Mamaduka We need to make sure these tests remain the same when migrating them. |
@ellatrix, sorry I missed that 🙇 I will create PRs to add missing expectations. |
What?
Part of #38851.
Migrate splitting-merging.test.js to its Playwright version.
Why?
Part of #38851.
How?
See MIGRATION.md for migration steps.
Testing Instructions
Run
npm run test-e2e:playwright test/e2e/specs/editor/various/splitting-merging.spec.js