test(imaging): retry transient edge failures instead of flaking the suite
CI / check (push) Successful in 37s
CI / tests-integration (push) Successful in 2m3s
CI / tests-unit (push) Successful in 2m8s
CI / tests-imaging-browsers (push) Successful in 2m15s
CI / tests-ui (push) Successful in 2m54s
CI / preflight (push) Skipped
CI / tests-quality (push) Successful in 1m14s
CI / deploy (push) Successful in 3m37s

The cross-browser imaging job runs against the public origin, so every request
goes through Cloudflare. One chromium run of "rejects malformed figures ›
missing figure" came back 525 (Cloudflare: TLS handshake to the origin failed)
after a 40s stall — the request never reached the CMS, so a 400 was impossible
to observe and the assertion was effectively testing the network. It passed on
both firefox and webkit, which is the signature of an edge hiccup rather than a
regression.

`e2e/imaging/imaging-target.ts` now owns `getThroughEdge` / `fetchThroughEdge`,
which retry on the statuses that mean "the app was never reached"
(502/503/504 plus Cloudflare's 520-527) with a short backoff, and both
edge-fronted specs use them. A genuinely broken edge still exhausts the retries
and fails the run, so nothing is masked.

Verified: 84 passed / 21 skipped / 0 failed against epicnabbo.nl with
IMAGING_EDGE=1 across chromium, firefox and webkit.
This commit is contained in:
openhands committed 2026-10-15 20:30:38 +02:00
1 parent 77a0d1010c
commit 480343d5a5
3 files changed
+117 -22

No files matched your search

+10 -3
View File
@@ -1,6 +1,7 @@
import { expect, test } from "@playwright/test";
import {
avatarPath,
getThroughEdge,
IMAGER_PATH,
IS_EDGE,
looksLikeImage,
@@ -17,7 +18,10 @@ test.skip(
);
test("the edge serves the imager endpoint as an image", async ({ request }) => {
const response = await request.get(IMAGER_PATH({ img_format: "png" }));
const response = await getThroughEdge(
request,
IMAGER_PATH({ img_format: "png" }),
);
expect(response.status()).toBe(200);
expect(response.headers()["content-type"]).toContain("image/");
expect(looksLikeImage(await response.body())).toBe(true);
@@ -26,14 +30,17 @@ test("the edge serves the imager endpoint as an image", async ({ request }) => {
test("the CMS avatar endpoint is reachable through the edge", async ({
request,
}) => {
const response = await request.get(avatarPath({ img_format: "png" }));
const response = await getThroughEdge(
request,
avatarPath({ img_format: "png" }),
);
expect(response.status()).toBe(200);
expect(response.headers()["content-type"]).toContain("image/");
expect(looksLikeImage(await response.body())).toBe(true);
});
test("the edge does not shadow the CMS badge endpoint", async ({ request }) => {
const response = await request.get("/api/imaging/badge?code=ADM");
const response = await getThroughEdge(request, "/api/imaging/badge?code=ADM");
expect(response.status()).toBe(200);
expect(response.headers()["content-type"]).toContain("image/");
});