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

Fix various E2E tests for recent Gutenberg changes #86070

Merged
merged 1 commit into from
Jan 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ const panel = '[aria-label="Editor settings"]';

const selectors = {
// Tab
tabButton: ( tabName: EditorSidebarTab ) => `${ panel } button:has-text("${ tabName }")`,
tabButton: ( tabName: EditorSidebarTab ) =>
`${ panel } button[role="tab"]:has-text("${ tabName }")`,
activeTabButton: ( tabName: EditorSidebarTab ) =>
`${ panel } button[aria-selected="true"]:has-text("${ tabName }")`,
`${ panel } button[aria-selected="true"][role="tab"]:has-text("${ tabName }")`,

// General section-related
section: ( name: string ) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const selectors = {
switchToDraftButton: `${ panel } button.editor-post-switch-to-draft`,

// Preview
previewButton: `${ panel } :text("Preview"):visible, [aria-label="Preview"]:visible`,
previewButton: `${ panel } :text("Preview"):visible, [aria-label="View"]:visible`,
desktopPreviewMenuItem: ( target: EditorPreviewOptions ) =>
`button[role="menuitem"] span:text("${ target }")`,
previewPane: ( target: EditorPreviewOptions ) => `.is-${ target.toLowerCase() }-preview`,
previewPane: `.edit-post-visual-editor`,

// Publish
publishButton: ( state: 'disabled' | 'enabled' ) => {
Expand Down Expand Up @@ -199,7 +199,7 @@ export class EditorToolbarComponent {
await desktopPreviewMenuItemLocator.click();

// Verify the editor panel is resized and stable.
const desktopPreviewPaneLocator = editorParent.locator( selectors.previewPane( target ) );
const desktopPreviewPaneLocator = editorParent.locator( selectors.previewPane );
await desktopPreviewPaneLocator.waitFor();
const elementHandle = await desktopPreviewPaneLocator.elementHandle();
await elementHandle?.waitForElementState( 'stable' );
Expand All @@ -214,7 +214,7 @@ export class EditorToolbarComponent {
async openDesktopPreviewMenu(): Promise< void > {
const editorParent = await this.editor.parent();

const translatedButtonName = await this.translateFromPage( 'Preview' );
const translatedButtonName = await this.translateFromPage( 'View' );
const previewButton = editorParent.getByRole( 'button', {
name: translatedButtonName,
exact: true,
Expand All @@ -233,7 +233,7 @@ export class EditorToolbarComponent {
async closeDesktopPreviewMenu(): Promise< void > {
const editorParent = await this.editor.parent();

const translatedButtonName = await this.translateFromPage( 'Preview' );
const translatedButtonName = await this.translateFromPage( 'View' );
const previewButton = editorParent.getByRole( 'button', {
name: translatedButtonName,
exact: true,
Expand Down
Loading