From 4d58c79ff412ec1d47c036f5a3deac24a8d8657a Mon Sep 17 00:00:00 2001 From: epiqueras Date: Mon, 4 Nov 2019 14:34:01 -0800 Subject: [PATCH] Editor: Add e2e test. --- .../editor/various/change-detection.test.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/e2e-tests/specs/editor/various/change-detection.test.js b/packages/e2e-tests/specs/editor/various/change-detection.test.js index 0f384d7c3efd5a..3acb41cbfb337e 100644 --- a/packages/e2e-tests/specs/editor/various/change-detection.test.js +++ b/packages/e2e-tests/specs/editor/various/change-detection.test.js @@ -7,6 +7,7 @@ import { pressKeyWithModifier, ensureSidebarOpened, publishPost, + openDocumentSettingsSidebar, } from '@wordpress/e2e-test-utils'; describe( 'Change detection', () => { @@ -348,4 +349,25 @@ describe( 'Change detection', () => { // Verify that the post is not dirty. await assertIsDirty( false ); } ); + + it( 'should not prompt to confirm unsaved changes when trashing an existing post', async () => { + // Enter title. + await page.type( '.editor-post-title__input', 'Hello World' ); + + // Save + await Promise.all( [ + // Wait for "Saved" to confirm save complete. + page.waitForSelector( '.editor-post-saved-state.is-saved' ), + + // Keyboard shortcut Ctrl+S save. + pressKeyWithModifier( 'primary', 'S' ), + ] ); + + // Trash post. + await openDocumentSettingsSidebar(); + await page.click( '.editor-post-trash.components-button' ); + + // Check that the dialog didn't show. + await assertIsDirty( false ); + } ); } );