diff --git a/tests/e2e/generated-feature.spec.ts b/tests/e2e/generated-feature.spec.ts index f80d424f..63af5ac4 100644 --- a/tests/e2e/generated-feature.spec.ts +++ b/tests/e2e/generated-feature.spec.ts @@ -59,10 +59,17 @@ function envelope(data: unknown) { return { success: true, data, meta: META }; } -function failure(code: string, retryable: boolean) { +/** + * 1112/03-09. The paired backend's failure Envelope: code, category and + * retryable as its OperationalError row gives them + * (clean-architecture-backend-template src/shared-contract/.../OperationalError.java: + * RATE_LIMIT_EXCEEDED is RATE_LIMIT, 429, retryable; INTERNAL_ERROR is + * INTERNAL, 500, not retryable). + */ +function failure(code: string, category: string, retryable: boolean) { return { success: false, - error: { code, category: "SYSTEM", message: "backend message", retryable }, + error: { code, category, message: "backend message", retryable }, meta: META, }; } @@ -243,7 +250,7 @@ test.describe("the save", () => { route.fulfill({ status: 429, headers: { "retry-after": "1" }, - json: failure("RATE_LIMITED", true), + json: failure("RATE_LIMIT_EXCEEDED", "RATE_LIMIT", true), }); test("keeps the input and saves on retry", async ({ page }) => { @@ -281,7 +288,7 @@ test.describe("the save", () => { "x-correlation-id": "corr-save-500", "access-control-expose-headers": "x-correlation-id", }, - json: failure("INTERNAL_ERROR", false), + json: failure("INTERNAL_ERROR", "INTERNAL", false), }); // 0929/08-04. The case a user most wants to report shows the id support diff --git a/tests/e2e/old-tab-chunk-recovery.spec.ts b/tests/e2e/old-tab-chunk-recovery.spec.ts index 81ec3e5f..b968a9a4 100644 --- a/tests/e2e/old-tab-chunk-recovery.spec.ts +++ b/tests/e2e/old-tab-chunk-recovery.spec.ts @@ -184,25 +184,21 @@ async function preloadedWith(dist: string, page: string): Promise { } // 1103/11-09. Vite preloads a chunk together with the chunks it imports, so a -// missing chunk leaves itself and the chunks preloaded with it unused: in the -// A tab those of A's platform page (the tab is still on A while recovery -// reads the release manifest), in the B tab those of B's context routes -// module for the feature's list page. The fixture's preload check reports them in every -// engine (WebKit's own three-second warning only did when its timer ran -// before the test ended). They are the provoked failure's own effect; only -// those chunks are allowed. +// missing chunk leaves itself and the chunks preloaded with it unused. The +// fixture's preload check reads only the documents open at the end +// (tests/support/browser/preload-use.ts), and the A tab has become a B +// document by then, so only B's: those of B's context routes module for the +// feature's list page. The check reports them in every engine (WebKit's own +// three-second warning only did when its timer ran before the test ended). +// They are the provoked failure's own effect; only those chunks are allowed +// (1112/03-06: the A list here covered nothing but a B chunk of the same name). test.use({ allowedBrowserFailure: async ({ browserName: _engine }, provide) => { if (!builds) throw new Error("Fixture builds were not prepared."); - const aManifest = await viteManifest(builds.dist.a); const bManifest = await viteManifest(builds.dist.b); - const files = [ - ...(await preloadedWith(builds.dist.a, pageSource(aManifest, PLATFORM))), - ...(await preloadedWith( - builds.dist.b, - routesSource(bManifest, pageSource(bManifest, FEATURE())), - )), - ].map((file) => file.replaceAll(".", String.raw`\.`)); + const files = ( + await preloadedWith(builds.dist.b, routesSource(bManifest, pageSource(bManifest, FEATURE()))) + ).map((file) => file.replaceAll(".", String.raw`\.`)); await provide( new RegExp( [