Build comprehensive test suites for frontend applications including unit tests, integration tests, and end-to-end tests with proper coverage and assertions.
When to Use
Component testing
Integration testing
End-to-end testing
Regression prevention
Quality assurance
Test-driven development
Quick Start
Minimal working example:
// Button.test.tsx
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import { Button } from './Button';
describe('Button Component', () => {
it('renders button with text', () => {
render(<Button>Click me</Button>);
expect(screen.getByRole('button')).toHaveTextContent('Click me');
});
it('calls onClick handler when clicked', () => {
const handleClick = jest.fn();
render(<Button
fireEvent.click(screen.getByRole('button'));
expect(handleClick).toHaveBeenCalledTimes(1);
});
it('disables button when disabled prop is true', () => {
render(<Button disabled>Click me</Button>);
expect(screen.getByRole('button')).toBeDisabled();
});
it('applies variant styles correctly', () => {
// ... (see reference guides for full implementation)
Reference Guides
Detailed implementations in the references/ directory:
Guide
Contents
Jest Unit Testing (React)
Jest Unit Testing (React)
React Testing Library Integration Tests
React Testing Library Integration Tests
Vitest for Vue Testing
Vitest for Vue Testing
Cypress E2E Testing
Cypress E2E Testing
Test Coverage Configuration
Test Coverage Configuration
Best Practices
✅ DO
Follow established patterns and conventions
Write clean, maintainable code
Add appropriate documentation
Test thoroughly before deploying
❌ DON'T
Skip testing or validation
Ignore error handling
Hard-code configuration values
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: aj-geddes-useful-ai-prompts-frontend-testing3description: Frontend Testing4---56# Frontend Testing78## Table of Contents910- [Overview](#overview)11- [When to Use](#when-to-use)12- [Quick Start](#quick-start)13- [Reference Guides](#reference-guides)14- [Best Practices](#best-practices)1516## Overview1718Build comprehensive test suites for frontend applications including unit tests, integration tests, and end-to-end tests with proper coverage and assertions.1920## When to Use2122- Component testing23- Integration testing24- End-to-end testing25- Regression prevention26- Quality assurance27- Test-driven development2829## Quick Start3031Minimal working example:3233```typescript34// Button.test.tsx35import { render, screen, fireEvent } from '@testing-library/react';36import '@testing-library/jest-dom';37import { Button } from './Button';3839describe('Button Component', () => {40 it('renders button with text', () => {41 render(<Button>Click me</Button>);42 expect(screen.getByRole('button')).toHaveTextContent('Click me');43 });4445 it('calls onClick handler when clicked', () => {46 const handleClick = jest.fn();47 render(<Button onClick={handleClick}>Click</Button>);4849 fireEvent.click(screen.getByRole('button'));50 expect(handleClick).toHaveBeenCalledTimes(1);51 });5253 it('disables button when disabled prop is true', () => {54 render(<Button disabled>Click me</Button>);55 expect(screen.getByRole('button')).toBeDisabled();56 });5758 it('applies variant styles correctly', () => {59// ... (see reference guides for full implementation)60```6162## Reference Guides6364Detailed implementations in the `references/` directory:6566| Guide | Contents |67|---|---|68| [Jest Unit Testing (React)](references/jest-unit-testing-react.md) | Jest Unit Testing (React) |69| [React Testing Library Integration Tests](references/react-testing-library-integration-tests.md) | React Testing Library Integration Tests |70| [Vitest for Vue Testing](references/vitest-for-vue-testing.md) | Vitest for Vue Testing |71| [Cypress E2E Testing](references/cypress-e2e-testing.md) | Cypress E2E Testing |72| [Test Coverage Configuration](references/test-coverage-configuration.md) | Test Coverage Configuration |7374## Best Practices7576### ✅ DO7778- Follow established patterns and conventions79- Write clean, maintainable code80- Add appropriate documentation81- Test thoroughly before deploying8283### ❌ DON'T8485- Skip testing or validation86- Ignore error handling87- Hard-code configuration values8889---90> Converted and distributed by [TomeVault](https://tomevault.io/claim/aj-geddes) — claim your Tome and manage your conversions.91<!-- tomevault:4.0:skill_md:2026-04-11 -->
Run npx skillmds@latest add tomevault-io/aj-geddes-useful-ai-prompts-frontend-testing in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Frontend Testing It is listed under Web & Frontend on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.