agente-testes 0.4.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. agente_testes-0.4.7/.cursor/rules/commit-patterns.mdc +44 -0
  2. agente_testes-0.4.7/.env.example +20 -0
  3. agente_testes-0.4.7/.env.schema +23 -0
  4. agente_testes-0.4.7/.github/workflows/ci.yml +98 -0
  5. agente_testes-0.4.7/.github/workflows/e2e-ai.yml +74 -0
  6. agente_testes-0.4.7/.github/workflows/publish-pypi.yml +30 -0
  7. agente_testes-0.4.7/.gitignore +46 -0
  8. agente_testes-0.4.7/.gitmessage +15 -0
  9. agente_testes-0.4.7/AGENTS.md +65 -0
  10. agente_testes-0.4.7/LICENSE +21 -0
  11. agente_testes-0.4.7/PKG-INFO +180 -0
  12. agente_testes-0.4.7/README.md +156 -0
  13. agente_testes-0.4.7/artifacts/.gitkeep +0 -0
  14. agente_testes-0.4.7/docs/CI-EXTERNAL.md +148 -0
  15. agente_testes-0.4.7/docs/CI.md +87 -0
  16. agente_testes-0.4.7/docs/COMMITS.md +65 -0
  17. agente_testes-0.4.7/docs/CT-03.md +45 -0
  18. agente_testes-0.4.7/docs/CT-04.md +80 -0
  19. agente_testes-0.4.7/docs/CT-05.md +23 -0
  20. agente_testes-0.4.7/docs/FASE-5.md +61 -0
  21. agente_testes-0.4.7/docs/PYPI.md +42 -0
  22. agente_testes-0.4.7/docs/templates/example-dashboard-authenticated.spec.js +13 -0
  23. agente_testes-0.4.7/docs/templates/example-login-invalid.spec.js +17 -0
  24. agente_testes-0.4.7/docs/templates/external-app-ci.yml +131 -0
  25. agente_testes-0.4.7/fixtures/demo-app/.gitignore +4 -0
  26. agente_testes-0.4.7/fixtures/demo-app/dashboard.html +20 -0
  27. agente_testes-0.4.7/fixtures/demo-app/login.html +98 -0
  28. agente_testes-0.4.7/fixtures/demo-app/server.js +67 -0
  29. agente_testes-0.4.7/fixtures/demo-app/settings.html +20 -0
  30. agente_testes-0.4.7/fixtures/nextjs-sonner-fixture/src/app/login/page.tsx +39 -0
  31. agente_testes-0.4.7/fixtures/nextjs-sonner-fixture/src/middleware.ts +13 -0
  32. agente_testes-0.4.7/knowledge/user_preference.txt +4 -0
  33. agente_testes-0.4.7/output/.gitkeep +0 -0
  34. agente_testes-0.4.7/package-lock.json +76 -0
  35. agente_testes-0.4.7/package.json +12 -0
  36. agente_testes-0.4.7/playwright.config.js +28 -0
  37. agente_testes-0.4.7/pyproject.toml +50 -0
  38. agente_testes-0.4.7/run.ps1 +28 -0
  39. agente_testes-0.4.7/scripts/ci_auth_setup.py +36 -0
  40. agente_testes-0.4.7/scripts/hooks/commit-msg +34 -0
  41. agente_testes-0.4.7/scripts/install-git-hooks.ps1 +18 -0
  42. agente_testes-0.4.7/scripts/install-global.ps1 +18 -0
  43. agente_testes-0.4.7/scripts/smoke_tools.py +93 -0
  44. agente_testes-0.4.7/scripts/start_demo.py +22 -0
  45. agente_testes-0.4.7/scripts/verify_healing.py +37 -0
  46. agente_testes-0.4.7/src/agente_testes/__init__.py +0 -0
  47. agente_testes-0.4.7/src/agente_testes/auth_preflight.py +226 -0
  48. agente_testes-0.4.7/src/agente_testes/bundled/.env.example +15 -0
  49. agente_testes-0.4.7/src/agente_testes/bundled/package.json +8 -0
  50. agente_testes-0.4.7/src/agente_testes/bundled/playwright.config.js +28 -0
  51. agente_testes-0.4.7/src/agente_testes/cli.py +564 -0
  52. agente_testes-0.4.7/src/agente_testes/config/agents.yaml +50 -0
  53. agente_testes-0.4.7/src/agente_testes/config/tasks.yaml +154 -0
  54. agente_testes-0.4.7/src/agente_testes/context.py +100 -0
  55. agente_testes-0.4.7/src/agente_testes/crew.py +94 -0
  56. agente_testes-0.4.7/src/agente_testes/limits.py +25 -0
  57. agente_testes-0.4.7/src/agente_testes/login_preflight.py +108 -0
  58. agente_testes-0.4.7/src/agente_testes/main.py +42 -0
  59. agente_testes-0.4.7/src/agente_testes/models/__init__.py +3 -0
  60. agente_testes-0.4.7/src/agente_testes/models/test_scenario.py +75 -0
  61. agente_testes-0.4.7/src/agente_testes/output_formatter.py +127 -0
  62. agente_testes-0.4.7/src/agente_testes/paths.py +70 -0
  63. agente_testes-0.4.7/src/agente_testes/playwright_config.py +31 -0
  64. agente_testes-0.4.7/src/agente_testes/playwright_runtime.py +75 -0
  65. agente_testes-0.4.7/src/agente_testes/port_probe.py +47 -0
  66. agente_testes-0.4.7/src/agente_testes/route_preflight.py +584 -0
  67. agente_testes-0.4.7/src/agente_testes/runtime_setup.py +114 -0
  68. agente_testes-0.4.7/src/agente_testes/security.py +97 -0
  69. agente_testes-0.4.7/src/agente_testes/self_healing.py +711 -0
  70. agente_testes-0.4.7/src/agente_testes/spec_runner.py +107 -0
  71. agente_testes-0.4.7/src/agente_testes/tools/__init__.py +17 -0
  72. agente_testes-0.4.7/src/agente_testes/tools/playwright_tools.py +327 -0
  73. agente_testes-0.4.7/src/agente_testes/tools/repository_tools.py +152 -0
  74. agente_testes-0.4.7/src/agente_testes/workspace_init.py +89 -0
  75. agente_testes-0.4.7/temp_specs/.gitkeep +0 -0
  76. agente_testes-0.4.7/tests/e2e/demo-dashboard-authenticated.spec.js +7 -0
  77. agente_testes-0.4.7/tests/e2e/demo-login-invalid.spec.js +9 -0
  78. agente_testes-0.4.7/tests/test_auth_preflight.py +37 -0
  79. agente_testes-0.4.7/tests/test_login_preflight.py +41 -0
  80. agente_testes-0.4.7/tests/test_playwright_runtime.py +34 -0
  81. agente_testes-0.4.7/tests/test_route_preflight.py +182 -0
  82. agente_testes-0.4.7/tests/test_self_healing.py +112 -0
  83. agente_testes-0.4.7/tests/test_spec_runner.py +30 -0
  84. agente_testes-0.4.7/uv.lock +3846 -0
