
Frontend Testing Best Practices
Testing guidelines that favor E2E tests over unit tests, limit mocking, and check behavior over implementation.
- skills.sh installs
- 2.3K
- GitHub stars
- 92
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers test strategy, E2E structure, selector choice, and unit test layout for frontend code
- Includes 6 rules with code examples, including a
prefer-e2e-testsrule and anavoid-component-testsrule - Enforces a mock limit where 3 or more mocks signal that an E2E test should replace the unit test
- Guides selector choice in order: role, label, text, then test ID, with CSS selectors marked as bad
- Designed for frontend teams writing or reviewing Playwright and Vitest tests
Install
$ npx -y skills add sergiodxa/agent-skills --skill frontend-testing-best-practices -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Testing Best Practices
Guidelines for writing effective, maintainable tests that provide real confidence. Contains 6 rules focused on preferring E2E tests, minimizing mocking, and testing behavior over implementation.
Core Philosophy
- Prefer E2E tests over unit tests - Test the whole system, not isolated pieces
- Minimize mocking - If you need complex mocks, write an E2E test instead
- Test behavior, not implementation - Test what users see and do
- Avoid testing React components directly - Test them through E2E
When to Apply
Reference these guidelines when:
- Deciding what type of test to write
- Writing new E2E or unit tests
- Reviewing test code
- Refactoring tests
Rules Summary
Testing Strategy (CRITICAL)
prefer-e2e-tests - @rules/prefer-e2e-tests.md
Default to E2E tests. Only write unit tests for pure functions.
Details
- Repository
- github.com/sergiodxa/agent-skills
- Categories
- Testing & QA, Frontend & UI Code
More from sergiodxa/agent-skills
All 10- Owasp Security Check1.8K
- Frontend React Best Practices1.2K
- Frontend Accessibility Best Practices911
- Frontend Tailwind Best Practices468
- Frontend React Router Best Practices404
- Frontend Js Best Practices337
- Ruby On Rails Best Practices282
- Frontend Async Best Practices226
- Frontend Internationalization Best Practices194
Similar to Frontend Testing Best Practices
More Testing & QA
vue-testing-best-practicesantfu/skills17.2K installsTesting guide for Vue.js components covering Vitest, Vue Test Utils, mocking, and Playwright E2E tests.
e2e-testing-patternswshobson/agents25.3K installsPractical E2E testing guidance for Playwright and Cypress covering selectors, flaky-test fixes, and debugging workflows.
playwright-best-practicescurrents-dev/playwright-best-practices-skill107.6K installsComprehensive guidance for writing, debugging, and maintaining Playwright tests across E2E, component, API, visual, accessibility, security, Electron, and exten
testing-best-practicesasyrafhussin/agent-skills975 installsPractical TDD and unit/integration testing guidelines with 34 TypeScript rules across seven prioritized categories.
frontend-testingaj-geddes/useful-ai-prompts516 installsComprehensive frontend test suites across Jest, Vitest, React Testing Library, and Cypress, with five reference guides.
playwright-coretestdino-hq/playwright-skill1K installsOpinionated Playwright testing guide spanning 50 references for E2E, API, visual, accessibility, and debugging work.