mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
test(landing): fix six stale e2e specs and wire the suite into CI (#572)
The landing Playwright suite ran in no CI workflow, so six specs had drifted red on main. Five subpages navigation tests asserted bare paths while the site emits trailing-slash URLs (format: directory), and one asserted a localized tool-detail page that is English-only by design. Fix the assertions and rewrite the tool test to the real invariant, then add a test-e2e-landing job gated on a new landing path filter so the suite runs on landing-relevant PRs and can't silently rot again.
This commit is contained in:
@@ -26,10 +26,22 @@ test.describe("landing i18n routing", () => {
|
||||
await expect(page.locator("[data-mt-banner]")).toBeAttached();
|
||||
});
|
||||
|
||||
test("a localized tool page renders with the translated tool name", async ({ page }) => {
|
||||
const res = await page.goto("/de/tools/image/resize/");
|
||||
expect(res?.status()).toBeLessThan(400);
|
||||
test("localized tools section pages render; tool-detail pages stay English-only", async ({
|
||||
page,
|
||||
}) => {
|
||||
// The tools SECTION pages (/tools/<section>/) are localized and render the
|
||||
// translated section title as their heading.
|
||||
const section = await page.goto("/de/tools/image/");
|
||||
expect(section?.status()).toBeLessThan(400);
|
||||
await expect(page.locator("html")).toHaveAttribute("lang", "de");
|
||||
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
|
||||
|
||||
// Tool DETAIL pages (/tools/<section>/<tool>/) are English-only by design, so
|
||||
// a locale-prefixed detail URL has no built page and must not resolve. The
|
||||
// canonical English detail page is the one that exists.
|
||||
const localizedDetail = await page.goto("/de/tools/image/resize/");
|
||||
expect(localizedDetail?.status()).toBe(404);
|
||||
const englishDetail = await page.goto("/tools/image/resize/");
|
||||
expect(englishDetail?.status()).toBeLessThan(400);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user