import { test, expect } from "@playwright/test";
import { products } from "@/lib/site-config";

test("homepage loads with hero, stats, and product cards", async ({ page }) => {
  await page.goto("/");

  await expect(page).toHaveTitle(/OrthoGlobe/);

  await expect(
    page.getByRole("heading", { name: /Advancing global orthopaedics/ }),
  ).toBeVisible();

  for (const product of products) {
    await expect(page.getByText(product.name, { exact: false }).first()).toBeVisible();
  }
});

test("homepage logo links to /", async ({ page }) => {
  await page.goto("/about");
  await page.getByRole("link", { name: /OrthoGlobe home/i }).click();
  await expect(page).toHaveURL("http://localhost:3000/");
});
