Skip to content
Back to skills

Frontend Testing

ASecurity

Guide for testing React/Next.js frontend applications.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 5, 2026
developmenttypescriptgoreactnextjstestingapifrontend

Works with

  • cli
  • api

Security analysis

A100/100

Scanned June 5, 2026

npx -y skills add Burburton/amazingteam --skill frontend-testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Frontend Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Frontend Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/burburton-frontend-testing/badge)](https://www.skillsdirectory.com/skills/burburton-frontend-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Frontend Testing Skill

## Purpose

Guide for testing React/Next.js frontend applications.

## Testing Stack

- **Jest**: Test runner
- **React Testing Library**: Component testing
- **Playwright**: E2E testing
- **MSW**: API mocking

## Component Testing

```typescript
import { render, screen, fireEvent } from '@testing-library/react';
import { Button } from './Button';

describe('Button', () => {
  it('renders with text', () => {
    render(<Button>Click me</Button>);
    expect(screen.getByText('Click me')).toBeInTheDocument();
  });

  it('calls onClick when clicked', () => {
    const handleClick = jest.fn();
    render(<Button onClick={handleClick}>Click</Button>);
    fireEvent.click(screen.getByText('Click'));
    expect(handleClick).toHaveBeenCalledTimes(1);
  });
});
```

## Hook Testing

```typescript
import { renderHook, act } from '@testing-library/react-hooks';
import { useCounter } from './useCounter';

describe('useCounter', () => {
  it('increments counter', () => {
    const { result } = renderHook(() => useCounter());
    act(() => result.current.increment());
    expect(result.current.count).toBe(1);
  });
});
```

## E2E Testing with Playwright

```typescript
import { test, expect } from '@playwright/test';

test('user can login', async ({ page }) => {
  await page.goto('/login');
  await page.fill('[name="email"]', 'test@example.com');
  await page.fill('[name="password"]', 'password');
  await page.click('button[type="submit"]');
  await expect(page).toHaveURL('/dashboard');
});
```

## Best Practices

1. Test user behavior, not implementation
2. Use `data-testid` for reliable selectors
3. Mock API calls with MSW
4. Keep tests isolated
5. Aim for 80% coverage

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.