test(e2e): a localhost connect the machine dropped is tried again on the test side

On a Windows host a burst of test traffic can drop a loopback connect now and then (every port,
any program — measured on the dev desktop). The browser resends it and only waits; Node (libuv)
sends a loopback SYN once and fails at ~300 ms with "connect ETIMEDOUT". `e2e/retryConnect.ts` wraps
Playwright's request context so that one error is tried again (0.5 / 1 / 2 / 4 / 8 s, the system's
own retry waits) while every other failure goes straight to the test; global.setup's health check,
login and /api/me and speed.measure's share probe go through it. Unit-tested; e2e 61/61.
This commit is contained in:
2026-10-11 00:45:13 +02:00
parent 891507dc75
commit b9eb8458b3
5 changed files with 92 additions and 4 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
import { test, type Page } from "@playwright/test";
import { execFileSync } from "node:child_process";
import { mkdirSync, writeFileSync } from "node:fs";
import { retryConnect } from "./retryConnect";
/**
* The speed baseline: numbers, not assertions — read by `scripts/audit_metrics.py --speed`, which
@@ -83,7 +84,7 @@ test("speed baseline", async ({ browser, page: page0 }) => {
// the visitor's tap — the page has no autoplay).
let token: string | null = null;
for (const t of shareTokens()) {
if ((await page0.request.get(`/api/public/watch/${t}`)).ok()) {
if ((await retryConnect(page0.request).get(`/api/public/watch/${t}`)).ok()) {
token = t;
break;
}