Skip to content

Commit

Permalink
Try avoiding beforeAll and afterAll in nonce test
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Apr 5, 2022
1 parent e51a00a commit 70eb336
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions packages/e2e-tests/specs/editor/plugins/nonce.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,12 @@ import {
} from '@wordpress/e2e-test-utils';

describe( 'Nonce', () => {
beforeAll( async () => {
it( 'should refresh when expired', async () => {
// This test avoids using `beforeAll` and `afterAll` as that
// interferes with the `rest` and `batch` e2e test utils.
await activatePlugin( 'gutenberg-test-plugin-nonce' );
} );

afterAll( async () => {
await deactivatePlugin( 'gutenberg-test-plugin-nonce' );
} );

beforeEach( async () => {
await createNewPost();
} );

it( 'should refresh when expired', async () => {
await page.keyboard.press( 'Enter' );
// eslint-disable-next-line no-restricted-syntax
await page.waitForTimeout( 5000 );
Expand All @@ -31,5 +24,6 @@ describe( 'Nonce', () => {
await saveDraft();
// We expect a 403 status once.
expect( console ).toHaveErrored();
await deactivatePlugin( 'gutenberg-test-plugin-nonce' );
} );
} );

0 comments on commit 70eb336

Please sign in to comment.