Skip to content

Commit

Permalink
Fix flaky navigation-frontend-interactivity e2e tests (WordPress#68667)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
3 people authored Jan 15, 2025
1 parent 6940e88 commit 4085555
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,22 @@ export async function visitSiteEditor(
'.edit-site-canvas-loader, .edit-site-canvas-spinner'
);

// Wait for the canvas loader to appear first, so that the locator that
// waits for the hidden state doesn't resolve prematurely.
await canvasLoader.waitFor( { state: 'visible', timeout: 60_000 } );
await canvasLoader.waitFor( {
state: 'hidden',
// Bigger timeout is needed for larger entities, like the Large Post
// HTML fixture that we load for performance tests, which often
// doesn't make it under the default timeout value.
timeout: 60_000,
} );
try {
// Wait for the canvas loader to appear first, so that the locator that
// waits for the hidden state doesn't resolve prematurely.
await canvasLoader.waitFor( { state: 'visible', timeout: 60_000 } );
await canvasLoader.waitFor( {
state: 'hidden',
// Bigger timeout is needed for larger entities, like the Large Post
// HTML fixture that we load for performance tests, which often
// doesn't make it under the default timeout value.
timeout: 60_000,
} );
} catch ( error ) {
// If the canvas loader is already disappeared, skip the waiting.
await this.page
.getByRole( 'region', { name: 'Editor content' } )
.waitFor();
}
}
}

0 comments on commit 4085555

Please sign in to comment.