For full functionality, this website places cookies on your computer. In addition, cookies are placed for tracking visitor behavior within Google Analytics. This information helps us improve our website. The cookies contain anonymous information and remain in your browser for a maximum of 2 years. Read more
Writing a good E2E test with a proper page object, correct locators, shared fixtures, lint compliance, and a review against current framework best practices takes a senior engineer one to two hours per test. For a complex application with dozens of critical flows, the math rarely works out in testing's favor.
That changed when we started using AI as an active participant in writing and maintaining our E2E test suites. Across multiple projects, we are now using Claude Code, an Anthropic's AI agent for software engineering alongside Playwright and TypeScript to build automated test coverage at a pace that was not previously achievable.
Unit and integration tests verify that individual pieces of code work in isolation. They are fast and widely favored by developers, but they cannot answer the broader question that matters to a user: does the entire flow work, end to end, in a real browser?
In complex web applications, the most critical paths like multi-step workflows, external integrations, and rich UI components, span across many layers. An operation might begin on a calendar, pass through a form with dropdown dependencies, and end with a generated document that must contain the right line items. A unit test cannot catch a regression in that chain. A manual tester can, but not on every pull request, not across every browser, and not without accumulating significant toil over time.
E2E tests fill that gap by simulating exactly what a real user does: open the browser, log in, navigate, fill forms, and assert that the right things appeared on screen.
The process starts with writing a detailed CLAUDE.md instruction file at the root of the test project. This file is read by Claude Code at the start of every session, which captures the project's conventions, the locator hierarchy, naming rules, the page object model, forbidden patterns, and the structure of the CI pipeline.
The prompts that work are descriptions written in the style of a manual test case:
"Test that a user can create a new task by filling in the subject, description, and expiry date, selecting a receiver from a dropdown, saving, and then verifying the task appears in the accordion panel under the correct animal."
Claude reads this alongside the instruction file and produces a page object with private read-only locators, a fixture entry, and a spec file that follows the Arrange-Act-Assert structure with test.step() blocks, matching exactly what the team would write by hand.
For pages that already have a page object, the prompt references it: "Extend the existing TaskPage to add an edit flow via the context menu." Claude reads the existing file, follows its patterns, and adds only what is needed without refactoring, new abstractions or scope creep.
When a generated test fails on first run, the failure output goes back into Claude. It reads the error, identifies whether the issue is a locator, a timing, or a logic issue, and proposes a targeted fix. This back-and-forth process moves much faster with AI in the loop than working through failures manually.
Example: If a locator doesn’t exist in the application yet, Claude flags it and proposes adding a data-testid attribute to the Angular template. This keeps the test code clean and improves the application's testability as a side effect.