Let the AI click. Don’t let it grade.
Описание и применение
В статье рассматривается интеграция ИИ в тесты e2e, предлагается смешанный подход: использовать agent.act для действий, expect для детерминированных проверок и agent.assert только для семантических оценок. Это снижает расходы на модели, повышает надёжность и облегчает обнаружение регрессий.
Задача
Determining which test steps should invoke an AI model versus which should remain deterministic code to balance cost, reliability, and maintainability in end‑to‑end testing.
Результат
Adopting a hybrid AI‑driven testing strategy reduced model calls from every step to only interaction steps, lowered costs, improved determinism, and made regressions easier to detect.
Рабочий процесс
- 1. Write tests using agent.act for actions and expect for deterministic checks.
- 2. Commit the .e2e/cache/ folder to version control and enable --strict-cache in CI.
- 3. Run tests; agent.act steps replay from cache unless stale, while expect assertions validate UI state.
- 4. Use agent.assert only for outcomes that cannot be expressed as locators, such as chatbot responses.
Доказательства
"agent.act" hands a goal in plain English to a model that drives the app.
"agent.assert" always run live. A judgment is never cached.
The recording is a 1.4 KB JSON file. It holds two actions…
The product broke. My dead button: exit 1, ASSERTION_FAILED…
- Дата записи: 2026-10-06T18:40:51.841Z