Skip to content

Commit

Permalink
Migrate block api test to Playwright (#40217)
Browse files Browse the repository at this point in the history
* Create block-api.spec.js

* Delete original test file

* Update block-api.spec.js

* Update block-api.spec.js
  • Loading branch information
JustinyAhin committed Apr 11, 2022
1 parent f3cdea9 commit 6fe9d46
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 33 deletions.
33 changes: 0 additions & 33 deletions packages/e2e-tests/specs/editor/plugins/block-api.test.js

This file was deleted.

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

test.describe( 'Using Block API', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activatePlugin( 'gutenberg-test-block-api' );
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin( 'gutenberg-test-block-api' );
} );

test( 'Inserts the filtered hello world block even when filter added after block registration', async ( {
page,
pageUtils,
} ) => {
await pageUtils.createNewPost();

await pageUtils.insertBlock( { name: 'e2e-tests/hello-world' } );

const block = page.locator( '[data-type="e2e-tests/hello-world"]' );
await expect( block ).toHaveText( 'Hello Editor!' );
} );
} );

0 comments on commit 6fe9d46

Please sign in to comment.