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
12 changes: 9 additions & 3 deletions tests/challenger-m3-2-sql-and-lighthouse-stress.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { describe, expect, it } from "vitest";
import {
POSTGRES_TOKEN_PATTERN,
Expand Down Expand Up @@ -396,8 +396,10 @@
const largeSql = statements.join("\n");
expect(largeSql.length).toBeGreaterThan(150000);

// Warm up once to avoid measuring cold-start noise, then require every measured run to
// remain below the limit. This catches regressions that a fastest-run statistic could hide.
// Warm up once to avoid measuring cold-start noise, then require the median of five warm
// runs to stay below the limit. A slow stripper (or catastrophic backtracking) slows every
// run, so the median still catches it, while one garbage-collection or scheduler pause on a
// loaded coverage runner no longer fails the build (a single run reached 107 ms, 12 Oct 2026).
stripMigrationSql(largeSql);
let stripped = "";
const durations: number[] = [];
Expand All @@ -410,7 +412,11 @@
expect(stripped).toContain("https://example.com/item--1999");
expect(stripped).toContain("Note with ''quotes'' and -- dashes");
expect(stripped).not.toContain("trailing comment");
expect(Math.max(...durations)).toBeLessThan(100); // Every warm run must be very fast
const median = [...durations].sort((a, b) => a - b)[Math.floor(durations.length / 2)];
expect(median).toBeLessThan(100);
Comment thread
BigSimmo marked this conversation as resolved.
Resolved
// An outlier ceiling still fails a run that is pathologically slow, which no runner pause
// explains.
expect(Math.max(...durations)).toBeLessThan(300);
});

it("handles long unclosed comment or string safely without catastrophic backtracking", () => {
Expand Down
29 changes: 20 additions & 9 deletions tests/ui-on-call-boards.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,26 @@ test.describe("02 More — the second row is about the page you are on", () => {
await expect(page.locator('[data-testid^="admin-help-"][data-testid$="-loading"]')).toHaveCount(0, {
timeout: 20_000,
});
for (const label of await barWords(page, ADMIN_SECTION_HEADER_PREFIX)) {
const slug = label
.trim()
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "");
if (!slug) continue;
await expect(page.locator(`#admin-help-${slug}`), `${label} is offered but absent`).toHaveCount(1);
}
// The bar resolves its words from the rendered sections one animation frame after the page
// changes (use-resolved-page-sections.ts), so a single read can still hold Support for a
// frame after it left the page (WebKit, 12 Oct 2026). Poll until the two agree.
await expect
.poll(
async () => {
const absent: string[] = [];
for (const label of await barWords(page, ADMIN_SECTION_HEADER_PREFIX)) {
const slug = label
.trim()
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "");
if (slug && (await page.locator(`#admin-help-${slug}`).count()) !== 1) absent.push(label);
}
return absent;
},
{ message: "words the bar offers but the page does not render", timeout: 10_000 },
)
.toEqual([]);
});
});

Expand Down
24 changes: 22 additions & 2 deletions tests/ui-phone-scroll-assessments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,28 @@ for (const standalone of [false, true]) {
const hidden = (await collapse.getAttribute("data-scroll-hidden")) === "true";
expect((await band.getAttribute("data-bar-hidden")) !== null).toBe(hidden);
if (hidden && (await band.getAttribute("data-stuck")) !== null) {
const bottom = await band.locator("nav").evaluate((nav) => nav.getBoundingClientRect().bottom);
expect(bottom, "hidden tabs leave no strip over the content").toBeLessThanOrEqual(1);
// On failure, report where the row is held and why, not only that it is visible, so a
// WebKit-only failure can be read from the CI log (no trace download from here).
await expect
.poll(
() =>
band.evaluate((element) => {
const bottom = element.querySelector("nav")?.getBoundingClientRect().bottom ?? 0;
if (bottom <= 1) return "gone";
const style = getComputedStyle(element);
return JSON.stringify({
bottom,
top: style.top,
translate: style.translate,
animations: element.getAnimations().length,
focusWithin: element.matches(":focus-within"),
hidden: element.hasAttribute("data-bar-hidden"),
stuck: element.hasAttribute("data-stuck"),
});
}),
{ message: "hidden tabs leave no strip over the content", timeout: 1_000 },
)
.toBe("gone");
}
}

Expand Down
14 changes: 6 additions & 8 deletions tests/ui-route-coverage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,12 @@ test.describe("previously uncovered production routes", () => {
});
await expect(remove).toBeEnabled();
await waitForReactEventHandler(remove);
// Slot clear commits through `router.push` with compacted ids. Wait for
// the URL only — same-route `?ids=` soft-nav may not fire a document load.
await Promise.all([
currentPage.waitForURL(/\/dsm\/compare\?ids=bipolar-ii-disorder$/, {
timeout: 30_000,
}),
remove.click(),
]);
// Slot clear commits through `router.push` with compacted ids. Click first, then poll
// the URL: a same-route `?ids=` soft navigation fires no document load, which
// `waitForURL` waits for, and inside `Promise.all` its timeout also hid whether the
// click itself ever landed (WebKit, 12 Oct 2026).
await remove.click();
await expect(currentPage).toHaveURL(/\/dsm\/compare\?ids=bipolar-ii-disorder$/, { timeout: 30_000 });
// Empty dashed panel is suppressed in favour of the compact slot rail
// and inline starter chips when fewer than two diagnoses remain.
await expect(currentPage.getByTestId("compare-slot-tile-compact").first()).toBeVisible();
Expand Down
Loading