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
2 changes: 1 addition & 1 deletion test/e2e/specs/admin/workflow-palette.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ test.describe( 'Workflow palette', () => {
const requestCountAfterFirstOpen = abilityRequests.length;
await page.keyboard.press( 'ControlOrMeta+j' );
await expect( palette ).toBeVisible();
expect( abilityRequests.length ).toBe( requestCountAfterFirstOpen );
expect( abilityRequests ).toHaveLength( requestCountAfterFirstOpen );
} );
} );
7 changes: 4 additions & 3 deletions test/e2e/specs/editor/blocks/avatar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ test.describe( 'Avatar', () => {
);

await expect( blockInspectorControls ).toBeVisible();
await page.click(
`role=region[name="Editor settings"i] >> role=tab[name="Settings"i]`
);
await page
.getByRole( 'region', { name: 'Editor settings' } )
.getByRole( 'tab', { name: 'Settings' } )
.click();

const userInput = page.locator(
'role=region[name="Editor settings"i] >> role=combobox[name="User"i]'
Expand Down
48 changes: 33 additions & 15 deletions test/e2e/specs/editor/blocks/buttons.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ test.describe( 'Buttons', () => {
} )
.getByRole( 'button', { name: 'Color', exact: true } )
.click();
await page.click( 'role=option[name="Cyan bluish gray"i]' );
await page.getByRole( 'option', { name: 'Cyan bluish gray' } ).click();
await editorSettings
.locator( '.components-tools-panel' )
.filter( {
has: page.getByRole( 'heading', { name: 'Background' } ),
} )
.getByRole( 'button', { name: 'Color', exact: true } )
.click();
await page.click( 'role=option[name="Vivid red"i]' );
await page.getByRole( 'option', { name: 'Vivid red' } ).click();

// Check the content.
const content = await editor.getEditedPostContent();
Expand Down Expand Up @@ -320,8 +320,12 @@ test.describe( 'Buttons', () => {
// Match by substring: when the control has a value (e.g. an inherited
// color), the button's accessible name gains a "The currently selected
// color is…" suffix, so an exact-name match no longer works.
await page.click( 'role=button[name=/Custom color picker/i]' );
await page.fill( 'role=textbox[name="Hex color"i]', 'ff0000' );
await page
.getByRole( 'button', { name: /Custom color picker/i } )
.click();
await page
.getByRole( 'textbox', { name: 'Hex color' } )
.fill( 'ff0000' );

await editorSettings
.locator( '.components-tools-panel' )
Expand All @@ -330,8 +334,12 @@ test.describe( 'Buttons', () => {
} )
.getByRole( 'button', { name: 'Color', exact: true } )
.click();
await page.click( 'role=button[name=/Custom color picker/i]' );
await page.fill( 'role=textbox[name="Hex color"i]', '00ff00' );
await page
.getByRole( 'button', { name: /Custom color picker/i } )
.click();
await page
.getByRole( 'textbox', { name: 'Hex color' } )
.fill( '00ff00' );

// Check the content.
const content = await editor.getEditedPostContent();
Expand All @@ -356,7 +364,9 @@ test.describe( 'Buttons', () => {
.getByRole( 'region', { name: 'Editor settings' } )
.getByRole( 'button', { name: 'Gradient', exact: true } )
.click();
await page.click( 'role=option[name="Gradient: Purple to yellow"i]' );
await page
.getByRole( 'option', { name: 'Gradient: Purple to yellow' } )
.click();

// Check the content.
const content = await editor.getEditedPostContent();
Expand All @@ -381,15 +391,23 @@ test.describe( 'Buttons', () => {
.getByRole( 'region', { name: 'Editor settings' } )
.getByRole( 'button', { name: 'Gradient', exact: true } )
.click();
await page.click(
'role=button[name=/^Gradient control point at position 0% with color code/]'
);
await page.fill( 'role=textbox[name="Hex color"i]', 'ff0000' );
await page
.getByRole( 'button', {
name: /^Gradient control point at position 0% with color code/,
} )
.click();
await page
.getByRole( 'textbox', { name: 'Hex color' } )
.fill( 'ff0000' );
await page.keyboard.press( 'Escape' );
await page.click(
'role=button[name=/^Gradient control point at position 100% with color code/]'
);
await page.fill( 'role=textbox[name="Hex color"i]', '00ff00' );
await page
.getByRole( 'button', {
name: /^Gradient control point at position 100% with color code/,
} )
.click();
await page
.getByRole( 'textbox', { name: 'Hex color' } )
.fill( '00ff00' );

// Check the content.
const content = await editor.getEditedPostContent();
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/specs/editor/blocks/columns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ test.describe( 'Columns', () => {
)
);
await editor.clickBlockToolbarButton( 'Options' );
await page.click( 'role=menuitem[name="Lock"i]' );
await page.getByRole( 'menuitem', { name: 'Lock' } ).click();
await page.locator( 'role=checkbox[name="Lock removal"i]' ).check();
await page.click( 'role=button[name="Apply"i]' );
await page.getByRole( 'button', { name: 'Apply' } ).click();

// Select columns block
await editor.selectBlocks(
Expand All @@ -80,7 +80,7 @@ test.describe( 'Columns', () => {
await expect( columnsChangeInput ).toHaveAttribute( 'min', '3' );

// Changing the number of columns should take into account locked columns
await page.fill( 'role=spinbutton[name="Columns"i]', '1' );
await page.getByRole( 'spinbutton', { name: 'Columns' } ).fill( '1' );
await pageUtils.pressKeys( 'Tab' );
await expect( columnsChangeInput ).toHaveValue( '3' );
} );
Expand Down
12 changes: 7 additions & 5 deletions test/e2e/specs/editor/blocks/comments.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ test.describe( 'Comments', () => {
page.locator( 'role=link[name="Newer Comments"i]' )
).toBeHidden();

await page.click( 'role=link[name="Older Comments"i]' );
await page.getByRole( 'link', { name: 'Older Comments' } ).click();

// We check that there are a previous and a next link.
await expect(
Expand All @@ -96,7 +96,7 @@ test.describe( 'Comments', () => {
page.locator( 'role=link[name="Newer Comments"i]' )
).toBeVisible();

await page.click( 'role=link[name="Older Comments"i]' );
await page.getByRole( 'link', { name: 'Older Comments' } ).click();

// We check that there is only have a next link
await expect(
Expand Down Expand Up @@ -356,10 +356,12 @@ class CommentsBlockUtils {
*/
async setOption( setting, value ) {
await this.admin.visitAdminPage( 'options.php', '' );
const previousValue = await this.page.inputValue( `#${ setting }` );
const previousValue = await this.page
.locator( `#${ setting }` )
.inputValue();

await this.page.fill( `#${ setting }`, value );
await this.page.click( '#Update' );
await this.page.locator( `#${ setting }` ).fill( value );
await this.page.locator( '#Update' ).click();

return previousValue;
}
Expand Down
1 change: 1 addition & 0 deletions test/e2e/specs/editor/blocks/details.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ test.describe( 'Details', () => {
)
.toBe( true );
} );

test( 'should select the parent when clicking its summary from an inner paragraph', async ( {
editor,
page,
Expand Down
9 changes: 5 additions & 4 deletions test/e2e/specs/editor/blocks/fit-text.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,11 @@ test.describe( 'Fit Text', () => {
await editor.openDocumentSettingsSidebar();

// Set a custom font size
await page.click(
'role=region[name="Editor settings"i] >> role=button[name="Set custom size"i]'
);
await page.click( 'role=spinbutton[name="Font size"i]' );
await page
.getByRole( 'region', { name: 'Editor settings' } )
.getByRole( 'button', { name: 'Set custom size' } )
.click();
await page.getByRole( 'spinbutton', { name: 'Font size' } ).click();
await page.keyboard.type( '24' );

// fitText should be cleared
Expand Down
14 changes: 8 additions & 6 deletions test/e2e/specs/editor/blocks/gallery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ test.describe( 'Gallery', () => {
<!-- /wp:image --></figure>
<!-- /wp:gallery -->` );

await page.click(
'role=region[name="Editor top bar"i] >> role=button[name="Undo"i]'
);
await page
.getByRole( 'region', { name: 'Editor top bar' } )
.getByRole( 'button', { name: 'Undo' } )
.click();

await expect.poll( editor.getEditedPostContent ).toBe( '' );

await page.click(
'role=region[name="Editor top bar"i] >> role=button[name="Redo"i]'
);
await page
.getByRole( 'region', { name: 'Editor top bar' } )
.getByRole( 'button', { name: 'Redo' } )
.click();

await expect
.poll( editor.getEditedPostContent )
Expand Down
16 changes: 9 additions & 7 deletions test/e2e/specs/editor/blocks/group.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ test.describe( 'Group', () => {

await inserterButton.click();

await page.type( 'role=searchbox[name="Search"i]', 'Group' );
await page.getByRole( 'searchbox', { name: 'Search' } ).type( 'Group' );

await page.click(
'role=listbox[name="Blocks"i] >> role=option[name="Group"i]'
);
await page
.getByRole( 'listbox', { name: 'Blocks' } )
.getByRole( 'option', { name: 'Group' } )
.click();

// Select the default, selected Group layout from the variation picker.
await editor.canvas
Expand Down Expand Up @@ -69,9 +70,10 @@ test.describe( 'Group', () => {
)
.click();
await editor.canvas.locator( 'role=button[name="Add block"i]' ).click();
await page.click(
'role=listbox[name="Blocks"i] >> role=option[name="Paragraph"i]'
);
await page
.getByRole( 'listbox', { name: 'Blocks' } )
.getByRole( 'option', { name: 'Paragraph' } )
.click();
await page.keyboard.type( 'Group Block with a Paragraph' );

expect( await editor.getEditedPostContent() ).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ test.describe( 'Navigation block - Frontend interactivity', () => {
await expect( innerElement ).toBeVisible();

// Test: submenu closes on click outside submenu
await page.click( 'body' );
await page.locator( 'body' ).click();
await expect( innerElement ).toBeHidden();

// Test: nested submenu opens on click
Expand All @@ -212,7 +212,7 @@ test.describe( 'Navigation block - Frontend interactivity', () => {
await expect( secondLevelElement ).toBeVisible();

// Test: nested submenus close on click outside submenu
await page.click( 'body' );
await page.locator( 'body' ).click();
await expect( firstLevelElement ).toBeHidden();
await expect( secondLevelElement ).toBeHidden();

Expand Down Expand Up @@ -350,7 +350,7 @@ test.describe( 'Navigation block - Frontend interactivity', () => {
await expect( secondLevelElement ).toBeHidden();

// Close the menu via click on the body
await page.click( 'body' );
await page.locator( 'body' ).click();
await expect( firstLevelElement ).toBeHidden();

// Test: nested submenu closes on ESC key and focuses parent menu item:
Expand Down Expand Up @@ -445,7 +445,7 @@ test.describe( 'Navigation block - Frontend interactivity', () => {
await expect( secondLevelElement ).toBeHidden();

// Close menu via click on the body
await page.click( 'body' );
await page.locator( 'body' ).click();
await expect( firstLevelElement ).toBeHidden();
await expect( secondLevelElement ).toBeHidden();
} );
Expand Down Expand Up @@ -503,7 +503,7 @@ test.describe( 'Navigation block - Frontend interactivity', () => {
await expect( innerElement ).toBeVisible();

// page-list submenu closes on click outside
await page.click( 'body' );
await page.locator( 'body' ).click();
await expect( innerElement ).toBeHidden();

// page-list submenu opens on enter keypress
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/specs/editor/blocks/navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1088,10 +1088,10 @@ test.describe( 'Navigation block', () => {
await admin.visitAdminPage( 'options-permalink.php' );

// Select the Post name permalink structure (/%postname%/)
await page.click( '#permalink-input-post-name' );
await page.locator( '#permalink-input-post-name' ).click();

// Click Save Changes
await page.click( '#submit' );
await page.locator( '#submit' ).click();

// Wait for settings to be saved
await page.waitForSelector( '.notice-success' );
Expand Down Expand Up @@ -1129,10 +1129,10 @@ test.describe( 'Navigation block', () => {
await admin.visitAdminPage( 'options-permalink.php' );

// Select Plain permalinks
await page.click( '#permalink-input-plain' );
await page.locator( '#permalink-input-plain' ).click();

// Click Save Changes
await page.click( '#submit' );
await page.locator( '#submit' ).click();

// Wait for settings to be saved
await page.waitForSelector( '.notice-success' );
Expand Down
Loading
Loading