How to Test UIs with an AI Agent: 5 Rules from the Creators of e2e, Which Has 13.8K Stars
Conventional UI tests fall apart after any interface rework: swap a component and the test-id can no longer be found. The creators of the open-source e2e framework (13.8K stars on GitHub, $8M in investment) propose writing a test as a goal in plain language and letting the agent find the buttons. The result is checked by a separate AI judge against data from the API, not against the agent's own report. That is what makes a "green" test actually mean something.
AI-processed from X: @hungryturbo; edited by Hamidun News
End-to-end UI tests have become a source of pain for almost every team. The frontend moves to a different component library, identifiers change, and half the suite turns red even though the product works. Now that an AI agent can handle the clicks, the question is how to build these tests so they don't become even less reliable. Technical evangelist Kacper Kapuściak, from the team behind an open-source AI testing framework for e2e, has published his answers. The project has 13.8K stars on GitHub and recently raised $8M in funding. Below are five principles from his engineering breakdown, as retold by the author in an X post by @hungryturbo.
Test intent, not markup
The first principle is to drop the binding to DOM nodes and test-ids. Instead of a chain of "find the element, click it, enter a value," the agent receives a short, concrete business task in natural language. For example: "generate last month's report." The agent decides on its own how to pick the date and where to click "Generate" by looking at the screen. A everyday analogy: you ask a colleague to book a taxi, you don't dictate which spot on the screen to tap. If the team replaces the component library, the test keeps working, because the goal hasn't changed.
The second principle concerns waiting. Fixed pauses such as a five-second sleep slow down CI and still sometimes fall short. The author recommends dynamic waiting with an upper time limit, and the wait should be for a strong business signal, such as "last month's report is open and available for viewing." A loading indicator disappearing is a weak signal: the spinner is gone, but the data may not be there yet. Waiting for asynchronous loading should also be kept separate from an instant check of the current frame: the first answers "when is it ready," the second answers "what is on the screen right now."
Who checks the agent
The third point is perhaps the most important. An agent's message "click completed" does not prove that the report has no empty rows or someone else's data. But you also can't ask another model to judge "by eye" what the correct screen should look like: it will be guessing. So first, the actual list of tasks or records is fetched from the backend via the API, which is the single source of truth. Then a separate AI judge compares what is rendered on the screen against this reference. The executor and the checker are separated, the way a developer and a reviewer are.
The fourth principle is familiar to anyone who has fixed flaky tests: no dependence on execution order. Before the test, a reusable fixture creates a separate workspace and the needed data through the API, and after the run a lifecycle hook cleans everything up. In that case, a rerun after a failure or parallel execution yields the same result.
Small tests and a trace for repairs
The fifth principle is to split long scenarios. Instead of one test that "generates a report, downloads a CSV and sends an email," it is better to write three separate atomic tests with clear names. Then the name of the failing test immediately shows what broke.
On failure, the framework automatically collects a trace: the preceding steps, application logs, the agent's reasoning context, and screenshots. A human quickly finds the cause, and the same trace can be passed to a coding agent so it can try to fix the bug itself. That yields a ready-made input for an automatic "it failed, it got fixed" loop.
What to keep in mind
The source material is a brief retelling on social media, so it contains no figures on stability, the cost of runs, or speed compared with Playwright and Cypress. An AI agent adds token usage and time for each step, and the AI judge can itself make mistakes, although the API-based reference greatly reduces the risk. It is also worth remembering that the principles about data isolation, explicit waits and small tests are useful even without AI.
The practical takeaway for teams: if you are experimenting with agentic E2E tests, start with two things. Phrase goals in business language, and verify results against backend data rather than the agent's own words. Everything else, from fixtures to tracing, will help make such a test suite repeatable and suitable for CI.
- Nov 21, 2026Agent takes over a site's SEO: Yandex impressions climb from 2.8K to 55K after an audit
- Nov 21, 2026Claude Code wrote all the code for an ESP32 rig and debunked a false 'discovery'
- Nov 21, 2026Nectar launches AI agent that finds influencers among 300 million profiles
- Nov 21, 2026opencode Hits 226K GitHub Stars: A Free 10-Tool AI Stack
Key Questions Answered
What are the key details on Test intent, not markup?
The first principle is to drop the binding to DOM nodes and test-ids. Instead of a chain of "find the element, click it, enter a value," the agent receives a short, concrete business task in natural language. For example: "generate last month's report." The agent decides on its own how to pick the date and where to click "Generate" by looking at the screen. A everyday analogy: you ask a colleague to book a taxi, you don't dictate which spot on the screen to tap.
Who checks the agent?
The third point is perhaps the most important. An agent's message "click completed" does not prove that the report has no empty rows or someone else's data. But you also can't ask another model to judge "by eye" what the correct screen should look like: it will be guessing. So first, the actual list of tasks or records is fetched from the backend via the API, which is the single source of truth. Then a separate AI judge compares what is rendered on the screen against this reference.
What are the key details on Small tests and a trace for repairs?
The fifth principle is to split long scenarios. Instead of one test that "generates a report, downloads a CSV and sends an email," it is better to write three separate atomic tests with clear names. Then the name of the failing test immediately shows what broke. On failure, the framework automatically collects a trace: the preceding steps, application logs, the agent's reasoning context, and screenshots.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.