forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate 'Plugins API' e2e tests to Playwright (WordPress#55958)
* Migrate 'Plugins API' e2e tests to Playwright * Remove old test file and snapshot
- Loading branch information
Showing
4 changed files
with
271 additions
and
196 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
packages/e2e-tests/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap
This file was deleted.
Oops, something went wrong.
189 changes: 0 additions & 189 deletions
189
packages/e2e-tests/specs/editor/plugins/plugins-api.test.js
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
test/e2e/specs/editor/plugins/plugins-api-error-boundary.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.' | ||
); | ||
} ); | ||
} ); |
Oops, something went wrong.