Skip to content

Commit

Permalink
wait 2 sec in between menu creations
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieCabrera committed Mar 8, 2023
1 parent 91ad3b5 commit 0463f38
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/e2e/specs/editor/blocks/navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,15 @@ test.describe(
requestUtils,
} ) => {
await admin.createNewPost();

await requestUtils.createNavigationMenu( {
title: 'Test Menu 1',
content:
'<!-- wp:navigation-link {"label":"WordPress","type":"custom","url":"http://www.wordpress.org/","kind":"custom","isTopLevelLink":true} /-->',
} );

// The two menus are created with the same timestamp, so we need to wait a bit to ensure the second one is created after the first one.
await editor.page.waitForTimeout( 2000 );

const latestMenu = await requestUtils.createNavigationMenu( {
title: 'Test Menu 2',
content:
Expand All @@ -156,13 +158,6 @@ test.describe(

await editor.insertBlock( { name: 'core/navigation' } );

// Check the block in the canvas.
await expect(
editor.canvas.locator(
`role=textbox[name="Navigation link text"i] >> text="My site link"`
)
).toBeVisible();

// Check the markup of the block is correct.
await editor.publishPost();
await expect.poll( editor.getBlocks ).toMatchObject( [
Expand All @@ -173,6 +168,13 @@ test.describe(
] );
await page.locator( 'role=button[name="Close panel"i]' ).click();

// Check the block in the canvas.
await expect(
editor.canvas.locator(
`role=textbox[name="Navigation link text"i] >> text="My site link"`
)
).toBeVisible();

// Check the block in the frontend.
await page.goto( '/' );
await expect(
Expand Down

0 comments on commit 0463f38

Please sign in to comment.