aicoolies logo

Testing & QA Stack

$0/mo

A complete testing pyramid — from unit tests to end-to-end visual regression, all open-source.

Share

What This Stack Does

The testing pyramid remains the most reliable mental model for structuring a quality assurance strategy, and this stack maps each layer of that pyramid to the best available open-source tool. At the base of the pyramid sit fast, numerous unit tests handled by Vitest. In the middle layer, component-level tests split between Testing Library for behavioral assertions and Storybook for visual component development and isolation testing. Near the top, Playwright covers end-to-end browser tests that verify complete user workflows. At the peak, Chromatic provides visual regression detection that catches unintended UI changes, and k6 sits alongside to validate that your application performs under load. The pyramid shape is intentional and important — you should have hundreds or thousands of unit tests that run in seconds, dozens of component tests that run in under a minute, and a focused set of end-to-end tests covering critical paths that run in a few minutes. Inverting this pyramid by writing mostly end-to-end tests leads to slow, flaky test suites that developers learn to ignore, which is functionally equivalent to having no tests at all. Each tool in this stack is open-source and free to use, with Chromatic offering a generous free tier of five thousand snapshots per month that is sufficient for most projects. The total cost of implementing a comprehensive testing strategy with these tools is zero dollars and roughly two to three days of initial setup time, after which the investment pays continuous dividends in reduced bugs, faster refactoring, and developer confidence.

Fast Feedback at the Unit Level

Vitest occupies the foundation of the testing pyramid because it delivers the fast feedback loop that makes test-driven development actually enjoyable rather than a chore developers avoid. Built on Vite's transformation pipeline, Vitest provides near-instant test execution with native ES module support, TypeScript and JSX transformation without additional configuration, and a watch mode that re-runs only the tests affected by your code changes. For a typical web application, Vitest can execute a thousand unit tests in under two seconds, meaning developers get immediate feedback on whether their changes broke existing behavior. The API is Jest-compatible, which means teams migrating from Jest can often switch to Vitest by changing the import statements and configuration file without rewriting any test logic. Vitest's built-in code coverage reporting using v8 or istanbul providers gives teams visibility into which parts of their codebase lack test coverage, and its snapshot testing feature captures the output of functions or serialized component trees for comparison against known-good baselines. For modern web applications, Vitest's workspace feature allows you to run tests across multiple projects — such as a monorepo with shared libraries, a frontend app, and an API server — with a single command and unified reporting. The in-source testing feature lets you co-locate tests directly in your source files during development for maximum convenience, then exclude them from production builds automatically. Vitest is not just a test runner; it is the backbone of a development workflow where writing and running tests is frictionless enough that developers do it continuously rather than as an afterthought before release.

From Components to Complete User Journeys

Testing Library and Storybook together address the component testing layer with complementary philosophies that produce more resilient and maintainable tests than either could achieve alone. Testing Library, created by Kent C. Dodds, enforces a testing approach that mirrors how users actually interact with your application — tests query elements by their accessible roles, labels, and text content rather than CSS classes or test IDs, which means your tests verify behavior that matters to users and are resilient to implementation refactoring. When you test a login form with Testing Library, you find the email input by its label, type a value using the userEvent library that simulates real keyboard events, click the submit button by its accessible name, and assert that a success message appears — this test will pass regardless of whether you restructure the component, change CSS classes, or refactor state management. Storybook complements this behavioral testing with visual component development and isolation. Each component gets a set of stories that render it in different states — loading, error, empty, populated, disabled — and developers can visually verify that each state looks correct in the Storybook browser. Storybook's interaction testing addon allows you to write Testing Library queries within stories, combining visual verification with behavioral assertions in a single artifact. The component development workflow becomes: design the component in Storybook to get the visual states right, write Testing Library tests to verify the behavioral logic, and use Storybook's accessibility addon to check for WCAG compliance. This produces components that look correct, behave correctly, and are accessible — the three quality dimensions that matter most for user-facing interfaces.

