From 4ac7dc9d2d93a1b3ab81b44a6fbd89952a44915e Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 30 Jul 2019 09:47:30 +0100 Subject: [PATCH] Fix: Close "Block Styles" section on transformBlockTo e2e test helper. (#16739) --- packages/e2e-test-utils/src/transform-block-to.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/e2e-test-utils/src/transform-block-to.js b/packages/e2e-test-utils/src/transform-block-to.js index 64132aac7f45b..9bb11b7bafc81 100644 --- a/packages/e2e-test-utils/src/transform-block-to.js +++ b/packages/e2e-test-utils/src/transform-block-to.js @@ -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 ];