From 1c5c727691681862eddee18964ecdf7e9f6e8d1b Mon Sep 17 00:00:00 2001 From: Keith Solomon Date: Sat, 25 Jul 2026 13:38:36 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test:=20Add=20Playwright=20tests=20?= =?UTF-8?q?for=20team-grid=20block?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/team-page.spec.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/team-page.spec.js diff --git a/tests/team-page.spec.js b/tests/team-page.spec.js new file mode 100644 index 0000000..84cf2b5 --- /dev/null +++ b/tests/team-page.spec.js @@ -0,0 +1,41 @@ +import { test, expect } from "@playwright/test"; +import AxeBuilder from "@axe-core/playwright"; + +test.describe("Team Grid block on /team/", () => { + test("renders the photo, name, and title for each member", async ({ page }) => { + await page.goto("/team/"); + + const cards = page.locator(".team-grid__card"); + await expect(cards.first()).toBeVisible(); + + const firstCard = cards.first(); + await expect(firstCard.locator(".team-grid__photo")).toBeVisible(); + await expect(firstCard.locator(".team-grid__name")).toBeVisible(); + await expect(firstCard.locator(".team-grid__title")).toBeVisible(); + }); + + test("bio is hidden by default and expands on summary click", async ({ page }) => { + await page.goto("/team/"); + + const firstDetails = page.locator(".team-grid__details").first(); + // Bio is closed by default. + await expect(firstDetails).not.toHaveAttribute("open", ""); + + // Click the summary; the details should open and the bio should be visible. + await firstDetails.locator(".team-grid__summary").click(); + await expect(firstDetails).toHaveAttribute("open", ""); + await expect(firstDetails.locator(".team-grid__bio")).toBeVisible(); + + // Click again; the details should close. + await firstDetails.locator(".team-grid__summary").click(); + await expect(firstDetails).not.toHaveAttribute("open", ""); + }); + + test("no axe violations on the team-grid block", async ({ page }) => { + await page.goto("/team/"); + const results = await new AxeBuilder({ page }) + .include(".team-grid") + .analyze(); + expect(results.violations).toEqual([]); + }); +});