test(e2e): retry admin nav so post-sign-in redirect can't interrupt it

signInAsAdmin waited for the /files redirect then immediately goto'd
/admin/storages, but the client redirect to /files could still be in
flight and interrupt the navigation ("interrupted by another navigation
to /files"), flaking responsive-admin. Wrap the goto + URL assertion in
expect(...).toPass() so it re-navigates until /admin/storages commits.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
saltbo
2026-06-19 21:32:51 -04:00
parent 29ec82651f
commit 0138e7779e
+6 -2
View File
@@ -51,8 +51,12 @@ export async function signInAsAdmin(page: Page) {
])
expect(resp.status()).toBe(200)
await expect(page).toHaveURL(/files/, { timeout: 10000 })
await page.goto('/admin/storages')
await expect(page).toHaveURL(/admin\/storages/, { timeout: 10000 })
// The post-sign-in client redirect to /files can still be in flight and
// interrupt this navigation; retry the goto until /admin/storages commits.
await expect(async () => {
await page.goto('/admin/storages')
await expect(page).toHaveURL(/admin\/storages/, { timeout: 5000 })
}).toPass({ timeout: 15000 })
}
export async function expandSignUpForm(page: Page) {