Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/e2e/specs/admin/font-library.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ test.describe( 'Font Library', () => {
);
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-delete-installed-fonts'
);
} );

test.beforeEach( async ( { admin } ) => {
await admin.visitAdminPage(
'admin.php',
'page=font-library-wp-admin'
);
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-delete-installed-fonts'
);
} );

test( 'should allow user to add and remove multiple local font files', async ( {
page,
editor,
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/specs/editor/blocks/buttons.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,14 @@ test.describe( 'Buttons', () => {
await requestUtils.activateTheme( 'emptytheme' );
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test( 'can resize width', async ( { editor, page } ) => {
// Mock spacing units to include % for the width control
await page.waitForFunction( () => window?.wp?.data );
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/specs/editor/blocks/classic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ test.use( {
} );

test.describe( 'Classic', () => {
test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllMedia();
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllMedia();
} );

test( 'should be inserted', async ( { editor, page } ) => {
await editor.insertBlock( { name: 'core/freeform' } );
await editor.canvas
Expand Down Expand Up @@ -142,7 +142,7 @@ test.describe( 'Classic', () => {
await expect( classicBlock ).toBeVisible();
await classicBlock.click();

expect( errors.length ).toBe( 0 );
expect( errors ).toHaveLength( 0 );
await expect.poll( editor.getEditedPostContent ).toBe( 'test' );
} );
} );
Expand Down
1 change: 1 addition & 0 deletions test/e2e/specs/editor/blocks/columns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ test.describe( 'Columns', () => {
await pageUtils.pressKeys( 'Tab' );
await expect( columnsChangeInput ).toHaveValue( '3' );
} );

test( 'Ungroup properly', async ( { editor } ) => {
await editor.insertBlock( {
name: 'core/columns',
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/specs/editor/blocks/image.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,14 +969,14 @@ test.describe( 'Image - lightbox', () => {
);
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllMedia();
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllMedia();
} );

test.describe( 'should respect theme.json settings and block overrides', () => {
test.describe( 'Theme.json settings - allow editing FALSE, enabled FALSE', () => {
test.beforeAll( async ( { requestUtils } ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ test.describe( 'Navigation block - Frontend interactivity', () => {
await requestUtils.deleteAllMenus();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test.afterEach( async ( { requestUtils } ) => {
await requestUtils.deleteAllTemplates( 'wp_template_part' );
await requestUtils.deleteAllPages();
await requestUtils.deleteAllMenus();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test.describe( 'Overlay menu', () => {
test.beforeEach( async ( { admin, editor, requestUtils } ) => {
await admin.visitSiteEditor( {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Navigation block - Submenu Visibility', () => {
test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllMenus();
await requestUtils.deleteAllPages();
} );

test.beforeEach( async ( { admin, editor, requestUtils } ) => {
await admin.createNewPost();

Expand Down Expand Up @@ -38,6 +33,11 @@ test.describe( 'Navigation block - Submenu Visibility', () => {
await editor.selectBlocks( navBlock );
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllMenus();
await requestUtils.deleteAllPages();
} );

test( 'When Always is selected, submenus are visible on the page', async ( {
editor,
page,
Expand Down Expand Up @@ -139,6 +139,7 @@ test.describe( 'Navigation block - Submenu Visibility', () => {
const pageListBlock = editor.canvas.getByRole( 'document', {
name: 'Block: Page List',
} );

await test.step( 'Test setup', async () => {
// Create parent and child pages for testing
const parentPage = await requestUtils.createPage( {
Expand Down Expand Up @@ -206,6 +207,7 @@ test.describe( 'Navigation block - Submenu Visibility', () => {

await expect( submenuVisibilityGroup ).toBeVisible();
} );

await test.step( 'Set submenu visibility to always', async () => {
const settingsPanel = page
.getByRole( 'region', { name: 'Editor settings' } )
Expand Down
14 changes: 7 additions & 7 deletions test/e2e/specs/editor/blocks/query.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ test.describe( 'Query block', () => {
await requestUtils.createPost( { title: 'Post 1', status: 'publish' } );
} );

test.afterAll( async ( { requestUtils } ) => {
await Promise.all( [
requestUtils.deleteAllPosts(),
requestUtils.deactivatePlugin( 'gutenberg-test-query-block' ),
] );
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost( {
postType: 'page',
Expand All @@ -31,6 +24,13 @@ test.describe( 'Query block', () => {
await requestUtils.deleteAllPages();
} );

test.afterAll( async ( { requestUtils } ) => {
await Promise.all( [
requestUtils.deleteAllPosts(),
requestUtils.deactivatePlugin( 'gutenberg-test-query-block' ),
] );
} );

test.describe( 'Query block insertion', () => {
test( 'List', async ( { page, editor } ) => {
await editor.insertBlock( { name: 'core/query' } );
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/specs/editor/blocks/search.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ test.describe( 'Search', () => {
await admin.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllMenus();
} );

test.afterEach( async ( { requestUtils } ) => {
await Promise.all( [
requestUtils.deleteAllPosts(),
requestUtils.deleteAllMenus(),
] );
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllMenus();
} );

test( 'should auto-configure itself to sensible defaults when inserted into a Navigation block', async ( {
page,
editor,
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/specs/editor/plugins/block-hooks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ test.describe( 'Block Hooks API', () => {
].forEach( ( { name, postType, blockType, createMethod } ) => {
test.describe( `Hooked blocks in ${ name } (blocks)`, () => {
let postObject, containerPost;

test.beforeAll( async ( { requestUtils } ) => {
postObject = await requestUtils[ createMethod ]( {
title: name,
Expand Down Expand Up @@ -185,6 +186,7 @@ test.describe( 'Block Hooks API', () => {

test.describe( `Hooked blocks in ${ name } (classic)`, () => {
let postObject, containerPost;

test.beforeAll( async ( { requestUtils } ) => {
postObject = await requestUtils[ createMethod ]( {
title: name,
Expand Down Expand Up @@ -308,6 +310,7 @@ test.describe( 'Block Hooks API', () => {

test.describe( 'Hooked blocks in Navigation Menu', () => {
let postObject, containerPost;

test.beforeAll( async ( { requestUtils } ) => {
postObject = await requestUtils.createNavigationMenu( {
title: 'Navigation Menu',
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/specs/editor/plugins/format-api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ test.describe( 'Using Format API', () => {
await requestUtils.activatePlugin( 'gutenberg-test-format-api' );
} );

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

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

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

test( 'Clicking the control wraps the selected text properly with HTML code', async ( {
editor,
page,
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/specs/editor/plugins/hooks-api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ test.describe( 'Using Hooks API', () => {
await requestUtils.activatePlugin( 'gutenberg-test-hooks-api' );
} );

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

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

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

test( 'Should contain a reset block button on the sidebar', async ( {
page,
editor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ test.describe( 'Allowed Blocks Setting on InnerBlocks', () => {
);
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-innerblocks-allowed-blocks'
);
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test( 'allows all blocks if the allowed blocks setting was not set', async ( {
editor,
page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test.describe( 'Server-side rendered block', () => {
'gutenberg-test-server-side-rendered-block'
);
} );

test.beforeEach( async ( { admin, editor } ) => {
await admin.createNewPost();
await editor.insertBlock( { name: 'test/server-side-rendered-block' } );
Expand Down Expand Up @@ -112,16 +113,16 @@ test.describe( 'PHP-only auto-register blocks', () => {
);
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

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

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test( 'should register blocks with autoRegister flag', async ( {
editor,
} ) => {
Expand Down
10 changes: 6 additions & 4 deletions test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const userList = [
password: 'sm1lingsmyfavorite',
},
];

test.describe( 'Autocomplete (@firefox, @webkit)', () => {
test.beforeAll( async ( { requestUtils } ) => {
await Promise.all(
Expand All @@ -61,21 +62,22 @@ test.describe( 'Autocomplete (@firefox, @webkit)', () => {
await requestUtils.activatePlugin( 'gutenberg-test-autocompleter' );
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deleteAllUsers();
await requestUtils.deactivatePlugin( 'gutenberg-test-autocompleter' );
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

[
[ 'User Mention', 'mention' ],
[ 'Custom Completer', 'option' ],
].forEach( ( completerAndOptionType ) => {
const [ completer, type ] = completerAndOptionType;

test( `${ completer }: should insert ${ type }`, async ( {
page,
editor,
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/specs/editor/various/background-gradient.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ test.describe( 'Background gradient block support', () => {
await requestUtils.activateTheme( 'emptytheme' );
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test.describe( 'color.gradient read-through and migration', () => {
// A custom gradient that does NOT match any WordPress preset so that
// clicking a preset in the picker always performs a fresh selection
Expand Down
Loading
Loading