test(e2e): give an unnavigated page an origin before a session call

The setup flow specs answer questions through these helpers before their
first real navigation. That case still went through page.request, which
shares the runner's keep-alive agent, and a stale socket failed an answer
with read ECONNRESET on the dependency update branches. The page now opens
the public version endpoint first and sends the call with its own fetch.
This commit is contained in:
Marc-André Bombeck committed 2026-09-13 20:58:04 +02:00
1 parent b794a256d0
commit 99ddf0db5d
1 file changed
+6 -5
+6 -5
View File
@@ -68,9 +68,11 @@ export async function acceptAndSetUp(page: Page): Promise<void> {
* Every Playwright API context in the runner shares one keep-alive agent,
* and it can hand out a socket the server already closed on its idle
* timeout; the call then dies with `read ECONNRESET` and CI counts the retry
* as a failure. The page opens its own connection. Before the first
* navigation there is no origin to fetch against, so that case keeps the
* API context.
* as a failure. The page opens its own connection. A page that has not
* navigated yet has no origin to fetch against, so it first opens the public
* version endpoint: the specs call these helpers before their first real
* navigation, and routing that case back through the API context is what
* kept the flake alive.
*/
async function sessionCall(
page: Page,
@@ -79,8 +81,7 @@ async function sessionCall(
body?: unknown,
): Promise<{ status: number; json: unknown }> {
if (!page.url().startsWith("http")) {
const res = await page.request.fetch(path, { method, data: body });
return { status: res.status(), json: await res.json().catch(() => null) };
await page.goto("/api/version", { waitUntil: "domcontentloaded" });
}
return page.evaluate(
async ({ method, path, body }) => {