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