From e12ac149a1ec47518b011dd5d6d26e224429b1cb Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 11 Feb 2022 16:43:56 +0100 Subject: [PATCH] Fix e2e test --- packages/e2e-tests/specs/editor/blocks/image.test.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/e2e-tests/specs/editor/blocks/image.test.js b/packages/e2e-tests/specs/editor/blocks/image.test.js index 291bb125f4226..ac3ddba34b46e 100644 --- a/packages/e2e-tests/specs/editor/blocks/image.test.js +++ b/packages/e2e-tests/specs/editor/blocks/image.test.js @@ -103,9 +103,10 @@ describe( 'Image', () => { `\\s*
\\s*` ); expect( await getEditedPostContent() ).toMatch( regex3 ); - // For some reason just clicking the block wrapper causes figcaption to get focus - // in puppeteer but not in live browser, so clicking on the image wrapper div here instead. - await page.click( '.wp-block-image > div' ); + // Focus outside the block to avoid the image caption being selected + // It can happen on CI specially. + await page.click( '.wp-block-post-title' ); + await page.click( '.wp-block-image img' ); await page.keyboard.press( 'Backspace' ); expect( await getEditedPostContent() ).toBe( '' );