Files
openconcho/packages/web/e2e/sidebar.spec.ts
Agents 37eb9bdf59 test(web): add E2E for Fleet route nav + per-instance row render
Two focused Playwright tests, mirroring the existing sidebar.spec
pattern (no backend dependency — instances point at unreachable ports
and we only assert on rendered names + row count, not health):

- Fleet link in the sidebar navigates to /fleet
- /fleet renders one row per configured instance under the table role

Also adds a Fleet link assertion to the existing sidebar.spec so the
nav entry is covered on the dashboard route alongside the other top
links. Both new tests run under the existing `pnpm test:e2e` (not
gated in CI by design — matches the current Compare/Dashboard E2E
posture).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 15:57:17 -05:00

31 lines
1.1 KiB
TypeScript

import { expect, test } from "@playwright/test";
const CONFIG_KEY = "openconcho:config";
const CONFIG_VALUE = JSON.stringify({ baseUrl: "http://localhost:9999", token: "" });
test.describe("Sidebar", () => {
test.beforeEach(async ({ context }) => {
await context.addInitScript(
([key, value]) => {
window.localStorage.setItem(key, value);
},
[CONFIG_KEY, CONFIG_VALUE],
);
});
test("renders the sidebar nav on the dashboard route", async ({ page }) => {
await page.goto("/");
await expect(page.getByRole("complementary")).toBeVisible();
await expect(page.getByRole("link", { name: /dashboard/i })).toBeVisible();
await expect(page.getByRole("link", { name: /fleet/i })).toBeVisible();
await expect(page.getByRole("link", { name: /workspaces/i })).toBeVisible();
await expect(page.getByRole("link", { name: /settings/i })).toBeVisible();
});
test("renders the sidebar nav on the settings route", async ({ page }) => {
await page.goto("/settings");
await expect(page.getByRole("complementary")).toBeVisible();
await expect(page.getByRole("link", { name: /dashboard/i })).toBeVisible();
});
});