- Engineering
- 5 min read
AI E2E testing: what the AI does and what stays a rule

Test Automation + AI Gateway
On this page
End-to-end (E2E) tests break for reasons that have little to do with bugs: a selector that changed, a slow network, a browser that crashed. The common promise of "AI E2E testing" is to let a model decide all of that. We split the tasks: the AI writes draft tests and suggests selector fixes; failure classification and the CI gate remain fixed rules that give the same result every time. This post describes Test Automation as it is in the platform code, checked on November 27, 2026.
#The choice: AI where it helps, rules where it must be predictable
A CI gate that sometimes passes and sometimes fails the same result is useless as a gate. That's why the "passed or failed" decision and the class of each failure come from rules. AI comes in at three points, always with a cost cap and never with the final word: writing a test from a description, suggesting the new selector when a saved test breaks, and, if the workspace wants it, summarizing a run as a suggestion.
#We only test what is yours
A test runner that accepts any address becomes an attack tool. Before running, the platform checks that the environment is yours: you publish a token in the /.well-known/aiuby-test-automation.txt file at the origin, and the platform fetches the file over public HTTPS, without following redirects, with a cap of 10 seconds and 4 KB.
- The proof is valid for 7 days and is redone before each run: the origin may have changed owners in the meantime.
- There are at most 5 verifications per target and 20 per workspace each hour.
- The error shown is generic on purpose, so verification can't be used to probe ports and paths.
#Your suite, in an isolated runner
Test Automation runs the Playwright suite that already exists in your repository. Each shard is a Cloud Run job with the official Playwright image, which ships Chromium, Firefox, and WebKit. Your repository's code runs as an unprivileged user, with no capabilities and a clean environment.
| Item | Default | Cap in code |
|---|---|---|
| Shards per run | 4 | 8 |
| Time per shard | 600 s | 900 s |
| Runs per day | 20 | 200 |
| Minutes per month | 600 | 12,000 |
| Retries | per the suite | 3 |
Traces, screenshots, and videos of each failure are kept for 14 days by default, with a cap of 30.
#Failure triage without AI
Each failed test comes back with one of four classes, decided by rules applied in this order:
| Class | When |
|---|---|
| Flaky | Failed and then passed on a retry. |
| Infrastructure | Run interrupted, or a DNS, network, navigation timeout, browser crash, or worker crash error. |
| Broken test | Invalid or ambiguous selector, an error in the test code, or element not found. |
| Flaky | Two or more flips between passing and failing in the last 10 runs. |
| Likely bug | Everything else: a failed assertion, an element that won't accept an action, test timeout exceeded. |
Limit
#Tests written by AI, accepted by a person
You describe in Portuguese what to test and point to an environment with verified ownership. An agent reads the page in read-only mode, without clicking or typing, and proposes a declarative test, with selectors by role and accessible label.
- The plan uses a closed list of actions: open page, click, fill, press key, select, wait, and check visibility, text, URL, and title. Up to 3 scenarios and 25 steps per proposal.
- Outside an environment marked as a test environment, the agent only clicks links and tabs, and refuses actions such as logging out, deleting, or purchasing.
- Values that look like a key, token, CPF, CNPJ, or card number are refused even in a test environment.
- A proposal only shows as ready after passing a real run, in up to 3 attempts, and only becomes a saved test with the approval of a workspace administrator.
- Each request has a cost cap, defaulting to US$1, and the organization has a daily cap. Model calls go through the AI Gateway, so they count against the workspace budget like any other.
Declarative plans also support steps interpreted by the AI on every run and a resilient mode that replaces a broken selector during the run itself, one replacement at a time. A run makes at most 40 requests to the AI or the database.
#The result as a CI gate
The suite runs through API v1, the CLI, an AIUBY pipeline step, or a GitHub Actions action. The key needs the tests:run scope. In the CLI, the exit code is the gate:
aiuby tests run --suite empresa/web --target https://staging.empresa.com.br --shards 2 --wait
# 0: passou 6: algum teste falhou 1: a suíte não rodou até o fim 7: ainda rodando no fim da esperaThrough the API, GET /api/v1/tests/runs/{id} returns gate with pending, passed, or failed. The step-by-step guide is in Test Automation, in the docs, and GitHub Actions usage is in CI gates.
#Limitations
- Playwright only, npm only (not pnpm or yarn yet), and projects named after the browser: chromium, firefox, or webkit.
- A Playwright version different from the one in the image costs 30 to 90 seconds per shard to download the browsers.
- AI authoring makes at most 6 page reads per run and doesn't navigate on its own. In read-only mode, login, cart, and forms are left out.
- There is no credential vault for tests: a plan parameter is not a secret.
- "Passed" means the test ran, not that it checks what you wanted. That's why a person gives the approval.
- The GitHub Actions action isn't on the Marketplace yet: the files are delivered by the team.
- Cost estimates for AI authoring don't have production measurements yet.
- Activation is through Cortex, as described in the docs, and every target needs verified ownership.
A test written by the AI and accepted can go to the repository as a .spec.ts file through Code Automation, with review. How that path works is in AI code fixes via pull request.


