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

The app page's not-running sentence is tested against the state production is really in #16273

Closed opened this
Closed without merging

talk/fix-web-apps-test → main 1 commit

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
1 file changed +15 −1
test/web-apps.test.ts +15 −1
@@ -27,6 +27,7 @@ import { tmpdir } from "node:os";
2727 import { join } from "node:path";
2828 import { createApp, type App } from "../src/app.ts";
2929 import { addToCrew, createAgent } from "../src/actions/crew.ts";
30 import { appView } from "../src/actions/apps.ts";
3031 import { openPull } from "../src/actions/pulls.ts";
3132 import { commitToBranch } from "../src/actions/repos.ts";
3233 import { AppsRuntime } from "../src/apps/runtime.ts";
@@ -1094,7 +1095,20 @@ describe("apps, runs and the crew on the web", () => {
10941095 expect(old.status).toBe(302);
10951096 const page = words(await (await web(alice, `${old.headers.get("location")!}/files`)).text());
10961097 const strip = page.slice(page.indexOf('class="app-strip"'));
1097 expect(strip).toContain("Not running. Deploy main to start it.");
1098 // The sentence follows the state production is really in. A first deploy
1099 // that started leaves it stopped; one that could not start on this
1100 // machine leaves it failed, and stopping a failed production keeps that
1101 // word. Either way it is not running, and the strip says what to do.
1102 const view = appView(app, user("alice"), hello);
1103 if (!view.ok) throw new Error(view.error);
1104 const production = view.value.environments.find((env) => env.env === "production");
1105 const state = production?.state ?? "stopped";
1106 expect(["stopped", "failed"]).toContain(state);
1107 expect(strip).toContain(
1108 state === "failed"
1109 ? "Failed to start. Deploy main to try again."
1110 : "Not running. Deploy main to start it.",
1111 );
10981112 } finally {
10991113 // Leave production as found, so test order does not matter.
11001114 await web(alice, "/alice/hello/app/production/redeploy", { form: {} });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs