Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E tests: update button selector #45087

Merged
merged 3 commits into from
Oct 19, 2022
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
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