create-huenei-template 0.3.3 → 0.3.4
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/dist/core/skills-refresh.js +8 -3
- package/dist/templates/automation/_ci/cypress-ts/azure/azure-pipelines.yml +7 -0
- package/dist/templates/automation/_ci/cypress-ts/bitbucket/bitbucket-pipelines.yml +1 -0
- package/dist/templates/automation/_ci/cypress-ts/github/.github/workflows/e2e.yml +9 -0
- package/dist/templates/automation/_ci/cypress-ts/gitlab/.gitlab-ci.yml +2 -1
- package/dist/templates/automation/_ci/cypress-ts/jenkins/Jenkinsfile +3 -0
- package/dist/templates/automation/_ci/playwright-ts/azure/azure-pipelines.yml +7 -0
- package/dist/templates/automation/_ci/playwright-ts/github/.github/workflows/e2e.yml +10 -3
- package/dist/templates/automation/_ci/playwright-ts/jenkins/Jenkinsfile +2 -1
- package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/AGENTS.md +7 -7
- package/dist/templates/automation/e2e-cypress-ts-app-actions/README.md +1 -1
- package/dist/templates/automation/e2e-cypress-ts-app-actions/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-cypress-ts-app-actions/cypress.config.ts +44 -1
- package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/HUB-INTEGRATION.md +51 -76
- package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +34 -23
- package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-test.md +46 -21
- package/dist/templates/automation/e2e-cypress-ts-app-actions/scenarios/INDEX.md +20 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/AGENTS.md +7 -7
- package/dist/templates/automation/e2e-cypress-ts-pom/README.md +1 -1
- package/dist/templates/automation/e2e-cypress-ts-pom/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-cypress-ts-pom/cypress.config.ts +44 -1
- package/dist/templates/automation/e2e-cypress-ts-pom/docs/HUB-INTEGRATION.md +51 -76
- package/dist/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-scenario.md +34 -23
- package/dist/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-test.md +46 -21
- package/dist/templates/automation/e2e-cypress-ts-pom/scenarios/INDEX.md +20 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/AGENTS.md +7 -6
- package/dist/templates/automation/e2e-playwright-ts-app-actions/README.md +1 -1
- package/dist/templates/automation/e2e-playwright-ts-app-actions/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/HUB-INTEGRATION.md +51 -76
- package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +33 -22
- package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-test.md +56 -28
- package/dist/templates/automation/e2e-playwright-ts-app-actions/playwright.config.ts +6 -1
- package/dist/templates/automation/e2e-playwright-ts-app-actions/scenarios/INDEX.md +20 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/AGENTS.md +7 -6
- package/dist/templates/automation/e2e-playwright-ts-pom/README.md +1 -1
- package/dist/templates/automation/e2e-playwright-ts-pom/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-playwright-ts-pom/docs/HUB-INTEGRATION.md +51 -76
- package/dist/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-scenario.md +33 -22
- package/dist/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-test.md +56 -28
- package/dist/templates/automation/e2e-playwright-ts-pom/playwright.config.ts +6 -1
- package/dist/templates/automation/e2e-playwright-ts-pom/scenarios/INDEX.md +20 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/SKILL.md +38 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/mocking.md +59 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/tests.md +77 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/AGENTS.md +7 -6
- package/dist/templates/automation/e2e-playwright-ts-screenplay/README.md +1 -1
- package/dist/templates/automation/e2e-playwright-ts-screenplay/_skills-lock.json +6 -0
- package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/HUB-INTEGRATION.md +51 -76
- package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-scenario.md +33 -22
- package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-test.md +56 -28
- package/dist/templates/automation/e2e-playwright-ts-screenplay/playwright.config.ts +6 -1
- package/dist/templates/automation/e2e-playwright-ts-screenplay/scenarios/INDEX.md +20 -0
- package/dist/test-cli.js +35 -4
- package/package.json +1 -1
- package/templates/automation/_ci/cypress-ts/azure/azure-pipelines.yml +7 -0
- package/templates/automation/_ci/cypress-ts/bitbucket/bitbucket-pipelines.yml +1 -0
- package/templates/automation/_ci/cypress-ts/github/.github/workflows/e2e.yml +9 -0
- package/templates/automation/_ci/cypress-ts/gitlab/.gitlab-ci.yml +2 -1
- package/templates/automation/_ci/cypress-ts/jenkins/Jenkinsfile +3 -0
- package/templates/automation/_ci/playwright-ts/azure/azure-pipelines.yml +7 -0
- package/templates/automation/_ci/playwright-ts/github/.github/workflows/e2e.yml +10 -3
- package/templates/automation/_ci/playwright-ts/jenkins/Jenkinsfile +2 -1
- package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-cypress-ts-app-actions/AGENTS.md +7 -7
- package/templates/automation/e2e-cypress-ts-app-actions/README.md +1 -1
- package/templates/automation/e2e-cypress-ts-app-actions/_skills-lock.json +6 -0
- package/templates/automation/e2e-cypress-ts-app-actions/cypress.config.ts +44 -1
- package/templates/automation/e2e-cypress-ts-app-actions/docs/HUB-INTEGRATION.md +51 -76
- package/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +34 -23
- package/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-test.md +46 -21
- package/templates/automation/e2e-cypress-ts-app-actions/scenarios/INDEX.md +20 -0
- package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-cypress-ts-pom/AGENTS.md +7 -7
- package/templates/automation/e2e-cypress-ts-pom/README.md +1 -1
- package/templates/automation/e2e-cypress-ts-pom/_skills-lock.json +6 -0
- package/templates/automation/e2e-cypress-ts-pom/cypress.config.ts +44 -1
- package/templates/automation/e2e-cypress-ts-pom/docs/HUB-INTEGRATION.md +51 -76
- package/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-scenario.md +34 -23
- package/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-test.md +46 -21
- package/templates/automation/e2e-cypress-ts-pom/scenarios/INDEX.md +20 -0
- package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-playwright-ts-app-actions/AGENTS.md +7 -6
- package/templates/automation/e2e-playwright-ts-app-actions/README.md +1 -1
- package/templates/automation/e2e-playwright-ts-app-actions/_skills-lock.json +6 -0
- package/templates/automation/e2e-playwright-ts-app-actions/docs/HUB-INTEGRATION.md +51 -76
- package/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +33 -22
- package/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-test.md +56 -28
- package/templates/automation/e2e-playwright-ts-app-actions/playwright.config.ts +6 -1
- package/templates/automation/e2e-playwright-ts-app-actions/scenarios/INDEX.md +20 -0
- package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-playwright-ts-pom/AGENTS.md +7 -6
- package/templates/automation/e2e-playwright-ts-pom/README.md +1 -1
- package/templates/automation/e2e-playwright-ts-pom/_skills-lock.json +6 -0
- package/templates/automation/e2e-playwright-ts-pom/docs/HUB-INTEGRATION.md +51 -76
- package/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-scenario.md +33 -22
- package/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-test.md +56 -28
- package/templates/automation/e2e-playwright-ts-pom/playwright.config.ts +6 -1
- package/templates/automation/e2e-playwright-ts-pom/scenarios/INDEX.md +20 -0
- package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/SKILL.md +38 -0
- package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/agents/openai.yaml +3 -0
- package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/mocking.md +59 -0
- package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/tests.md +77 -0
- package/templates/automation/e2e-playwright-ts-screenplay/AGENTS.md +7 -6
- package/templates/automation/e2e-playwright-ts-screenplay/README.md +1 -1
- package/templates/automation/e2e-playwright-ts-screenplay/_skills-lock.json +6 -0
- package/templates/automation/e2e-playwright-ts-screenplay/docs/HUB-INTEGRATION.md +51 -76
- package/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-scenario.md +33 -22
- package/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-test.md +56 -28
- package/templates/automation/e2e-playwright-ts-screenplay/playwright.config.ts +6 -1
- package/templates/automation/e2e-playwright-ts-screenplay/scenarios/INDEX.md +20 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Índice de escenarios
|
|
2
|
+
|
|
3
|
+
Lo leen y actualizan `/new-e2e-scenario` y `/new-e2e-test` (y el agente del Hub). Antes de preguntar algo, buscarlo acá.
|
|
4
|
+
|
|
5
|
+
## Escenarios
|
|
6
|
+
|
|
7
|
+
| Id | Título | Estado | Tag | Pantalla | Rol | Test | Preguntas abiertas |
|
|
8
|
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
|
9
|
+
|
|
10
|
+
Estados: **borrador** (tiene preguntas abiertas que bloquean), **listo** (completo, sin test), **implementado** (test en verde), **bloqueado** (captcha, 2FA, dato o cambio que depende de desarrollo; el motivo va en Preguntas abiertas).
|
|
11
|
+
|
|
12
|
+
## Decisiones compartidas
|
|
13
|
+
|
|
14
|
+
Respuestas que valen para más de un escenario. Se reutilizan como Supuestos, no se repreguntan.
|
|
15
|
+
|
|
16
|
+
- Roles y cómo obtienen sesión:
|
|
17
|
+
- Creación y limpieza de datos (API, seed, existentes):
|
|
18
|
+
- Servicios externos (sandbox o simulados):
|
|
19
|
+
- Atributo de test id y convenciones de selectores:
|
|
20
|
+
- Bloqueos conocidos y cómo se evitan:
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test-Driven Development
|
|
7
|
+
|
|
8
|
+
TDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle: consult them before and during the loop, not after.
|
|
9
|
+
|
|
10
|
+
When exploring the codebase, read `GLOSSARY.md` (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.
|
|
11
|
+
|
|
12
|
+
## What a good test is
|
|
13
|
+
|
|
14
|
+
Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification: "user can checkout with valid cart" tells you exactly what capability exists, and it survives refactors because it doesn't care about internal structure.
|
|
15
|
+
|
|
16
|
+
See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
|
|
17
|
+
|
|
18
|
+
## Seams: where tests go
|
|
19
|
+
|
|
20
|
+
A **seam** is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.
|
|
21
|
+
|
|
22
|
+
**Test only at pre-agreed seams.** Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything, so agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.
|
|
23
|
+
|
|
24
|
+
Ask: "What's the public interface, and which seams should we test?" Give each proposed seam a one-line note on what it catches and what it misses.
|
|
25
|
+
|
|
26
|
+
When the shape of that interface is itself in question (how deep the module is, where the seam belongs, what the interface should expose), call the Skill tool with "codebase-design" for the vocabulary. It is the shared source of the module, interface, depth, seam, adapter, leverage and locality terms, and it is a reference to consult, not a session to run.
|
|
27
|
+
|
|
28
|
+
## Anti-patterns
|
|
29
|
+
|
|
30
|
+
- **Implementation-coupled**: mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.
|
|
31
|
+
- **Tautological**: the assertion recomputes the expected value the way the code does (`expect(add(a, b)).toBe(a + b)`, a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth: a known-good literal, a worked example, the spec.
|
|
32
|
+
- **Horizontal slicing**: writing all tests first, then all implementation. Bulk tests verify _imagined_ behavior: you test the _shape_ of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in **vertical slices** instead: one test → one implementation → repeat, each test a **tracer bullet** that responds to what the last cycle taught you.
|
|
33
|
+
|
|
34
|
+
## Rules of the loop
|
|
35
|
+
|
|
36
|
+
- **Red before green.** Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.
|
|
37
|
+
- **One slice at a time.** One seam, one test, one minimal implementation per cycle.
|
|
38
|
+
- **Refactoring is not part of the loop.** It belongs to the review stage (see the `code-review` skill), not the red → green implementation cycle.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# When to Mock
|
|
2
|
+
|
|
3
|
+
Mock at **system boundaries** only:
|
|
4
|
+
|
|
5
|
+
- External APIs (payment, email, etc.)
|
|
6
|
+
- Databases (sometimes - prefer test DB)
|
|
7
|
+
- Time/randomness
|
|
8
|
+
- File system (sometimes)
|
|
9
|
+
|
|
10
|
+
Don't mock:
|
|
11
|
+
|
|
12
|
+
- Your own classes/modules
|
|
13
|
+
- Internal collaborators
|
|
14
|
+
- Anything you control
|
|
15
|
+
|
|
16
|
+
## Designing for Mockability
|
|
17
|
+
|
|
18
|
+
At system boundaries, design interfaces that are easy to mock:
|
|
19
|
+
|
|
20
|
+
**1. Use dependency injection**
|
|
21
|
+
|
|
22
|
+
Pass external dependencies in rather than creating them internally:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Easy to mock
|
|
26
|
+
function processPayment(order, paymentClient) {
|
|
27
|
+
return paymentClient.charge(order.total);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Hard to mock
|
|
31
|
+
function processPayment(order) {
|
|
32
|
+
const client = new StripeClient(process.env.STRIPE_KEY);
|
|
33
|
+
return client.charge(order.total);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**2. Prefer SDK-style interfaces over generic fetchers**
|
|
38
|
+
|
|
39
|
+
Create specific functions for each external operation instead of one generic function with conditional logic:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// GOOD: Each function is independently mockable
|
|
43
|
+
const api = {
|
|
44
|
+
getUser: (id) => fetch(`/users/${id}`),
|
|
45
|
+
getOrders: (userId) => fetch(`/users/${userId}/orders`),
|
|
46
|
+
createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// BAD: Mocking requires conditional logic inside the mock
|
|
50
|
+
const api = {
|
|
51
|
+
fetch: (endpoint, options) => fetch(endpoint, options),
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The SDK approach means:
|
|
56
|
+
- Each mock returns one specific shape
|
|
57
|
+
- No conditional logic in test setup
|
|
58
|
+
- Easier to see which endpoints a test exercises
|
|
59
|
+
- Type safety per endpoint
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Good and Bad Tests
|
|
2
|
+
|
|
3
|
+
## Good Tests
|
|
4
|
+
|
|
5
|
+
**Integration-style**: Test through real interfaces, not mocks of internal parts.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// GOOD: Tests observable behavior
|
|
9
|
+
test("user can checkout with valid cart", async () => {
|
|
10
|
+
const cart = createCart();
|
|
11
|
+
cart.add(product);
|
|
12
|
+
const result = await checkout(cart, paymentMethod);
|
|
13
|
+
expect(result.status).toBe("confirmed");
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Characteristics:
|
|
18
|
+
|
|
19
|
+
- Tests behavior users/callers care about
|
|
20
|
+
- Uses public API only
|
|
21
|
+
- Survives internal refactors
|
|
22
|
+
- Describes WHAT, not HOW
|
|
23
|
+
- One logical assertion per test
|
|
24
|
+
|
|
25
|
+
## Bad Tests
|
|
26
|
+
|
|
27
|
+
**Implementation-detail tests**: Coupled to internal structure.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// BAD: Tests implementation details
|
|
31
|
+
test("checkout calls paymentService.process", async () => {
|
|
32
|
+
const mockPayment = jest.mock(paymentService);
|
|
33
|
+
await checkout(cart, payment);
|
|
34
|
+
expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Red flags:
|
|
39
|
+
|
|
40
|
+
- Mocking internal collaborators
|
|
41
|
+
- Testing private methods
|
|
42
|
+
- Asserting on call counts/order
|
|
43
|
+
- Test breaks when refactoring without behavior change
|
|
44
|
+
- Test name describes HOW not WHAT
|
|
45
|
+
- Verifying through external means instead of interface
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// BAD: Bypasses interface to verify
|
|
49
|
+
test("createUser saves to database", async () => {
|
|
50
|
+
await createUser({ name: "Alice" });
|
|
51
|
+
const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
|
|
52
|
+
expect(row).toBeDefined();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// GOOD: Verifies through interface
|
|
56
|
+
test("createUser makes user retrievable", async () => {
|
|
57
|
+
const user = await createUser({ name: "Alice" });
|
|
58
|
+
const retrieved = await getUser(user.id);
|
|
59
|
+
expect(retrieved.name).toBe("Alice");
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Tautological tests**: Expected value restates the implementation, so the test passes by construction.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// BAD: Expected value is recomputed the way the code computes it
|
|
67
|
+
test("calculateTotal sums line items", () => {
|
|
68
|
+
const items = [{ price: 10 }, { price: 5 }];
|
|
69
|
+
const expected = items.reduce((sum, i) => sum + i.price, 0);
|
|
70
|
+
expect(calculateTotal(items)).toBe(expected);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// GOOD: Expected value is an independent, known literal
|
|
74
|
+
test("calculateTotal sums line items", () => {
|
|
75
|
+
expect(calculateTotal([{ price: 10 }, { price: 5 }])).toBe(15);
|
|
76
|
+
});
|
|
77
|
+
```
|
|
@@ -75,21 +75,21 @@ Funcionan en cualquier IDE o extensión. Si la persona escribe el comando, o pid
|
|
|
75
75
|
| Comando | Qué hace | Seguir |
|
|
76
76
|
| --- | --- | --- |
|
|
77
77
|
| `/setup-project-context` | Briefing del SUT → sección `## Aplicación bajo prueba` en `AGENTS.md` | [docs/agent-commands/setup-project-context.md](docs/agent-commands/setup-project-context.md) |
|
|
78
|
-
| `/new-e2e-scenario` |
|
|
79
|
-
| `/new-e2e-test` |
|
|
78
|
+
| `/new-e2e-scenario` | Completa un escenario a partir del borrador/contexto del Hub (o entrevista si no hay borrador) y escribe `scenarios/` + `data/<id>` | [docs/agent-commands/new-e2e-scenario.md](docs/agent-commands/new-e2e-scenario.md) |
|
|
79
|
+
| `/new-e2e-test` | Implementa el test con ciclo TDD (falla → pasa → puede fallar); no reescribe el escenario | [docs/agent-commands/new-e2e-test.md](docs/agent-commands/new-e2e-test.md) |
|
|
80
80
|
|
|
81
81
|
Antes de cualquier tarea E2E, leer la sección `## Aplicación bajo prueba` de este archivo. Si aún tiene placeholders, sugerí `/setup-project-context`.
|
|
82
82
|
|
|
83
|
-
Cursor, Claude Code (`.claude/commands/`) y Copilot (`.github/prompts/`) los ofrecen como comandos de barra; todos apuntan a esos archivos. En ejecuciones sin persona (Cloud Agents), no usarlos: anotar lo faltante en **Preguntas abiertas** del escenario y en el PR. Excepción: `/setup-project-context` invocado por el Hub con el contexto del proyecto corre en su modo pipeline, sin preguntas.
|
|
83
|
+
Cursor, Claude Code (`.claude/commands/`) y Copilot (`.github/prompts/`) los ofrecen como comandos de barra; todos apuntan a esos archivos. En ejecuciones sin persona (Cloud Agents), no usarlos: anotar lo faltante en **Preguntas abiertas** del escenario y en el PR. Excepción: `/setup-project-context` invocado por el Hub con el contexto del proyecto corre en su modo pipeline, sin preguntas. Excepción Hub: `/new-e2e-scenario` y `/new-e2e-test` en **modo Hub (borrador)** corren sin persona (sin grilling ni preguntas); los huecos van a **Preguntas abiertas**.
|
|
84
84
|
|
|
85
85
|
## Flujo para implementar un escenario
|
|
86
86
|
|
|
87
|
-
1. **Leer el escenario
|
|
87
|
+
1. **Leer** [scenarios/INDEX.md](scenarios/INDEX.md) (estado y Decisiones compartidas) y el escenario en `scenarios/<ID>-<slug>.md` (formato en [scenarios/_template.md](scenarios/_template.md)) y su set de datos en `data_file`. Si el archivo de datos no existe, generarlo con las reglas de **Dónde se guarda** de `/new-e2e-scenario`. Si falta información imprescindible, dejarlo anotado en el PR en lugar de inventarla.
|
|
88
88
|
2. **Explorar la aplicación**: correr `pnpm env:check` para ver `BASE_URL` (la URL de la app vive en `.env`) y abrir `BASE_URL` + `target_path`. Si el escenario tiene `session`, explorar con la sesión del rol según **Explorar una pantalla que requiere sesión** de la skill `e2e-playwright`: el login lo hace `tests/auth/<rol>.setup.ts` con `pnpm auth`, y el agente nunca escribe contraseñas en el navegador. Usar el navegador disponible (Playwright MCP en el IDE, el navegador de la VM en Cloud Agents) para confirmar textos, roles y test ids reales antes de escribir locators.
|
|
89
89
|
3. **Implementar según la arquitectura** descrita en [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md): reutilizar lo existente antes de crear algo nuevo.
|
|
90
90
|
4. **Escribir el test** en `tests/`, importando los casos de `data_file`, etiquetado con el id del escenario (`@SC-001`) y con `@smoke` o `@regression`.
|
|
91
|
-
5. **Correr y corregir**: `pnpm typecheck`, `pnpm lint` y el test
|
|
92
|
-
6. **Dejar
|
|
91
|
+
5. **Correr y corregir (TDD)**: por caso, aplicar la skill `tdd` (falla → pasa → puede fallar). Luego `pnpm typecheck`, `pnpm lint` y el test deben pasar. Si la app difiere del escenario, anotar en **Preguntas abiertas** — no reescribir pasos ni resultados. Ante un fallo, revisar el trace (`test-results/`).
|
|
92
|
+
6. **Dejar listo para revisión**: actualizar la fila del escenario en [scenarios/INDEX.md](scenarios/INDEX.md) (`implementado` o `bloqueado` con el motivo). En modo interactivo, abrir el PR con el escenario cubierto, archivos y supuestos. En **modo Hub (borrador)** de `/new-e2e-test`, el resumen agrupa archivos en el orden de commits de [docs/HUB-INTEGRATION.md](docs/HUB-INTEGRATION.md); el disparador del Hub abre el PR.
|
|
93
93
|
|
|
94
94
|
## Skills
|
|
95
95
|
|
|
@@ -102,6 +102,7 @@ En `.cursor/skills/`. Ante cualquier diferencia, este archivo, `.cursor/rules/`
|
|
|
102
102
|
| `playwright-cli` | Explorar la app desde la terminal con `npx playwright cli`, sin MCP |
|
|
103
103
|
| `e2e-testing-patterns` | Criterios generales de E2E (qué automatizar, selectores estables, aislamiento) |
|
|
104
104
|
| `grilling` | Entrevistar a la persona sobre el dominio antes de documentar contexto |
|
|
105
|
+
| `tdd` | Ciclo falla → pasa → puede fallar al implementar cada caso E2E |
|
|
105
106
|
| `verification-before-completion` | No dar nada por terminado sin correr y leer typecheck, lint y tests |
|
|
106
107
|
|
|
107
108
|
Antes de declarar un escenario terminado, aplicar `verification-before-completion`: correr `pnpm typecheck`, `pnpm lint` y el test nuevo, y citar el resultado.
|
|
@@ -58,7 +58,7 @@ Safari real no se puede automatizar: el proyecto `webkit` usa el motor WebKit. E
|
|
|
58
58
|
src/screenplay/ Actor, habilidades, tareas, preguntas y locators por pantalla
|
|
59
59
|
tests/ Specs, aserciones y fixture `actor`
|
|
60
60
|
data/ Set de datos de cada escenario (data/<id>.ts), catálogo de usuarios (users.ts) y credentials.ts
|
|
61
|
-
scenarios/ Escenarios
|
|
61
|
+
scenarios/ Escenarios + INDEX.md (estados y Decisiones compartidas; contrato con el Hub)
|
|
62
62
|
scripts/env-check.mjs Validación de .env (pnpm env:check)
|
|
63
63
|
docs/agent-commands/ /new-e2e-scenario y /new-e2e-test, para cualquier agente
|
|
64
64
|
docs/ARCHITECTURE.md El patrón Screenplay y cuándo agregar capas
|
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
"sourceType": "github",
|
|
31
31
|
"skillPath": "skills/productivity/grilling/SKILL.md",
|
|
32
32
|
"computedHash": "e40cc1d348f6d935e28f1e24474302d7368f0a400429271a43b35fe154891dc5"
|
|
33
|
+
},
|
|
34
|
+
"tdd": {
|
|
35
|
+
"source": "mattpocock/skills",
|
|
36
|
+
"sourceType": "github",
|
|
37
|
+
"skillPath": "skills/engineering/tdd/SKILL.md",
|
|
38
|
+
"computedHash": "daf55026f456af104a72fa43247f7bcec89e5127316dc5b1b8d675d6a9d8ce94"
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
}
|
|
@@ -1,91 +1,66 @@
|
|
|
1
1
|
# Integración con el Hub
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Contrato entre este repo y el **Hub de Pre-Sales** (orquestador). El Hub no vive acá: solo se documenta qué espera de un proyecto generado con `create-huenei-template`.
|
|
4
4
|
|
|
5
5
|
## Generación del repo (pipeline)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Cuando el Hub crea el proyecto de automatización:
|
|
8
8
|
|
|
9
|
-
1.
|
|
10
|
-
2.
|
|
9
|
+
1. Corre `npx create-huenei-template` con `--template`, `--name`, `--agent both` y el resto de flags E2E (`--framework`, `--language`, `--architecture`, `--ci`).
|
|
10
|
+
2. Corre `pnpm install` (descarga Chromium, Firefox y WebKit vía `postinstall` en Playwright; en Cypress, el binario vía `onlyBuiltDependencies`).
|
|
11
|
+
3. Corre `/setup-project-context` en **modo pipeline**: el agente recibe el contexto del proyecto, escribe el briefing en `AGENTS.md` → `## Aplicación bajo prueba` sin grilling ni preguntas, y anota los huecos en `### Preguntas abiertas`.
|
|
12
|
+
4. Genera escenarios con `/new-e2e-scenario` (y, si aplica, scripts con `/new-e2e-test`) en **modo Hub (borrador)**. Solo es posible cuando se cumple el preset: el repo ya está vinculado al proyecto del Hub, `BASE_URL` y la rama principal están configuradas, y `/setup-project-context` ya corrió.
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
npx create-huenei-template --template e2e-automation --name "${PROYECTO}-automation" \
|
|
14
|
-
--agent both --framework <playwright|cypress> --language ts --architecture <arquitectura> --ci azure
|
|
15
|
-
```
|
|
14
|
+
Si el contexto llega vacío o incompleto, el agente deja `### Preguntas abiertas` con lo que falta; no aborta el pipeline.
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
## Flujo borrador → PR
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
El Hub genera escenarios y scripts como **borrador**. Cuando una persona los revisa y aprueba, un disparador del Hub:
|
|
19
|
+
|
|
20
|
+
1. Crea una rama desde la rama principal del repo.
|
|
21
|
+
2. Hace commits separados y en orden (tabla abajo).
|
|
22
|
+
3. Hace push y abre el PR.
|
|
23
|
+
|
|
24
|
+
Por eso `/new-e2e-scenario` y `/new-e2e-test` **no** crean ramas, commits ni PRs: escriben archivos en el workspace y terminan con un resumen para la revisión en el Hub.
|
|
25
|
+
|
|
26
|
+
### Orden de commits (Conventional Commits + id del escenario)
|
|
27
|
+
|
|
28
|
+
| # | Mensaje | Contenido |
|
|
29
|
+
|---|---------|-----------|
|
|
30
|
+
| 1 | `test(e2e): add scenario SC-123` | Escenario + `data/<id>` |
|
|
31
|
+
| 2 | `test(e2e): add role <rol>` | Catálogo de usuarios, login del rol y `.env.example` (solo si hay roles nuevos) |
|
|
32
|
+
| 3 | `test(e2e): add <abstracciones> for SC-123` | Page objects, tareas o app actions |
|
|
33
|
+
| 4 | `test(e2e): add spec SC-123` | Spec del escenario |
|
|
20
34
|
|
|
21
35
|
## Contrato
|
|
22
36
|
|
|
37
|
+
| Tema | Convención en este repo |
|
|
38
|
+
|------|-------------------------|
|
|
39
|
+
| Briefing del SUT | `AGENTS.md` → `## Aplicación bajo prueba` (fuente de verdad). `docs/PROJECT-CONTEXT.md` solo redirige ahí. |
|
|
40
|
+
| Escenarios | Markdown en `scenarios/` con frontmatter YAML (`id`, `title`, `priority`, `status`, `tags`, `target_path`). El `.md` es lo que el Hub sincroniza. Índice en `scenarios/INDEX.md` (estados y Decisiones compartidas). |
|
|
41
|
+
| Datos de prueba | `data/<scenario-id>/` referenciado desde el escenario. |
|
|
42
|
+
| Usuarios de prueba | Variables `TEST_<ROLE>_EMAIL` / `TEST_<ROLE>_PASSWORD` en `.env` (ver `.env.example`). |
|
|
43
|
+
| URL base | `BASE_URL` en `.env`; sin ella, `pnpm env:check` y el config de tests fallan. |
|
|
44
|
+
| Agente | Generado con `--agent both`: skills en `.claude/skills/` (Cursor las lee también), comandos en `.claude/commands/` y `.cursor/commands/`. |
|
|
45
|
+
| Diferencias app ↔ escenario | Solo `/new-e2e-scenario` reescribe el escenario. `/new-e2e-test` anota diferencias en **Preguntas abiertas** y las informa en el resumen / PR. |
|
|
46
|
+
|
|
23
47
|
1. El Hub exporta el escenario a `scenarios/<ID>-<slug>.md` siguiendo [scenarios/_template.md](../scenarios/_template.md) (commit en la rama de trabajo, o incluido en el prompt), con `target_path` y la tabla **Set de datos**. La URL de la app no va en el escenario: el Hub la pasa como `BASE_URL` en `envVars`, junto con los usuarios de prueba. Si un escenario exportado todavía trae `base_url`, se ignora.
|
|
24
|
-
2. El agente sigue [AGENTS.md](../AGENTS.md): lee el escenario, genera su set de datos si el Hub no lo incluyó, corre `pnpm env:check`, explora la app en `BASE_URL` + `target_path`, implementa según [ARCHITECTURE.md](ARCHITECTURE.md), corre los tests y deja el PR.
|
|
48
|
+
2. El agente sigue [AGENTS.md](../AGENTS.md): lee el escenario y [scenarios/INDEX.md](../scenarios/INDEX.md), genera su set de datos si el Hub no lo incluyó, corre `pnpm env:check`, explora la app en `BASE_URL` + `target_path`, implementa según [ARCHITECTURE.md](ARCHITECTURE.md), corre los tests, actualiza el índice y deja el trabajo listo. En modo Hub (borrador) no abre el PR: lo hace el disparador. El Hub puede leer `scenarios/INDEX.md` para ver estados.
|
|
25
49
|
3. Cada test generado queda etiquetado con el id del escenario (`@SC-123`), lo que permite al Hub correrlo con `--grep @SC-123` y vincular resultados.
|
|
26
50
|
|
|
27
|
-
##
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{ "url": "https://github.com/acme/e2e-tests", "startingRef": "main" }
|
|
44
|
-
],
|
|
45
|
-
"autoCreatePR": true,
|
|
46
|
-
"envVars": {
|
|
47
|
-
"BASE_URL": "https://staging.example.com",
|
|
48
|
-
"TEST_ADMIN_EMAIL": "<tomado del gestor de secretos del worker>",
|
|
49
|
-
"TEST_ADMIN_PASSWORD": "<tomado del gestor de secretos del worker>"
|
|
50
|
-
},
|
|
51
|
-
"mcpServers": {
|
|
52
|
-
"playwright": { "command": "npx", "args": ["-y", "@playwright/mcp@latest", "--headless"] },
|
|
53
|
-
"playwright-session": { "command": "npx", "args": ["-y", "@playwright/mcp@latest", "--headless", "--isolated", "--storage-state", ".auth/session.json"] }
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
- La respuesta incluye `agent.id` y `agent.url` (`https://cursor.com/agents/bc-…`). El Hub los guarda vinculados al escenario para que la persona abra el agente después.
|
|
59
|
-
- Los Cloud Agents leen `AGENTS.md` y `.cursor/rules/`, y preparan el entorno con `.cursor/environment.json`. **No leen `.cursor/mcp.json`**: por eso el MCP se pasa en `mcpServers` (o se configura a nivel equipo en cursor.com/agents).
|
|
60
|
-
- `envVars` lleva las variables de `.env.example`: `BASE_URL` (obligatoria), un `TEST_<ROL>_EMAIL` / `TEST_<ROL>_PASSWORD` por cada rol que use el escenario (ver [CREDENTIALS.md](CREDENTIALS.md)) y otros secretos si los hay. Con ellos el agente corre `pnpm env:check` y `pnpm auth` en la VM y explora las pantallas protegidas con `playwright-session` sin ver las contraseñas; verificar que la ruta relativa `.auth/session.json` se resuelva desde la raíz del repo.
|
|
61
|
-
- Revisar en la documentación vigente de la API los nombres exactos de `envVars` y `mcpServers` antes de implementar el worker; la API v1 está en beta pública.
|
|
62
|
-
- La API key vive solo en el worker, nunca en el navegador del Hub.
|
|
63
|
-
|
|
64
|
-
## Opción B: SDK local (app en red interna)
|
|
65
|
-
|
|
66
|
-
Si la app solo es accesible desde la red de Huenei, la VM de Cursor no la ve (salvo con Tailscale, Cloudflare Tunnel o Self-Hosted Machines). En ese caso el worker usa `@cursor/sdk` sobre un checkout local:
|
|
67
|
-
|
|
68
|
-
```ts
|
|
69
|
-
import { Agent } from '@cursor/sdk';
|
|
70
|
-
|
|
71
|
-
const agent = await Agent.create({
|
|
72
|
-
apiKey: process.env.CURSOR_API_KEY!,
|
|
73
|
-
model: { id: '<modelo>' },
|
|
74
|
-
local: { cwd: '/ruta/al/checkout/e2e-tests' },
|
|
75
|
-
});
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
En modo local las herramientas se aprueban automáticamente por defecto: correrlo en una máquina o contenedor dedicado.
|
|
79
|
-
|
|
80
|
-
## Opción C: handoff a una persona en el IDE
|
|
81
|
-
|
|
82
|
-
Para que quien prueba vea la app en el navegador de Cursor mientras el agente escribe el script:
|
|
83
|
-
|
|
84
|
-
1. Abrir el checkout local en Cursor (`cursor <ruta>`; verificar este comando en las máquinas de QA, no está en la documentación oficial).
|
|
85
|
-
2. Abrir un deeplink con un prompt **corto** que apunte al escenario, no el escenario entero (límite de 10.000 caracteres):
|
|
86
|
-
|
|
87
|
-
```text
|
|
88
|
-
cursor://anysphere.cursor-deeplink/prompt?text=Implementá%20scenarios%2FSC-123-checkout.md%20siguiendo%20AGENTS.md.%20Corré%20pnpm%20env%3Acheck%20y%20abrí%20BASE_URL%20en%20el%20navegador%20como%20referencia.
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
3. La persona revisa y envía el chat (el deeplink nunca se ejecuta solo y no elige el repo: cae en la ventana abierta). El agente abre la app con el navegador de Cursor y escribe el test.
|
|
51
|
+
## Resultados para el Hub
|
|
52
|
+
|
|
53
|
+
CI publica bajo `test-results/`:
|
|
54
|
+
|
|
55
|
+
| Archivo | Origen |
|
|
56
|
+
|---------|--------|
|
|
57
|
+
| `test-results/junit.xml` | Reporter JUnit (Playwright) / si el pipeline lo configura |
|
|
58
|
+
| `test-results/results.json` | Reporter JSON (Playwright) o hook `after:run` (Cypress) |
|
|
59
|
+
|
|
60
|
+
Cada test lleva el tag `@SC-xxx` (Playwright: `tag` en el `test` / `describe`; Cypress: `@SC-xxx` en el título del `describe` y en `tags`). El Hub vincula resultados y métricas del dashboard por ese tag.
|
|
61
|
+
|
|
62
|
+
## Fuera de alcance de este template
|
|
63
|
+
|
|
64
|
+
- UI del Hub, auth del Hub, colas o workers.
|
|
65
|
+
- Cómo el Hub inyecta el contexto del proyecto en el agente (API propia del Hub).
|
|
66
|
+
- El disparador (ramas, commits, push, PR) y el dashboard viven en el Hub; este template solo define el contrato.
|
package/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-scenario.md
CHANGED
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
# /new-e2e-scenario
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Completa un escenario E2E en `scenarios/` (detalle técnico y set de datos) para que `/new-e2e-test` pueda escribir el script sin adivinar.
|
|
4
4
|
|
|
5
5
|
Este archivo es la fuente única del comando: lo usan los comandos de Cursor, Claude Code (`.claude/commands/`), Copilot (`.github/prompts/`) y cualquier agente que lea `AGENTS.md` (Codex, ChatGPT).
|
|
6
6
|
|
|
7
|
-
**Entrada
|
|
7
|
+
**Entrada**: borrador del Hub (texto o `scenarios/<ID>-<slug>.md` ya existente), o URL / historia / ticket / descripción libre cuando no hay borrador.
|
|
8
8
|
|
|
9
|
-
**Salida** (se escribe recién en el paso 7):
|
|
9
|
+
**Salida** (se escribe recién en el paso 7, y el login del paso 3 si hace falta):
|
|
10
10
|
|
|
11
11
|
- `scenarios/<ID>-<slug>.md` con el formato de [scenarios/_template.md](../../scenarios/_template.md).
|
|
12
|
+
- `scenarios/INDEX.md`: fila del escenario y, si aplica, entradas nuevas en **Decisiones compartidas**.
|
|
12
13
|
- El set de datos en `data/<id>.ts` y, si hay datos generados, su factory en `factories/`.
|
|
13
14
|
- Los roles nuevos en el catálogo `data/users.ts` y sus variables en `.env.example`; si la pantalla requiere sesión, el login del rol en `tests/auth/<rol>.setup.ts`.
|
|
14
15
|
- Los nombres de otras variables secretas en `.env.example`, si aparecen.
|
|
15
16
|
|
|
16
|
-
Este comando no escribe tests: eso lo hace `/new-e2e-test`.
|
|
17
|
+
Este comando no escribe tests: eso lo hace `/new-e2e-test`. No crea ramas, commits ni PRs: el Hub abre el PR después de la revisión humana (ver [HUB-INTEGRATION.md](../HUB-INTEGRATION.md)).
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
+
## Entrada desde el Hub
|
|
20
|
+
|
|
21
|
+
Si la entrada trae un borrador de escenario o `scenarios/<ID>.md` ya existe:
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
1. Detectar qué secciones están completas (frontmatter, objetivo, pasos, resultado, set de datos).
|
|
24
|
+
2. Informar en **Supuestos** lo que ya trae (id, `target_path`, rol, pasos).
|
|
25
|
+
3. Abrir solo los pasos que tienen huecos.
|
|
26
|
+
4. **No cambiar el id** que vino del Hub.
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
Sin borrador, correr la entrevista completa (pasos 1–7).
|
|
29
|
+
|
|
30
|
+
## Modo de trabajo
|
|
23
31
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- Sin herramienta estructurada, numerar las preguntas (Q1, Q2...) con la recomendación debajo de cada una, redactadas para que responder "sí" acepte la recomendación.
|
|
32
|
+
**No escribir archivos** salvo el login del paso 3 y el cierre del paso 7.
|
|
33
|
+
|
|
34
|
+
**Skill grilling.** La entrevista sigue `.cursor/skills/grilling/SKILL.md` (rondas, frontera, recomendada primero). Usar la herramienta estructurada del entorno (`AskQuestion` / `AskUserQuestion`) con opciones, la recomendada primera y texto libre. Sin herramienta estructurada, numerar Q1, Q2… como indica grilling.
|
|
28
35
|
|
|
29
36
|
**Mensajes cortos.** Cada mensaje a la persona sigue este formato, y nada más:
|
|
30
37
|
|
|
@@ -35,7 +42,7 @@ Paso X de 7: <nombre del paso>
|
|
|
35
42
|
<preguntas en caja, o un bloque "Acción tuya">
|
|
36
43
|
```
|
|
37
44
|
|
|
38
|
-
- Máximo unas 5 líneas antes de las preguntas. No repetir respuestas ya dadas, no explicar las skills ni el
|
|
45
|
+
- Máximo unas 5 líneas antes de las preguntas. No repetir respuestas ya dadas, no explicar las skills ni el oficio, no mostrar el escenario armado hasta el paso 7.
|
|
39
46
|
- Cuando la persona tenga que hacer algo fuera del chat, usar un bloque **Acción tuya** con el comando o el cambio exacto, y esperar a que confirme antes de seguir:
|
|
40
47
|
|
|
41
48
|
```text
|
|
@@ -64,18 +71,23 @@ Leer antes de empezar. Rutas relativas a `.cursor/skills/`.
|
|
|
64
71
|
| Skill | Para qué |
|
|
65
72
|
| --- | --- |
|
|
66
73
|
| `e2e-playwright/SKILL.md` | Convenciones del proyecto; prevalece sobre las demás |
|
|
74
|
+
| `grilling/SKILL.md` | Mecánica de la entrevista (rondas, frontera, recomendada) |
|
|
67
75
|
| `e2e-testing-patterns/SKILL.md` | Decidir si el comportamiento corresponde a E2E (paso 2) |
|
|
68
76
|
| `playwright-best-practices/SKILL.md` | Preguntas técnicas (paso 6) |
|
|
69
77
|
|
|
70
78
|
## Contexto del proyecto
|
|
71
79
|
|
|
72
|
-
Leer primero `AGENTS.md` → `## Aplicación bajo prueba`. Si ya tiene contenido real (no solo placeholders), no repreguntés tipo de superficie, propósito del producto, roles, datos de prueba, flujos críticos ni convenciones de selectores. Si aún tiene placeholders, sugerí `/setup-project-context
|
|
80
|
+
Leer primero `AGENTS.md` → `## Aplicación bajo prueba` y `scenarios/INDEX.md`. Si `AGENTS.md` ya tiene contenido real (no solo placeholders), no repreguntés tipo de superficie, propósito del producto, roles, datos de prueba, flujos críticos ni convenciones de selectores. Si aún tiene placeholders, el paso 1 lo trata como requisito faltante del Hub (en modo interactivo, sugerí `/setup-project-context`; se puede hacer después del paso 1 si la persona quiere seguir ya).
|
|
81
|
+
|
|
82
|
+
Lo que ya esté en **Decisiones compartidas** del índice, o en un escenario previo con la misma pantalla/rol, va a **Supuestos**: no se vuelve a preguntar. Si un escenario existente cubre el mismo flujo, avisarlo y preguntar si se extiende o se crea uno nuevo.
|
|
73
83
|
|
|
74
84
|
## Paso 1 de 7: Preparación
|
|
75
85
|
|
|
86
|
+
Requisito previo del Hub: el repo ya está vinculado al proyecto (`BASE_URL` y rama principal configuradas, generado con el CLI, `/setup-project-context` corrido).
|
|
87
|
+
|
|
76
88
|
1. Correr `pnpm env:check`. Muestra `BASE_URL` y los usuarios definidos en `.env`, sin contraseñas.
|
|
77
|
-
2. Si falla, mostrar lo que falta en un bloque **Acción tuya** (por ejemplo:
|
|
78
|
-
3.
|
|
89
|
+
2. Si falla, o si `## Aplicación bajo prueba` en `AGENTS.md` todavía tiene solo placeholders, mostrar lo que falta en un bloque **Acción tuya** (por ejemplo: completar `BASE_URL`, o correr `/setup-project-context`) y no seguir con la entrevista desde cero.
|
|
90
|
+
3. Si todo está listo, informar `BASE_URL` en **Supuestos** como la app y el ambiente a automatizar, sin preguntar. Si la persona dice que no lo es, pedir que la corrija en `.env`: este proyecto apunta a una sola app; otros ambientes se eligen cambiando `BASE_URL` (en CI, como variable del pipeline).
|
|
79
91
|
|
|
80
92
|
## Paso 2 de 7: Objetivo y alcance
|
|
81
93
|
|
|
@@ -86,7 +98,7 @@ En una ronda:
|
|
|
86
98
|
|
|
87
99
|
En **Supuestos**, sin preguntar:
|
|
88
100
|
|
|
89
|
-
- Id: el que traiga la entrada (Hub, Jira u otra herramienta) o, si no trae ninguno, el siguiente `SC-xxx` libre
|
|
101
|
+
- Id: el que traiga la entrada (Hub, Jira u otra herramienta) o, si no trae ninguno, el siguiente `SC-xxx` libre según `scenarios/INDEX.md` (y los archivos de `scenarios/`). Con borrador del Hub, el id no se cambia.
|
|
90
102
|
- Tag: `@smoke` (camino crítico, corre en cada PR) si el flujo figura en **Flujos críticos** de `AGENTS.md`; si no, `@regression`.
|
|
91
103
|
|
|
92
104
|
Solo si hace falta: dividir en varios escenarios, requisitos de red (VPN), navegador, viewport, idioma o zona horaria.
|
|
@@ -96,12 +108,11 @@ Solo si hace falta: dividir en varios escenarios, requisitos de red (VPN), naveg
|
|
|
96
108
|
1. Si la pantalla es pública, `session: none` y pasar al paso 4.
|
|
97
109
|
2. Leer `data/users.ts` (si existe) y la salida de `pnpm env:check`. El rol que tenga los permisos que pide el escenario va a **Supuestos**; preguntar solo si ninguno sirve o si hay más de uno posible.
|
|
98
110
|
3. Si hace falta un rol nuevo, preguntar su clave (minúsculas y guiones bajos, por ejemplo `sales_manager`), rol y permisos. El email y la contraseña no se preguntan: van en `.env`. No preguntar si el login tiene MFA, SSO externo o captcha: aparece al correr `pnpm auth` (punto 5).
|
|
99
|
-
4.
|
|
111
|
+
4. Escribir solo lo necesario para explorar:
|
|
100
112
|
- el rol en `data/users.ts` (ver **Dónde se guarda**);
|
|
101
113
|
- `TEST_<CLAVE>_EMAIL=` y `TEST_<CLAVE>_PASSWORD=` en el bloque **Usuarios de prueba** de `.env.example`, sin valores;
|
|
102
114
|
- `tests/auth/<clave>.setup.ts`, si no existe (ejemplo en `e2e-playwright/SKILL.md`).
|
|
103
115
|
5. **Acción tuya**: completar esas dos variables en `.env`. Esperar, correr `pnpm env:check <clave>` y luego `pnpm auth`. Si `pnpm auth` falla, mostrar el error en una línea y acordar cómo seguir (corregir el login, o MFA/SSO según `e2e-playwright/SKILL.md`).
|
|
104
|
-
6. Volver a modo plan.
|
|
105
116
|
|
|
106
117
|
Preguntar también, en la misma ronda o la siguiente: entidades que deben existir antes (pedidos, productos, configuraciones), feature flags y, si el test modifica datos, cómo se limpia o se aísla para correr en paralelo.
|
|
107
118
|
|
|
@@ -186,7 +197,7 @@ Solo las filas que apliquen al escenario; si ninguna aplica además de la primer
|
|
|
186
197
|
| Necesita sesión | `advanced/authentication.md` | Supuesto: un usuario por rol compartido entre workers. Preguntar solo si el test cambia datos del propio usuario (perfil, contraseña) |
|
|
187
198
|
| Crea o modifica datos | `core/test-data.md`, `core/fixtures-hooks.md` | ¿Hay API para crear y limpiar? |
|
|
188
199
|
| Depende de servicios externos (pagos, email, OAuth) | `architecture/when-to-mock.md`, `advanced/third-party.md` | ¿Sandbox real o respuesta simulada? |
|
|
189
|
-
| Espera
|
|
200
|
+
| Espera eventos o datos asíncronos | `core/assertions-waiting.md`, `advanced/network-advanced.md` | ¿Qué request o elemento indica que la pantalla terminó? |
|
|
190
201
|
| Depende de fecha u hora | `advanced/clock-mocking.md` | ¿Fecha y zona horaria fijas? |
|
|
191
202
|
| Sube o descarga archivos | `testing-patterns/file-upload-download.md` | ¿Qué archivo? ¿Se valida el contenido? |
|
|
192
203
|
| Abre pestañas, popups o iframes | `advanced/multi-context.md`, `browser-apis/iframes.md` | ¿Qué se valida en la ventana o frame nuevo? |
|
|
@@ -200,9 +211,9 @@ En la misma ronda, si aplica: lo que el test no debe hacer (pagos reales, envío
|
|
|
200
211
|
|
|
201
212
|
## Paso 7 de 7: Confirmar y escribir
|
|
202
213
|
|
|
203
|
-
1. Mostrar una sola vez el resumen: objetivo, `target_path`, rol, pasos, resultado esperado, set de datos completo, decisiones técnicas, preguntas abiertas y la lista de archivos a escribir. Preguntar en caja si se escribe así o qué corregir. No escribir nada hasta la confirmación.
|
|
204
|
-
2.
|
|
205
|
-
3.
|
|
214
|
+
1. Mostrar una sola vez el resumen: objetivo, `target_path`, rol, pasos, resultado esperado, set de datos completo, decisiones técnicas, preguntas abiertas y la lista de archivos a escribir. Preguntar en caja si se escribe así o qué corregir. No escribir nada hasta la confirmación (salvo el login ya hecho en el paso 3).
|
|
215
|
+
2. Escribir `scenarios/<ID>-<slug>.md` completando todas las secciones de [scenarios/_template.md](../../scenarios/_template.md) (frontmatter y secciones que lee el Hub), con `target_path`, `session` y `data_file`. Sin campos nuevos fuera de la plantilla.
|
|
216
|
+
3. Actualizar `scenarios/INDEX.md`: agregar o actualizar la fila (Id, Título, Tag, Pantalla, Rol, Test vacío, Preguntas abiertas) con estado `borrador` si quedan Preguntas abiertas que bloquean, o `listo` si el escenario está completo. Sumar a **Decisiones compartidas** las respuestas nuevas reutilizables (rol nuevo, API de limpieza, mock, bloqueo, atributo de test id).
|
|
206
217
|
4. Escribir el set de datos y los roles nuevos según **Dónde se guarda**, y en `.env.example` el nombre de cada variable secreta nueva, sin valor.
|
|
207
218
|
5. Correr `pnpm typecheck` y `pnpm lint`, y corregir lo que falle.
|
|
208
219
|
6. Cerrar con dos líneas: los archivos escritos y `Siguiente: /new-e2e-test`.
|