Skip to content

Commit

Permalink
Fix E2E tests in Gutenberg RC (#95519)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1r0 authored Oct 21, 2024
1 parent 2d68e51 commit b090fe6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ export class EditorSettingsSidebarComponent {
*/
async enterUrlSlug( slug: string ) {
const editorParent = await this.editor.parent();
// TODO: Once WordPress/gutenberg#60632 is everywhere, remove the alternation.
await editorParent.getByRole( 'button', { name: /Change (link|URL):/ } ).click();
await editorParent.getByRole( 'textbox', { name: /^(Link|Permalink)$/ } ).fill( slug );
// TODO: Once WordPress/gutenberg#63669 is everywhere, remove the alternation.
await editorParent.getByRole( 'button', { name: /Change link:/ } ).click();
await editorParent.getByRole( 'textbox', { name: /^(Link|Slug)$/ } ).fill( slug );
await editorParent.getByRole( 'button', { name: 'Close', exact: true } ).click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,17 @@ export class EditorToolbarComponent {
async openBlockInserter(): Promise< void > {
const editorParent = await this.editor.parent();

const translatedButtonName = await this.translateFromPage(
// TODO: Once WordPress/gutenberg#63669 is everywhere, remove the old name.
const translatedButtonNameOld = await this.translateFromPage(
'Toggle block inserter',
'Generic label for block inserter button'
);
const translatedButtonNameNew = await this.translateFromPage(
'Block Inserter',
'Generic label for block inserter button'
);
const blockInserterButton = editorParent.getByRole( 'button', {
name: translatedButtonName,
name: new RegExp( `^(${ translatedButtonNameOld }|${ translatedButtonNameNew })` ),
exact: true,
} );

Expand All @@ -130,12 +135,17 @@ export class EditorToolbarComponent {
async closeBlockInserter(): Promise< void > {
const editorParent = await this.editor.parent();

const translatedButtonName = await this.translateFromPage(
// TODO: Once WordPress/gutenberg#63669 is everywhere, remove the old name.
const translatedButtonNameOld = await this.translateFromPage(
'Toggle block inserter',
'Generic label for block inserter button'
);
const translatedButtonNameNew = await this.translateFromPage(
'Block Inserter',
'Generic label for block inserter button'
);
const blockInserterButton = editorParent.getByRole( 'button', {
name: translatedButtonName,
name: new RegExp( `^(${ translatedButtonNameOld }|${ translatedButtonNameNew })` ),
exact: true,
} );

Expand Down

0 comments on commit b090fe6

Please sign in to comment.