Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions services/frontend/tests/e2e/boards-swipe.motion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 5 additions & 8 deletions services/frontend/tests/e2e/committee-save.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions services/frontend/tests/e2e/esports-season-drag.motion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading