@onion-ai/cli 1.0.0-beta.1
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.
- package/LICENSE +21 -0
- package/README.md +529 -0
- package/bin/onion.js +6 -0
- package/framework/CLAUDE.md +45 -0
- package/framework/VERSION +1 -0
- package/framework/agents/compliance/iso-22301-specialist.md +985 -0
- package/framework/agents/compliance/iso-27001-specialist.md +713 -0
- package/framework/agents/compliance/pmbok-specialist.md +739 -0
- package/framework/agents/compliance/security-information-master.md +907 -0
- package/framework/agents/compliance/soc2-specialist.md +889 -0
- package/framework/agents/deployment/docker-specialist.md +1192 -0
- package/framework/agents/development/c4-architecture-specialist.md +745 -0
- package/framework/agents/development/c4-documentation-specialist.md +695 -0
- package/framework/agents/development/clickup-specialist.md +396 -0
- package/framework/agents/development/cursor-specialist.md +277 -0
- package/framework/agents/development/docs-reverse-engineer.md +417 -0
- package/framework/agents/development/gamma-api-specialist.md +1168 -0
- package/framework/agents/development/gitflow-specialist.md +1206 -0
- package/framework/agents/development/linux-security-specialist.md +675 -0
- package/framework/agents/development/mermaid-specialist.md +515 -0
- package/framework/agents/development/nodejs-specialist.md +672 -0
- package/framework/agents/development/nx-migration-specialist.md +866 -0
- package/framework/agents/development/nx-monorepo-specialist.md +618 -0
- package/framework/agents/development/postgres-specialist.md +1123 -0
- package/framework/agents/development/react-developer.md +131 -0
- package/framework/agents/development/runflow-specialist.md +277 -0
- package/framework/agents/development/system-documentation-orchestrator.md +1387 -0
- package/framework/agents/development/task-specialist.md +677 -0
- package/framework/agents/git/branch-code-reviewer.md +225 -0
- package/framework/agents/git/branch-documentation-writer.md +161 -0
- package/framework/agents/git/branch-metaspec-checker.md +67 -0
- package/framework/agents/git/branch-test-planner.md +176 -0
- package/framework/agents/meta/agent-creator-specialist.md +1266 -0
- package/framework/agents/meta/command-creator-specialist.md +1676 -0
- package/framework/agents/meta/metaspec-gate-keeper.md +240 -0
- package/framework/agents/meta/onion.md +824 -0
- package/framework/agents/product/branding-positioning-specialist.md +1029 -0
- package/framework/agents/product/extract-meeting-specialist.md +394 -0
- package/framework/agents/product/meeting-consolidator.md +482 -0
- package/framework/agents/product/pain-price-specialist.md +508 -0
- package/framework/agents/product/presentation-orchestrator.md +1190 -0
- package/framework/agents/product/product-agent.md +201 -0
- package/framework/agents/product/story-points-framework-specialist.md +538 -0
- package/framework/agents/product/storytelling-business-specialist.md +890 -0
- package/framework/agents/research/research-agent.md +292 -0
- package/framework/agents/review/code-reviewer.md +154 -0
- package/framework/agents/review/corporate-compliance-specialist.md +370 -0
- package/framework/agents/testing/test-agent.md +424 -0
- package/framework/agents/testing/test-engineer.md +294 -0
- package/framework/agents/testing/test-planner.md +117 -0
- package/framework/commands/common/prompts/README.md +208 -0
- package/framework/commands/common/prompts/clickup-patterns.md +144 -0
- package/framework/commands/common/prompts/code-review-checklist.md +168 -0
- package/framework/commands/common/prompts/git-workflow-patterns.md +235 -0
- package/framework/commands/common/prompts/output-formats.md +240 -0
- package/framework/commands/common/prompts/technical.md +194 -0
- package/framework/commands/common/templates/abstraction-template.md +399 -0
- package/framework/commands/common/templates/agent-template.md +353 -0
- package/framework/commands/common/templates/business_context_template.md +748 -0
- package/framework/commands/common/templates/command-template.md +273 -0
- package/framework/commands/common/templates/technical_context_template.md +526 -0
- package/framework/commands/design/screen-spec.md +505 -0
- package/framework/commands/development/runflow-dev.md +465 -0
- package/framework/commands/docs/build-business-docs.md +299 -0
- package/framework/commands/docs/build-compliance-docs.md +143 -0
- package/framework/commands/docs/build-index.md +119 -0
- package/framework/commands/docs/build-tech-docs.md +221 -0
- package/framework/commands/docs/docs-health.md +141 -0
- package/framework/commands/docs/help.md +278 -0
- package/framework/commands/docs/refine-vision.md +25 -0
- package/framework/commands/docs/reverse-consolidate.md +158 -0
- package/framework/commands/docs/sync-sessions.md +354 -0
- package/framework/commands/docs/validate-docs.md +157 -0
- package/framework/commands/engineer/bump.md +29 -0
- package/framework/commands/engineer/docs.md +11 -0
- package/framework/commands/engineer/hotfix.md +183 -0
- package/framework/commands/engineer/plan.md +85 -0
- package/framework/commands/engineer/pr-update.md +219 -0
- package/framework/commands/engineer/pr.md +117 -0
- package/framework/commands/engineer/pre-pr.md +81 -0
- package/framework/commands/engineer/start.md +254 -0
- package/framework/commands/engineer/validate-phase-sync.md +134 -0
- package/framework/commands/engineer/warm-up.md +20 -0
- package/framework/commands/engineer/work.md +155 -0
- package/framework/commands/f/company-context-extractor.md +93 -0
- package/framework/commands/f/process-meetings.md +103 -0
- package/framework/commands/git/README.md +682 -0
- package/framework/commands/git/code-review.md +213 -0
- package/framework/commands/git/fast-commit.md +43 -0
- package/framework/commands/git/feature/finish.md +88 -0
- package/framework/commands/git/feature/publish.md +89 -0
- package/framework/commands/git/feature/start.md +172 -0
- package/framework/commands/git/help.md +100 -0
- package/framework/commands/git/hotfix/finish.md +96 -0
- package/framework/commands/git/hotfix/start.md +92 -0
- package/framework/commands/git/init.md +111 -0
- package/framework/commands/git/release/finish.md +96 -0
- package/framework/commands/git/release/start.md +93 -0
- package/framework/commands/git/sync.md +199 -0
- package/framework/commands/meta/all-tools.md +58 -0
- package/framework/commands/meta/analyze-complex-problem.md +186 -0
- package/framework/commands/meta/create-abstraction.md +882 -0
- package/framework/commands/meta/create-agent-express.md +98 -0
- package/framework/commands/meta/create-agent.md +210 -0
- package/framework/commands/meta/create-command.md +203 -0
- package/framework/commands/meta/create-knowledge-base.md +143 -0
- package/framework/commands/meta/create-task-structure.md +150 -0
- package/framework/commands/meta/setup-integration.md +274 -0
- package/framework/commands/onion.md +169 -0
- package/framework/commands/product/README.md +249 -0
- package/framework/commands/product/analyze-pain-price.md +694 -0
- package/framework/commands/product/branding.md +458 -0
- package/framework/commands/product/check.md +46 -0
- package/framework/commands/product/checklist-sync.md +239 -0
- package/framework/commands/product/collect.md +95 -0
- package/framework/commands/product/consolidate-meetings.md +291 -0
- package/framework/commands/product/estimate.md +511 -0
- package/framework/commands/product/extract-meeting.md +226 -0
- package/framework/commands/product/feature.md +416 -0
- package/framework/commands/product/light-arch.md +82 -0
- package/framework/commands/product/presentation.md +174 -0
- package/framework/commands/product/refine.md +161 -0
- package/framework/commands/product/spec.md +79 -0
- package/framework/commands/product/task-check.md +378 -0
- package/framework/commands/product/task.md +603 -0
- package/framework/commands/product/validate-task.md +325 -0
- package/framework/commands/product/warm-up.md +24 -0
- package/framework/commands/quick/analisys.md +17 -0
- package/framework/commands/test/e2e.md +377 -0
- package/framework/commands/test/integration.md +508 -0
- package/framework/commands/test/unit.md +381 -0
- package/framework/commands/validate/collab/pair-testing.md +657 -0
- package/framework/commands/validate/collab/three-amigos.md +534 -0
- package/framework/commands/validate/qa-points/estimate.md +660 -0
- package/framework/commands/validate/test-strategy/analyze.md +1201 -0
- package/framework/commands/validate/test-strategy/create.md +411 -0
- package/framework/commands/validate/workflow.md +370 -0
- package/framework/commands/warm-up.md +20 -0
- package/framework/docs/architecture/acoplamento-clickup-problema-analise.md +468 -0
- package/framework/docs/architecture/desacoplamento-roadmap.md +364 -0
- package/framework/docs/architecture/validacao-fase-1.md +235 -0
- package/framework/docs/c4/c4-detection-rules.md +395 -0
- package/framework/docs/c4/c4-documentation-templates.md +579 -0
- package/framework/docs/c4/c4-mermaid-patterns.md +331 -0
- package/framework/docs/c4/c4-templates.md +256 -0
- package/framework/docs/clickup/clickup-acceptance-criteria-strategy.md +329 -0
- package/framework/docs/clickup/clickup-auto-update-strategy.md +340 -0
- package/framework/docs/clickup/clickup-comment-formatter.md +239 -0
- package/framework/docs/clickup/clickup-description-fix.md +384 -0
- package/framework/docs/clickup/clickup-dual-comment-strategy.md +528 -0
- package/framework/docs/clickup/clickup-formatting.md +302 -0
- package/framework/docs/clickup/separador-tamanho-otimizado.md +258 -0
- package/framework/docs/engineer/pre-pr-acceptance-validation.md +256 -0
- package/framework/docs/onion/ESPERANTO.md +293 -0
- package/framework/docs/onion/agents-reference.md +832 -0
- package/framework/docs/onion/clickup-integration.md +780 -0
- package/framework/docs/onion/commands-guide.md +924 -0
- package/framework/docs/onion/engineering-flows.md +900 -0
- package/framework/docs/onion/getting-started.md +803 -0
- package/framework/docs/onion/maintenance-checklist.md +421 -0
- package/framework/docs/onion/naming-conventions.md +286 -0
- package/framework/docs/onion/practical-examples.md +854 -0
- package/framework/docs/product/story-points-integration.md +269 -0
- package/framework/docs/product/story-points-validation.md +237 -0
- package/framework/docs/reviews/task-manager-docs-review-2025-11-24.md +184 -0
- package/framework/docs/strategies/clickup-comment-patterns.md +766 -0
- package/framework/docs/strategies/clickup-integration-tests.md +602 -0
- package/framework/docs/strategies/clickup-mcp-wrappers-tests.md +888 -0
- package/framework/docs/strategies/clickup-regression-tests.md +587 -0
- package/framework/docs/strategies/visual-patterns.md +315 -0
- package/framework/docs/templates/README.md +649 -0
- package/framework/docs/templates/adr-template.md +226 -0
- package/framework/docs/templates/analysis-template.md +280 -0
- package/framework/docs/templates/execution-plan-template.md +430 -0
- package/framework/docs/templates/guide-template.md +367 -0
- package/framework/docs/templates/phase-execution-prompt-template.md +504 -0
- package/framework/docs/templates/reference-template.md +522 -0
- package/framework/docs/templates/solution-template.md +390 -0
- package/framework/docs/tools/README.md +356 -0
- package/framework/docs/tools/agents.md +365 -0
- package/framework/docs/tools/commands.md +669 -0
- package/framework/docs/tools/cursor.md +539 -0
- package/framework/docs/tools/mcps.md +937 -0
- package/framework/docs/tools/rules.md +461 -0
- package/framework/rules/language-and-documentation.mdc +371 -0
- package/framework/rules/nestjs-controllers.md +83 -0
- package/framework/rules/nestjs-dtos.md +255 -0
- package/framework/rules/nestjs-modules.md +141 -0
- package/framework/rules/nestjs-services.md +230 -0
- package/framework/rules/nx-rules.mdc +41 -0
- package/framework/rules/onion-patterns.mdc +197 -0
- package/framework/skills/codebase-visualizer/SKILL.md +26 -0
- package/framework/skills/codebase-visualizer/scripts/visualize.py +131 -0
- package/framework/skills/collect/SKILL.md +84 -0
- package/framework/skills/create-rule/SKILL.md +152 -0
- package/framework/skills/db-schema-visualizer/SKILL.md +49 -0
- package/framework/skills/db-schema-visualizer/scripts/visualize.py +1191 -0
- package/framework/skills/sync-meetings/SKILL.md +239 -0
- package/framework/utils/clickup-mcp-wrappers.md +744 -0
- package/framework/utils/date-time-standards.md +200 -0
- package/framework/utils/task-manager/README.md +94 -0
- package/framework/utils/task-manager/adapters/asana.md +377 -0
- package/framework/utils/task-manager/adapters/clickup.md +467 -0
- package/framework/utils/task-manager/adapters/linear.md +421 -0
- package/framework/utils/task-manager/detector.md +299 -0
- package/framework/utils/task-manager/factory.md +363 -0
- package/framework/utils/task-manager/interface.md +248 -0
- package/framework/utils/task-manager/types.md +409 -0
- package/package.json +41 -0
- package/src/cli.js +73 -0
- package/src/commands/doctor.js +191 -0
- package/src/commands/init.js +287 -0
- package/src/commands/install.js +261 -0
- package/src/commands/list.js +152 -0
- package/src/commands/uninstall.js +90 -0
- package/src/commands/update.js +26 -0
- package/src/utils/fs.js +89 -0
- package/src/utils/log.js +35 -0
- package/src/utils/paths.js +32 -0
- package/src/utils/prompt.js +76 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: e2e
|
|
3
|
+
description: |
|
|
4
|
+
Gera e executa testes end-to-end automaticamente com detecção de framework.
|
|
5
|
+
Use para criar testes E2E seguindo padrões do projeto e executá-los com gravação.
|
|
6
|
+
model: sonnet
|
|
7
|
+
|
|
8
|
+
parameters:
|
|
9
|
+
- name: feature-name
|
|
10
|
+
description: Nome da feature para testar (ex: "login", "checkout")
|
|
11
|
+
required: true
|
|
12
|
+
- name: --generate
|
|
13
|
+
description: Gera arquivo de teste se não existir
|
|
14
|
+
required: false
|
|
15
|
+
- name: --run
|
|
16
|
+
description: Executa os testes
|
|
17
|
+
required: false
|
|
18
|
+
- name: --headless
|
|
19
|
+
description: Executa sem interface gráfica (default: true)
|
|
20
|
+
required: false
|
|
21
|
+
- name: --record
|
|
22
|
+
description: Grava vídeo/screenshots dos testes
|
|
23
|
+
required: false
|
|
24
|
+
- name: --framework
|
|
25
|
+
description: Framework específico (sobrescreve auto-detecção: cypress|playwright|selenium)
|
|
26
|
+
required: false
|
|
27
|
+
|
|
28
|
+
category: test
|
|
29
|
+
tags:
|
|
30
|
+
- testing
|
|
31
|
+
- e2e-tests
|
|
32
|
+
- test-generation
|
|
33
|
+
- automation
|
|
34
|
+
- cypress
|
|
35
|
+
- playwright
|
|
36
|
+
- recording
|
|
37
|
+
|
|
38
|
+
version: "3.0.0"
|
|
39
|
+
updated: "2025-11-24"
|
|
40
|
+
|
|
41
|
+
related_commands:
|
|
42
|
+
- /test/unit
|
|
43
|
+
- /test/integration
|
|
44
|
+
- /validate/test-strategy/create
|
|
45
|
+
- /engineer/work
|
|
46
|
+
|
|
47
|
+
related_agents:
|
|
48
|
+
- test-engineer
|
|
49
|
+
- test-planner
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
# 🎭 Test E2E
|
|
53
|
+
|
|
54
|
+
Gera e executa testes end-to-end automaticamente com detecção inteligente de framework, geração de cenários baseados em features e integração com gravação de vídeo/screenshots.
|
|
55
|
+
|
|
56
|
+
## 🎯 Objetivo
|
|
57
|
+
|
|
58
|
+
Automatizar o ciclo completo de testes E2E:
|
|
59
|
+
- **Auto-detecção** de framework E2E (Cypress, Playwright, Selenium)
|
|
60
|
+
- **Geração de cenários** baseados no nome da feature (login → valid/invalid credentials, etc.)
|
|
61
|
+
- **Selectors inteligentes** usando data-attributes, semantic selectors, text content
|
|
62
|
+
- **Execução** com suporte a headless mode e gravação
|
|
63
|
+
- **Integração** com pipeline CI/CD existente
|
|
64
|
+
|
|
65
|
+
## ⚡ Fluxo de Execução
|
|
66
|
+
|
|
67
|
+
### Passo 1: Validar Feature Name
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Validar formato
|
|
71
|
+
if [[ ! "{{feature-name}}" =~ ^[a-z][a-z0-9-]*$ ]]; then
|
|
72
|
+
echo "❌ ERRO: Feature name deve ser kebab-case (ex: login, user-registration)"
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Validações:**
|
|
78
|
+
```markdown
|
|
79
|
+
SE feature-name vazio:
|
|
80
|
+
❌ ERRO: Nome da feature é obrigatório
|
|
81
|
+
|
|
82
|
+
SE formato inválido:
|
|
83
|
+
❌ ERRO: Use kebab-case (ex: login, checkout-flow)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Passo 2: Detectar Framework E2E
|
|
87
|
+
|
|
88
|
+
**Estratégia de Detecção (em ordem de prioridade):**
|
|
89
|
+
|
|
90
|
+
1. **Verificar configurações:**
|
|
91
|
+
- `cypress.config.{js,ts}` → Cypress detectado
|
|
92
|
+
- `playwright.config.{js,ts}` → Playwright detectado
|
|
93
|
+
- `wdio.conf.{js,ts}` → WebdriverIO/Selenium detectado
|
|
94
|
+
- `package.json` → `cypress`, `@playwright/test`, `selenium-webdriver` em dependencies
|
|
95
|
+
|
|
96
|
+
2. **Buscar arquivos de teste existentes:**
|
|
97
|
+
- `cypress/e2e/**/*.spec.{js,ts}`
|
|
98
|
+
- `e2e/**/*.spec.{js,ts}` (Playwright)
|
|
99
|
+
- `tests/e2e/**/*.{js,ts}` (Selenium)
|
|
100
|
+
|
|
101
|
+
3. **Inferir por estrutura:**
|
|
102
|
+
- Diretório `cypress/` → Cypress
|
|
103
|
+
- Diretório `e2e/` com estrutura Playwright → Playwright
|
|
104
|
+
- `selenium` em package.json → Selenium
|
|
105
|
+
|
|
106
|
+
**Output:**
|
|
107
|
+
```markdown
|
|
108
|
+
✅ Framework detectado: [cypress|playwright|selenium]
|
|
109
|
+
📁 Config: [caminho do arquivo de config]
|
|
110
|
+
🌐 Base URL: [URL detectada do config ou .env]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Se `--framework` fornecido:** Sobrescreve detecção automática
|
|
114
|
+
|
|
115
|
+
### Passo 3: Analisar Estrutura de Testes Existente
|
|
116
|
+
|
|
117
|
+
**Buscar:** `**/*.e2e.{js,ts}`, `**/e2e/**/*.spec.{js,ts}`, `cypress/**/*.spec.{js,ts}`
|
|
118
|
+
|
|
119
|
+
**Extrair:** Page objects, nomenclatura, selectors (data-testid/classes/IDs), helpers/fixtures, base URL
|
|
120
|
+
|
|
121
|
+
**Output:** Page objects (Sim/Não), selectors preferidos, base URL, fixtures/helpers
|
|
122
|
+
|
|
123
|
+
### Passo 4: Gerar Cenários Baseados na Feature
|
|
124
|
+
|
|
125
|
+
**Mapeamento de Features → Cenários:**
|
|
126
|
+
|
|
127
|
+
- **Login:** valid/invalid credentials, empty fields, forgot password, remember me
|
|
128
|
+
- **Checkout:** complete flow, invalid payment, empty cart, shipping options, order summary
|
|
129
|
+
- **User Registration:** valid data, duplicate email, weak password, terms acceptance
|
|
130
|
+
- **Search:** valid query, empty query, special chars, filters, pagination
|
|
131
|
+
- **Genérico:** happy path, invalid input, empty state, edge cases
|
|
132
|
+
|
|
133
|
+
**Output:** Lista de cenários gerados com nomes e descrições
|
|
134
|
+
|
|
135
|
+
### Passo 5: Verificar Arquivo de Teste Existente
|
|
136
|
+
|
|
137
|
+
**Padrões:** Cypress: `cypress/e2e/{{feature}}.spec.{js,ts}`, Playwright: `e2e/{{feature}}.spec.{js,ts}`, Selenium: `tests/e2e/{{feature}}.test.{js,ts}`
|
|
138
|
+
|
|
139
|
+
**Decisão:** Se existe → continua execução (ou pula geração se --generate). Se não existe → gera (se --generate) ou erro
|
|
140
|
+
|
|
141
|
+
### Passo 6: Gerar Arquivo de Teste (SE --generate)
|
|
142
|
+
|
|
143
|
+
#### 6.1 Determinar Selectors Inteligentes
|
|
144
|
+
|
|
145
|
+
**Estratégia (ordem de prioridade):**
|
|
146
|
+
1. Data attributes: `[data-testid]`, `[data-cy]`
|
|
147
|
+
2. Semantic HTML: `<button>`, `<form>`, `<input type="email">`
|
|
148
|
+
3. ARIA: `[aria-label]`, `[role]`
|
|
149
|
+
4. Text content: `contains()`, `getByText()`
|
|
150
|
+
5. Classes/IDs: último recurso
|
|
151
|
+
|
|
152
|
+
#### 6.2 Gerar Estrutura de Teste
|
|
153
|
+
|
|
154
|
+
**Padrão AAA (Arrange, Act, Assert) por framework:**
|
|
155
|
+
|
|
156
|
+
- **Cypress:** `describe()` + `it()`, `cy.visit()`, `cy.get('[data-testid]')`, `cy.url().should()`
|
|
157
|
+
- **Playwright:** `test.describe()` + `test()`, `page.goto()`, `page.getByTestId()`, `expect().toBeVisible()`
|
|
158
|
+
- **Selenium:** `describe()` + `it()`, `browser.url()`, `$('[data-testid]')`, `expect().toHaveUrlContaining()`
|
|
159
|
+
|
|
160
|
+
**Estrutura base:** beforeEach (visit), testes para happy path, error handling, edge cases
|
|
161
|
+
|
|
162
|
+
#### 6.3 Adicionar Page Objects (se padrão existir)
|
|
163
|
+
|
|
164
|
+
**Se projeto usa page objects:** Gerar classe com getters para elementos e métodos para ações (visit, submitForm, etc.)
|
|
165
|
+
|
|
166
|
+
#### 6.4 Criar Arquivo de Teste
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
write {{test-file-path}} [conteúdo gerado]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Validação:**
|
|
173
|
+
```markdown
|
|
174
|
+
✅ Arquivo gerado: {{test-file-path}}
|
|
175
|
+
📊 Cenários: [N] testes
|
|
176
|
+
∟ Happy path: [N]
|
|
177
|
+
∟ Error handling: [N]
|
|
178
|
+
∟ Edge cases: [N]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Passo 7: Executar Testes (SE --run)
|
|
182
|
+
|
|
183
|
+
#### 7.1 Preparar Comando de Execução
|
|
184
|
+
|
|
185
|
+
**Comandos por framework:**
|
|
186
|
+
|
|
187
|
+
- **Cypress:** `npx cypress run --spec "cypress/e2e/{{feature}}.spec.ts" [--headless] [--record]` ou `pnpm cypress run`
|
|
188
|
+
- **Playwright:** `npx playwright test e2e/{{feature}}.spec.ts [--headed=false] [--video=on]` ou `pnpm playwright test`
|
|
189
|
+
- **Selenium:** `npx wdio run wdio.conf.ts --spec tests/e2e/{{feature}}.test.ts [--headless]`
|
|
190
|
+
|
|
191
|
+
#### 7.2 Construir Comando Final
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
**Comando base:** [comando do framework]
|
|
195
|
+
|
|
196
|
+
**Flags:**
|
|
197
|
+
SE --headless não fornecido OU --headless=true:
|
|
198
|
+
+ flag headless (default: true)
|
|
199
|
+
|
|
200
|
+
SE --headless=false:
|
|
201
|
+
+ flag headed (abre browser)
|
|
202
|
+
|
|
203
|
+
SE --record:
|
|
204
|
+
+ flag de gravação (vídeo/screenshots)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### 7.3 Executar Testes
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
run_terminal_cmd [comando construído]
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Capturar output:**
|
|
214
|
+
- Resultado dos testes (pass/fail)
|
|
215
|
+
- Screenshots/vídeos (se --record)
|
|
216
|
+
- Erros e stack traces
|
|
217
|
+
- Tempo de execução
|
|
218
|
+
- Artifacts gerados
|
|
219
|
+
|
|
220
|
+
### Passo 8: Apresentar Resultados
|
|
221
|
+
|
|
222
|
+
## 📤 Output Esperado
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
226
|
+
✅ TESTES E2E - {{feature-name}}
|
|
227
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
228
|
+
|
|
229
|
+
🔍 Detecção:
|
|
230
|
+
∟ Framework: [cypress|playwright|selenium]
|
|
231
|
+
∟ Config: [caminho do arquivo de config]
|
|
232
|
+
∟ Base URL: [URL]
|
|
233
|
+
∟ Headless: [true|false]
|
|
234
|
+
|
|
235
|
+
📊 Análise de Padrões:
|
|
236
|
+
∟ Page objects: [✅ Sim | ❌ Não]
|
|
237
|
+
∟ Selectors: [data-testid|semantic|classes]
|
|
238
|
+
∟ Estrutura existente: [encontrada|nova]
|
|
239
|
+
|
|
240
|
+
📝 Arquivo de Teste:
|
|
241
|
+
∟ Status: [✅ Existente | ✅ Gerado | ❌ Não encontrado]
|
|
242
|
+
∟ Caminho: {{test-file-path}}
|
|
243
|
+
∟ Cenários: [N] testes
|
|
244
|
+
├─ Happy path: [N]
|
|
245
|
+
├─ Error handling: [N]
|
|
246
|
+
└─ Edge cases: [N]
|
|
247
|
+
|
|
248
|
+
🧪 Execução:
|
|
249
|
+
∟ Comando: [comando executado]
|
|
250
|
+
∟ Status: [✅ Passou | ❌ Falhou | ⚠️ Parcial]
|
|
251
|
+
∟ Testes executados: [X/Y] passaram
|
|
252
|
+
∟ Tempo: [X]s
|
|
253
|
+
|
|
254
|
+
📹 Gravação (se --record):
|
|
255
|
+
∟ Vídeos: [caminho]
|
|
256
|
+
∟ Screenshots: [caminho]
|
|
257
|
+
∟ Artifacts: [lista]
|
|
258
|
+
|
|
259
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
260
|
+
|
|
261
|
+
🚀 Próximos Passos:
|
|
262
|
+
1. Revisar testes gerados e ajustar selectors
|
|
263
|
+
2. Executar novamente: /test/e2e {{feature-name}} --run
|
|
264
|
+
3. Integrar no CI/CD: /validate/test-strategy/create
|
|
265
|
+
4. Adicionar mais cenários conforme necessário
|
|
266
|
+
|
|
267
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## 📋 Exemplos de Uso
|
|
271
|
+
|
|
272
|
+
**1. Gerar e executar com gravação:**
|
|
273
|
+
```bash
|
|
274
|
+
/test/e2e login --generate --run --record
|
|
275
|
+
```
|
|
276
|
+
→ Detecta framework, gera `login.spec.ts` com cenários de login, executa com vídeo
|
|
277
|
+
|
|
278
|
+
**2. Executar em modo headed:**
|
|
279
|
+
```bash
|
|
280
|
+
/test/e2e checkout --run --headless false
|
|
281
|
+
```
|
|
282
|
+
→ Executa `checkout.spec.ts` com browser visível
|
|
283
|
+
|
|
284
|
+
**3. Apenas gerar teste:**
|
|
285
|
+
```bash
|
|
286
|
+
/test/e2e user-registration --generate
|
|
287
|
+
```
|
|
288
|
+
→ Gera `user-registration.spec.ts` com cenários de registro, não executa
|
|
289
|
+
|
|
290
|
+
**4. Executar teste existente:**
|
|
291
|
+
```bash
|
|
292
|
+
/test/e2e search --run --record
|
|
293
|
+
```
|
|
294
|
+
→ Executa `search.spec.ts` existente com gravação, não gera novo arquivo
|
|
295
|
+
|
|
296
|
+
## ⚙️ Parâmetros Detalhados
|
|
297
|
+
|
|
298
|
+
| Parâmetro | Tipo | Obrigatório | Descrição |
|
|
299
|
+
|-----------|------|-------------|-----------|
|
|
300
|
+
| `feature-name` | string | ✅ | Nome da feature em kebab-case |
|
|
301
|
+
| `--generate` | flag | ❌ | Gera arquivo de teste se não existir |
|
|
302
|
+
| `--run` | flag | ❌ | Executa os testes |
|
|
303
|
+
| `--headless` | boolean | ❌ | Executa sem interface (default: true) |
|
|
304
|
+
| `--record` | flag | ❌ | Grava vídeo/screenshots |
|
|
305
|
+
| `--framework` | string | ❌ | Framework específico (sobrescreve auto-detecção) |
|
|
306
|
+
|
|
307
|
+
## 🔗 Comandos Relacionados
|
|
308
|
+
|
|
309
|
+
- `/test/unit` - Testes unitários (White-box)
|
|
310
|
+
- `/test/integration` - Testes de integração (Grey-box)
|
|
311
|
+
- `/validate/test-strategy/create` - Criar estratégia completa de testes
|
|
312
|
+
- `/engineer/work` - Continuar desenvolvimento
|
|
313
|
+
|
|
314
|
+
## ⚠️ Validações e Regras
|
|
315
|
+
|
|
316
|
+
### Validações Obrigatórias
|
|
317
|
+
|
|
318
|
+
1. **Feature name deve ser válido:**
|
|
319
|
+
```markdown
|
|
320
|
+
SE feature-name vazio:
|
|
321
|
+
❌ ERRO: Nome da feature é obrigatório
|
|
322
|
+
|
|
323
|
+
SE formato inválido:
|
|
324
|
+
❌ ERRO: Use kebab-case (ex: login, checkout-flow)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
2. **Framework deve ser detectável ou fornecido:**
|
|
328
|
+
```markdown
|
|
329
|
+
SE nenhum framework detectado E --framework não fornecido:
|
|
330
|
+
❌ ERRO: Não foi possível detectar framework E2E
|
|
331
|
+
💡 Instale Cypress/Playwright ou use --framework [nome]
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
3. **Arquivo de teste deve existir para execução:**
|
|
335
|
+
```markdown
|
|
336
|
+
SE --run fornecido E arquivo não existe E --generate não fornecido:
|
|
337
|
+
❌ ERRO: Arquivo de teste não encontrado
|
|
338
|
+
💡 Use --generate para criar automaticamente
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Regras de Negócio
|
|
342
|
+
|
|
343
|
+
1. **Auto-detecção tem prioridade** sobre --framework, exceto se fornecido
|
|
344
|
+
2. **Geração segue padrões** do projeto (analisa testes existentes)
|
|
345
|
+
3. **Selectors inteligentes** priorizam data-attributes e semantic HTML
|
|
346
|
+
4. **Headless é default** (true) para CI/CD, use `--headless false` para debug
|
|
347
|
+
5. **Gravação** sempre captura em falhas, `--record` habilita em sucessos também
|
|
348
|
+
|
|
349
|
+
## 🔧 Suporte por Framework
|
|
350
|
+
|
|
351
|
+
| Framework | Headless | Gravação | Page Objects | CI/CD |
|
|
352
|
+
|-----------|----------|----------|--------------|-------|
|
|
353
|
+
| Cypress | ✅ | ✅ | ✅ | ✅ |
|
|
354
|
+
| Playwright | ✅ | ✅ | ✅ | ✅ |
|
|
355
|
+
| Selenium | ✅ | ⚠️ | ✅ | ✅ |
|
|
356
|
+
|
|
357
|
+
## 📚 Referências
|
|
358
|
+
|
|
359
|
+
- **Agente de Testes:** @test-engineer
|
|
360
|
+
- **Framework de Testes:** `docs/knowbase/frameworks/framework_testes.md`
|
|
361
|
+
- **Cypress Docs:** https://docs.cypress.io
|
|
362
|
+
- **Playwright Docs:** https://playwright.dev
|
|
363
|
+
|
|
364
|
+
## ⚠️ Notas Importantes
|
|
365
|
+
|
|
366
|
+
- **Auto-detecção inteligente:** Analisa configurações e estrutura do projeto
|
|
367
|
+
- **Geração conservadora:** Cria testes básicos, desenvolvedor deve expandir
|
|
368
|
+
- **Selectors robustos:** Prioriza data-attributes para estabilidade
|
|
369
|
+
- **CI/CD ready:** Headless por padrão, gravação opcional
|
|
370
|
+
- **Page objects:** Detecta e segue padrão se existir no projeto
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
**Versão:** 3.0.0
|
|
375
|
+
**Última atualização:** 2025-12-03
|
|
376
|
+
**Mantido por:** Sistema Onion
|
|
377
|
+
|