Skip to content

Commit

Permalink
Fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Dec 11, 2023
1 parent b5bdfc5 commit 67b8625
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
4 changes: 1 addition & 3 deletions packages/e2e-test-utils-playwright/src/editor/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export async function openPreviewPage( this: Editor ): Promise< Page > {
const editorTopBar = this.page.locator(
'role=region[name="Editor top bar"i]'
);
const previewButton = editorTopBar.locator(
'role=button[name="Preview"i]'
);
const previewButton = editorTopBar.locator( 'role=button[name="View"i]' );

await previewButton.click();

Expand Down
6 changes: 5 additions & 1 deletion test/e2e/specs/editor/plugins/block-context.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ test.describe( 'Block context', () => {
.fill( '123' );

await editorPage
.getByRole( 'button', { name: 'Preview', expanded: false } )
.getByRole( 'button', {
name: 'View',
expanded: false,
exact: true,
} )
.click();
await editorPage
.getByRole( 'menuitem', { name: 'Preview in new tab' } )
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/specs/editor/various/new-post.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ test.describe( 'new editor state', () => {
await expect( title ).toBeEditable();
await expect( title ).toHaveText( '' );

// Should display the Preview button.
// Should display the View button.
await expect(
page.locator( 'role=button[name="Preview"i]' )
page.locator( 'role=button[name="View"i]' )
).toBeVisible();

// Should display the Post Formats UI.
Expand Down
9 changes: 2 additions & 7 deletions test/e2e/specs/editor/various/preview.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ test.describe( 'Preview', () => {
} ) => {
const editorPage = page;

// Disabled until content present.
await expect(
editorPage.locator( 'role=button[name="Preview"i]' )
).toBeDisabled();

await editor.canvas
.locator( 'role=textbox[name="Add title"i]' )
.type( 'Hello World' );
Expand Down Expand Up @@ -301,7 +296,7 @@ test.describe( 'Preview with private custom post type', () => {
} );

// Open the view menu.
await page.click( 'role=button[name="Preview"i]' );
await page.click( 'role=button[name="View"i]' );

await expect(
page.locator( 'role=menuitem[name="Preview in new tab"i]' )
Expand All @@ -316,7 +311,7 @@ class PreviewUtils {

async waitForPreviewNavigation( previewPage ) {
const previewToggle = this.page.locator(
'role=button[name="Preview"i][expanded=false]'
'role=button[name="View"i][expanded=false]'
);
const isDropdownClosed = await previewToggle.isVisible();
if ( isDropdownClosed ) {
Expand Down

0 comments on commit 67b8625

Please sign in to comment.