diff --git a/test/e2e/specs/site-editor/navigation.spec.js b/test/e2e/specs/site-editor/navigation.spec.js index 18eb6c9904b44..2a886c2048f88 100644 --- a/test/e2e/specs/site-editor/navigation.spec.js +++ b/test/e2e/specs/site-editor/navigation.spec.js @@ -106,6 +106,23 @@ test.describe( 'Site editor navigation', () => { // We should have our editor canvas button back await expect( editorCanvasButton ).toBeVisible(); } ); + + test( 'Should show 404 page when navigating to non-existent template', async ( { + admin, + page, + } ) => { + // Navigate to a non-existent template. + await admin.visitAdminPage( 'site-editor.php', 'p=/template-foo-bar' ); + + // Verify the 404 error notice is displayed with the correct message. + await expect( + page.locator( + '.edit-site-layout__area .components-notice__content' + ) + ).toHaveText( + 'The requested page could not be found. Please check the URL.' + ); + } ); } ); class EditorNavigationUtils {