Public: anyone can read this; the crew can change it.

A pull that touches the app page shows that page beside main at 1440 and 390 #9804

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/9797-a-pull-that-touches-the-app-page-shows-t → main 1 commit fork

  • Merged. mason/9797-a-pull-that-touches-the-app-page-shows-t was merged into main as 2e19387.

Review

Sign in to review this change.
3 files changed +29 −2
src/web/studio/previews.ts +1 −1
@@ -63,7 +63,7 @@ function openAppBtn(base: string, env: EnvStatus | undefined, forge = false): Ht
6363 });
6464 const reason =
6565 env === undefined || env.state === "stopped"
66 ? "Not running"
66 ? "Nothing is running yet. The app starts when it is deployed."
6767 : env.state === "deploying"
6868 ? "Still deploying"
6969 : "The last deploy failed";
test/preview-app-look.test.ts +27
@@ -5,7 +5,11 @@ import { tmpdir } from "node:os";
55 import { join } from "node:path";
66 import { createApp, type App } from "../src/app.ts";
77 import { getAppByRepo } from "../src/core/apps.ts";
8 import { getUserByName } from "../src/core/users.ts";
9 import type { Ctx } from "../src/http/context.ts";
10 import { studioApp } from "../src/web/studio/app.ts";
811 import { getRepo } from "../src/core/repos.ts";
12 import { ownerLooksFor } from "../src/spawn/preview-looks.ts";
913 import { PREVIEW_ADMIN, PREVIEW_APP, PREVIEW_APP_PAGE, PREVIEW_OWNER_LOOKS, seedPreview } from "../src/spawn/preview-seed.ts";
1014
1115 let dir: string;
@@ -32,3 +36,26 @@ test("the seed made one app, as a record only", () => {
3236 expect(getAppByRepo(app.db, repo.id)?.slug).toBe(PREVIEW_APP);
3337 expect(app.db.query<{ n: number }, []>("SELECT count(*) AS n FROM app").get()!.n).toBe(1);
3438 });
39
40 test("a forge preview takes the app's page at both widths, whatever its diff touches (#9797)", () => {
41 const looks = ownerLooksFor("trevato/forge", { ownerName: "trevato", name: "forge" }, "pull-1");
42 for (const kind of ["desktop", "phone"] as const)
43 expect(looks).toContainEqual({ page: PREVIEW_APP_PAGE, kind });
44 // Another repository's preview, and production, take none of them.
45 expect(ownerLooksFor("trevato/forge", { ownerName: "x", name: "y" }, "pull-1")).toEqual([]);
46 expect(ownerLooksFor("trevato/forge", { ownerName: "trevato", name: "forge" }, "production")).toEqual([]);
47 });
48
49 test("the app's page says in plain words why Open the app is off when nothing runs (#9797)", async () => {
50 const repo = getRepo(app.db, PREVIEW_ADMIN, PREVIEW_APP)!;
51 const record = getAppByRepo(app.db, repo.id)!;
52 const admin = getUserByName(app.db, PREVIEW_ADMIN)!;
53 const url = new URL(`https://preview.invalid${PREVIEW_APP_PAGE}`);
54 const answer = await studioApp(
55 { app, request: new Request(url.href), url, params: {}, auth: { user: admin }, theme: undefined } as Ctx,
56 repo,
57 record,
58 );
59 expect(answer.status).toBe(200);
60 expect(await answer.text()).toContain('title="Nothing is running yet. The app starts when it is deployed."');
61 });
test/studio-door.test.ts +1 −1
@@ -780,7 +780,7 @@ describe("the studio head says why the app is not up", () => {
780780 expect(mine).toContain('action="/alice/notes/app/production/redeploy"');
781781 expect(mine).not.toContain('href="/-/confirm?to=%2Falice%2Fnotes%2Fapp%2Fproduction%2Fstop"');
782782 expect(mine).not.toContain('href="/alice/notes/app/production/open"');
783 expect(mine).toContain('title="Not running"');
783 expect(mine).toContain('title="Nothing is running yet. The app starts when it is deployed."');
784784 expect(await shelfBadge(writer)).toBe("not running");
785785 });
786786

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs