From 33cf482639a15d559c8d1f654a868ddc9f6ade20 Mon Sep 17 00:00:00 2001 From: ramonjd Date: Mon, 21 Feb 2022 10:54:50 +1100 Subject: [PATCH] Focussing on the cover block before testing the expand element. --- packages/e2e-tests/specs/editor/various/list-view.test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/e2e-tests/specs/editor/various/list-view.test.js b/packages/e2e-tests/specs/editor/various/list-view.test.js index 21b512dd8c94f4..9c5ac2327631fb 100644 --- a/packages/e2e-tests/specs/editor/various/list-view.test.js +++ b/packages/e2e-tests/specs/editor/various/list-view.test.js @@ -129,6 +129,11 @@ describe( 'List view', () => { // Check that we're collapsed expect( await getBlockListLeafNodes() ).toHaveLength( 1 ); + // Focus the cover block. The paragraph is not focussed by default. + const coverBlock = await page.waitForSelector( '.wp-block-cover' ); + + await coverBlock.focus(); + // Click the cover title placeholder. const coverTitle = await page.waitForSelector( '.wp-block-cover .wp-block-paragraph' @@ -138,7 +143,7 @@ describe( 'List view', () => { // The block list should contain two leafs and the second should be selected (and be a paragraph). const selectedElementText = await page.$eval( - '.block-editor-list-view-leaf:nth-child(2).is-selected a', + '.block-editor-list-view-leaf.is-selected .block-editor-list-view-block-contents', ( element ) => element.innerText );