Skip to content

Commit

Permalink
Migrate 'Plugins API' e2e tests to Playwright (WordPress#55958)
Browse files Browse the repository at this point in the history
* Migrate 'Plugins API' e2e tests to Playwright
* Remove old test file and snapshot
  • Loading branch information
Mamaduka authored Nov 15, 2023
1 parent 8f3405f commit 90aa9bd
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 196 deletions.

This file was deleted.

189 changes: 0 additions & 189 deletions packages/e2e-tests/specs/editor/plugins/plugins-api.test.js

This file was deleted.

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

test.describe( 'Plugins API Error Boundary', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activatePlugin(
'gutenberg-test-plugin-plugins-error-boundary'
);
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-plugin-plugins-error-boundary'
);
} );

test( 'Should create notice using plugin error boundary callback', async ( {
admin,
page,
} ) => {
let hasError = false;
page.on( 'console', ( msg ) => {
if ( msg.type() === 'error' && msg.text().includes( 'Whoops!' ) )
hasError = true;
} );

await admin.createNewPost();

expect( hasError ).toBe( true );
await expect(
page.locator( '.is-error .components-notice__content' )
).toContainText(
'The "my-error-plugin" plugin has encountered an error and cannot be rendered.'
);
} );
} );
Loading

0 comments on commit 90aa9bd

Please sign in to comment.