diff --git a/services/frontend/tests/e2e/boards-swipe.motion.spec.ts b/services/frontend/tests/e2e/boards-swipe.motion.spec.ts index 15528e1b3..7f36d9d6a 100644 --- a/services/frontend/tests/e2e/boards-swipe.motion.spec.ts +++ b/services/frontend/tests/e2e/boards-swipe.motion.spec.ts @@ -243,9 +243,13 @@ test.describe("dragging the board page", () => { // arrived board's node in the middle of the window. await expect.poll(async () => (await scrollsAsked(page)).at(-1)).toBe("smooth") await expect.poll(async () => Math.round(await scrolled(page))).not.toBe(Math.round(opened)) - const node = (await page.getByTestId("board-node-3").boundingBox())! - const box = (await page.locator(SCROLLER).boundingBox())! - expect(Math.abs((node.x + node.width / 2) - (box.x + box.width / 2))).toBeLessThan(24) + // Polled rather than read once: the poll above answers the moment the smooth scroll starts, + // so a single reading is taken somewhere along the travel rather than at the end of it. + await expect.poll(async () => { + const node = (await page.getByTestId("board-node-3").boundingBox())! + const box = (await page.locator(SCROLLER).boundingBox())! + return Math.abs((node.x + node.width / 2) - (box.x + box.width / 2)) + }, {message: "the arrived board's node off the middle of the window"}).toBeLessThan(24) // A hit on one of the strip's own nodes is what it always was: the line does not move at // all, because the node the visitor aimed at would slide out from under their finger. diff --git a/services/frontend/tests/e2e/committee-save.spec.ts b/services/frontend/tests/e2e/committee-save.spec.ts index 82942fd1c..a402324b4 100644 --- a/services/frontend/tests/e2e/committee-save.spec.ts +++ b/services/frontend/tests/e2e/committee-save.spec.ts @@ -34,19 +34,16 @@ test.describe("the committee manager", () => { return route.fallback() }) - // Waited for before the page is opened, so a save that lands early is not missed — which - // means its budget also covers opening the page. A cold dev server compiles this route on - // the first visit, and on a loaded runner that alone outran the default five seconds. - const saved = page.waitForRequest( - request => request.method() === "PUT" && /\/committees\/900$/.test(new URL(request.url()).pathname), - {timeout: 60_000}, - ) - await page.goto("/committees/manage") await page.getByTestId("committee-edit-btn-900").click() await page.getByLabel("Committee name").fill("Events Committee Renamed") await page.getByLabel("Description").fill("A description long enough to satisfy the rule.") + // Opened here rather than above the page: the five second budget is for the submit and the + // request it makes, and a window opened earlier spends it on the load and the two fills too. + const saved = page.waitForRequest( + request => request.method() === "PUT" && /\/committees\/900$/.test(new URL(request.url()).pathname), + ) await page.getByTestId("committee-form-submit-btn").click() const request = await saved diff --git a/services/frontend/tests/e2e/esports-season-drag.motion.spec.ts b/services/frontend/tests/e2e/esports-season-drag.motion.spec.ts index b970d1d84..c75afa854 100644 --- a/services/frontend/tests/e2e/esports-season-drag.motion.spec.ts +++ b/services/frontend/tests/e2e/esports-season-drag.motion.spec.ts @@ -347,9 +347,13 @@ test.describe("dragging a game's page between seasons", () => { // arrived season's node in the middle of the window. await expect.poll(async () => (await scrollsAsked(page)).at(-1)).toBe("smooth") await expect.poll(async () => Math.round(await scrolledIn(page, STRIP))).not.toBe(Math.round(opened)) - const node = (await page.getByTestId("esports-season-node-63").boundingBox())! - const box = (await page.locator(STRIP).boundingBox())! - expect(Math.abs((node.x + node.width / 2) - (box.x + box.width / 2))).toBeLessThan(24) + // Polled rather than read once: the poll above answers the moment the smooth scroll starts, + // so a single reading is taken somewhere along the travel rather than at the end of it. + await expect.poll(async () => { + const node = (await page.getByTestId("esports-season-node-63").boundingBox())! + const box = (await page.locator(STRIP).boundingBox())! + return Math.abs((node.x + node.width / 2) - (box.x + box.width / 2)) + }, {message: "the arrived season's node off the middle of the window"}).toBeLessThan(24) // A hit on one of the strip's own nodes is what it always was: the line does not move at // all, because the node the visitor aimed at would slide out from under their finger.