Playwright handles the end-to-end testing layer where you verify that complete user workflows function correctly across the full application stack — frontend, API, database, and third-party integrations all working together. Unlike unit and component tests that isolate individual pieces, Playwright tests launch a real browser, navigate to your application, and interact with it exactly as a user would. For a SaaS application, critical Playwright tests might cover the signup flow from landing page through email verification to first dashboard view, the subscription purchase flow through Stripe's checkout, and the core product workflow that delivers the value users pay for. Playwright's auto-waiting mechanism eliminates the most common source of end-to-end test flakiness — instead of hardcoded timeouts or manual wait commands, Playwright automatically waits for elements to be visible, enabled, and stable before interacting with them, and waits for navigation to complete before asserting on page content. The trace viewer is an invaluable debugging tool: when a test fails in CI, Playwright captures a complete trace including screenshots at every step, network requests, console logs, and a timeline view that lets you replay the test execution to understand exactly what went wrong. Playwright's test generator can record user interactions in the browser and output test code, accelerating the initial test creation process. For API testing, Playwright's request context lets you make authenticated API calls within your end-to-end tests without browser overhead, useful for setting up test data or verifying backend state after UI interactions. The recommended approach is to run Playwright tests against preview deployments in your CI pipeline, ensuring that every pull request is verified against a real deployment before merging.

Visual Integrity and Performance Under Load

Chromatic adds visual regression testing to your pipeline by capturing screenshots of every Storybook story and comparing them pixel-by-pixel against baseline images to detect unintended visual changes. This catches an entire category of bugs that behavioral tests miss — a CSS refactoring that accidentally changes the padding on your primary button, a font loading issue that causes text to render in a fallback typeface, a z-index change that makes a dropdown appear behind other content, or a color variable update that affects components you did not intend to modify. Chromatic runs in your CI pipeline and blocks merging when visual changes are detected, presenting a side-by-side comparison of the baseline and changed screenshots for a developer to review and approve or reject. The approval workflow is critical because not all visual changes are bugs — when you intentionally redesign a component, you review and accept the new appearance as the updated baseline. Chromatic tests across multiple browser engines and viewport sizes, catching cross-browser rendering differences that are nearly impossible to detect through manual testing. The free tier provides five thousand snapshots per month, which is sufficient for most projects with up to a few hundred components and stories. For teams that take visual quality seriously, Chromatic eliminates the painful experience of deploying a change that looks perfect on your machine but breaks the layout for users on different browsers, screen sizes, or operating systems. The integration with Storybook is seamless — Chromatic reads your existing stories, so adding visual regression testing to a project that already uses Storybook requires zero additional test code, only a CI pipeline configuration change.

k6 addresses the performance dimension that is often completely absent from testing strategies until a production incident forces the team to react. Written in Go and scriptable in JavaScript, k6 simulates concurrent user load against your application to identify performance bottlenecks, establish baseline response times, and verify that your infrastructure scales to meet expected demand. A basic k6 test script defines virtual users that execute HTTP requests in a loop, ramping up from a handful of users to hundreds or thousands over a defined duration, and k6 reports response time percentiles, error rates, and throughput metrics throughout the test. For web applications, k6 can simulate realistic user behavior including login flows, authenticated API calls, WebSocket connections, and multi-step transactions, with each virtual user maintaining its own session state. The integration into CI/CD pipelines is where k6 delivers the most value — by running a performance smoke test on every deployment, you catch performance regressions immediately rather than discovering them when users complain. A typical CI performance gate might assert that the 95th percentile response time for critical API endpoints stays below 500 milliseconds and that the error rate under load stays below one percent. k6 also supports testing against production-like environments with realistic data volumes, identifying issues like slow database queries, memory leaks under sustained load, and connection pool exhaustion that only manifest under concurrent usage. The browser module in k6 extends load testing to include real browser rendering, measuring Core Web Vitals like Largest Contentful Paint and Cumulative Layout Shift under load conditions. Combined with Vitest for unit performance benchmarks and Playwright for functional correctness, k6 completes the testing stack by ensuring your application is not just correct but fast and reliable under real-world usage patterns.

Stack Overview

ToolRolePricingOpen Source
VitestUnit TestingFreeYes
PlaywrightE2E TestingFreeYes
StorybookComponent TestingFree (open-source) / Chromatic visual testing from $0Yes
ChromaticVisual RegressionFree (5,000 snapshots/mo) / Pro from $149/moNo
k6Load TestingFree (open-source) / Grafana Cloud k6 paid tiersYes