Skip to content

Commit

Permalink
Fix: Close "Block Styles" section on transformBlockTo e2e test helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Jul 24, 2019
1 parent 174c098 commit f34daaa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/e2e-test-utils/src/transform-block-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ 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' );
// Close the "Block Styles" section if it is open.
// Having the section open may make the transform buttons hidden on the testing resolution.
const closeBlockStylesButton = await page.$x(
'//div[contains(@class,"block-editor-block-switcher__popover")]//button[contains(text(),"Block Styles")][@aria-expanded="true"]'
);
if ( closeBlockStylesButton.length > 0 ) {
await closeBlockStylesButton[ 0 ].click();
}
const insertButton = ( await page.$x(
`//button//span[contains(text(), '${ name }')]`
) )[ 0 ];
Expand Down

0 comments on commit f34daaa

Please sign in to comment.