From a733f2798be77628bb7907973bc016bc139d9546 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 16 Jun 2023 14:47:03 +0400 Subject: [PATCH] Fix flaky 'Switch to Draft' action in preview e2e tests (#51564) --- test/e2e/specs/editor/various/preview.spec.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/e2e/specs/editor/various/preview.spec.js b/test/e2e/specs/editor/various/preview.spec.js index 3f5e6eef60d3dc..cc97d5741c4c11 100644 --- a/test/e2e/specs/editor/various/preview.spec.js +++ b/test/e2e/specs/editor/various/preview.spec.js @@ -104,6 +104,8 @@ test.describe( 'Preview', () => { page, previewUtils, } ) => { + await editor.openDocumentSettingsSidebar(); + const editorPage = page; // Type aaaaa in the title field. @@ -180,7 +182,10 @@ test.describe( 'Preview', () => { // Return to editor and switch to Draft. await editorPage.bringToFront(); - await page.click( 'role=button[name="Switch to draft"i]' ); + await page + .getByRole( 'region', { name: 'Editor settings' } ) + .getByRole( 'button', { name: 'Switch to draft' } ) + .click(); // FIXME: The confirmation dialog is not named yet. await page.click( 'role=dialog >> role=button[name="OK"i]' );