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
3 changes: 3 additions & 0 deletions tests/ui-phone-scroll-assessments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ for (const standalone of [false, true]) {
await expect(page).toHaveURL(/view=progress/);
await expect(page.locator("[data-screen-heading]").first()).toBeFocused();
await page.goto("/teaching/assessments");
// A streamed page can briefly hold a finished section twice (once still parked in React's hidden
// reveal container), which a strict locator rejects at once. Wait for the single settled copy.
await expect(page.getByTestId("assess-doctor-hero")).toHaveCount(1, { timeout: 15_000 });
await expect(page.getByTestId("assess-doctor-hero")).toBeVisible();
await page.getByRole("button", { name: /^Request an EPA From/ }).click();
await expect(page.getByRole("dialog")).toBeVisible();
Expand Down
25 changes: 13 additions & 12 deletions tests/ui-tools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1241,8 +1241,18 @@ test.describe("PsychSift tools directory and legacy launcher", () => {

const icon = homeRegion.locator(".mode-home-icon").first();
await expect(icon).toBeVisible();
const iconBox = await icon.boundingBox();
expect(iconBox, `${home.path} hero icon`).not.toBeNull();
// The hero tile is `h-tap w-tap` on phones, so it tracks `--spacing-tap`
// (48px since PR 5b), not a standalone pixel choice. The home can swap its subtree between the
// visibility check and a box read, so each sample is a fresh read of the settled icon.
await expect
.poll(
async () => {
const box = await icon.boundingBox();
return box && { width: Math.round(box.width), height: Math.round(box.height) };
},
{ message: `${home.path} hero icon size` },
)
.toEqual({ width: 48, height: 48 });

// ModeHomeHero gives its heading the deterministic id `<heroTestId>-title`
// (role/name lookups can collide with sr-only section headings).
Expand Down Expand Up @@ -1271,16 +1281,7 @@ test.describe("PsychSift tools directory and legacy launcher", () => {
};
});

const metrics = {
iconWidth: Math.round(iconBox?.width ?? 0),
iconHeight: Math.round(iconBox?.height ?? 0),
headingFontSize,
};
// The hero tile is `h-tap w-tap` on phones, so it tracks `--spacing-tap`
// (48px since PR 5b), not a standalone pixel choice.
expect(metrics.iconWidth).toBe(48);
expect(metrics.iconHeight).toBe(48);
expect(metrics.headingFontSize).toBeCloseTo(expectedTypeSizes.hero, 1);
expect(headingFontSize).toBeCloseTo(expectedTypeSizes.hero, 1);
expect(subtitleFontSize).toBeCloseTo(expectedTypeSizes.subtitle, 1);

await expectNoPageHorizontalOverflow(page);
Expand Down
Loading