Skip to main content

Agente Testes

CLI para gravar fluxos E2E (Playwright codegen) e executar specs em segundos — com opção de exploração via linguagem natural e CrewAI.

Repositório: https://github.com/BrunooooPaiva/agente-testes

Instalação global (recomendado)

Pré-requisitos: Python 3.10–3.13, Node.js 18+ (npm/npx no PATH), chave OpenAI.

Opção A — PyPI (recomendado)

pip install --pre agente-testes
agente-testes setup

Com uv:

uv tool install --pre agente-testes
agente-testes setup

Opção B — uv tool a partir do repositório

cd agente_testes
uv tool install --prerelease=allow .
agente-testes setup

Opção C — repositório Git

pip install "agente-testes @ git+https://github.com/BrunooooPaiva/agente-testes.git"
agente-testes setup

O comando setup cria ~/.agente-testes/.env, instala @playwright/test e o Chromium no runtime global.

Edite a API key:

notepad $env:USERPROFILE\.agente-testes\.env

Fluxo principal (painel ou CLI)

# 1. Entre no projeto que quer testar
cd C:\projetos\meu-app

# 2. Prepara workspace (tests/e2e/ + .agente-testes/)
agente-testes init

# 3. Com o app rodando (npm run dev), abra o painel web
agente-testes ui --url http://localhost:3000
# → http://127.0.0.1:9323 (gravar, executar, evidências)

# Alternativa CLI:
agente-testes record --url http://localhost:3000
agente-testes exec tests/e2e/recorded-YYYYMMDD-HHMMSS.spec.js --url http://localhost:3000
agente-testes list

Rotas autenticadas: agente-testes auth-setup e depois record --auth ou exec com AGENTE_TESTES_STORAGE_STATE. Specs que gravam login devem rodar com --clear-storage ou sem a variável de sessão.

Exploração com IA (opcional)

agente-testes run "Validar login com e-mail inválido na rota /login"

Use run para descobrir cenários; use record + exec para repetir com custo zero de API.

Comandos

Comando Descrição
agente-testes ui Painel web local (127.0.0.1:9323) — gravar, executar, evidências
agente-testes record Grava fluxo com Playwright codegen → tests/e2e/*.spec.js
agente-testes exec <spec> Executa spec sem IA (replay em segundos)
agente-testes list Lista specs em tests/e2e/ com último status
agente-testes auth-setup Login determinístico → auth-state.json
agente-testes run "<pedido>" Exploração com IA (CrewAI) — mais lento, usa API
agente-testes init Cria tests/e2e/, .agente-testes/ e .gitignore
agente-testes doctor Valida Python, API key, npx, Playwright, URL e portas locais
agente-testes setup Instala runtime Playwright (uso global)
agente-testes --verbose run ... Logs completos do CrewAI

Flags do exec: --video on|retain-on-failure|off, --screenshot on|only-on-failure|off, --trace on|retain-on-failure|off, --clear-storage.

Exemplo determinístico (CT-02 versionado):

agente-testes exec tests/e2e/demo-login-invalid.spec.js --repo fixtures/demo-app

Flags úteis do run: --repo, --url, --skip-url-check.

Desenvolvimento local

cd agente_testes
uv sync
npm install
npx playwright install chromium
copy .env.example .env
# Edite OPENAI_API_KEY em .env

uv run agente-testes doctor
uv run python scripts/start_demo.py   # http://localhost:3000/login

Demo E2E:

cd fixtures\demo-app
uv run agente-testes init
uv run agente-testes run "Validar login com e-mail inválido na rota /login"

Smoke (sem LLM):

uv run python scripts/smoke_tools.py

Configuração

Onde Variável Uso
~/.agente-testes/.env OPENAI_API_KEY Obrigatória (instalação global)
Projeto alvo .env AGENTE_TESTES_APP_URL URL do app sob teste
CLI --url Sobrescreve URL na execução

Artefatos ficam em <projeto>/.agente-testes/ (output/, artifacts/, temp_specs/).

Estrutura

src/agente_testes/       CLI, crew, tools, self-healing
src/agente_testes/ui/    Painel web (server, API, static/)
fixtures/demo-app/       App HTTP de demonstração (:3000)
scripts/                 smoke, demo, hooks de commit
docs/ESCOPO_PROJETO.md   Escopo e roadmap por fase
docs/FASE-8.md           Painel web v0.6.0
docs/COMMITS.md          Padrão de commits do projeto

Segurança

  • Nunca commite .env; use .env.example / ~/.agente-testes/.env
  • Tools bloqueiam leitura de secrets no repositório alvo
  • Subprocess Playwright usa env mínimo (sem OPENAI_API_KEY)

Validação em app externo (CT-05, só local)

Apps reais na sua máquina podem ser usados para teste manual (agente-testes run com --repo implícito via cwd). Isso não faz parte do CI nem dos specs versionados deste pacote. Guia: docs/CT-05.md.

Padrões Next.js + toast Sonner: fixture fixtures/nextjs-sonner-fixture/.

Fase 5 — qualidade

  • Pré-leitura de login antes da IA (login_preflight)
  • Healing proativo ao salvar specs
  • Testes: uv run --group dev pytest tests/ -q

Detalhes: docs/FASE-5.md

Fase 8 — painel web (v0.6.0)

  • agente-testes ui — gravar, executar specs, auth-setup, relatório e evidências
  • agente-testes list — catálogo com último status
  • exec com --video, --screenshot, --trace, --clear-storage
  • Navegador fecha automaticamente após record (Windows)

Detalhes: docs/FASE-8.md · Escopo: docs/ESCOPO_PROJETO.md

CI (GitHub Actions)

Licença

MIT

Metadata

Release files for agente-testes 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agente-testes 0.6.0
File Size Uploaded
agente_testes-0.6.0.tar.gz 323.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agente-testes 0.6.0
File Interpreter ABI Platform
agente_testes-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 403.3 kB

Release files / agente_testes-0.6.0.tar.gz

Download URL agente_testes-0.6.0.tar.gz
Size 323.3 kB
Tags Source
SHA-256 checksum
How to use checksums
98cd38113866a697e25c6c641eed8ef15b611e7fef45216cb1021732aaa726fd
BLAKE2b-256 checksum
How to use checksums
7c4b381fc09973b46e0d80a197f726744df135cdf6073b114c226a82fc7c9828
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 12, 2026.

Transparency log

Release files / agente_testes-0.6.0-py3-none-any.whl

Download URL agente_testes-0.6.0-py3-none-any.whl
Size 80.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d04d609c82dc6a6acda80d0df2de53c1dcb273948699bdbc33b5da5f73a66dc4
BLAKE2b-256 checksum
How to use checksums
22266ca28a6e30389d9458c4493ec156683f14983a6624102d24b9c1a96be05a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.11

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page