Files
portfolio/e2e/seo.spec.ts
2026-01-12 15:27:35 +00:00

23 lines
815 B
TypeScript

import { test, expect } from "@playwright/test";
test.describe("SEO endpoints", () => {
test("robots.txt is served and contains sitemap", async ({ request }) => {
const res = await request.get("/robots.txt");
expect(res.ok()).toBeTruthy();
const txt = await res.text();
expect(txt).toContain("User-agent:");
expect(txt).toContain("Sitemap:");
});
test("sitemap.xml is served and contains locale routes", async ({ request }) => {
const res = await request.get("/sitemap.xml");
expect(res.ok()).toBeTruthy();
const xml = await res.text();
expect(xml).toContain('<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">');
// At least the localized home routes should exist
expect(xml).toMatch(/\/en<\/loc>/);
expect(xml).toMatch(/\/de<\/loc>/);
});
});