Skip to content

Commit

Permalink
Make navigation editor end-to-end tests more robust (#28936)
Browse files Browse the repository at this point in the history
* Wait for loading to finish in e2e test

* Simplify and add some more assertions
  • Loading branch information
talldan authored and noisysocks committed Mar 1, 2021
1 parent 12d70a5 commit 8ef203d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/e2e-tests/specs/experiments/navigation-editor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ describe( 'Navigation editor', () => {
await visitNavigationEditor();

// Wait for the header to show that no menus are available.
await page.waitForXPath( '//h2[contains(., "No menus available")]' );
await page.waitForXPath( '//h2[contains(., "No menus available")]', {
visible: true,
} );

// Prepare the menu endpoint for creating a menu.
await setUpResponseMocking( [
Expand Down Expand Up @@ -204,6 +206,10 @@ describe( 'Navigation editor', () => {
);
await addAllPagesButton.click();

// When the block is created the root element changes from a div (for the placeholder)
// to a nav (for the navigation itself). Wait for this to happen.
await page.waitForSelector( 'nav[aria-label="Block: Navigation"]' );

expect( await getSerializedBlocks() ).toMatchSnapshot();
} );

Expand All @@ -215,7 +221,12 @@ describe( 'Navigation editor', () => {
await visitNavigationEditor();

// Wait for the header to show the menu name.
await page.waitForXPath( '//h2[contains(., "Editing: Test Menu 1")]' );
await page.waitForXPath( '//h2[contains(., "Editing: Test Menu 1")]', {
visible: true,
} );

// Wait for the block to be present.
await page.waitForSelector( 'nav[aria-label="Block: Navigation"]' );

expect( await getSerializedBlocks() ).toMatchSnapshot();
} );
Expand Down

0 comments on commit 8ef203d

Please sign in to comment.