Testing
Guides in Testing. Written like documentation — short paragraphs, real examples, interview-relevant depth.
Testing UI with Testing Library
intermediateTest user-facing behavior — queries by role and label, async utilities, and what not to assert.
intermediate
Unit Testing Pure Logic
beginnerExtract and test pure functions hard — money, parsing, permissions — without rendering React when the DOM adds no signal.
beginner
Testing Library Queries Priority
beginnerQuery 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
beginnerBalance 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
intermediateUse Storybook as a component workshop and optional test runner — stories as living specs, interaction tests, and a11y checks.
intermediate
Integration Testing UI
intermediateTest composed UI with real children and network stubs — the sweet spot between shallow unit tests and full E2E.
intermediate
End-to-End Testing Tradeoffs
intermediateWhen 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
intermediateCompare Playwright and Cypress for frontend E2E — architecture, multi-browser, speed, debugging, and when to pick which.
intermediate
MSW Mock Service Worker
intermediateIntercept 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
intermediateWire axe and lint rules into CI without false confidence — what automation catches, what it misses, and a practical pipeline.
intermediate
Mocking fetch in Tests
intermediateStub fetch without lying — MSW vs vi.fn, Response shapes, error paths, and cleanup so network tests stay deterministic.
intermediate
Fake Timers for Debounce
intermediateTest debounced and throttled UI with Vitest/Jest fake timers — advance time deterministically without real sleeps.
intermediate
Flaky Tests Common Causes
intermediateHunt timing, shared state, order dependence, and network flake — a practical checklist to stabilize frontend test suites.
intermediate
Snapshot Testing When Useful
intermediateWhen DOM or data snapshots help, when they become merge-conflict noise, and how to keep snapshots intentional and small.
intermediate
Coverage Metrics Pitfalls
intermediateWhy 100% line coverage can still ship bugs — gaming metrics, useless tests, and what coverage is actually good for.
intermediate
Visual Regression Testing
intermediateCatch CSS regressions with screenshot diffs — tooling options, what to snapshot, flake from fonts/animations, and review workflows.
intermediate
Contract Testing APIs
advancedKeep frontend and backend agreements honest — schema contracts, Pact-style consumer tests, and OpenAPI-driven checks without brittle E2E.
advanced
Test IDs as Last Resort
beginnerWhy 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
beginnerPrefer user-event for realistic interactions — how it differs from fireEvent, setup patterns, and when fireEvent is still fine.
beginner