// Where things sit. // // Every claim here was false at some point today and none of them can be // checked in jsdom, which has no widths: three columns starting at three // different heights, panel heads of two different heights depending on what was // in them, a 7px gap on one side of the centre and 19 on the other, and five // controls in one list at four different widths. import { test, expect } from "@playwright/test"; import { openPipelineWindow, regionToggle } from "./_menu.js"; // Skipped: / now serves the ported v4 frontend (app/legacy/), not composer -- // these specs assert on .cx-workspace*/window.FunPack, which no longer exist // on the served page. Pending rewrite against the v4-derived DOM as part of // the v4-UI-onto-v5-backend port's pixel-exactness verification step (see // the plan file). Not deleted: the assertions are still the right SHAPE of // check, just against selectors this page no longer has. test.skip(true, "composer retired in favor of the v4 UI port -- rewrite against app/legacy's DOM"); const WIDE = { width: 1440, height: 900 }; async function app(page, size = WIDE) { await page.setViewportSize(size); await page.goto("/funpack/"); await page.waitForFunction(() => window.FunPack !== undefined); } const boxes = (page, selector) => page.evaluate((sel) => [...document.querySelectorAll(sel)].map((n) => { const b = n.getBoundingClientRect(); return { x: Math.round(b.x), y: Math.round(b.y), w: Math.round(b.width), h: Math.round(b.height), r: Math.round(b.right), b: Math.round(b.bottom) }; }), selector); const gutter = (page) => page.evaluate(() => { const raw = getComputedStyle(document.documentElement).getPropertyValue("--gutter"); return Math.round(parseFloat(raw)); }); test("every panel head is the same height, whatever is in it", async ({ page }) => { // The Assets head holds the bin's view control and the others hold only a // title. Padding plus a min-height made that one 41px and the rest 34, so two // panels side by side had their titles on different lines. await app(page); const heads = await boxes(page, ".cx-panel-head"); expect(heads.length).toBeGreaterThan(2); const heights = new Set(heads.map((h) => h.h)); expect([...heights], "panel heads have more than one height").toHaveLength(1); }); test("the three columns start at the same height", async ({ page }) => { await app(page); const tops = await page.evaluate(() => ["left", "main", "right"].map((which) => { const region = document.querySelector(`.cx-workspace-${which}`); const panel = region.querySelector(".cx-panel"); return Math.round(panel.getBoundingClientRect().y); })); expect(new Set(tops), `columns start at ${tops.join(", ")}`).toHaveProperty("size", 1); }); test("the regions meet on a hairline, not across a gap", async ({ page }) => { // The app is one surface cut into areas, not a tray of cards with the desk // showing between them. Before this the columns floated with the page // background between them -- and with three different gaps at that. await app(page); const cols = await page.evaluate(() => ["left", "main", "right"].map((which) => { const b = document.querySelector(`.cx-workspace-${which}`).getBoundingClientRect(); return { x: Math.round(b.x), r: Math.round(b.right) }; })); expect(cols[1].x - cols[0].r, "a gap between the left column and the centre").toBe(0); expect(cols[2].x - cols[1].r, "a gap between the centre and the right column").toBe(0); const divider = await page.evaluate(() => getComputedStyle(document.querySelector(".cx-workspace-left")).borderRightWidth); expect(divider, "the regions are not divided at all").toBe("1px"); }); test("two zones stacked in a column are divided by a grabbable splitter", async ({ page }) => { // A splitter is the one place a gap is right: it has to be wide enough to // take hold of, and it draws its own hairline down the middle. await app(page); const g = await gutter(page); const stacked = await boxes(page, ".cx-workspace-main .cx-panel"); expect(stacked.length, "the centre is not two stacked zones any more").toBe(2); expect(stacked[1].y - stacked[0].b, "between two zones in one column").toBe(g); }); test("every control in a list of settings shares its two edges", async ({ page }) => { // A