(name: string)
| 15 | export const FORCED_LATEST = "99.0.0"; |
| 16 | |
| 17 | export const registerUpdateCardRenderScenario = (name: string): void => |
| 18 | scenario( |
| 19 | name, |
| 20 | { timeout: 120_000 }, |
| 21 | Effect.gen(function* () { |
| 22 | const target = yield* Target; |
| 23 | const browser = yield* Browser; |
| 24 | const identity = yield* target.newIdentity(); |
| 25 | |
| 26 | yield* browser.session(identity, async ({ page, step }) => { |
| 27 | // Force a newer published version regardless of the registry, so the |
| 28 | // card is deterministic on this host's real UI. |
| 29 | await page.route("**/v1/app/npm/dist-tags", (route) => |
| 30 | route.fulfill({ |
| 31 | contentType: "application/json", |
| 32 | body: JSON.stringify({ latest: FORCED_LATEST, beta: `${FORCED_LATEST}-beta.1` }), |
| 33 | }), |
| 34 | ); |
| 35 | |
| 36 | await step("Open the console", async () => { |
| 37 | await page.goto("/", { waitUntil: "domcontentloaded" }); |
| 38 | await page.getByRole("heading", { name: "Integrations" }).waitFor({ timeout: 60_000 }); |
| 39 | }); |
| 40 | |
| 41 | await step("The sidebar surfaces the update-available card", async () => { |
| 42 | await page.getByText("Update available").waitFor({ timeout: 30_000 }); |
| 43 | await page.getByText(`v${FORCED_LATEST}`).waitFor({ timeout: 5_000 }); |
| 44 | // Self-host and Cloudflare upgrade via their own deploy (image pull / |
| 45 | // rebuild / redeploy), not npm: the card links to the host's upgrade |
| 46 | // guide and shows NO npm command. |
| 47 | const guide = page.getByRole("link", { name: "Upgrade guide" }); |
| 48 | await guide.waitFor({ timeout: 5_000 }); |
| 49 | expect(await guide.getAttribute("href"), "links to the hosted upgrade docs").toContain( |
| 50 | "/docs/hosted/", |
| 51 | ); |
| 52 | expect( |
| 53 | await page.getByText("npm i -g", { exact: false }).count(), |
| 54 | "the self-host / Cloudflare card shows no npm command", |
| 55 | ).toBe(0); |
| 56 | }); |
| 57 | }); |
| 58 | }), |
| 59 | ); |
| 60 | |
| 61 | // Regression for the "card always shows on Docker even on the latest version" |
| 62 | // report: a placeholder build version (0.0.0-selfhost / 0.0.0-cloudflare) made |
no test coverage detected