๐Ÿ”’ EXCLUSIVE: WordPress/gutenberg/pull/ - High Quality

Skip to content

Conversation

@pooja-muchandikar

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

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
kevin940726

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 );

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 ) }
} ] );

`<!-- 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 );

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.

@kevin940726 kevin940726 mentioned this pull request Jun 15, 2023