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 Patterns Test to Playwright #50083

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

22 changes: 0 additions & 22 deletions packages/e2e-tests/specs/editor/various/adding-patterns.test.js

This file was deleted.

31 changes: 31 additions & 0 deletions test/e2e/specs/editor/various/adding-patterns.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'adding patterns', () => {
test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test( 'should insert a block pattern', async ( { page, editor } ) => {
await page.click(
'role=region[name="Editor top bar"i] >> role=button[name="Toggle block inserter"i]'
);

await page.fill(
'role=region[name="Block Library"i] >> role=searchbox[name="Search for blocks and patterns"i]',
'Social links with a shared background color'
);

await page.click(
'role=option[name="Social links with a shared background color"i]'
);
await expect.poll( editor.getBlocks ).toMatchObject( [
{
name: 'core/social-links',
attributes: { className: 'has-icon-color' },
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I don't think we need this. I think we only want to check if it's a social-links block.

Suggested change
attributes: { className: 'has-icon-color' },

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed the feedback!

},
] );
} );
} );