@@ -0,0 +1,44 @@
1
+ ---
2
+ description: Padrão de commits iuricode + Conventional Commits (emoji, tipo, português)
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Commits — iuricode/padroes-de-commits
7
+
8
+ Referência: https://github.com/iuricode/padroes-de-commits
9
+
10
+ ## Formato obrigatório
11
+
12
+ ```
13
+ :emoji: tipo: Descrição curta
14
+ ```
15
+
16
+ ou, sem emoji:
17
+
18
+ ```
19
+ tipo: Descrição curta
20
+ ```
21
+
22
+ Escopo opcional: `tipo(escopo): …` — ex.: `feat(cli): …`
23
+
24
+ ## Regras
25
+
26
+ - Título curto (≈4 palavras); detalhes no corpo do commit.
27
+ - Português na descrição; imperativo ("Adicionar", "Corrigir", "Atualizar").
28
+ - Tipos: `feat`, `fix`, `docs`, `test`, `refactor`, `perf`, `style`, `chore`, `build`, `ci`, `raw`, `cleanup`, `remove`, `revert`.
29
+ - Emojis comuns: `:sparkles:` feat, `:bug:` fix, `:books:` docs, `:test_tube:` test, `:recycle:` refactor, `:wrench:` chore, `:bricks:` ci.
30
+ - Nunca commitar `.env` ou secrets.
31
+ - Manter `Co-Authored-By: Cursor <noreply@cursor.com>` no rodapé quando o commit for feito pelo agente.
32
+
33
+ ## Exemplos válidos
34
+
35
+ - `:sparkles: feat: Comando init do workspace`
36
+ - `:bug: fix: Corrigir path do spec Playwright`
37
+ - `:books: docs: Atualizar README de instalacao`
38
+
39
+ ## Exemplos inválidos
40
+
41
+ - `feat(cli): add Phase 2` (inglês sem emoji — evitar)
42
+ - `WIP` / `fix stuff` (sem tipo)
43
+
44
+ Guia completo: `docs/COMMITS.md`
@@ -0,0 +1,20 @@
1
+ # Copie para .env e preencha com valores reais (nunca commite .env)
2
+ # cp .env.example .env
3
+
4
+ # --- CrewAI / LLM (obrigatório para `agente-testes run`) ---
5
+ OPENAI_API_KEY=
6
+ # Nome do modelo OpenAI; prefixo openai/ é aplicado automaticamente se omitido
7
+ MODEL=openai/gpt-4o-mini
8
+
9
+ # --- Aplicação sob teste ---
10
+ # URL base do app (preferida; evita conflito com BASE_URL do CrewAI)
11
+ AGENTE_TESTES_APP_URL=http://localhost:3000
12
+ # Fallback legado; o CLI também aceita --url
13
+ BASE_URL=http://localhost:3000
14
+
15
+ # --- Pedido padrão (opcional; sobrescrito pelo argumento `run`) ---
16
+ USER_REQUEST=
17
+
18
+ # --- Credenciais E2E (opcional; referenciadas nos scripts Playwright gerados) ---
19
+ TEST_USER=
20
+ TEST_PASSWORD=
@@ -0,0 +1,23 @@
1
+ # Schema Varlock — valores reais ficam em .env (gitignored)
2
+ # @defaultSensitive=true @defaultRequired=infer
3
+
4
+ # @type=string(startsWith=sk_) @required @sensitive
5
+ OPENAI_API_KEY=
6
+
7
+ # @type=string @sensitive=false
8
+ MODEL=openai/gpt-4o-mini
9
+
10
+ # @type=url @sensitive=false
11
+ AGENTE_TESTES_APP_URL=http://localhost:3000
12
+
13
+ # @type=url @sensitive=false
14
+ BASE_URL=http://localhost:3000
15
+
16
+ # @type=string @sensitive=false
17
+ USER_REQUEST=
18
+
19
+ # @type=string @sensitive
20
+ TEST_USER=
21
+
22
+ # @type=string @sensitive
23
+ TEST_PASSWORD=
@@ -0,0 +1,98 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master, main]
6
+ pull_request:
7
+ branches: [master, main]
8
+
9
+ concurrency:
10
+ group: ci-${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ smoke-and-deterministic-e2e:
15
+ runs-on: ubuntu-latest
16
+ timeout-minutes: 15
17
+
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Setup Node.js
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: "20"
26
+ cache: npm
27
+
28
+ - name: Setup uv
29
+ uses: astral-sh/setup-uv@v5
30
+ with:
31
+ enable-cache: true
32
+
33
+ - name: Install Python dependencies
34
+ run: uv sync
35
+
36
+ - name: Install Playwright (npm + Chromium)
37
+ run: |
38
+ npm ci
39
+ npx playwright install --with-deps chromium
40
+
41
+ - name: Start demo app
42
+ run: |
43
+ node fixtures/demo-app/server.js &
44
+ for i in $(seq 1 30); do
45
+ if curl -fsS http://localhost:3000/login > /dev/null; then
46
+ echo "Demo app ready"
47
+ exit 0
48
+ fi
49
+ sleep 1
50
+ done
51
+ echo "Demo app failed to start"
52
+ exit 1
53
+
54
+ - name: Smoke tools (sem LLM)
55
+ run: uv run python scripts/smoke_tools.py
56
+
57
+ - name: Unit tests (sem LLM)
58
+ run: uv run --group dev pytest tests/ -q
59
+
60
+ - name: Verify self-healing (sem LLM)
61
+ run: uv run python scripts/verify_healing.py
62
+
63
+ - name: Exec spec versionado — login inválido (determinístico)
64
+ run: |
65
+ uv run agente-testes exec tests/e2e/demo-login-invalid.spec.js \
66
+ --repo fixtures/demo-app \
67
+ --url http://localhost:3000
68
+
69
+ - name: Gerar storageState (auth setup)
70
+ env:
71
+ TEST_USER: usuario-demo@exemplo.com
72
+ TEST_PASSWORD: senha-demo
73
+ run: |
74
+ uv run agente-testes auth-setup \
75
+ --repo fixtures/demo-app \
76
+ --url http://localhost:3000
77
+
78
+ - name: Exec spec versionado — dashboard autenticado
79
+ env:
80
+ TEST_USER: usuario-demo@exemplo.com
81
+ TEST_PASSWORD: senha-demo
82
+ AGENTE_TESTES_STORAGE_STATE: fixtures/demo-app/.agente-testes/artifacts/auth-state.json
83
+ run: |
84
+ uv run agente-testes exec tests/e2e/demo-dashboard-authenticated.spec.js \
85
+ --repo fixtures/demo-app \
86
+ --url http://localhost:3000
87
+
88
+ - name: Upload artefatos E2E
89
+ if: always()
90
+ uses: actions/upload-artifact@v4
91
+ with:
92
+ name: agente-testes-artifacts
93
+ path: |
94
+ fixtures/demo-app/.agente-testes/output/
95
+ fixtures/demo-app/.agente-testes/artifacts/
96
+ fixtures/demo-app/.agente-testes/temp_specs/
97
+ retention-days: 14
98
+ if-no-files-found: warn
@@ -0,0 +1,74 @@
1
+ name: E2E com IA
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ request:
7
+ description: Pedido em linguagem natural
8
+ required: true
9
+ default: "Validar login com e-mail inválido na rota /login"
10
+ base_url:
11
+ description: URL base do app
12
+ required: false
13
+ default: "http://localhost:3000"
14
+
15
+ jobs:
16
+ ai-e2e:
17
+ runs-on: ubuntu-latest
18
+ timeout-minutes: 20
19
+
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: "20"
28
+ cache: npm
29
+
30
+ - name: Setup uv
31
+ uses: astral-sh/setup-uv@v5
32
+ with:
33
+ enable-cache: true
34
+
35
+ - name: Install Python dependencies
36
+ run: uv sync
37
+
38
+ - name: Install Playwright (npm + Chromium)
39
+ run: |
40
+ npm ci
41
+ npx playwright install --with-deps chromium
42
+
43
+ - name: Start demo app
44
+ run: |
45
+ node fixtures/demo-app/server.js &
46
+ for i in $(seq 1 30); do
47
+ if curl -fsS http://localhost:3000/login > /dev/null; then
48
+ echo "Demo app ready"
49
+ exit 0
50
+ fi
51
+ sleep 1
52
+ done
53
+ echo "Demo app failed to start"
54
+ exit 1
55
+
56
+ - name: Executar agente-testes run (IA)
57
+ env:
58
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
59
+ run: |
60
+ uv run agente-testes run "${{ inputs.request }}" \
61
+ --repo fixtures/demo-app \
62
+ --url "${{ inputs.base_url }}"
63
+
64
+ - name: Upload artefatos E2E (IA)
65
+ if: always()
66
+ uses: actions/upload-artifact@v4
67
+ with:
68
+ name: agente-testes-ai-artifacts
69
+ path: |
70
+ fixtures/demo-app/.agente-testes/output/
71
+ fixtures/demo-app/.agente-testes/artifacts/
72
+ fixtures/demo-app/.agente-testes/temp_specs/
73
+ retention-days: 14
74
+ if-no-files-found: warn
@@ -0,0 +1,30 @@
1
+ name: Publish PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ id-token: write
11
+
12
+ jobs:
13
+ publish:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v5
20
+ with:
21
+ enable-cache: true
22
+
23
+ - name: Build package
24
+ run: uv build
25
+
26
+ - name: Publish to PyPI (Trusted Publisher)
27
+ uses: pypa/gh-action-pypi-publish@release/v1
28
+ with:
29
+ password: ${{ secrets.PYPI_API_TOKEN }}
30
+ skip-existing: true
@@ -0,0 +1,46 @@
1
+ # Secrets — nunca commitar
2
+ .env
3
+ .env.*
4
+ !.env.example
5
+ !.env.schema
6
+
7
+ # Python
8
+ __pycache__/
9
+ *.py[cod]
10
+ *$py.class
11
+ .venv/
12
+ .pytest_cache/
13
+ *.egg-info/
14
+ dist/
15
+ build/
16
+
17
+ # Node / Playwright
18
+ node_modules/
19
+ test-results/
20
+ playwright-report/
21
+ blob-report/
22
+
23
+ # Artefatos de execução (pacote legado, fallback sem workspace)
24
+ output/*
25
+ !output/.gitkeep
26
+ artifacts/*
27
+ !artifacts/.gitkeep
28
+ temp_specs/*
29
+ !temp_specs/.gitkeep
30
+
31
+ # Workspace por projeto alvo (criado em <repo>/.agente-testes/)
32
+ **/.agente-testes/
33
+
34
+ # Logs e temporários
35
+ *.log
36
+ npm-debug.log*
37
+ yarn-error.log*
38
+ *.tmp
39
+ *.temp
40
+ *.cache
41
+ *.swp
42
+
43
+ # SO / IDE
44
+ .DS_Store
45
+ Thumbs.db
46
+ desktop.ini
@@ -0,0 +1,15 @@
1
+ # :emoji: tipo: Descricao curta (max. ~4 palavras no titulo)
2
+ #
3
+ # Tipos: feat | fix | docs | test | build | perf | style | refactor | chore | ci | raw | cleanup | remove
4
+ #
5
+ # Exemplos:
6
+ # :sparkles: feat: Pagina de login
7
+ # :bug: fix: Corrigir seletor do formulario
8
+ # :books: docs: Atualizar README
9
+ # :test_tube: test: Cobrir self-healing
10
+ #
11
+ # Corpo (opcional): impacto, motivo, instrucoes futuras.
12
+ # Rodape (opcional): Refs #123 | Reviewed-by: Nome
13
+ #
14
+ # Guia: docs/COMMITS.md
15
+ # Referencia: https://github.com/iuricode/padroes-de-commits
@@ -0,0 +1,65 @@
1
+ # Agent Instructions
2
+
3
+ CrewAI E2E: linguagem natural → Playwright → relatório. Ver `README.md` para setup.
4
+
5
+ ## Package Manager
6
+
7
+ - **Python:** `uv sync` na raiz do projeto
8
+ - **Node (Playwright):** `npm install` + `npx playwright install chromium`
9
+
10
+ ## File-Scoped Commands
11
+
12
+ | Task | Command |
13
+ |------|---------|
14
+ | Setup global | `uv tool install .` + `agente-testes setup` |
15
+ | Doctor | `uv run agente-testes doctor` |
16
+ | Run crew | `uv run agente-testes run "pedido"` |
17
+ | Exec spec (CI) | `uv run agente-testes exec tests/e2e/demo-login-invalid.spec.js --repo fixtures/demo-app` |
18
+ | Smoke (sem LLM) | `uv run python scripts/smoke_tools.py` |
19
+ | Demo app | `uv run python scripts/start_demo.py` |
20
+
21
+ ## Key Conventions
22
+
23
+ - Working dir alvo: passe `--repo` ou rode de dentro do projeto testado
24
+ - Workspace de execução: `<repo-alvo>/.agente-testes/` (gitignored)
25
+ - URL do app: `AGENTE_TESTES_APP_URL` (não use `BASE_URL` para CrewAI LLM)
26
+ - Secrets: só em `.env` local; validar com `varlock load` se instalado
27
+ - Nunca ler/commitar `.env`; schema em `.env.schema`
28
+ - Tools sensíveis: `src/agente_testes/security.py` (denylist + redaction)
29
+ - Config crew: `src/agente_testes/config/{agents,tasks}.yaml`, `crew.py`
30
+
31
+ ## Commits
32
+
33
+ Padrão [iuricode/padroes-de-commits](https://github.com/iuricode/padroes-de-commits):
34
+
35
+ ```
36
+ :emoji: tipo: Descrição curta
37
+ ```
38
+
39
+ Ex.: `:sparkles: feat: Comando init do workspace` — ver `docs/COMMITS.md`.
40
+
41
+ Hook local: `.\scripts\install-git-hooks.ps1`
42
+
43
+ ## Commit Attribution
44
+
45
+ AI commits MUST include:
46
+
47
+ ```
48
+ Co-Authored-By: Cursor <noreply@cursor.com>
49
+ ```
50
+
51
+ ## Structure
52
+
53
+ ```
54
+ src/agente_testes/cli.py Entrada CLI
55
+ src/agente_testes/crew.py Agentes e tasks
56
+ src/agente_testes/tools/ Playwright + repositório
57
+ src/agente_testes/security.py Hardening de secrets
58
+ fixtures/demo-app/ Demo HTTP :3000
59
+ ```
60
+
61
+ ## Do Not
62
+
63
+ - Commitar `.env`, `.venv/`, `node_modules/`, `test-results/`, artefatos em `output/`/`artifacts/`/`temp_specs/`
64
+ - Hardcodar API keys ou senhas em código ou specs
65
+ - Usar `os.environ.copy()` em subprocessos — usar `minimal_playwright_env()`
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BrunooooPaiva
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: agente-testes
3
+ Version: 0.4.7
4
+ Summary: CLI de testes E2E com IA: linguagem natural vira Playwright executável.
5
+ Project-URL: Homepage, https://github.com/BrunooooPaiva/agente-testes
6
+ Project-URL: Repository, https://github.com/BrunooooPaiva/agente-testes
7
+ Project-URL: Issues, https://github.com/BrunooooPaiva/agente-testes/issues
8
+ Project-URL: Documentation, https://github.com/BrunooooPaiva/agente-testes#readme
9
+ Project-URL: Changelog, https://github.com/BrunooooPaiva/agente-testes/releases
10
+ Author: BrunooooPaiva
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: cli,crewai,e2e,playwright,qa,testing
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Topic :: Software Development :: Testing
20
+ Requires-Python: <3.14,>=3.10
21
+ Requires-Dist: crewai[tools]==1.14.5a2
22
+ Requires-Dist: python-dotenv>=1.0.0
23
+ Description-Content-Type: text/markdown
24
+
25
+ # Agente Testes
26
+
27
+ CLI que transforma pedidos em **linguagem natural** em testes **Playwright** executáveis, com relatório e evidências — powered by CrewAI.
28
+
29
+ Repositório: https://github.com/BrunooooPaiva/agente-testes
30
+
31
+ ## Instalação global (recomendado)
32
+
33
+ **Pré-requisitos:** Python 3.10–3.13, Node.js 18+ (`npm`/`npx` no PATH), chave OpenAI.
34
+
35
+ ### Opção A — PyPI (recomendado)
36
+
37
+ ```powershell
38
+ pip install --pre agente-testes
39
+ agente-testes setup
40
+ ```
41
+
42
+ Com [uv](https://docs.astral.sh/uv/):
43
+
44
+ ```powershell
45
+ uv tool install --pre agente-testes
46
+ agente-testes setup
47
+ ```
48
+
49
+ ### Opção B — `uv tool` a partir do repositório
50
+
51
+ ```powershell
52
+ cd agente_testes
53
+ uv tool install --prerelease=allow .
54
+ agente-testes setup
55
+ ```
56
+
57
+ ### Opção C — repositório Git
58
+
59
+ ```powershell
60
+ pip install "agente-testes @ git+https://github.com/BrunooooPaiva/agente-testes.git"
61
+ agente-testes setup
62
+ ```
63
+
64
+ O comando `setup` cria `~/.agente-testes/.env`, instala `@playwright/test` e o Chromium no runtime global.
65
+
66
+ Edite a API key:
67
+
68
+ ```powershell
69
+ notepad $env:USERPROFILE\.agente-testes\.env
70
+ ```
71
+
72
+ ## Fluxo CLI (3 passos)
73
+
74
+ ```powershell
75
+ # 1. Entre no projeto que quer testar
76
+ cd C:\projetos\meu-app
77
+
78
+ # 2. (opcional) prepara workspace local
79
+ agente-testes init
80
+
81
+ # 3. Com o app rodando (npm run dev), peça o teste
82
+ agente-testes run "Validar login com e-mail inválido na rota /login"
83
+ ```
84
+
85
+ Saída esperada: status ✅/❌, caminhos do relatório, spec e artefatos em `.agente-testes/`.
86
+
87
+ ## Comandos
88
+
89
+ | Comando | Descrição |
90
+ |---------|-----------|
91
+ | `agente-testes run "<pedido>"` | Fluxo completo com IA: análise → Playwright → execução → relatório |
92
+ | `agente-testes exec <spec>` | Executa spec versionado **sem IA** (ideal para CI) |
93
+ | `agente-testes init` | Cria `.agente-testes/` e entradas no `.gitignore` do projeto |
94
+ | `agente-testes doctor` | Valida Python, API key, npx, Playwright, URL e portas locais |
95
+ | `agente-testes setup` | Instala runtime Playwright (uso global) |
96
+ | `agente-testes --verbose run ...` | Logs completos do CrewAI |
97
+
98
+ Exemplo determinístico (CT-02 versionado):
99
+
100
+ ```powershell
101
+ agente-testes exec tests/e2e/demo-login-invalid.spec.js --repo fixtures/demo-app
102
+ ```
103
+
104
+ Flags úteis do `run`: `--repo`, `--url`, `--skip-url-check`.
105
+
106
+ ## Desenvolvimento local
107
+
108
+ ```powershell
109
+ cd agente_testes
110
+ uv sync
111
+ npm install
112
+ npx playwright install chromium
113
+ copy .env.example .env
114
+ # Edite OPENAI_API_KEY em .env
115
+
116
+ uv run agente-testes doctor
117
+ uv run python scripts/start_demo.py # http://localhost:3000/login
118
+ ```
119
+
120
+ Demo E2E:
121
+
122
+ ```powershell
123
+ cd fixtures\demo-app
124
+ uv run agente-testes init
125
+ uv run agente-testes run "Validar login com e-mail inválido na rota /login"
126
+ ```
127
+
128
+ Smoke (sem LLM):
129
+
130
+ ```powershell
131
+ uv run python scripts/smoke_tools.py
132
+ ```
133
+
134
+ ## Configuração
135
+
136
+ | Onde | Variável | Uso |
137
+ |------|----------|-----|
138
+ | `~/.agente-testes/.env` | `OPENAI_API_KEY` | Obrigatória (instalação global) |
139
+ | Projeto alvo `.env` | `AGENTE_TESTES_APP_URL` | URL do app sob teste |
140
+ | CLI | `--url` | Sobrescreve URL na execução |
141
+
142
+ Artefatos ficam em `<projeto>/.agente-testes/` (`output/`, `artifacts/`, `temp_specs/`).
143
+
144
+ ## Estrutura
145
+
146
+ ```
147
+ src/agente_testes/ CLI, crew, tools, self-healing
148
+ fixtures/demo-app/ App HTTP de demonstração (:3000)
149
+ scripts/ smoke, demo, hooks de commit
150
+ docs/COMMITS.md Padrão de commits do projeto
151
+ ```
152
+
153
+ ## Segurança
154
+
155
+ - Nunca commite `.env`; use `.env.example` / `~/.agente-testes/.env`
156
+ - Tools bloqueiam leitura de secrets no repositório alvo
157
+ - Subprocess Playwright usa env mínimo (sem `OPENAI_API_KEY`)
158
+
159
+ ## Validação em app externo (CT-05, só local)
160
+
161
+ 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`](docs/CT-05.md).
162
+
163
+ Padrões Next.js + toast Sonner: fixture `fixtures/nextjs-sonner-fixture/`.
164
+
165
+ ## Fase 5 — qualidade
166
+
167
+ - Pré-leitura de login antes da IA (`login_preflight`)
168
+ - Healing proativo ao salvar specs
169
+ - Testes: `uv run --group dev pytest tests/ -q`
170
+
171
+ Detalhes: [`docs/FASE-5.md`](docs/FASE-5.md)
172
+
173
+ ## CI (GitHub Actions)
174
+
175
+ - **Automático em PR/push:** smoke + pytest + `exec` (sem custo de API) — ver [`docs/CI.md`](docs/CI.md)
176
+ - **Manual com IA:** workflow `E2E com IA` + secret `OPENAI_API_KEY` — ver [`docs/CI.md#secret-obrigatório`](docs/CI.md)
177
+
178
+ ## Licença
179
+
180
+ MIT