From 24498dbcafe60e7bd441e6afb97027abd98caaa8 Mon Sep 17 00:00:00 2001 From: ramonjd Date: Wed, 19 Oct 2022 10:34:44 +1100 Subject: [PATCH 1/3] Update E2E test after Post editor: Rename view to Preview (#45074) --- test/e2e/specs/editor/various/new-post.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/specs/editor/various/new-post.spec.js b/test/e2e/specs/editor/various/new-post.spec.js index d9ffc0a4840cb0..e58e8ed94ffc56 100644 --- a/test/e2e/specs/editor/various/new-post.spec.js +++ b/test/e2e/specs/editor/various/new-post.spec.js @@ -30,9 +30,9 @@ test.describe( 'new editor state', () => { await expect( title ).toBeEditable(); await expect( title ).toHaveText( '' ); - // Should display the View button. + // Should display the Preview button. await expect( - page.locator( 'role=button[name="View"i]' ) + page.locator( 'role=button[name="Preview"i]' ) ).toBeVisible(); // Should display the Post Formats UI. From ed719bc76b485e671fd0dc9e5b919e1a4ec8be5d Mon Sep 17 00:00:00 2001 From: ramonjd Date: Wed, 19 Oct 2022 11:50:22 +1100 Subject: [PATCH 2/3] Follow ups --- packages/e2e-test-utils-playwright/src/editor/preview.ts | 2 +- test/e2e/specs/editor/various/preview.spec.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/e2e-test-utils-playwright/src/editor/preview.ts b/packages/e2e-test-utils-playwright/src/editor/preview.ts index a71249d7bb62b6..17a8d8cab57c60 100644 --- a/packages/e2e-test-utils-playwright/src/editor/preview.ts +++ b/packages/e2e-test-utils-playwright/src/editor/preview.ts @@ -19,7 +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="View"i]' ); + const previewButton = editorTopBar.locator( 'role=button[name="Preview"i]' ); await previewButton.click(); const [ previewPage ] = await Promise.all( [ diff --git a/test/e2e/specs/editor/various/preview.spec.js b/test/e2e/specs/editor/various/preview.spec.js index aaf816d1803a78..be2f4ddb65d27b 100644 --- a/test/e2e/specs/editor/various/preview.spec.js +++ b/test/e2e/specs/editor/various/preview.spec.js @@ -24,7 +24,7 @@ test.describe( 'Preview', () => { // Disabled until content present. await expect( - editorPage.locator( 'role=button[name="View"i]' ) + editorPage.locator( 'role=button[name="Preview"i]' ) ).toBeDisabled(); await editorPage.type( @@ -282,7 +282,7 @@ test.describe( 'Preview with private custom post type', () => { await admin.createNewPost( { postType: 'not_public', title: 'aaaaa' } ); // Open the view menu. - await page.click( 'role=button[name="View"i]' ); + await page.click( 'role=button[name="Preview"i]' ); await expect( page.locator( 'role=menuitem[name="Preview in new tab"i]' ) @@ -297,7 +297,7 @@ class PreviewUtils { async waitForPreviewNavigation( previewPage ) { const previewToggle = this.page.locator( - 'role=button[name="View"i][expanded=false]' + 'role=button[name="Preview"i][expanded=false]' ); const isDropdownClosed = await previewToggle.isVisible(); if ( isDropdownClosed ) { From 874bca8b746af10550ab11d3dae54d8fd341d931 Mon Sep 17 00:00:00 2001 From: ramonjd Date: Wed, 19 Oct 2022 12:07:53 +1100 Subject: [PATCH 3/3] Mucho linto --- packages/e2e-test-utils-playwright/src/editor/preview.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/e2e-test-utils-playwright/src/editor/preview.ts b/packages/e2e-test-utils-playwright/src/editor/preview.ts index 17a8d8cab57c60..e3aef98ca9c81e 100644 --- a/packages/e2e-test-utils-playwright/src/editor/preview.ts +++ b/packages/e2e-test-utils-playwright/src/editor/preview.ts @@ -19,7 +19,10 @@ 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="Preview"i]' + ); + await previewButton.click(); const [ previewPage ] = await Promise.all( [