test(app): every shell suite drops late replays after a test

The client journey could fail after it passed: since V1-1.6 the client page
reloads its animals after a restore, and that replay outlived the test. One
support helper unroutes without waiting, for the three shell specs. Found by
the V1-1.6 verifier. Memory: BDR-079, LRN-087 to 089.
This commit is contained in:
bchanot committed 2026-10-26 17:38:52 +01:00
1 parent 212392263c
commit 10413478fb
8 files changed
+74 -9

No files matched your search

+7 -4
View File
@@ -11,7 +11,12 @@ import {
expectNoHorizontalOverflow,
test,
} from '../support/browser'
import { createAccount, routeToSandbox, sandboxUrl } from '../support/sandbox'
import {
createAccount,
dropLateReplays,
routeToSandbox,
sandboxUrl,
} from '../support/sandbox'
import {
literal,
seedAnimal,
@@ -120,10 +125,8 @@ for (const [locale, dict] of LANGUAGES) {
test.beforeEach(async ({ context }) => {
await routeToSandbox(context)
})
// A page may still be reading (a list, the relations) when its last check
// passed: the replay of that answer is dropped with the context, not failed.
test.afterEach(async ({ context }) => {
await context.unrouteAll({ behavior: 'ignoreErrors' })
await dropLateReplays(context)
})
test('empty list, an « Autre » with no owner, search, species filter, edit, archive, archived filter, restore', async ({
+6 -1
View File
@@ -12,6 +12,7 @@ import {
} from '../support/browser'
import {
createAccount,
dropLateReplays,
routeToSandbox,
sandboxUrl,
workspaceOf,
@@ -75,6 +76,9 @@ for (const [locale, dict] of LANGUAGES) {
test.beforeEach(async ({ context }) => {
await routeToSandbox(context)
})
test.afterEach(async ({ context }) => {
await dropLateReplays(context)
})
test('empty list, create, find, open, edit, archive, archived filter, restore', async ({
page,
@@ -255,7 +259,8 @@ for (const [locale, dict] of LANGUAGES) {
).toBeVisible()
await expect(
page.getByRole('link', { name: dict['clients.detail.edit'] }),
).toBeVisible()
).toBeVisible() // The animal section is read again for the restored client.
await expect(page.getByText(dict['clients.animals.none'])).toBeVisible()
})
test('pages of 25 with « Afficher plus », in name order', async ({
+8 -1
View File
@@ -9,7 +9,11 @@ import {
focusedName,
test,
} from '../support/browser'
import { createAccount, routeToSandbox } from '../support/sandbox'
import {
createAccount,
dropLateReplays,
routeToSandbox,
} from '../support/sandbox'
import { signIn } from '../support/shell'
// The authenticated shell on the isolated stack: sign-in, dashboard, the
@@ -37,6 +41,9 @@ for (const [locale, dict] of LANGUAGES) {
test.beforeEach(async ({ context }) => {
await routeToSandbox(context)
})
test.afterEach(async ({ context }) => {
await dropLateReplays(context)
})
test('sign-in, dashboard, then the photo confirmation of the account', async ({
page,
+9
View File
@@ -39,6 +39,15 @@ export async function routeToSandbox(context: BrowserContext): Promise<void> {
})
}
/**
* After a test: removes the replay without waiting for it. A page may still be
* reading (a list, a section reloaded after a change) when the last check
* passed; that answer is dropped with the context instead of failing the test.
*/
export async function dropLateReplays(context: BrowserContext): Promise<void> {
await context.unrouteAll({ behavior: 'ignoreErrors' })
}
/** 1 × 1 lossless WebP: a real image for the clean avatar the account starts with. */
const AVATAR_WEBP = Buffer.from(
'UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==',