import { test, expect } from "@playwright/test";

test.describe("Demo Mode", () => {
  test("shows demo landing page", async ({ page }) => {
    await page.goto("/demo");
    await expect(page.locator("text=Start Demo")).toBeVisible();
  });

  test("enters demo app", async ({ page }) => {
    await page.goto("/demo");
    await page.click("text=Start Demo");
    await expect(page).toHaveURL("/demo/app");
  });

  test("shows residences in demo", async ({ page }) => {
    await page.goto("/demo/app/residences");
    await expect(page.locator("h1, h2").first()).toContainText(/residences|properties/i);
  });

  test("shows tasks in demo", async ({ page }) => {
    await page.goto("/demo/app/tasks");
    await expect(page.locator("h1, h2").first()).toContainText(/tasks/i);
  });

  test("shows contractors in demo", async ({ page }) => {
    await page.goto("/demo/app/contractors");
    await expect(page.locator("h1, h2").first()).toContainText(/contractors/i);
  });

  test("shows documents in demo", async ({ page }) => {
    await page.goto("/demo/app/documents");
    await expect(page.locator("h1, h2").first()).toContainText(/documents/i);
  });

  test("can navigate to add task in demo", async ({ page }) => {
    await page.goto("/demo/app/tasks");
    await page.click("text=Add Task");
    await expect(page).toHaveURL("/demo/app/tasks/new");
  });
});
