Tech News
← Back to articles

Using Claude Code SDK to reduce E2E test time

read original related products more articles

End-to-end (E2E) tests sit at the top of the test pyramid because they're slow, fragile, and expensive. But they're also the only tests that completely verify complete user workflows actually work across systems.

Due to time constraints, most teams run E2E nightly to avoid CI bottlenecks. However, this means bugs can slip through to production and be harder to fix because there are so many changes to isolate the root cause.

But what if we could run only the relevant E2E tests for specific code changes of a PR?

Instead of waiting hours for the entire suite, we could get the results in under 10 minutes, catch bugs before they ship, and keep our master branch always clean.

Thinking with globs

The first logical step toward running only relevant tests would be using glob patterns. We tell the system to test what changed by matching file paths.

Here's how a typical ./labeler.yml could work:

user-authentication-test: # Trigger this test # If any of these file changes - "src/auth/**/*" - "src/components/LoginForm.tsx" - "api/auth/**/*" checkout-flow-test: - "src/pages/checkout/**/*" - "src/components/PaymentForm.tsx" - "api/payments/**/*" admin-dashboard-test: - "src/admin/**/*" - "api/admin/**/*"

But globs are very limited. They require constant maintenance as the codebase evolves. Every new feature would require updating the glob patterns file.

More importantly, they cast too wide a net. A change to components/Button.tsx might need to trigger every E2E test that involves any page with a button interaction, depending on how deep the change is.

... continue reading