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 Splitting Merging test to Playwright #44916

Merged

Conversation

pooja-muchandikar
Copy link
Contributor

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

@Mamaduka Mamaduka added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Oct 13, 2022
@Mamaduka Mamaduka self-requested a review October 13, 2022 11:30
@pooja-muchandikar
Copy link
Contributor Author

Hi @Mamaduka,

Could you please help me reviewing this PR? Do let me know if there are any suggestions.

Thanks!!

Comment on lines 304 to 306
expect(
await page.locator( '.block-editor-block-list__block' )
).toBeDefined();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Comment on lines 329 to 330
const content = await editor.getEditedPostContent();
expect( content ).toBe(
Copy link
Member

@Mamaduka Mamaduka Oct 19, 2022

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.

Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link
Member

@Mamaduka Mamaduka left a 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.

@pooja-muchandikar
Copy link
Contributor Author

Hi @Mamaduka,

Rest other feedbacks are addressed..

@Mamaduka Mamaduka merged commit e1fd14d into WordPress:trunk Oct 20, 2022
@github-actions github-actions bot added this to the Gutenberg 14.5 milestone Oct 20, 2022
@pooja-muchandikar pooja-muchandikar deleted the add/splitting-merging-test branch October 20, 2022 10:19
await page.keyboard.type( '-' );

// Check the content.
expect( await editor.getEditedPostContent() ).toMatchSnapshot();
Copy link
Member

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?

@ellatrix
Copy link
Member

@Mamaduka We need to make sure these tests remain the same when migrating them.

@Mamaduka
Copy link
Member

Mamaduka commented Nov 25, 2022

@ellatrix, sorry I missed that 🙇 I will create PRs to add missing expectations.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants