
Frontend Testing Best Practices
This is a testing strategy that pushes you toward end-to-end tests and away from component unit tests. It's opinionated: default to E2E, only unit test pure functions, minimize mocking, and test user behavior instead of React component internals. The rules cover selector preferences (role over CSS), test structure (E2E tests go in e2e/tests/, unit tests colocate with source), and when to bail on mocks and write an E2E test instead. If you've been maintaining a sprawling component test suite that breaks on every refactor, this gives you permission to delete most of it. The tradeoff is you need a solid E2E setup, which means Playwright or similar actually working in your project.
- skills.sh installs
- 2.2K
- GitHub stars
- 92
- last updated
- Aug 21, 2026
Install
$ npx -y skills add sergiodxa/agent-skills --skill frontend-testing-best-practices --agent claude-codeInstalls into .claude/skills of the current project.
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.
Sponsors
Details
- Repository
- github.com/sergiodxa/agent-skills
- Categories
- Frontend Development, Testing & QA, Documentation, AI & Agent Building
More from sergiodxa/agent-skills
All 10- Owasp Security Check1.7K
- Frontend React Best Practices1.2K
- Frontend Accessibility Best Practices896
- Frontend Tailwind Best Practices465
- Frontend React Router Best Practices402
- Frontend Js Best Practices336
- Ruby On Rails Best Practices282
- Frontend Async Best Practices225
- Frontend Internationalization Best Practices193