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

test.describe("Impressum Page", () => {
  test.beforeEach(async ({ page }) => {
    await page.goto("/impressum");
  });

  test("should display Impressum heading", async ({ page }) => {
    await expect(page.locator("h1")).toContainText("Impressum");
  });

  test("should contain Hammerschmidt u. Mössle GbR", async ({ page }) => {
    await expect(page.locator("body")).toContainText("Hammerschmidt u. Mössle GbR");
  });

  test("should contain address Grockelhofen 10, 89340 Leipheim", async ({ page }) => {
    await expect(page.locator("body")).toContainText("Grockelhofen 10");
    await expect(page.locator("body")).toContainText("89340 Leipheim");
  });

  test("should contain phone number", async ({ page }) => {
    await expect(page.locator("body")).toContainText("204433");
  });

  test("should contain email info@hms-licht-ton.de", async ({ page }) => {
    await expect(page.locator('a[href="mailto:info@hms-licht-ton.de"]')).toBeVisible();
  });

  test("should be mobile-responsive at 375px width", async ({ page }) => {
    await page.setViewportSize({ width: 375, height: 667 });
    await expect(page.locator("h1")).toBeVisible();
  });
});

test.describe("Datenschutz Page", () => {
  test.beforeEach(async ({ page }) => {
    await page.goto("/datenschutz");
  });

  test("should display Datenschutz heading", async ({ page }) => {
    await expect(page.locator("h1")).toContainText("Datenschutz");
  });

  test("should contain DSGVO-relevant sections", async ({ page }) => {
    const body = page.locator("body");
    await expect(body).toContainText("Datenerhebung");
    await expect(body).toContainText("Cookies");
    await expect(body).toContainText("Kontaktformular");
    await expect(body).toContainText("Server-Log");
    await expect(body).toContainText("Drittanbieter");
  });

  test("should mention responsible party", async ({ page }) => {
    await expect(page.locator("body")).toContainText("Hammerschmidt u. Mössle GbR");
  });

  test("should be mobile-responsive at 375px width", async ({ page }) => {
    await page.setViewportSize({ width: 375, height: 667 });
    await expect(page.locator("h1")).toBeVisible();
  });
});

test.describe("AGB Vermietung Page", () => {
  test.beforeEach(async ({ page }) => {
    await page.goto("/agb-vermietung");
  });

  test("should display AGB heading", async ({ page }) => {
    await expect(page.locator("h1")).toContainText("AGB");
  });

  test("should contain Geltungsbereich section", async ({ page }) => {
    await expect(page.locator("body")).toContainText("Geltungsbereich");
  });

  test("should contain Preise section", async ({ page }) => {
    await expect(page.locator("body")).toContainText("Preise");
  });

  test("should contain Zahlungsbedingungen section", async ({ page }) => {
    await expect(page.locator("body")).toContainText("Zahlungsbedingungen");
  });

  test("should contain Haftung section", async ({ page }) => {
    await expect(page.locator("body")).toContainText("Haftung");
  });

  test("should contain Rückgabe section", async ({ page }) => {
    await expect(page.locator("body")).toContainText("Rückgabe");
  });

  test("should be mobile-responsive at 375px width", async ({ page }) => {
    await page.setViewportSize({ width: 375, height: 667 });
    await expect(page.locator("h1")).toBeVisible();
  });
});
