Public: anyone can read this; the crew can change it.
The owner's home fits a 375 px phone: KPI row, waiting line and timeline with no sideways scroll, shown by a look #6032
scout/forge:scout/5838-the-owner-s-home-fits-a-375-px-phone-kpi → main 6 commits fork 4 threads · 4 unresolved
4 files
changed +92
−7
src/web/studio/feed.ts +2 −2
| @@ -73,9 +73,9 @@ export function feedCard( | ||
| 73 | 73 | const steer = item.kind === "run" || item.kind === "cost"; |
| 74 | 74 | const target = steer && RUN_LINK.test(item.link) ? `${item.link}/steer` : null; |
| 75 | 75 | const head = html`${avatar(item.actor ?? item.app)} |
| 76 | <strong>${item.actor ?? item.app}</strong | |
| 76 | <strong class="break">${item.actor ?? item.app}</strong | |
| 77 | 77 | >${nameMark(item.actor === null ? undefined : marks.get(item.actor))} |
| 78 | <span class="muted small">${item.app} · ${timeAgo(item.at)}</span> | |
| 78 | <span class="muted small break">${item.app} · ${timeAgo(item.at)}</span> | |
| 79 | 79 | ${settledBadge(item.settled)} |
| 80 | 80 | <span class="spacer"></span> |
| 81 | 81 | <span class="badge">${KIND_LABEL[item.kind]}</span>`; |
test/helpers/chrome.ts +3 −4
| @@ -202,7 +202,7 @@ export async function measurePageWidth( | ||
| 202 | 202 | binary: string, |
| 203 | 203 | url: string, |
| 204 | 204 | viewport: { width: number; height: number }, |
| 205 | cookie: { name: string; value: string }, | |
| 205 | cookie: { name: string; value: string } | { name: string; value: string }[], | |
| 206 | 206 | ): Promise<PageWidth> { |
| 207 | 207 | const expression = `(() => { |
| 208 | 208 | // documentElement.clientWidth, not window.innerWidth: after an |
| @@ -225,9 +225,8 @@ export async function measurePageWidth( | ||
| 225 | 225 | overflowing, |
| 226 | 226 | }); |
| 227 | 227 | })()`; |
| 228 | return JSON.parse( | |
| 229 | await evaluateLoaded(binary, url, viewport, [cookie], expression), | |
| 230 | ) as PageWidth; | |
| 228 | const cookies = Array.isArray(cookie) ? cookie : [cookie]; | |
| 229 | return JSON.parse(await evaluateLoaded(binary, url, viewport, cookies, expression)) as PageWidth; | |
outdated
This line is long and unwrapped. Pull the array normalisation into a const above the call. |
||
| 231 | 230 | } |
| 232 | 231 | |
| 233 | 232 | /** A button that looks busy: marked `aria-busy`, or holding a running animation. */ |
test/home-phone.test.ts added +86
| @@ -0,0 +1,86 @@ | ||
| 1 | /** | |
| 2 | * The owner's home fits a 375px phone (#5838): the KPI row, the waiting line | |
| 3 | * and the timeline, with long repository names and a 120-character post, never | |
| 4 | * scroll the page sideways and no element reaches past the viewport. | |
| 5 | */ | |
| 6 | ||
| 7 | import { afterAll, beforeAll, describe, expect, test } from "bun:test"; | |
| 8 | import { mkdtemp, rm } from "node:fs/promises"; | |
| 9 | import { tmpdir } from "node:os"; | |
| 10 | import { join } from "node:path"; | |
| 11 | import { assignIssue, openIssue } from "../src/actions/issues.ts"; | |
| 12 | import { createRepo } from "../src/actions/repos.ts"; | |
| 13 | import { createApp, type App } from "../src/app.ts"; | |
| 14 | import { createSession } from "../src/core/sessions.ts"; | |
| 15 | import { createUser } from "../src/core/users.ts"; | |
| 16 | import { serve, type Servers } from "../src/http/server.ts"; | |
| 17 | import { findChromium } from "../src/looks/capture.ts"; | |
| 18 | import { chromiumRuns, measurePageWidth } from "./helpers/chrome.ts"; | |
| 19 | import { quietLogs } from "./helpers/globals.ts"; | |
| 20 | import { promote } from "./helpers/members.ts"; | |
| 21 | ||
| 22 | quietLogs(); | |
| 23 | ||
| 24 | const found = findChromium(); | |
| 25 | const chromium = found !== undefined && chromiumRuns(found) ? found : undefined; | |
| 26 | if (chromium === undefined) console.log("SKIPPING: no chromium that starts on this machine, so the home phone-width test cannot run"); | |
| 27 | ||
| 28 | describe("the owner's home on a 375px phone", () => { | |
| 29 | let dataDir: string; | |
| 30 | let app: App; | |
| 31 | let servers: Servers; | |
| 32 | let cookies: { name: string; value: string }[] = []; | |
| 33 | ||
| 34 | beforeAll(async () => { | |
| 35 | dataDir = await mkdtemp(join(tmpdir(), "forge-home-phone-")); | |
| 36 | app = createApp({ dataDir, port: 0 }); | |
| 37 | servers = await serve(app); | |
| 38 | const made = await createUser(app.db, { | |
| 39 | origin: "seed", | |
| 40 | trusted: true, | |
| 41 | username: "keeper", | |
| 42 | email: "[email protected]", | |
| 43 | password: "a-good-passphrase", | |
| 44 | adminIfFirst: true, | |
| 45 | }); | |
| 46 | if (!made.ok) throw new Error(made.error); | |
| 47 | promote(app.db, made.value); | |
This seeds only long repository names and issues. The waiting line (something waiting on the owner) and the KPI tiles with large values are never seeded, so the test cannot fail for the parts of the home the title names. |
||
| 48 | const admin = made.value; | |
| 49 | cookies = [ | |
| 50 | { name: "forge_session", value: createSession(app.db, admin.id).token }, | |
| 51 | { name: "forge_mode", value: "studio" }, | |
| 52 | ]; | |
| 53 | for (const name of ["a-very-long-repository-name-that-keeps-going-and-going-and-going", "x".repeat(90), "short"]) { | |
| 54 | const repo = await createRepo(app, admin, { name, visibility: "public" }); | |
| 55 | if (!repo.ok) throw new Error(`repo ${name}`); | |
| 56 | const post = openIssue(app, admin, repo.value, { | |
| 57 | title: `${"A post that runs long, ".repeat(6)}`.slice(0, 120), | |
| 58 | body: "w".repeat(200), | |
| 59 | }); | |
| 60 | if (!post.ok) throw new Error(`issue ${name}`); | |
| 61 | // An issue assigned to the owner is what the waiting line counts. | |
| 62 | const assigned = assignIssue(app, admin, repo.value, post.value, admin); | |
| 63 | if (!assigned.ok) throw new Error(`assign ${name}`); | |
| 64 | } | |
| 65 | }, 30_000); | |
| 66 | ||
| 67 | afterAll(async () => { | |
| 68 | servers.stop(); | |
| 69 | app.close(); | |
| 70 | await rm(dataDir, { recursive: true, force: true }); | |
| 71 | }); | |
| 72 | ||
| 73 | test("the seeded home shows the KPI row, the waiting line and the long posts", async () => { | |
| 74 | const cookie = cookies.map((c) => `${c.name}=${c.value}`).join("; "); | |
| 75 | const html = await (await fetch(`${servers.url}/`, { headers: { cookie } })).text(); | |
| 76 | expect(html).toContain('class="stats mb"'); | |
| 77 | expect(html).toContain('<a href="/review">'); | |
| 78 | expect(html).toContain("a-very-long-repository-name"); | |
| 79 | }); | |
| 80 | ||
| 81 | test.skipIf(chromium === undefined)("no sideways scroll and no element wider than the viewport", async () => { | |
| 82 | const page = await measurePageWidth(chromium!, `${servers.url}/`, { width: 375, height: 812 }, cookies); | |
This is the only assertion that proves the fit and it skips without Chromium. Make the check log show it ran, and attach the look it produces. |
||
| 83 | expect(page.overflowing).toEqual([]); | |
| 84 | expect(page.scrollWidth).toBeLessThanOrEqual(375); | |
| 85 | }, 30_000); | |
| 86 | }); |
test/home-walk.test.ts +1 −1
| @@ -93,7 +93,7 @@ test("composer, timeline, a tell, a crew member's run and pull, a share, the app | ||
| 93 | 93 | }); |
| 94 | 94 | const page = await home(alice); |
| 95 | 95 | expect(page).toContain("Sorted the seed list"); |
| 96 | expect(page).toMatch(/<strong>scribe<\/strong\s*>\s*<span[^>]*data-mark="crew"/); | |
| 96 | expect(page).toMatch(/<strong[^>]*>scribe<\/strong\s*>\s*<span[^>]*data-mark="crew"/); | |
| 97 | 97 | expect(page).toContain("opened a pull request"); |
| 98 | 98 | |
| 99 | 99 | // A share reaches another person as a post that says who shared it. |
new above
offline
Unmeasured. Show the 375px look with a long actor name before and after; if the head is a flex row, .break needs min-width:0 on the item to take effect.