Skip to content

feat: add Playwright E2E test suite#435

Draft
victorfrye wants to merge 5 commits into
mainfrom
feat/playwright-e2e-tests
Draft

feat: add Playwright E2E test suite#435
victorfrye wants to merge 5 commits into
mainfrom
feat/playwright-e2e-tests

Conversation

@victorfrye

Copy link
Copy Markdown
Owner

Summary

Adds a comprehensive Playwright TypeScript E2E test suite covering all nine functional scenarios for microsoftgraveyard.com, fixes the Threads URL bug, and wires E2E tests into CI.

Changes

New: tests/ — Playwright E2E project at repo root

  • playwright.config.ts — Edge, Chrome, Safari; configurable PLAYWRIGHT_BASE_URL; 4 workers; 60s timeout; retries in CI
  • e2e/app.spec.ts — App loads, title, main element visible
  • e2e/graveyard.spec.ts — All 175 corpse cards rendered (reads corpses.json dynamically)
  • e2e/shell.spec.ts — Footer, byline, copyright year, GitHub/Threads links, scroll FAB
  • e2e/consent.spec.ts — Cookie dialog, accept/reject localStorage values, cookie FAB opens manager
  • e2e/analytics.spec.ts — GA4 script tags + network requests, Clarity initialization + network requests

Fix: Threads social URL (threads.netthreads.com)

  • src/WebClient/app/shell/socials.tsx — corrected URL
  • src/WebClient/app/shell/socials.test.tsx — updated assertion

Source: data-testid attributes for reliable E2E selection

  • headstone.tsxdata-testid="headstone" on Card
  • scroll-fab.tsxdata-testid="scroll-fab" on scroll FAB button
  • privacy/cookies/fab.tsxdata-testid="cookie-fab" on cookie FAB button

CI: .github/workflows/azure-swa.yml

  • Added outputs to build_and_deploy exposing static_web_app_url
  • Added e2e_tests job running after deploy using the SWA URL as PLAYWRIGHT_BASE_URL
  • Uploads playwright-report/ artifact on failure

Docs: AGENTS.md

  • Documents Playwright test setup, test IDs, and corrects the Card DOM rendering note (renders as role="group", not <article>)

Test Results

60/60 tests passing locally across Edge, Chrome, and Safari (37.8s)

Notes

  • Consent tests use test.use({ storageState }) for reliable cross-browser storage isolation
  • Deployed smoke tests use the SWA staging URL from the deploy job output
  • Fluent UI Card renders as role="group" in the DOM, not <article>

victorfrye and others added 5 commits May 19, 2026 12:26
- Add tests/ project with package.json, playwright.config.ts, tsconfig.json
- Cover app load, graveyard corpse count (175), shell footer/FABs, cookie consent flows, and analytics tags
- Three browser projects: Edge, Chrome, Safari
- Dynamic corpse count via fs.readFileSync from corpses.json

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Threads migrated their canonical domain from threads.net to threads.com.
Updated the link in socials.tsx and the corresponding test assertion.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add data-testid='headstone' to Card in headstone.tsx for reliable count
- Add data-testid='scroll-fab' to ScrollFab button
- Add data-testid='cookie-fab' to CookieFab button
- Fix graveyard spec: use [data-testid=headstone] selector (Card renders as
  role=group not article); remove brittle networkidle wait
- Fix consent spec: replace addInitScript in beforeEach with test.use
  storageState for reliable cross-browser storage isolation; use exact button
  text ('Accept all', 'Reject unnecessary'); increase dialog timeout to 10s
- Fix shell spec: use [data-testid=scroll-fab] instead of computed style check
- Fix playwright.config.ts: drop channel requirements for Edge/Chrome,
  set workers=4, increase timeout to 60s
- Update AGENTS.md: document Playwright setup and correct Card DOM rendering

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
let gtmRequestFired = false;

page.on('request', (request) => {
if (request.url().includes('googletagmanager.com')) {
let clarityRequestFired = false;

page.on('request', (request) => {
if (request.url().includes('clarity.ms') || request.url().includes('c.bing.com')) {
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://zealous-plant-083d54e10-435.centralus.5.azurestaticapps.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants