Skip to content

Commit

Permalink
Test: Add e2e test for 404 page (WordPress#69272)
Browse files Browse the repository at this point in the history
* Add e2e test for 404 page

* Improve navigation test

* Remove unnecessery `visitSiteEditor()`

Co-authored-by: Infinite-Null <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
4 people authored Feb 25, 2025
1 parent e532b74 commit 9a495f8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/e2e/specs/site-editor/navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9a495f8

Please sign in to comment.