Skip to content
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

Conversation

pooja-muchandikar
Copy link
Contributor

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

@pooja-muchandikar
Copy link
Contributor Author

Hi @kevin940726,

I hope you are going great!..

Could you please help me in reviewing this PR?

Thanks!!

@juanfra juanfra added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label May 24, 2023
Copy link
Member

@kevin940726 kevin940726 left a 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 🙇‍♂️.

Comment on lines 50 to 54
// 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 );
Copy link
Member

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 );
Copy link
Member

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.

@pooja-muchandikar
Copy link
Contributor Author

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?

@pooja-muchandikar
Copy link
Contributor Author

Hi @kevin940726,
I am closing this PR as the conflicts are not visible in my local because of which unable to fix it..

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!

@pooja-muchandikar pooja-muchandikar deleted the migrate/adding-inline-token-test branch June 28, 2023 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
3 participants