Skip to main content

CLI de testes E2E com IA: linguagem natural vira Playwright executável.

Project description

Agente Testes

CLI que transforma pedidos em linguagem natural em testes Playwright executáveis, com relatório e evidências — powered by 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 CLI (3 passos)

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

# 2. (opcional) prepara workspace local
agente-testes init

# 3. Com o app rodando (npm run dev), peça o teste
agente-testes run "Validar login com e-mail inválido na rota /login"

Saída esperada: status ✅/❌, caminhos do relatório, spec e artefatos em .agente-testes/.

Comandos

Comando Descrição
agente-testes run "<pedido>" Fluxo completo com IA: análise → Playwright → execução → relatório
agente-testes exec <spec> Executa spec versionado sem IA (ideal para CI)
agente-testes init Cria .agente-testes/ e entradas no .gitignore do projeto
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

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
fixtures/demo-app/   App HTTP de demonstração (:3000)
scripts/             smoke, demo, hooks de commit
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

CI (GitHub Actions)

Licença

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agente_testes-0.4.7.tar.gz (294.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agente_testes-0.4.7-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

Details for the file agente_testes-0.4.7.tar.gz.

File metadata

  • Download URL: agente_testes-0.4.7.tar.gz
  • Upload date:
  • Size: 294.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agente_testes-0.4.7.tar.gz
Algorithm Hash digest
SHA256 3523c1914ab4d436e5b68b702c0d0fbab24404f143ccca7a7ad55007aeba5667
MD5 1159120e9bb4d307aed9143c55ef1593
BLAKE2b-256 59bb93617829b427052e44d3643baf0e2b02c5d13acdbe8882df1b6601f73110

See more details on using hashes here.

Provenance

The following attestation bundles were made for agente_testes-0.4.7.tar.gz:

Publisher: publish-pypi.yml on BrunooooPaiva/agente-testes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agente_testes-0.4.7-py3-none-any.whl.

File metadata

  • Download URL: agente_testes-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 54.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agente_testes-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 31d9cc02ea821fd792cffe83208536c97a8870b1fb092bfc4c981f2f55bb28a5
MD5 55dcf479048eade9c1b8d26b15d058dd
BLAKE2b-256 928473fd078e4a2eaa51ed671e3a6d6f4c730789c55600653df39e656f550cd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for agente_testes-0.4.7-py3-none-any.whl:

Publisher: publish-pypi.yml on BrunooooPaiva/agente-testes

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page