Skip to content

Commit cfa6fd0

Browse files
committed
Wait for 'Loading…' message rather than phpMyAdmin internals
1 parent 2a9b267 commit cfa6fd0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/playground/website/playwright/e2e/website-ui.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -451,28 +451,26 @@ test.describe('Database panel', () => {
451451
await expect(newPage.locator('body')).toContainText('wp_posts');
452452

453453
/*
454-
* Before clicking a link in phpMyAdmin, we need to wait for any AJAX
455-
* requests to be done. This prevents flaky tests (mainly in Firefox).
454+
* Before clicking a link in phpMyAdmin, we need to wait for the loading
455+
* indicator to disappear. This prevents flaky tests (mainly in Firefox).
456456
*/
457-
const waitForAjaxIdle = async () =>
458-
newPage.waitForFunction(() => {
459-
return (window as any).AJAX?.active === false;
460-
});
457+
const waitForLoad = async () =>
458+
expect(newPage.getByText('Loading…')).toBeHidden();
461459

462460
// Browse the "wp_posts" table
463461
const wpPostsRow = newPage
464462
.locator('tr')
465463
.filter({ hasText: 'wp_posts' })
466464
.first();
467465
await expect(wpPostsRow).toBeVisible();
468-
await waitForAjaxIdle();
466+
await waitForLoad();
469467
await wpPostsRow.getByRole('link', { name: 'Browse' }).click();
470468
await newPage.waitForLoadState();
471469
const pmaRows = newPage.locator('table.table_results tbody tr');
472470
await expect(pmaRows.first()).toContainText('Welcome to WordPress.');
473471

474472
// Click "edit" on a row
475-
await waitForAjaxIdle();
473+
await waitForLoad();
476474
await pmaRows
477475
.first()
478476
.getByRole('link', { name: 'Edit' })

0 commit comments

Comments
 (0)