// The Lucia project.
// Copyright 2026-2026 DSP, inc.  All rights reserved.
// Authors:
//   imacat.yang@dsp.im (imacat), 2026/03/22

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

test.describe("Account Management", () => {
  test.beforeEach(async ({ context }) => {
    await loginWithMSW(context);
  });

  test("displays user list on account admin page", async ({ page }) => {
    await page.goto("/account-admin");
    // Should display users from fixture
    await expect(page.getByText("Test Admin").first()).toBeVisible();
    await expect(page.getByText("Alice Wang")).toBeVisible();
    await expect(page.getByText("Bob Chen")).toBeVisible();
  });

  test("shows active/inactive status badges", async ({ page }) => {
    await page.goto("/account-admin");
    await expect(page.getByText("Test Admin").first()).toBeVisible();
    // The user list should show status indicators
    await expect(page.getByText("testadmin")).toBeVisible();
  });

  test("navigates to my-account page", async ({ page }) => {
    await page.goto("/my-account");
    await expect(page).toHaveURL(/\/my-account/);
  });
});
