diff --git a/tests/services-page.spec.js b/tests/services-page.spec.js new file mode 100644 index 0000000..c187822 --- /dev/null +++ b/tests/services-page.spec.js @@ -0,0 +1,33 @@ +import { test, expect } from "@playwright/test"; +import AxeBuilder from "@axe-core/playwright"; + +test.describe("Services List block on /services/mapping/", () => { + test("renders the heading and image for each card", async ({ page }) => { + await page.goto("/services/mapping/"); + + const blocks = page.locator(".services-list"); + await expect(blocks).toHaveCount(2); + + await expect(blocks.nth(0).locator(".services-list__card")).toHaveCount(2); + await expect(blocks.nth(1).locator(".services-list__card")).toHaveCount(4); + + const firstCard = blocks.nth(0).locator(".services-list__card").first(); + await expect(firstCard.locator(".services-list__media img")).toBeVisible(); + await expect(firstCard.locator(".services-list__heading")).toBeVisible(); + }); + + test("bisecting line is present and aria-hidden", async ({ page }) => { + await page.goto("/services/mapping/"); + const line = page.locator(".services-list__line").first(); + await expect(line).toBeAttached(); + await expect(line).toHaveAttribute("aria-hidden", "true"); + }); + + test("no axe violations on the services-list block", async ({ page }) => { + await page.goto("/services/mapping/"); + const results = await new AxeBuilder({ page }) + .include(".services-list") + .analyze(); + expect(results.violations).toEqual([]); + }); +});