import { expect, test } from "@playwright/test";
import { registerUser, uniqueEmail } from "../helpers/api";

test.describe("§15.7 scenario 6: Pending user", () => {
  test("pending user cannot access /profile", async ({ page, request }) => {
    const email = uniqueEmail("e2e-pending");
    await registerUser(request, email, "Valid1234");

    await page.goto("/profile");
    await expect(page).toHaveURL(/\/login$/);

    await page.goto("/login");
    await page.getByPlaceholder("Email").fill(email);
    await page.getByPlaceholder("Password").fill("Valid1234");
    await page.getByRole("button", { name: "Login" }).click();
    await expect(page).toHaveURL(/\/login$/);
  });
});
