File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
packages/playground/website/playwright/e2e Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -450,18 +450,30 @@ test.describe('Database panel', () => {
450450 await expect ( newPage . locator ( 'body' ) ) . toContainText ( 'phpMyAdmin' ) ;
451451 await expect ( newPage . locator ( 'body' ) ) . toContainText ( 'wp_posts' ) ;
452452
453+ /*
454+ * Before navigating to a page in phpMyAdmin, we need to wait for jQuery
455+ * to be ready to prevent clicking a link before listeners are attached.
456+ * This prevents flaky tests (mainly in Firefox).
457+ */
458+ const waitForAjaxHandlers = async ( ) =>
459+ newPage . waitForFunction (
460+ ( ) => ( window as any ) ?. jQuery ?. isReady ?? false
461+ ) ;
462+
453463 // Browse the "wp_posts" table
454464 const wpPostsRow = newPage
455465 . locator ( 'tr' )
456466 . filter ( { hasText : 'wp_posts' } )
457467 . first ( ) ;
458468 await expect ( wpPostsRow ) . toBeVisible ( { timeout : 10000 } ) ;
469+ await waitForAjaxHandlers ( ) ;
459470 await wpPostsRow . getByRole ( 'link' , { name : 'Browse' } ) . click ( ) ;
460471 await newPage . waitForLoadState ( ) ;
461472 const pmaRows = newPage . locator ( 'table.table_results tbody tr' ) ;
462473 await expect ( pmaRows . first ( ) ) . toContainText ( 'Welcome to WordPress.' ) ;
463474
464475 // Click "edit" on a row
476+ await waitForAjaxHandlers ( ) ;
465477 await pmaRows
466478 . first ( )
467479 . getByRole ( 'link' , { name : 'Edit' } )
You can’t perform that action at this time.
0 commit comments