Skip to content
Open
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
4 changes: 3 additions & 1 deletion test/e2e/mobile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,9 @@ test.describe("phone: new session", () => {
const look = await tinted(discard);
expect(look.color).toBe(look.tint);
expect(look.weight).toBeLessThan(600);
expect((await discard.boundingBox())!.height).toBeGreaterThanOrEqual(44);
// 44 CSS px, less the float rounding of a box measured at 3 device px to the px
// (43.99997 on the CI runner).
expect((await discard.boundingBox())!.height).toBeGreaterThanOrEqual(44 - 0.01);
// Cancel is no discard: the sheet closes, and opens again with the words.
await page.locator("[data-ns-cancel]").click();
await expect(sheet).toHaveCount(0);
Expand Down
5 changes: 3 additions & 2 deletions test/e2e/pool-surfaces.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ async function poolSession(page: Page): Promise<{ harness: string; id: string }>

/** The session from its first turn, where the switch fell. The pooled session takes a turn
* every few minutes and never ends, so late in the run its newest page no longer reaches
* back to that turn: until "Older turns" brings it, no turn on the page holds the switch. */
* back to that turn, and "Older turns" brings it. Nothing is asked of the page before
* that: for a while the newest page still holds the switch and already has older turns
* behind it. */
async function fromFirstTurn(page: Page): Promise<void> {
await expect(page.locator("li.turn").first()).toBeVisible();
const older = page.locator("li.older button");
if (await older.count()) await expect(page.locator("[data-swap]")).toHaveCount(0);
while (await older.count()) {
await older.click();
// A page of 200 events is drawn into the chat; on a busy runner that takes a while.
Expand Down
26 changes: 25 additions & 1 deletion test/e2e/split.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,33 @@ test.describe("split panel", () => {
expect(state.mainOverflowY).toBe("hidden");
expect(state.windowScrollY).toBe(0);

// Under the covering panel the pointer is off the list, so the board is not held: the
// demo's sessions add and move cards, and the page scrolls on by their height to keep
// what is on screen in place. So window.scrollY need not come back to the number it
// had. What must hold is that the page did not move under the reader: a card that is
// on the board before and after the close is where it was in the window.
const tops = () =>
page.evaluate(() =>
Object.fromEntries(
[...document.querySelectorAll<HTMLAnchorElement>("article.card a.card-link")].map((a) => [
a.getAttribute("href"),
a.getBoundingClientRect().top,
]),
),
);
const before = await tops();
await page.keyboard.press("Escape");
await expect(panel(page)).not.toHaveClass(/panel--open/);
await expect.poll(() => page.evaluate((want) => Math.abs(window.scrollY - want), beforeY)).toBeLessThanOrEqual(2);
await expect
.poll(async () => {
const after = await tops();
const moved = Object.keys(before)
.filter((k) => k in after)
.map((k) => Math.abs(after[k]! - before[k]!));
return Math.min(...moved);
})
.toBeLessThanOrEqual(2);
expect(await page.evaluate(() => window.scrollY)).toBeGreaterThan(0);
});
});

Expand Down