From 804eb949c6250004db08f2faf71b9d231336bf05 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Wed, 25 Jan 2023 15:54:13 +0100 Subject: [PATCH] Improve test stability by waiting for selection --- .../block-editor-keyboard-shortcuts.test.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/e2e-tests/specs/editor/various/block-editor-keyboard-shortcuts.test.js b/packages/e2e-tests/specs/editor/various/block-editor-keyboard-shortcuts.test.js index 0847f4d45c1db..e6e156ca8ee15 100644 --- a/packages/e2e-tests/specs/editor/various/block-editor-keyboard-shortcuts.test.js +++ b/packages/e2e-tests/specs/editor/various/block-editor-keyboard-shortcuts.test.js @@ -50,9 +50,10 @@ describe( 'block editor keyboard shortcuts', () => { it( 'should move the blocks up', async () => { await createTestParagraphBlocks(); expect( await getEditedPostContent() ).toMatchSnapshot(); - await page.keyboard.down( 'Shift' ); - await page.keyboard.press( 'ArrowUp' ); - await page.keyboard.up( 'Shift' ); + await pressKeyWithModifier( 'shift', 'ArrowUp' ); + await page.waitForSelector( + '[aria-label="Multiple selected blocks"]' + ); await moveUp(); expect( await getEditedPostContent() ).toMatchSnapshot(); } ); @@ -61,9 +62,10 @@ describe( 'block editor keyboard shortcuts', () => { await createTestParagraphBlocks(); expect( await getEditedPostContent() ).toMatchSnapshot(); await page.keyboard.press( 'ArrowUp' ); - await page.keyboard.down( 'Shift' ); - await page.keyboard.press( 'ArrowUp' ); - await page.keyboard.up( 'Shift' ); + await pressKeyWithModifier( 'shift', 'ArrowUp' ); + await page.waitForSelector( + '[aria-label="Multiple selected blocks"]' + ); await moveDown(); expect( await getEditedPostContent() ).toMatchSnapshot(); } );