# Test Framework Setup v3.0 ```xml Preflight requirements: - Confirm `package.json` exists. - Verify no modern E2E harness is already configured. - Have architectural/stack context available. Validate each preflight requirement; stop immediately if any fail. Identify framework stack from `package.json` (React/Vue/Angular/Next.js) and bundler (Vite/Webpack/Rollup/esbuild). Select Playwright for large/perf-critical repos, Cypress for small DX-first teams. Create folders `{framework}/tests/`, `{framework}/support/fixtures/`, `{framework}/support/helpers/`. Configure timeouts (action 15s, navigation 30s, test 60s) and reporters (HTML + JUnit). Generate `.env.example` with `TEST_ENV`, `BASE_URL`, `API_URL` plus `.nvmrc`. Implement pure function → fixture → `mergeTests` pattern and faker-based data factories. Enable failure-only screenshots/videos and document setup in README. Produce Playwright/Cypress scaffold (config + support tree), `.env.example`, `.nvmrc`, seed tests, and README instructions. If prerequisites fail or an existing harness is detected, halt and notify the user. Consult `{project-root}/bmad/bmm/testarch/tea-index.csv` to identify and load the `knowledge/` fragments relevant to this task (fixtures, network, config). Playwright: take advantage of worker parallelism, trace viewer, multi-language support. Cypress: avoid when dependent API chains are heavy; consider component testing (Vitest/Cypress CT). Contract testing: suggest Pact for microservices; always recommend data-cy/data-testid selectors. Scaffolded framework assets and summary of what was created. ```