Skip to content

Commit

Permalink
Move user creation/deletion into beforeAll and afterAll
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Jun 30, 2021
1 parent 16d64f4 commit bfa22c6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/e2e-tests/specs/editor/blocks/site-title.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@ const saveEntities = async () => {
};

describe( 'Site Title block', () => {
let originalSiteTitle;
let originalSiteTitle, password;
const username = 'testuser';
beforeAll( async () => {
originalSiteTitle = await getSetting( 'blogname' );
password = await createUser( username, { role: 'editor' } );
} );

afterAll( async () => {
await deleteUser( username );
await setSetting( 'blogname', originalSiteTitle );
} );

Expand All @@ -92,8 +95,6 @@ describe( 'Site Title block', () => {
} );

it( 'Cannot edit the site title as editor', async () => {
const username = 'testuser';
const password = await createUser( username, { role: 'editor' } );
await loginUser( username, password );

await createNewPost();
Expand All @@ -108,8 +109,6 @@ describe( 'Site Title block', () => {
);
expect( editable ).toBe( 'inherit' );

await deleteUser( username );

// FIXME: Fix https://github.com/WordPress/gutenberg/issues/33003 and remove the following line.
expect( console ).toHaveErroredWith(
'Failed to load resource: the server responded with a status of 403 (Forbidden)'
Expand Down

0 comments on commit bfa22c6

Please sign in to comment.