Skip to content

Commit

Permalink
Adjust tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
afercia committed Oct 9, 2024
1 parent 1ec1778 commit 3203837
Show file tree
Hide file tree
Showing 20 changed files with 70 additions and 36 deletions.
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ function InserterMenu(
onSelect={ handleSetSelectedTab }
onClose={ onClose }
selectedTab={ selectedTab }
closeButtonLabel={ __( 'Close block inserter' ) }
closeButtonLabel={ __( 'Close Block Inserter' ) }
tabs={ [
{
name: 'blocks',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function InserterSidebar() {
__next40pxDefaultSize
icon={ close }
onClick={ closeInserter }
label={ __( 'Close block inserter' ) }
label={ __( 'Close Block Inserter' ) }
/>
</TagName>
<div className="edit-widgets-layout__inserter-panel-content">
Expand Down
1 change: 1 addition & 0 deletions test/e2e/specs/editor/blocks/image.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ test.describe( 'Image', () => {
async function openMediaTab() {
const blockInserter = page.getByRole( 'button', {
name: 'Block Inserter',
exact: true,
} );
const isClosed =
( await blockInserter.getAttribute( 'aria-pressed' ) ) ===
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/specs/editor/plugins/allowed-blocks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ test.describe( 'Allowed Blocks Filter', () => {
page,
} ) => {
// The paragraph block is available.
await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const searchbox = page
.getByRole( 'region', { name: 'Block Library' } )
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/plugins/block-directory.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ test.describe( 'Block Directory', () => {

await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -209,7 +209,7 @@ test.describe( 'Block Directory', () => {

await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/specs/editor/plugins/block-icons.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.describe( 'Block Icons', () => {
test( 'Block with svg icon', async ( { editor, page } ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -60,7 +60,7 @@ test.describe( 'Block Icons', () => {
test( 'Block with dash icon', async ( { editor, page } ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -100,7 +100,7 @@ test.describe( 'Block Icons', () => {
test( 'Block with function icon', async ( { editor, page } ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -137,7 +137,7 @@ test.describe( 'Block Icons', () => {
} ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down Expand Up @@ -185,7 +185,7 @@ test.describe( 'Block Icons', () => {
} ) => {
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

const blockLibrary = page.getByRole( 'region', {
Expand Down
8 changes: 6 additions & 2 deletions test/e2e/specs/editor/plugins/block-variations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ test.describe( 'Block variations', () => {
test( 'Search for the overridden default Quote block', async ( {
page,
} ) => {
await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await page
.getByRole( 'region', { name: 'Block Library' } )
Expand Down Expand Up @@ -60,7 +62,9 @@ test.describe( 'Block variations', () => {
test( 'Search for the Paragraph block with 2 additional variations', async ( {
page,
} ) => {
await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await page
.getByRole( 'region', { name: 'Block Library' } )
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/specs/editor/plugins/child-blocks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test.describe( 'Child Blocks', () => {
test( 'are hidden from the global block inserter', async ( { page } ) => {
const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page.getByRole( 'region', {
name: 'Block Library',
} );
Expand Down Expand Up @@ -47,7 +47,7 @@ test.describe( 'Child Blocks', () => {

const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page
.getByRole( 'region', {
name: 'Block Library',
Expand Down Expand Up @@ -85,7 +85,7 @@ test.describe( 'Child Blocks', () => {

const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page
.getByRole( 'region', {
name: 'Block Library',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test.describe( 'Allowed Blocks Setting on InnerBlocks', () => {

const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page
.getByRole( 'region', {
name: 'Block Library',
Expand Down Expand Up @@ -92,7 +92,7 @@ test.describe( 'Allowed Blocks Setting on InnerBlocks', () => {

const blockInserter = page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } );
.getByRole( 'button', { name: 'Block Inserter', exact: true } );
const blockLibrary = page
.getByRole( 'region', {
name: 'Block Library',
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/specs/editor/plugins/pattern-recursion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ test.describe( 'Preventing Pattern Recursion (server)', () => {
editor,
} ) => {
// Click the Block Inserter button
await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
// Click the Patterns tab
await page.getByRole( 'tab', { name: 'Patterns' } ).click();
// Click the Uncategorized tab
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/specs/editor/plugins/post-type-locking.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ test.describe( 'Post-type locking', () => {
await expect(
page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', {
name: 'Block Inserter',
exact: true,
} )
).toBeEnabled();

await editor.insertBlock( { name: 'core/list' } );
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/allowed-patterns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe( 'Allowed Patterns', () => {
await admin.createNewPost();
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await page
Expand Down Expand Up @@ -61,7 +61,7 @@ test.describe( 'Allowed Patterns', () => {
await admin.createNewPost();
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await page
Expand Down
24 changes: 18 additions & 6 deletions test/e2e/specs/editor/various/block-visibility.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ test.describe( 'Block Visibility', () => {
} )
.getByRole( 'button', { name: 'Close' } )
.click();
await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page
.getByRole( 'region', { name: 'Block Library' } )
.getByRole( 'searchbox', {
Expand All @@ -57,7 +59,9 @@ test.describe( 'Block Visibility', () => {
'Heading block should not be visible'
).toBeHidden();

await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

// Show heading block again.
await BlockVisibilityUtils.openBlockVisibilityManager();
Expand All @@ -79,7 +83,9 @@ test.describe( 'Block Visibility', () => {
} )
.getByRole( 'button', { name: 'Close' } )
.click();
await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page
.getByRole( 'region', { name: 'Block Library' } )
.getByRole( 'searchbox', {
Expand Down Expand Up @@ -111,7 +117,9 @@ test.describe( 'Block Visibility', () => {
} )
.getByRole( 'button', { name: 'Close' } )
.click();
await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await expect(
page
Expand All @@ -120,7 +128,9 @@ test.describe( 'Block Visibility', () => {
'Media category should not be visible'
).toBeHidden();

await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

// Show Media category blocks again.
await BlockVisibilityUtils.openBlockVisibilityManager();
Expand All @@ -142,7 +152,9 @@ test.describe( 'Block Visibility', () => {
} )
.getByRole( 'button', { name: 'Close' } )
.click();
await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();

await expect(
page
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/various/editor-modes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ test.describe( 'Editing modes (visual/HTML)', () => {
await expect(
page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
).toBeDisabled();

// Go back to the visual editor.
Expand Down
9 changes: 5 additions & 4 deletions test/e2e/specs/editor/various/inserting-blocks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => {

const inserterButton = page.getByRole( 'button', {
name: 'Block Inserter',
exact: true,
} );
const blockLibrary = page.getByRole( 'region', {
name: 'Block Library',
Expand Down Expand Up @@ -503,7 +504,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => {
await editor.selectBlocks( paragraphBlock );
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page
.getByRole( 'listbox', { name: 'Text' } )
Expand Down Expand Up @@ -624,7 +625,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => {
await admin.createNewPost();
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page.getByRole( 'option', { name: 'More', exact: true } ).click();

Expand All @@ -646,7 +647,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => {
await admin.createNewPost();
await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page
.getByRole( 'listbox', { name: 'Text' } )
Expand Down Expand Up @@ -674,7 +675,7 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => {

await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page
.getByRole( 'listbox', { name: 'Media' } )
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/specs/editor/various/patterns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,9 @@ test.describe( 'Synced pattern', () => {
attributes: { ref: id },
} );

await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page
.getByRole( 'searchbox', {
name: 'Search',
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/specs/site-editor/pages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ async function addPageContent( editor, page ) {
.fill( 'Lorem ipsum dolor sit amet' );

// Insert into Page Content using global inserter.
await page.getByRole( 'button', { name: 'Block Inserter' } ).click();
await page
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
await page.getByRole( 'option', { name: 'Heading', exact: true } ).click();
await editor.canvas
.getByRole( 'document', {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/specs/site-editor/site-editor-inserter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test.describe( 'Site Editor Inserter', () => {
} ) => {
const inserterButton = page.getByRole( 'button', {
name: 'Block Inserter',
exact: true,
} );
const blockLibrary = page.getByRole( 'region', {
name: 'Block Library',
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/widgets/editing-widgets.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test.describe( 'Widgets screen', () => {

await page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
const blockLibrary = page.getByRole( 'region', {
name: 'Block Library',
Expand Down Expand Up @@ -698,7 +698,7 @@ class WidgetsScreen {
if ( await blockLibrary.isHidden() ) {
await this.#page
.getByRole( 'toolbar', { name: 'Document tools' } )
.getByRole( 'button', { name: 'Block Inserter' } )
.getByRole( 'button', { name: 'Block Inserter', exact: true } )
.click();
}

Expand Down
Loading

0 comments on commit 3203837

Please sign in to comment.