This document outlines the testing infrastructure and how to contribute tests.
- Vitest: Unit and Integration tests for components and hooks.
- React Testing Library: UI testing utilities.
- Playwright: E2E, Responsive, and Accessibility testing.
- Axe Core: Automated accessibility audits.
npm testTo run in watch mode:
npm run test:watchRoute smoke tests live in e2e/route-smoke.spec.ts. They cover the initial critical public and app routes:
/— marketing landing page/app— app dashboard in a disconnected-wallet state/app/prizes— prizes index in a disconnected-wallet state/app/vaults— vaults index in a disconnected-wallet state
The app-route tests clear browser storage, mock common wallet globals as disconnected, and fulfill /api/* requests with empty fixture data so route-level provider, import, and render failures surface consistently. Test names include the route path so CI failures identify the regressed route.
Run only the route smoke tests:
pnpm run test:smoke:routesMake sure the dev server is running (or let Playwright start it via playwright.config.ts):
pnpm run test:e2eTo see the test results UI:
pnpm exec playwright test --uiWe use wagmi mocks in tests/mocks/wagmi.ts. You can override these in individual tests to simulate different states:
import { mockWagmiHooks } from '@/tests/mocks/wagmi';
it('shows error state', () => {
mockWagmiHooks.useAccount.mockReturnValue({ status: 'error', message: 'Failed to connect' });
render(<MyComponent />);
// ...
});E2E tests include automated axe-core checks. Ensure all new pages or major UI changes are covered by a Playwright test with checkA11y.
Playwright is configured to run tests across multiple viewports (Chromium, Webkit, Mobile Chrome, Mobile Safari). Use isMobile flag in Playwright tests to handle breakpoint-specific logic.