diff --git a/test/e2e/specs/site-editor/navigation-editor.spec.js b/test/e2e/specs/site-editor/navigation-editor.spec.js index 3ac72ac3b78d60..344f776c71e027 100644 --- a/test/e2e/specs/site-editor/navigation-editor.spec.js +++ b/test/e2e/specs/site-editor/navigation-editor.spec.js @@ -20,20 +20,6 @@ test.describe( 'Editing Navigation Menus', () => { editor, } ) => { await test.step( 'Manually browse to focus mode for a Navigation Menu', async () => { - // We could Navigate directly to editing the Navigation Menu but we intentionally do not do this. - // - // Why? To provide coverage for a bug that caused the Navigation Editor behaviours to fail - // only when navigating through the editor screens (rather than going directly to the editor by URL). - // See: https://github.com/WordPress/gutenberg/pull/56856. - // - // Example (what we could do): - // await admin.visitSiteEditor( { - // postId: createdMenu?.id, - // postType: 'wp_navigation', - // } ); - // - await admin.visitSiteEditor(); - // create a Navigation Menu called "Test Menu" using the REST API helpers const createdMenu = await requestUtils.createNavigationMenu( { title: 'Primary Menu', @@ -48,6 +34,20 @@ test.describe( 'Editing Navigation Menus', () => { '', } ); + // We could Navigate directly to editing the Navigation Menu but we intentionally do not do this. + // + // Why? To provide coverage for a bug that caused the Navigation Editor behaviours to fail + // only when navigating through the editor screens (rather than going directly to the editor by URL). + // See: https://github.com/WordPress/gutenberg/pull/56856. + // + // Example (what we could do): + // await admin.visitSiteEditor( { + // postId: createdMenu?.id, + // postType: 'wp_navigation', + // } ); + // + await admin.visitSiteEditor(); + const editorSidebar = page.getByRole( 'region', { name: 'Navigation', } ); @@ -66,6 +66,10 @@ test.describe( 'Editing Navigation Menus', () => { } ) ).toBeVisible(); + await expect( page ).toHaveURL( + `wp-admin/site-editor.php?path=%2Fnavigation` + ); + await editorSidebar .getByRole( 'button', { name: 'Primary Menu', @@ -77,10 +81,12 @@ test.describe( 'Editing Navigation Menus', () => { ); // Wait for list of Navigations to appear. - editorSidebar.getByRole( 'heading', { - name: 'Primary Menu', - level: 1, - } ); + await expect( + editorSidebar.getByRole( 'heading', { + name: 'Primary Menu', + level: 1, + } ) + ).toBeVisible(); // Switch to editing the Navigation Menu await editorSidebar