Skip to content

Commit bb03c5b

Browse files
sadpandajoeclaude
andcommitted
fix(playwright): use toHaveURL for SPA navigation in saved-query test
The saved queries list uses React Router <Link>, which navigates via history.pushState — no full page load occurs. page.waitForURL with waitUntil hangs forever because domcontentloaded/load events never re-fire on SPA transitions. Switch to expect(page).toHaveURL() which polls the current URL instead of waiting for navigation events. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a8c85b2 commit bb03c5b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

superset-frontend/playwright/tests/sqllab/sqllab.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,10 @@ test('saves a query and loads it from saved queries', async ({
237237
// 1. Full-page navigation (slow under CI load)
238238
// 2. Saved-query API hydration (fires in useEffect after paint)
239239
await queryLink.click();
240-
await page.waitForURL(/sqllab/, {
241-
waitUntil: 'domcontentloaded',
242-
timeout: TIMEOUT.API_RESPONSE,
243-
});
240+
// React Router <Link> triggers a SPA navigation (history.pushState), not a
241+
// full page load, so page.waitForURL with waitUntil would hang forever.
242+
// Use toHaveURL which polls the current URL instead.
243+
await expect(page).toHaveURL(/sqllab/, { timeout: TIMEOUT.API_RESPONSE });
244244
await waitForGet(page, `api/v1/saved_query/${savedQueryId}`, {
245245
timeout: TIMEOUT.API_RESPONSE,
246246
});

0 commit comments

Comments
 (0)