-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 Adding Inline Token test to Playwright #50844
Migrate Adding Inline Token test to Playwright #50844
Conversation
Hi @kevin940726, I hope you are going great!.. Could you please help me in reviewing this PR? Thanks!! |
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! Sorry for the late review! This is looking great though! Just a small suggestion 🙇♂️.
// Check the content. | ||
const regex = new RegExp( | ||
`<!-- wp:paragraph -->\\s*<p>a <img class="wp-image-\\d+" style="width:\\s*10px;?" src="[^"]+\\/${ filename }\\.png" alt=""\\/?><\\/p>\\s*<!-- \\/wp:paragraph -->` | ||
); | ||
expect( await getEditedPostContent() ).toMatch( regex ); | ||
expect( await editor.getEditedPostContent() ).toMatch( regex ); |
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.
Let's instead do something like:
const contentRegex = new RegExp(
`a <img class="wp-image-\\d+" style="width:\\s*10px;?" src="[^"]+\\/${ filename }\\.png" alt=""\\/?>`
);
await expect.poll( editor.getBlocks ).toMatchObject( [ {
name: 'core/paragraph',
attributes: { content: expect.stringMatching( contentRegex ) }
} ] );
@@ -76,6 +64,6 @@ describe( 'adding inline tokens', () => { | |||
const regex2 = new RegExp( | |||
`<!-- wp:paragraph -->\\s*<p>a <img class="wp-image-\\d+" style="width:\\s*20px;?" src="[^"]+\\/${ filename }\\.png" alt=""\\/?><\\/p>\\s*<!-- \\/wp:paragraph -->` | |||
); | |||
expect( await getEditedPostContent() ).toMatch( regex2 ); | |||
expect( await editor.getEditedPostContent() ).toMatch( regex2 ); |
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.
Same here with a similar change.
Hi @kevin940726, I hope you are doing great! I have addressed all the feedbacks and pushed the code, but seems PR has some conflicts however, I am not able to see these conflicts in my local. Could you please help in resolve it from PR directly or should I create new PR with the suggested changes? |
Hi @kevin940726, So I have created new PR with all the changes/feedbacks being addressed - #52020 Please review and let me know if there are more suggestions! Thanks! |
What?
Part of #38851.
Migrate adding-inline-tokens.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/adding-inline-tokens.spec.js