Skip to content

Commit

Permalink
Migrate deprecated node matcher tests to playwright (#42759)
Browse files Browse the repository at this point in the history
Co-authored-by: pavanpatil1 <=>
  • Loading branch information
pavanpatil1 authored Aug 10, 2022
1 parent 69c294d commit d908473
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 57 deletions.

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

0 comments on commit d908473

Please sign in to comment.