Skip to content
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
6 changes: 6 additions & 0 deletions packages/e2e-test-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Master

### Bug Fixes

- `transformBlockTo` waits for the block switcher and the requested transform option to be visible before clicking, and for the transformed block to appear, so conversions no longer fail intermittently (backport of #15485, #18771, #23232, #23279 and #23311).

## 1.1.0 (2019-03-20)

### New Features
Expand Down
20 changes: 17 additions & 3 deletions packages/e2e-test-utils/src/transform-block-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@
export async function transformBlockTo( name ) {
await page.mouse.move( 200, 300, { steps: 10 } );
await page.mouse.move( 250, 350, { steps: 10 } );
await page.click( '.block-editor-block-switcher__toggle' );
await page.waitForSelector( `.block-editor-block-types-list__item[aria-label="${ name }"]` );
await page.click( `.block-editor-block-types-list__item[aria-label="${ name }"]` );
const switcherToggle = await page.waitForSelector( '.block-editor-block-switcher__toggle' );
await page.evaluate( ( element ) => element.scrollIntoView(), switcherToggle );
await page.waitForSelector( '.block-editor-block-switcher__toggle', { visible: true } );
await switcherToggle.click();
await page.waitForSelector( '.block-editor-block-switcher__popover', { visible: true } );

// Find the block button option within the switcher popover.
const insertButton = await page.waitForSelector(
`.block-editor-block-switcher__popover .block-editor-block-types-list__item[aria-label="${ name }"]`,
{ visible: true }
);
// Clicks may fail if the button is out of view. Assure it is before click.
await page.evaluate( ( element ) => element.scrollIntoView(), insertButton );
await insertButton.click();

// Wait for the transformed block to appear.
await page.waitForSelector( `.block-editor-block-list__block[aria-label="Block: ${ name }"]` );
}
Loading