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.11.tar.gz (304.2 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.11-py3-none-any.whl (61.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agente_testes-0.4.11.tar.gz
  • Upload date:
  • Size: 304.2 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.11.tar.gz
Algorithm Hash digest
SHA256 a291f276276448786ff3b38386012d09142b66ec48d41a4f15d3b57fecf69060
MD5 d6d5215d1e4a083c7db057046e4efd25
BLAKE2b-256 07e4227b13986fd45abf007653ce38e59e9a5899d2be5bfe56456975c29d0ee6

See more details on using hashes here.

Provenance

The following attestation bundles were made for agente_testes-0.4.11.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.11-py3-none-any.whl.

File metadata

  • Download URL: agente_testes-0.4.11-py3-none-any.whl
  • Upload date:
  • Size: 61.9 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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 bededb9ff0e01a4b7265d62b957da5a7600ebd24ec8f5cead5cab35f843d491f
MD5 49ab3a94b994120691e422ce7a802b5a
BLAKE2b-256 eafe8d682b93bd55c29432f827ebfb2e4e54730fc686b8b56e6882714f9e23c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for agente_testes-0.4.11-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