Primeiros passos
Testes E2E em linguagem natural com replay determinístico — o LLM planeja uma vez, os replays rodam sem ele.
Descreva um teste em linguagem simples — “faça login com a conta de teste, adicione o produto X ao carrinho, finalize a compra e verifique a confirmação do pedido” — e o Windup o transforma em um plano determinístico de ações do navegador em JSON. A partir da segunda execução, o teste faz replay com zero chamadas ao LLM: ~1 segundo, $0, resultados estáveis.
npm i -D windupjs # Chromium is provisioned automatically (one-time, machine-wide cache)
npx windup init # 3 questions → windup.config.ts + example scenario
npx windup scan # index your app's routes & elements from source code
npx windup new "log in as admin and create an invoice" # LLM-assisted scenario authoring
npx windup run checkout # 1st run: the LLM plans · every run after: ~1s replay, $0
Requisitos
- Node ≥ 20.
- Uma chave de API para o LLM planejador em
.env.localou.env(.env.localprevalece — use-o quando o seu.envestiver versionado):GOOGLE_GENERATIVE_AI_API_KEYpara Google (padrão) ouOPENAI_API_KEYpara OpenAI.
As chaves são usadas apenas para planejar; replays do cache nunca chamam um LLM. Para usar um Chrome existente em vez do Chromium baixado automaticamente, defina CHROME_PATH; para pular o download por completo, defina PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1.
Um tour de cinco minutos
O fluxo completo em um projeto novo, com o que você deve esperar ver:
# 1. Install — Chromium is provisioned automatically
npm i -D windupjs
# 2. Initialize — 3 questions (base URL, model, scenarios dir)
npx windup init
# → windup.config.ts + e2e/scenarios/ + .windup/ (gitignored)
# 3. Index your app from source — before anything ever runs
npx windup scan
# scan complete (full): framework=react-router routes=106 elements=1125
# The site map now knows your real routes and selectors; the planner
# will use them instead of guessing. Re-run after big changes
# (windup scan --update re-indexes only files changed since, via git).
# 4. Register test credentials once — values never touch git
npx windup secret set admin # hidden prompts → .env.local + mapping
# 5. Author a scenario from a rough instruction
npx windup new "log in with the admin account and create an invoice for ACME"
# → e2e/scenarios/create-invoice-acme.json — precise task grounded in
# your real screens, account referenced by name, final verification
# 6. First run — the LLM plans once (~3s, ~$0.002)
npx windup run create-invoice-acme
# PASS create-invoice-acme cache=miss llm_calls=1 ... cost=$0.0024
# 7. Every run after — deterministic replay, zero LLM
npx windup run create-invoice-acme
# PASS create-invoice-acme cache=hit llm_calls=0 total=600ms cost=$0
# 8. Read results like a human, ship reports to CI
npx windup run --all --summary --reporter html
npx windup costs # AI spend: totals, per provider/model
Se uma execução falhar após uma mudança no app, o plano em cache é invalidado e replanejado automaticamente na próxima execução — você edita cenários, não seletores.