One home per fact: cut the copied rationale, and give the seam test room to mean something
This commit is contained in:
@@ -205,7 +205,9 @@ test.describe.serial("authenticated admin journey", () => {
|
||||
// markup the shell does not own — so it is pinned here, on the reference plugin's own list, rather
|
||||
// than by asserting the class name the shell emits.
|
||||
test("plugin page: a filled page scrolls its table, not the document, and the header stays put", async () => {
|
||||
await page.setViewportSize({ width: 1280, height: 300 });
|
||||
// The region is the viewport less ~185px of chrome, so this leaves ~75px: enough that the 3-row
|
||||
// fixture overflows it by half its height, and enough to hold the header a row scrolls under.
|
||||
await page.setViewportSize({ width: 1280, height: 260 });
|
||||
await page.goto("/scheduling/shifts");
|
||||
|
||||
const bounded = await page.evaluate(() => {
|
||||
@@ -221,13 +223,19 @@ test.describe.serial("authenticated admin journey", () => {
|
||||
// Both halves, and both discriminating: miss a wrapper in the page's chain and the table grows
|
||||
// instead of scrolling, which pushes the frame past its own height.
|
||||
expect(bounded?.frameScrolls, "a filled page must fit its frame").toBe(false);
|
||||
expect(bounded?.regionScrolls, "the table must be the thing that scrolls").toBe(true);
|
||||
expect(bounded?.regionScrolls, "the fixture must overflow the region, or the rest proves nothing").toBe(true);
|
||||
|
||||
const headTop = async () => (await page.locator("thead th").first().boundingBox())?.y ?? -1;
|
||||
const headTop = async () => {
|
||||
const box = await page.locator("thead th").first().boundingBox();
|
||||
expect(box, "the header must have a box to stay put").not.toBeNull();
|
||||
return box?.y;
|
||||
};
|
||||
const before = await headTop();
|
||||
await page.locator(".table-wrap").evaluate((el) => el.scrollTo(0, el.scrollHeight));
|
||||
await expect(page.locator("tbody tr").last()).toBeInViewport();
|
||||
expect(await headTop(), "the header sticks to a scrollport that moves").toBe(before);
|
||||
// The journey shares one page; leaving it short would hand the next test a window it never chose.
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
});
|
||||
|
||||
test("plugin settings: the screen names the variable that sets each declared key", async () => {
|
||||
|
||||
@@ -52,13 +52,14 @@ for (const [name, path, tail] of [
|
||||
await expect(page.locator(".topbar")).toBeInViewport();
|
||||
if (width > 860) await expect(page.locator(".brand-name")).toBeInViewport();
|
||||
|
||||
// The open nav is a fixed overlay: the page must not slide out from under the scrim.
|
||||
// The open nav is a fixed overlay, so a reader cannot scroll the page out from under the
|
||||
// scrim. Focus can still move it, and stopping that needs script this page does not have.
|
||||
if (width <= 860) {
|
||||
await page.locator(".hamburger").click(); // the label is the control; the checkbox takes no pointer
|
||||
await expect(page.locator("#nav-toggle")).toBeChecked();
|
||||
const before = await page.evaluate(() => window.scrollY);
|
||||
await page.keyboard.press("Home");
|
||||
expect(await page.evaluate(() => window.scrollY), "the page is locked while the nav is open").toBe(before);
|
||||
expect(await page.evaluate(() => window.scrollY), "a key press cannot scroll the page while the nav is open").toBe(before);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user