Skip to content

Commit ff20239

Browse files
committed
use locator
1 parent cf79848 commit ff20239

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

packages/e2e-test-utils-playwright/src/editor/transform-block-to.ts

+2-14
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,14 @@ import type { Editor } from './index';
1212
export async function transformBlockTo( this: Editor, name: string ) {
1313
await this.showBlockToolbar();
1414

15-
const switcherToggle = await this.page.waitForSelector(
15+
const switcherToggle = this.page.locator(
1616
'.block-editor-block-switcher__toggle'
1717
);
18-
await switcherToggle.evaluate( ( element ) => element.scrollIntoView() );
19-
await this.page.waitForSelector( '.block-editor-block-switcher__toggle', {
20-
state: 'visible',
21-
} );
2218
await switcherToggle.click();
23-
await this.page.waitForSelector(
24-
'.block-editor-block-switcher__container',
25-
{
26-
state: 'visible',
27-
}
28-
);
2919

3020
// Find the block button option within the switcher popover.
3121
const xpath = `//*[contains(@class, "block-editor-block-switcher__popover")]//button[.='${ name }']`;
32-
const insertButton = await this.page.waitForSelector( xpath, {
33-
state: 'visible',
34-
} );
22+
const insertButton = this.page.locator( xpath );
3523
// Clicks may fail if the button is out of view. Assure it is before click.
3624
await insertButton.evaluate( ( element ) => element.scrollIntoView() );
3725
await insertButton.click();

0 commit comments

Comments
 (0)