Skip to content

Commit

Permalink
E2E tests: update button selector (#45087)
Browse files Browse the repository at this point in the history
* Update E2E test after Post editor: Rename view to Preview (#45074)

* Follow ups

* Mucho linto
  • Loading branch information
ramonjd authored Oct 19, 2022
1 parent d406de5 commit ba01e5d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/e2e-test-utils-playwright/src/editor/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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="View"i]' );
const previewButton = editorTopBar.locator(
'role=button[name="Preview"i]'
);

await previewButton.click();

const [ previewPage ] = await Promise.all( [
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 @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/specs/editor/various/preview.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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]' )
Expand All @@ -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 ) {
Expand Down

0 comments on commit ba01e5d

Please sign in to comment.