diff --git a/scripts/screenshots/journeys.mjs b/scripts/screenshots/journeys.mjs index d478331f..99a027fe 100644 --- a/scripts/screenshots/journeys.mjs +++ b/scripts/screenshots/journeys.mjs @@ -551,7 +551,16 @@ await journey('sign-in-redirects-at-once-and-lists-after', async ({ page, shot } // little more. The listing alone takes 8 s here, so a callback that waited for it fails either way expect(ms < 1500, `the sign-in callback took ${ms} ms`) const timed = await (await page.request.get(`${GITHUB}/_stub/timed`)).json() - const inCallback = timed.filter((c) => c.started >= asked && c.finished !== null && c.finished <= answered).map((c) => c.call) + // The callback's calls are the stub's calls after the browser's own GET /login/oauth/authorize (which sends it to the + // callback) that finished before the callback answered: counted by order, not from `asked`. Both clocks are whole + // milliseconds and the browser's events reach this process late, so a window from `asked` both took in authorize + // (5 Dec 2026, run 47531375940: "4 GitHub calls") and could leave out the callback's first call + const from = timed.findLastIndex((c) => c.call === 'GET /login/oauth/authorize') + expect(from >= 0, 'the stub never saw the sign-in authorize request') + const inCallback = timed + .slice(from + 1) + .filter((c) => c.finished !== null && c.finished <= answered) + .map((c) => c.call) expect(inCallback.length <= 3, `the sign-in callback made ${inCallback.length} GitHub calls: ${inCallback.join(', ')}`) // An installation set up meanwhile waits on the listing: the page that loads itself again every second, served once