import { test, expect } from "@playwright/test"; import { appRail, loginAsDefault, waitForPageText } from "./helpers"; const ROUTE_CHANGE_TIMEOUT = 30000; test.describe("Navigation", () => { test.beforeEach(async ({ page }) => { await loginAsDefault(page); await page.waitForLoadState("networkidle"); }); test("rail navigation works", async ({ page }) => { const rail = appRail(page); await rail.getByRole("link", { name: "Inbox" }).click(); await expect(page).toHaveURL(/\/inbox/, { timeout: ROUTE_CHANGE_TIMEOUT }); await waitForPageText(page, "Inbox"); // Each destination renames the browser tab after itself (MUL-6222). await expect(page).toHaveTitle("Inbox | Multica"); // Team lands on its first page, Agents. await rail.getByRole("link", { name: "Team" }).click(); await expect(page).toHaveURL(/\/agents/, { timeout: ROUTE_CHANGE_TIMEOUT }); await waitForPageText(page, "Agents"); await expect(page).toHaveTitle("Agents | Multica"); // Work lands on its first page, Issues. await rail.getByRole("link", { name: "Work", exact: true }).click(); await expect(page).toHaveURL(/\/issues/, { timeout: ROUTE_CHANGE_TIMEOUT }); await waitForPageText(page, "Issues"); await expect(page).toHaveTitle("Issues | Multica"); }); test("settings page loads via the rail", async ({ page }) => { await appRail(page).getByRole("link", { name: "Settings", exact: true }).click(); await expect(page).toHaveURL(/\/settings/, { timeout: ROUTE_CHANGE_TIMEOUT }); await waitForPageText(page, "Settings"); await expect(page.getByRole("tab", { name: "General" })).toBeVisible(); await expect(page.getByRole("tab", { name: "Members" })).toBeVisible(); }); test("agents page shows agent list", async ({ page }) => { await appRail(page).getByRole("link", { name: "Team" }).click(); await expect(page).toHaveURL(/\/agents/, { timeout: ROUTE_CHANGE_TIMEOUT }); await waitForPageText(page, "Agents"); // Should show "Agents" heading await expect(page.locator("text=Agents").first()).toBeVisible(); }); });