railyard/apps/relay/ui/e2e_tests/autopilot-unavailable.spec.ts
caelum0x e50bce7591 test(relay-ui): skip upstream Autopilot e2e specs, cover the unavailable page
Relay turned Autopilot off (every /autopilot route renders the "not
available" page), so the five upstream specs in e2e_tests/autopilot/ are
skipped explicitly with that reason. New autopilot-unavailable.spec.ts
(runs in the default suite) asserts /autopilot, /autopilot/sessions,
/autopilot/sessions/new and a session URL answer 501 with the unavailable
heading, and that the home sidebar has no Autopilot links.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 02:34:08 +03:00

34 lines
1.2 KiB
TypeScript

import { test, expect } from "@playwright/test";
// Relay does not offer Autopilot (upstream TensorZero's hosted service). Every
// /autopilot route must render the honest "not available" page and the
// sidebar must not link to it. See app/routes/autopilot/layout.tsx.
const UNAVAILABLE_HEADING = "Autopilot is not available in Relay";
for (const path of [
"/autopilot",
"/autopilot/sessions",
"/autopilot/sessions/new",
"/autopilot/sessions/0190a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b",
]) {
test(`${path} renders the Autopilot unavailable page`, async ({ page }) => {
// `/autopilot` redirects to `/autopilot/sessions`; goto follows it.
const response = await page.goto(path);
expect(response?.status()).toBe(501);
await expect(page.getByText(UNAVAILABLE_HEADING)).toBeVisible();
await expect(
page.getByRole("link", { name: "Back to the overview" }),
).toHaveAttribute("href", /\/$/);
});
}
test("the sidebar does not link to Autopilot", async ({ page }) => {
const response = await page.goto("/");
expect(response?.status()).toBe(200);
await expect(page.locator('a[href$="/autopilot"]')).toHaveCount(0);
await expect(page.locator('a[href$="/autopilot/sessions/new"]')).toHaveCount(
0,
);
});