Simplify Testing Structure #28
Reference in New Issue
Block a user
Delete Branch "adilallo/maintenance/SimplifyTestingStructure"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refactor testing infrastructure + streamline CI (Node 20 only, quiet-by-default)
Overview
This PR completes a testing + CI modernization pass to make contributions easier and reduce maintenance burden.
It consolidates component tests into a single, reusable pattern (
componentTestSuite), removes redundant/legacy test categories and the broken Storybook test-runner, cleans docs/build artifacts, and streamlines CI (Node 20 only; quieter logs; artifacts only on failure).Changes
Testing refactor (ticket: simplify & consolidate testing)
tests/utils/componentTestSuite.tsxas the standard baseline suite for component tests (render + basic a11y + optional keyboard/disabled/error smoke tests).tests/components/*.test.tsxand page-level tests intotests/pages/*.Storybook test-runner removal (ticket: Storybook runner broken after Next.js 16)
@storybook/test-runnerusage and any redundant Storybook runner configuration.Docs cleanup (ticket: keep only necessary docs; remove artifacts)
docs/to keep source documentation only; removed generated Storybook build artifacts from docs.docs/TESTING_GUIDE.mdand updatedREADME.mdaccordingly.Generated artifacts + git hygiene
coverage/,lhci-results/,playwright-report/,test-results/,storybook-static/)..gitignoreduplication.CI optimization: remove Node 18 matrix (ticket: CI runs tests twice)
.gitea/workflows/ci.yamlto run tests only on Node 20 (consistent with other jobs).engines.node >=20.0.0inpackage.jsonand documented Node 20+ requirements inREADME.md.CI maintainability + noise reduction (follow-up improvement)
Follow-up fixes discovered by running CI-style tests
jest-axeby removing invalid ARIA roles, avoiding empty headings, and makingaria-labelledbytarget real IDs (via a newtitleIdprop inContentLockup).tests/components/ContentBanner.test.tsxto preserveASSETS.tests/unit/Layout.test.jsx(avoid rendering<html>under RTL container) and mocking logger in content-processing tests.Screenshots
How to Test
Install deps:
npm ciRun component/page/unit tests:
npm testRun a focused component test:
npm run test:component -- --run tests/components/Button.test.tsxRun E2E tests:
npm run test:e2eOptional: Storybook (documentation/visual review):
npm run storybookNotes
README.mdand enforced inpackage.jsonviaengines.jest-axein the standard suite; full-page WCAG checks remain in Playwright E2E (tests/accessibility/e2e/).