From 949f6a1aa3846bf79d3d52b34f513fb4d693c7c1 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 10 May 2024 17:22:17 +0100 Subject: [PATCH] Fix e2e tests --- .../specs/editor/various/change-detection.spec.js | 14 ++++++-------- test/e2e/specs/site-editor/template-revert.spec.js | 7 +++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/test/e2e/specs/editor/various/change-detection.spec.js b/test/e2e/specs/editor/various/change-detection.spec.js index 4f539a92269e6..36496faecc3ad 100644 --- a/test/e2e/specs/editor/various/change-detection.spec.js +++ b/test/e2e/specs/editor/various/change-detection.spec.js @@ -411,19 +411,17 @@ test.describe( 'Change detection', () => { await editor.openDocumentSettingsSidebar(); await page .getByRole( 'region', { name: 'Editor settings' } ) - .getByRole( 'button', { name: 'Move to trash' } ) + .getByRole( 'button', { name: 'Actions' } ) + .click(); + await page + .getByRole( 'menu' ) + .getByRole( 'menuitem', { name: 'Move to Trash' } ) .click(); await page .getByRole( 'dialog' ) - .getByRole( 'button', { name: 'Move to trash' } ) + .getByRole( 'button', { name: 'Delete' } ) .click(); - await expect( - page - .getByRole( 'region', { name: 'Editor top bar' } ) - .getByRole( 'button', { name: 'saved' } ) - ).toBeDisabled(); - await expect( page ).toHaveURL( '/wp-admin/edit.php?post_type=post' ); } ); diff --git a/test/e2e/specs/site-editor/template-revert.spec.js b/test/e2e/specs/site-editor/template-revert.spec.js index 2af2a90eae119..5c19ed5a39e00 100644 --- a/test/e2e/specs/site-editor/template-revert.spec.js +++ b/test/e2e/specs/site-editor/template-revert.spec.js @@ -56,7 +56,7 @@ test.describe( 'Template Revert', () => { page.locator( 'role=region[name="Editor settings"i] >> role=button[name="Actions"i]' ) - ).toBeHidden(); + ).toBeDisabled(); } ); test( 'should show the original content after revert', async ( { @@ -179,6 +179,10 @@ test.describe( 'Template Revert', () => { await editor.saveSiteEditorEntities( { isOnlyCurrentEntityDirty: true, } ); + await page + .getByRole( 'button', { name: 'Dismiss this notice' } ) + .getByText( /(updated|published)\./ ) + .click(); const contentBefore = await templateRevertUtils.getCurrentSiteEditorContent(); @@ -190,7 +194,6 @@ test.describe( 'Template Revert', () => { await editor.saveSiteEditorEntities( { isOnlyCurrentEntityDirty: true, } ); - await admin.visitSiteEditor(); const contentAfter =