AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Frontend Testing

skill-mintuz-skills-frontend-testing · by mintuz

WHEN testing any front-end UI with DOM Testing Library; behavior-first queries, userEvent flows, async patterns.

No reviews yet
0 installs
34 views
0.0% view→install

Install

$ agentstack add skill-mintuz-skills-frontend-testing

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-mintuz-skills-frontend-testing)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
7mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Frontend Testing? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Front-End Testing with DOM Testing Library

Framework-agnostic DOM Testing Library patterns for behavior-driven testing. For React-specific patterns (renderHook, context, components), load the react-testing skill. For TDD workflow (RED-GREEN-REFACTOR), load the tdd skill.

Core Philosophy

Test behavior users see, not implementation details.

Testing Library exists to solve a fundamental problem: tests that break when you refactor (false negatives) and tests that pass when bugs exist (false positives).

Two Types of Users

Your UI components have two users:

  1. End-users: Interact through the DOM (clicks, typing, reading text)
  2. Developers: You, refactoring implementation

Kent C. Dodds principle: "The more your tests resemble the way your software is used, the more confidence they can give you."

Why This Matters

False negatives (tests break on refactor):

// ❌ WRONG - Testing implementation (will break on refactor)
it("should update internal state", () => {
  const component = new CounterComponent();
  component.setState({ count: 5 }); // Coupled to state implementation
  expect(component.state.count).toBe(5);
});

Correct approach (behavior-driven):

// ✅ CORRECT - Testing user-visible behavior
it("should submit form when user clicks submit", async () => {
  const handleSubmit = vi.fn();
  const user = userEvent.setup();

  render(`
    
      Email: 
      Submit
    
  `);

  await user.type(screen.getByLabelText(/email/i), "test@example.com");
  await user.click(screen.getByRole("button", { name: /submit/i }));

  expect(handleSubmit).toHaveBeenCalled();
});

Quick Reference

| Topic | Guide | | -------------------------------------- | --------------------------------------------------------------------------- | | Query selection priority and details | [queries.md](queries.md) | | userEvent patterns and interactions | [user-events.md](user-events.md) | | Async testing (findBy, waitFor) | [async-testing.md](async-testing.md) | | MSW for API mocking | [msw.md](msw.md) | | Common mistakes and fixes | [anti-patterns.md](anti-patterns.md) | | Accessibility-first testing principles | [accessibility-first-testing.md](references/accessibility-first-testing.md) |

When to Use Each Guide

Queries

Use [queries.md](queries.md) when you need:

  • Query priority order (getByRole → getByLabelText → ...)
  • Query variant decisions (getBy vs queryBy vs findBy)
  • Common query mistakes and fixes

User Events

Use [user-events.md](user-events.md) when you need:

  • userEvent vs fireEvent guidance
  • userEvent.setup() pattern
  • Common interaction patterns (clicking, typing, keyboard)

Async Testing

Use [async-testing.md](async-testing.md) when you need:

  • findBy queries for async elements
  • waitFor for complex conditions
  • waitForElementToBeRemoved
  • Loading states, API responses, debounced inputs

MSW

Use [msw.md](msw.md) when you need:

  • Network-level API mocking
  • setupServer pattern
  • Per-test handler overrides

Anti-Patterns

Use [anti-patterns.md](anti-patterns.md) when you need:

  • List of all common mistakes
  • Quick reference of what NOT to do
  • ESLint plugin setup

Accessibility-First Testing

Use [accessibility-first-testing.md](references/accessibility-first-testing.md) when you need:

  • Why accessible queries improve tests and accessibility
  • When to add ARIA attributes vs semantic HTML
  • Semantic HTML priority principles

Summary Checklist

Before merging UI tests, verify:

  • [ ] Using getByRole as first choice for queries
  • [ ] Using userEvent with setup() (not fireEvent)
  • [ ] Using screen object for all queries (not destructuring from render)
  • [ ] Using findBy* for async elements (loading, API responses)
  • [ ] Using jest-dom matchers (toBeInTheDocument, toBeDisabled, etc.)
  • [ ] Testing behavior users see, not implementation details
  • [ ] ESLint plugins installed (eslint-plugin-testing-library, eslint-plugin-jest-dom)
  • [ ] No manual cleanup() calls (automatic)
  • [ ] MSW for API mocking (not fetch/axios mocks)
  • [ ] Following TDD workflow (see tdd skill)
  • [ ] Using test factories for data (see testing skill)
  • [ ] For framework-specific patterns (React hooks, context, components), see react-testing skill

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.