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 deprecated node matcher tests to playwright #42759

Merged
Merged
Show file tree
Hide file tree
Changes from all 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.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- wp:deprecated-children-matcher -->
<p class="wp-block-deprecated-children-matcher">test<br/><strong>a</strong></p>
<!-- /wp:deprecated-children-matcher -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- wp:deprecated-node-matcher -->
<blockquote class="wp-block-deprecated-node-matcher"><p>test</p><p></p></blockquote>
<!-- /wp:deprecated-node-matcher -->
55 changes: 55 additions & 0 deletions test/e2e/specs/editor/plugins/deprecated-node-matcher.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* WordPress dependencies
*/
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Deprecated Node Matcher', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activatePlugin(
'gutenberg-test-deprecated-node-matcher'
);
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-deprecated-node-matcher'
);
} );

test( 'should insert block with node source', async ( {
page,
editor,
} ) => {
// await insertBlock( 'Deprecated Node Matcher' );
await editor.insertBlock( { name: 'core/deprecated-node-matcher' } );
await page.keyboard.type( 'test' );
await page.keyboard.press( 'Enter' );
expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );

test( 'should insert block with children source', async ( {
page,
editor,
pageUtils,
} ) => {
// await insertBlock( 'Deprecated Children Matcher' );
await editor.insertBlock( {
name: 'core/deprecated-children-matcher',
} );
await page.keyboard.type( 'test' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( 'a' );
await page.keyboard.down( 'Shift' );
await page.keyboard.press( 'ArrowLeft' );
await page.keyboard.up( 'Shift' );
await pageUtils.pressKeyWithModifier( 'primary', 'b' );
expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );
} );