import { test, expect } from "@playwright/test"; import { installRoutes } from "./helpers"; // The footer lists the OTHER sites in the pool (those with a siteUrl). The // playwright config points SITES_DIR at e2e/fixtures/sites with SITE_ID=testsite, // whose site.json features `othersite` under a "Friends" group; `thirdsite` has // a URL but isn't featured (→ trailing "Other sites"); `nourlsite` has no URL // (→ excluded entirely). See export/app/components/Footer.tsx + resolveRelatedSites. test("footer links featured siblings first, then the rest", async ({ page }) => { await installRoutes(page); await page.goto("/"); const nav = page.getByRole("navigation", { name: "Related sites" }); await expect(nav).toBeVisible(); // Featured group renders with its label and an absolute cross-site link. await expect(nav.getByText("Friends")).toBeVisible(); const featured = nav.getByRole("link", { name: "Other Fixture Site" }); await expect(featured).toHaveAttribute("href", "https://othersite.example"); // Non-featured sibling falls into the trailing "Other sites" group. await expect(nav.getByText("Other sites")).toBeVisible(); await expect( nav.getByRole("link", { name: "Third Fixture Site" }), ).toHaveAttribute("href", "https://thirdsite.example"); }); test("a sibling without a public URL is not linked", async ({ page }) => { await installRoutes(page); await page.goto("/"); const nav = page.getByRole("navigation", { name: "Related sites" }); await expect( nav.getByRole("link", { name: "No URL Fixture Site" }), ).toHaveCount(0); }); test("the current site does not link to itself", async ({ page }) => { await installRoutes(page); await page.goto("/"); const nav = page.getByRole("navigation", { name: "Related sites" }); await expect( nav.getByRole("link", { name: "Fixture Site Title" }), ).toHaveCount(0); });