ESC

Type to search the knowledge base.

Testing

Guides in Testing. Written like documentation — short paragraphs, real examples, interview-relevant depth.

Testing UI with Testing Library

intermediate

Test user-facing behavior — queries by role and label, async utilities, and what not to assert.

intermediate

Unit Testing Pure Logic

beginner

Extract and test pure functions hard — money, parsing, permissions — without rendering React when the DOM adds no signal.

beginner

Testing Library Queries Priority

beginner

Query UI like a user — getByRole first, test ids last, and which variant (get/query/find) to use for presence and async.

beginner

Testing Pyramid for Frontend

beginner

Balance unit, integration, and E2E tests for UI apps — the testing trophy mindset, what each layer owns, and allocation rules of thumb.

beginner

Component Testing Storybook

intermediate

Use Storybook as a component workshop and optional test runner — stories as living specs, interaction tests, and a11y checks.

intermediate

Integration Testing UI

intermediate

Test composed UI with real children and network stubs — the sweet spot between shallow unit tests and full E2E.

intermediate

End-to-End Testing Tradeoffs

intermediate

When E2E tests earn their keep, why they flake, and how to keep a small critical-path suite instead of a slow second frontend.

intermediate

Playwright vs Cypress Overview

intermediate

Compare Playwright and Cypress for frontend E2E — architecture, multi-browser, speed, debugging, and when to pick which.

intermediate

MSW Mock Service Worker

intermediate

Intercept HTTP in tests and dev with MSW — handlers, server setup, overrides per test, and how it beats ad-hoc fetch mocks.

intermediate

Accessibility Testing in CI

intermediate

Wire axe and lint rules into CI without false confidence — what automation catches, what it misses, and a practical pipeline.

intermediate

Mocking fetch in Tests

intermediate

Stub fetch without lying — MSW vs vi.fn, Response shapes, error paths, and cleanup so network tests stay deterministic.

intermediate

Fake Timers for Debounce

intermediate

Test debounced and throttled UI with Vitest/Jest fake timers — advance time deterministically without real sleeps.

intermediate

Flaky Tests Common Causes

intermediate

Hunt timing, shared state, order dependence, and network flake — a practical checklist to stabilize frontend test suites.

intermediate

Snapshot Testing When Useful

intermediate

When DOM or data snapshots help, when they become merge-conflict noise, and how to keep snapshots intentional and small.

intermediate

Coverage Metrics Pitfalls

intermediate

Why 100% line coverage can still ship bugs — gaming metrics, useless tests, and what coverage is actually good for.

intermediate

Visual Regression Testing

intermediate

Catch CSS regressions with screenshot diffs — tooling options, what to snapshot, flake from fonts/animations, and review workflows.

intermediate

Contract Testing APIs

advanced

Keep frontend and backend agreements honest — schema contracts, Pact-style consumer tests, and OpenAPI-driven checks without brittle E2E.

advanced

Test IDs as Last Resort

beginner

Why data-testid ranks last in Testing Library guidance — prefer roles and labels, and when a test id is still the right tool.

beginner

user-event vs fireEvent

beginner

Prefer user-event for realistic interactions — how it differs from fireEvent, setup patterns, and when fireEvent is still fine.

beginner