fix(editor): e2e setup retries a GoTrue 500 step-up, drops late replays

This commit is contained in:
bchanot committed 2026-11-14 19:01:21 +01:00
1 parent dca80cb006
commit 0ea94602d1
5 files changed
+110 -11

No files matched your search

+25 -4
View File
@@ -2,7 +2,11 @@ import { fr } from '@/i18n/fr'
import type { Locator, Page, TestInfo } from '@playwright/test'
import { rpc } from '../../../../packages/supabase/tests/sandbox/stack'
import { expect, expectAccessible, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
FAKE_SUPABASE_ORIGIN,
dropLateReplays,
routeToSandbox,
} from '../support/sandbox'
import {
type Actor,
copyKeyOf,
@@ -26,7 +30,7 @@ import {
UNSAVED_LINE,
} from '../support/editor'
import { stepUpAdmin } from '../support/admin'
import { secondSession } from '../support/editor'
import { closeSecondSession, secondSession } from '../support/editor'
import { signIn } from '../support/shell'
// V1-2.6 recovery and concurrency (contract C27 to C30, owner 2026-11-04): two sessions
@@ -134,7 +138,7 @@ test.describe('editor recovery and concurrency', () => {
// The reloaded session then saves without a conflict.
await commitText(nameFr(other.page), 'Seconde session, reprise')
await saveDraft(other.page, dict, 3)
await other.context.close()
await closeSecondSession(other)
})
test('an older copy restored then saved: conflict, then « Garder ma version » after the confirmation', async ({
@@ -254,6 +258,23 @@ test.describe('editor recovery and concurrency', () => {
await expect(nameFr(page)).toBeEditable()
})
test('a second session closed with a read in flight fails nothing (verifier 10)', async ({
browser,
baseURL,
}) => {
// Gate final3: a replay of the closed context's last read rejected with « Request
// context disposed » inside the route callback, which failed the test.
const other = await secondSession(browser, baseURL ?? '', 'fr-FR')
await other.page.goto('/login')
const replayed = other.page.waitForRequest(/\/rest\/v1\/species/)
// Many reads, so some replays are still running when the context closes.
await other.page.evaluate((url) => {
for (let i = 0; i < 60; i += 1) void fetch(`${url}&n=${i}`).catch(() => 0)
}, `${FAKE_SUPABASE_ORIGIN}/rest/v1/species?select=id`)
await replayed
await closeSecondSession(other)
})
test('the conflict read in progress can be left with Escape', async ({
page,
browser,
@@ -268,7 +289,7 @@ test.describe('editor recovery and concurrency', () => {
await signInAgain(other.page, actor, seed.sheetId)
await commitText(nameFr(other.page), 'Devant')
await saveDraft(other.page, dict, 2)
await other.context.close()
await closeSecondSession(other)
let release = () => {}
const gate = new Promise<void>((resolve) => (release = resolve))