**Overview — testing strategy (goals)**- Ensure correctness, accessibility, and visual consistency of components in the design system so developers implement faithful UI from our visuals.**1) Unit tests**- Purpose: verify component API, props, and small interactions.- Tools: Jest + React Testing Library.- Focus for designers: visual props (size/variant), aria attributes, and visible content.**2) Integration tests**- Purpose: interactions between components and focus/keyboard flows.- Tools: Playwright or Cypress.- Focus: opening Modal, focus trap, backdrop click, keyboard Escape to close.**3) Accessibility checks**- Purpose: automated a11y regression and CI gating.- Tools: axe-core (jest-axe), Storybook a11y addon, manual keyboard + screen reader spot checks.- Focus: role, aria-modal, focus order, contrast.**4) Visual regression**- Purpose: catch unintended style/layout changes.- Tools: Chromatic (Storybook), Percy, or Playwright + pixel compare.- Focus: snapshots across breakpoints, dark/light themes, motion-reduced states.**Example test for Modal (unit + a11y)**javascript
// Modal.test.jsx - Jest + React Testing Library + jest-axe
import { render, screen, fireEvent } from '@testing-library/react';
import { axe } from 'jest-axe';
import Modal from './Modal';
test('Modal opens, traps focus, and is accessible', async () => {
const onClose = jest.fn();
render(<Modal isOpen onClose={onClose}><button>Confirm</button></Modal>);
// content visible
expect(screen.getByText('Confirm')).toBeVisible();
// focus trapped: first focusable is focused
expect(document.activeElement).toBe(screen.getByText('Confirm'));
// keyboard escape closes
fireEvent.keyDown(document, { key: 'Escape' });
expect(onClose).toHaveBeenCalled();
// a11y check
const results = await axe(document.body);
expect(results).toHaveNoViolations();
});
**Notes**- Integrate Storybook stories and Chromatic snapshots for visual checks.- Run axe and Chromatic in CI; use Playwright for cross-browser interaction tests.