create-huenei-template 0.3.3 → 0.3.5

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 (159) hide show
  1. package/dist/core/skills-refresh.js +8 -3
  2. package/dist/templates/automation/_ci/cypress-ts/azure/azure-pipelines.yml +7 -0
  3. package/dist/templates/automation/_ci/cypress-ts/bitbucket/bitbucket-pipelines.yml +1 -0
  4. package/dist/templates/automation/_ci/cypress-ts/github/.github/workflows/e2e.yml +9 -0
  5. package/dist/templates/automation/_ci/cypress-ts/gitlab/.gitlab-ci.yml +2 -1
  6. package/dist/templates/automation/_ci/cypress-ts/jenkins/Jenkinsfile +3 -0
  7. package/dist/templates/automation/_ci/playwright-ts/azure/azure-pipelines.yml +7 -0
  8. package/dist/templates/automation/_ci/playwright-ts/github/.github/workflows/e2e.yml +10 -3
  9. package/dist/templates/automation/_ci/playwright-ts/jenkins/Jenkinsfile +2 -1
  10. package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
  11. package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
  12. package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
  13. package/dist/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
  14. package/dist/templates/automation/e2e-cypress-ts-app-actions/AGENTS.md +14 -7
  15. package/dist/templates/automation/e2e-cypress-ts-app-actions/README.md +1 -1
  16. package/dist/templates/automation/e2e-cypress-ts-app-actions/_skills-lock.json +6 -0
  17. package/dist/templates/automation/e2e-cypress-ts-app-actions/cypress.config.ts +44 -1
  18. package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/CREDENTIALS.md +1 -0
  19. package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/HUB-INTEGRATION.md +99 -74
  20. package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +102 -22
  21. package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-test.md +90 -22
  22. package/dist/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/setup-project-context.md +1 -1
  23. package/dist/templates/automation/e2e-cypress-ts-app-actions/scenarios/INDEX.md +20 -0
  24. package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
  25. package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
  26. package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
  27. package/dist/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/tests.md +77 -0
  28. package/dist/templates/automation/e2e-cypress-ts-pom/AGENTS.md +14 -7
  29. package/dist/templates/automation/e2e-cypress-ts-pom/README.md +1 -1
  30. package/dist/templates/automation/e2e-cypress-ts-pom/_skills-lock.json +6 -0
  31. package/dist/templates/automation/e2e-cypress-ts-pom/cypress.config.ts +44 -1
  32. package/dist/templates/automation/e2e-cypress-ts-pom/docs/CREDENTIALS.md +1 -0
  33. package/dist/templates/automation/e2e-cypress-ts-pom/docs/HUB-INTEGRATION.md +99 -74
  34. package/dist/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-scenario.md +102 -22
  35. package/dist/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-test.md +90 -22
  36. package/dist/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/setup-project-context.md +1 -1
  37. package/dist/templates/automation/e2e-cypress-ts-pom/scenarios/INDEX.md +20 -0
  38. package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
  39. package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
  40. package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
  41. package/dist/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
  42. package/dist/templates/automation/e2e-playwright-ts-app-actions/AGENTS.md +14 -6
  43. package/dist/templates/automation/e2e-playwright-ts-app-actions/README.md +1 -1
  44. package/dist/templates/automation/e2e-playwright-ts-app-actions/_skills-lock.json +6 -0
  45. package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/CREDENTIALS.md +1 -0
  46. package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/HUB-INTEGRATION.md +99 -74
  47. package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +101 -21
  48. package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-test.md +99 -28
  49. package/dist/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/setup-project-context.md +1 -1
  50. package/dist/templates/automation/e2e-playwright-ts-app-actions/playwright.config.ts +6 -1
  51. package/dist/templates/automation/e2e-playwright-ts-app-actions/scenarios/INDEX.md +20 -0
  52. package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
  53. package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
  54. package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
  55. package/dist/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/tests.md +77 -0
  56. package/dist/templates/automation/e2e-playwright-ts-pom/AGENTS.md +14 -6
  57. package/dist/templates/automation/e2e-playwright-ts-pom/README.md +1 -1
  58. package/dist/templates/automation/e2e-playwright-ts-pom/_skills-lock.json +6 -0
  59. package/dist/templates/automation/e2e-playwright-ts-pom/docs/CREDENTIALS.md +1 -0
  60. package/dist/templates/automation/e2e-playwright-ts-pom/docs/HUB-INTEGRATION.md +99 -74
  61. package/dist/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-scenario.md +101 -21
  62. package/dist/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-test.md +99 -28
  63. package/dist/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/setup-project-context.md +1 -1
  64. package/dist/templates/automation/e2e-playwright-ts-pom/playwright.config.ts +6 -1
  65. package/dist/templates/automation/e2e-playwright-ts-pom/scenarios/INDEX.md +20 -0
  66. package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/SKILL.md +38 -0
  67. package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/agents/openai.yaml +3 -0
  68. package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/mocking.md +59 -0
  69. package/dist/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/tests.md +77 -0
  70. package/dist/templates/automation/e2e-playwright-ts-screenplay/AGENTS.md +14 -6
  71. package/dist/templates/automation/e2e-playwright-ts-screenplay/README.md +1 -1
  72. package/dist/templates/automation/e2e-playwright-ts-screenplay/_skills-lock.json +6 -0
  73. package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/CREDENTIALS.md +1 -0
  74. package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/HUB-INTEGRATION.md +99 -74
  75. package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-scenario.md +101 -21
  76. package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-test.md +99 -28
  77. package/dist/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/setup-project-context.md +1 -1
  78. package/dist/templates/automation/e2e-playwright-ts-screenplay/playwright.config.ts +6 -1
  79. package/dist/templates/automation/e2e-playwright-ts-screenplay/scenarios/INDEX.md +20 -0
  80. package/dist/test-cli.js +59 -4
  81. package/package.json +1 -1
  82. package/templates/automation/_ci/cypress-ts/azure/azure-pipelines.yml +7 -0
  83. package/templates/automation/_ci/cypress-ts/bitbucket/bitbucket-pipelines.yml +1 -0
  84. package/templates/automation/_ci/cypress-ts/github/.github/workflows/e2e.yml +9 -0
  85. package/templates/automation/_ci/cypress-ts/gitlab/.gitlab-ci.yml +2 -1
  86. package/templates/automation/_ci/cypress-ts/jenkins/Jenkinsfile +3 -0
  87. package/templates/automation/_ci/playwright-ts/azure/azure-pipelines.yml +7 -0
  88. package/templates/automation/_ci/playwright-ts/github/.github/workflows/e2e.yml +10 -3
  89. package/templates/automation/_ci/playwright-ts/jenkins/Jenkinsfile +2 -1
  90. package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
  91. package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
  92. package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
  93. package/templates/automation/e2e-cypress-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
  94. package/templates/automation/e2e-cypress-ts-app-actions/AGENTS.md +14 -7
  95. package/templates/automation/e2e-cypress-ts-app-actions/README.md +1 -1
  96. package/templates/automation/e2e-cypress-ts-app-actions/_skills-lock.json +6 -0
  97. package/templates/automation/e2e-cypress-ts-app-actions/cypress.config.ts +44 -1
  98. package/templates/automation/e2e-cypress-ts-app-actions/docs/CREDENTIALS.md +1 -0
  99. package/templates/automation/e2e-cypress-ts-app-actions/docs/HUB-INTEGRATION.md +99 -74
  100. package/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +102 -22
  101. package/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/new-e2e-test.md +90 -22
  102. package/templates/automation/e2e-cypress-ts-app-actions/docs/agent-commands/setup-project-context.md +1 -1
  103. package/templates/automation/e2e-cypress-ts-app-actions/scenarios/INDEX.md +20 -0
  104. package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
  105. package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
  106. package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
  107. package/templates/automation/e2e-cypress-ts-pom/.cursor/skills/tdd/tests.md +77 -0
  108. package/templates/automation/e2e-cypress-ts-pom/AGENTS.md +14 -7
  109. package/templates/automation/e2e-cypress-ts-pom/README.md +1 -1
  110. package/templates/automation/e2e-cypress-ts-pom/_skills-lock.json +6 -0
  111. package/templates/automation/e2e-cypress-ts-pom/cypress.config.ts +44 -1
  112. package/templates/automation/e2e-cypress-ts-pom/docs/CREDENTIALS.md +1 -0
  113. package/templates/automation/e2e-cypress-ts-pom/docs/HUB-INTEGRATION.md +99 -74
  114. package/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-scenario.md +102 -22
  115. package/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/new-e2e-test.md +90 -22
  116. package/templates/automation/e2e-cypress-ts-pom/docs/agent-commands/setup-project-context.md +1 -1
  117. package/templates/automation/e2e-cypress-ts-pom/scenarios/INDEX.md +20 -0
  118. package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/SKILL.md +38 -0
  119. package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/agents/openai.yaml +3 -0
  120. package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/mocking.md +59 -0
  121. package/templates/automation/e2e-playwright-ts-app-actions/.cursor/skills/tdd/tests.md +77 -0
  122. package/templates/automation/e2e-playwright-ts-app-actions/AGENTS.md +14 -6
  123. package/templates/automation/e2e-playwright-ts-app-actions/README.md +1 -1
  124. package/templates/automation/e2e-playwright-ts-app-actions/_skills-lock.json +6 -0
  125. package/templates/automation/e2e-playwright-ts-app-actions/docs/CREDENTIALS.md +1 -0
  126. package/templates/automation/e2e-playwright-ts-app-actions/docs/HUB-INTEGRATION.md +99 -74
  127. package/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-scenario.md +101 -21
  128. package/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/new-e2e-test.md +99 -28
  129. package/templates/automation/e2e-playwright-ts-app-actions/docs/agent-commands/setup-project-context.md +1 -1
  130. package/templates/automation/e2e-playwright-ts-app-actions/playwright.config.ts +6 -1
  131. package/templates/automation/e2e-playwright-ts-app-actions/scenarios/INDEX.md +20 -0
  132. package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/SKILL.md +38 -0
  133. package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/agents/openai.yaml +3 -0
  134. package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/mocking.md +59 -0
  135. package/templates/automation/e2e-playwright-ts-pom/.cursor/skills/tdd/tests.md +77 -0
  136. package/templates/automation/e2e-playwright-ts-pom/AGENTS.md +14 -6
  137. package/templates/automation/e2e-playwright-ts-pom/README.md +1 -1
  138. package/templates/automation/e2e-playwright-ts-pom/_skills-lock.json +6 -0
  139. package/templates/automation/e2e-playwright-ts-pom/docs/CREDENTIALS.md +1 -0
  140. package/templates/automation/e2e-playwright-ts-pom/docs/HUB-INTEGRATION.md +99 -74
  141. package/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-scenario.md +101 -21
  142. package/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/new-e2e-test.md +99 -28
  143. package/templates/automation/e2e-playwright-ts-pom/docs/agent-commands/setup-project-context.md +1 -1
  144. package/templates/automation/e2e-playwright-ts-pom/playwright.config.ts +6 -1
  145. package/templates/automation/e2e-playwright-ts-pom/scenarios/INDEX.md +20 -0
  146. package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/SKILL.md +38 -0
  147. package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/agents/openai.yaml +3 -0
  148. package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/mocking.md +59 -0
  149. package/templates/automation/e2e-playwright-ts-screenplay/.cursor/skills/tdd/tests.md +77 -0
  150. package/templates/automation/e2e-playwright-ts-screenplay/AGENTS.md +14 -6
  151. package/templates/automation/e2e-playwright-ts-screenplay/README.md +1 -1
  152. package/templates/automation/e2e-playwright-ts-screenplay/_skills-lock.json +6 -0
  153. package/templates/automation/e2e-playwright-ts-screenplay/docs/CREDENTIALS.md +1 -0
  154. package/templates/automation/e2e-playwright-ts-screenplay/docs/HUB-INTEGRATION.md +99 -74
  155. package/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-scenario.md +101 -21
  156. package/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/new-e2e-test.md +99 -28
  157. package/templates/automation/e2e-playwright-ts-screenplay/docs/agent-commands/setup-project-context.md +1 -1
  158. package/templates/automation/e2e-playwright-ts-screenplay/playwright.config.ts +6 -1
  159. package/templates/automation/e2e-playwright-ts-screenplay/scenarios/INDEX.md +20 -0
@@ -13,7 +13,12 @@ export default defineConfig({
13
13
  retries: process.env.CI ? 2 : 0,
14
14
  workers: process.env.CI ? 2 : undefined,
15
15
  reporter: process.env.CI
16
- ? [['list'], ['html', { open: 'never' }], ['junit', { outputFile: 'test-results/junit.xml' }]]
16
+ ? [
17
+ ['list'],
18
+ ['html', { open: 'never' }],
19
+ ['junit', { outputFile: 'test-results/junit.xml' }],
20
+ ['json', { outputFile: 'test-results/results.json' }],
21
+ ]
17
22
  : [['list'], ['html', { open: 'never' }]],
18
23
  use: {
19
24
  baseURL,
@@ -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,3 @@
1
+ interface:
2
+ display_name: "TDD"
3
+ short_description: "Test-driven red-green-refactor"
@@ -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
+ ```
@@ -1,9 +1,12 @@
1
+ <!-- huenei-template:start -->
1
2
  # AGENTS.md
2
3
 
3
4
  Proyecto de pruebas E2E con **Playwright + TypeScript**, arquitectura **Page Object Model (POM)**.
4
5
 
5
6
  Este archivo es el punto de entrada para cualquier agente (Cursor, Claude Code, Codex/ChatGPT, Copilot, Cursor SDK, Cloud Agents). Las reglas en `.cursor/rules/` lo complementan.
6
7
 
8
+ <!-- huenei-template:end -->
9
+
7
10
  ## Aplicación bajo prueba
8
11
 
9
12
  Briefing canónico de la app bajo prueba. Completar con `/setup-project-context`. Los agentes lo leen antes de cualquier tarea E2E.
@@ -50,6 +53,8 @@ Briefing canónico de la app bajo prueba. Completar con `/setup-project-context`
50
53
 
51
54
  Última actualización: <!-- YYYY-MM-DD -->
52
55
 
56
+ <!-- huenei-template:start -->
57
+
53
58
  ## Comandos
54
59
 
55
60
  | Acción | Comando |
@@ -75,21 +80,21 @@ Funcionan en cualquier IDE o extensión. Si la persona escribe el comando, o pid
75
80
  | Comando | Qué hace | Seguir |
76
81
  | --- | --- | --- |
77
82
  | `/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` | Entrevista a QA paso a paso y escribe el escenario en `scenarios/` y su set de datos en `data/<id>.ts` | [docs/agent-commands/new-e2e-scenario.md](docs/agent-commands/new-e2e-scenario.md) |
79
- | `/new-e2e-test` | Pide elegir un escenario e implementa su test | [docs/agent-commands/new-e2e-test.md](docs/agent-commands/new-e2e-test.md) |
83
+ | `/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) |
84
+ | `/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
85
 
81
86
  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
87
 
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.
88
+ 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. Excepciones Hub: en **Modo Hub (borrador)**, `/new-e2e-scenario` y `/new-e2e-test` corren sin persona (sin grilling ni preguntas) y los huecos van a **Preguntas abiertas**. En **Modo Hub (interactivo)**, una sesión del Hub los sigue sin repo ni terminal y solo pregunta con bloques `hub-questions`, que responde una persona desde el Hub. Cada comando documenta sus modos en `## Modos`.
84
89
 
85
90
  ## Flujo para implementar un escenario
86
91
 
87
- 1. **Leer 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.
92
+ 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
93
  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
94
  3. **Implementar según la arquitectura** descrita en [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md): reutilizar lo existente antes de crear algo nuevo.
90
95
  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 nuevo deben pasar. Ante un fallo, revisar el trace (`test-results/`) antes de cambiar el test.
92
- 6. **Dejar el PR listo**: describir el escenario cubierto, los archivos creados y cualquier supuesto.
96
+ 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/`).
97
+ 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 persona (IDE)**, 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
98
 
94
99
  ## Skills
95
100
 
@@ -102,6 +107,7 @@ En `.cursor/skills/`. Ante cualquier diferencia, este archivo, `.cursor/rules/`
102
107
  | `playwright-cli` | Explorar la app desde la terminal con `npx playwright cli`, sin MCP |
103
108
  | `e2e-testing-patterns` | Criterios generales de E2E (qué automatizar, selectores estables, aislamiento) |
104
109
  | `grilling` | Entrevistar a la persona sobre el dominio antes de documentar contexto |
110
+ | `tdd` | Ciclo falla → pasa → puede fallar al implementar cada caso E2E |
105
111
  | `verification-before-completion` | No dar nada por terminado sin correr y leer typecheck, lint y tests |
106
112
 
107
113
  Antes de declarar un escenario terminado, aplicar `verification-before-completion`: correr `pnpm typecheck`, `pnpm lint` y el test nuevo, y citar el resultado.
@@ -112,3 +118,5 @@ Antes de declarar un escenario terminado, aplicar `verification-before-completio
112
118
  - No usar esperas fijas (`waitForTimeout`) ni `test.only`.
113
119
  - En `playwright.config.ts`, solo cambiar `testIdAttribute` si la app usa otro atributo, salvo que el escenario requiera más. Si cambia la versión de `@playwright/test`, actualizar también la imagen Docker del CI.
114
120
  - Los tests deben ser independientes entre sí y poder correr en paralelo.
121
+
122
+ <!-- huenei-template:end -->
@@ -58,7 +58,7 @@ Safari real no se puede automatizar: el proyecto `webkit` usa el motor WebKit. E
58
58
  pages/ Page objects: locators y acciones por página
59
59
  tests/ Specs y aserciones
60
60
  data/ Set de datos de cada escenario (data/<id>.ts), catálogo de usuarios (users.ts) y credentials.ts
61
- scenarios/ Escenarios en lenguaje natural (contrato con el Hub)
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 POM 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
  }
@@ -26,4 +26,5 @@ Definir `BASE_URL` como variable y cada `TEST_<CLAVE>_EMAIL` / `TEST_<CLAVE>_PAS
26
26
 
27
27
  - Las contraseñas nunca van en el catálogo, en un set de datos ni en un test: siempre `passwordOf()`. La excepción son los casos negativos con una contraseña inválida a propósito.
28
28
  - El agente nunca escribe valores en `.env`: los completa la persona.
29
+ - El agente nunca pide passwords, API keys, PATs ni otros valores secretos, tampoco en las preguntas del Hub (`hub-questions`): para una credencial pregunta la persona (`type: persona`, por clave de rol) o el nombre de la variable (`TEST_<CLAVE>_EMAIL`).
29
30
  - En `.env` solo van `BASE_URL`, los usuarios y otros secretos (tokens, claves de API). El resto de los datos de prueba va en el set de datos de cada escenario.
@@ -1,91 +1,116 @@
1
1
  # Integración con el Hub
2
2
 
3
- Cómo el Hub puede pedirle a un agente de Cursor que implemente un escenario en este repo. El código del Hub y del worker vive fuera de este repositorio; acá está el contrato del lado del repo de pruebas.
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
- En el pipeline del Hub, este repo se crea y se configura en tres pasos:
7
+ Cuando el Hub crea el proyecto de automatización:
8
8
 
9
- 1. Un nodo reúne el contexto del proyecto (tipo de superficie, producto, problemas que resuelve, roles, flujos).
10
- 2. Otro nodo genera el repo en Azure con el CLI, para Cursor, Claude Code y VS Code:
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 (interactivo)** con una persona respondiendo desde el Hub, o en **Modo Hub (borrador)** (ver **Modos de los comandos**). 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
- ```bash
13
- npx create-huenei-template --template e2e-automation --name "${PROYECTO}-automation" \
14
- --agent both --framework <playwright|cypress> --language ts --architecture <arquitectura> --ci azure
14
+ Si el contexto llega vacío o incompleto, el agente deja `### Preguntas abiertas` con lo que falta; no aborta el pipeline.
15
+
16
+ ## Modos de los comandos
17
+
18
+ | Modo | Marcador en la invocación | Quién corre el comando | Preguntas | Resultado |
19
+ |------|---------------------------|------------------------|-----------|-----------|
20
+ | Pipeline | `/setup-project-context` con el contexto del proyecto | Agente del pipeline | Ninguna | Briefing en `AGENTS.md` |
21
+ | Modo Hub (interactivo) | `Modo Hub (interactivo)` | Modelo del Hub, sin repo, terminal ni navegador | Bloques `hub-questions`; responde una persona desde el Hub | `/new-e2e-scenario`: secciones del escenario que guarda el Hub. `/new-e2e-test`: plan del test. No escribe archivos |
22
+ | Modo Hub (borrador) | `Modo Hub (borrador)` | Agente de código en la rama de trabajo | Ninguna | Archivos en el workspace, sin ramas, commits ni PRs. Legacy sin plan; deprecado a favor de interactivo + ejecutar plan |
23
+ | Ejecutar plan aprobado | `Modo Hub (borrador)` + bloque **Plan aprobado por QA** | Agente de código en la rama de trabajo | Ninguna | `/new-e2e-test` implementa el plan y resume en el orden de commits |
24
+ | Modo persona (IDE) | Sin marcador | Una persona en su editor | Entrevista (grilling) | El comando completo |
25
+
26
+ ## Flujo plan → aprobar → ejecutar
27
+
28
+ 1. El Hub abre una sesión con el marcador `Modo Hub (interactivo)` y el comando importado (`/new-e2e-scenario` o `/new-e2e-test`) como guía.
29
+ 2. Si falta información, el comando responde con un bloque `hub-questions`:
30
+
31
+ ```hub-questions
32
+ {
33
+ "questions": [
34
+ { "id": "acceso-rol", "prompt": "¿Con qué persona se entra a la pantalla?", "type": "persona", "required": true },
35
+ { "id": "datos-origen-pedido", "prompt": "¿De dónde sale el pedido que se edita?", "type": "select", "required": true, "options": ["fijo", "generado", "creado por API", "existente"] }
36
+ ],
37
+ "context": "Faltan el rol de Acceso y el origen del pedido del Set de datos."
38
+ }
39
+ ```
40
+
41
+ `type` es `text`, `select`, `persona` o `boolean`; `options` solo con `select`; `context` es opcional. No hay otros campos.
42
+ 3. La persona responde en el formulario del Hub y el Hub devuelve un bloque `hub-answers`:
43
+
44
+ ```hub-answers
45
+ { "answers": { "acceso-rol": "sales_manager", "datos-origen-pedido": "creado por API" } }
15
46
  ```
16
47
 
17
- 3. Un agente corre [`/setup-project-context`](agent-commands/setup-project-context.md) en ese repo con el contexto del paso 1. Va en su **modo pipeline**: sin preguntas, escribe el briefing en [AGENTS.md](../AGENTS.md) → `## Aplicación bajo prueba` y anota los huecos en `### Preguntas abiertas`.
48
+ Lo no respondido queda en **Preguntas abiertas**.
49
+ 4. Cuando no falta nada, el comando no emite `hub-questions` y responde con un resumen y el plan numerado. La aprobación es el botón «Aprobar plan» del Hub (en `hub-answers` llega como `"approvedPlan": true`); el comando nunca la pregunta.
50
+ 5. Ejecución:
51
+ - `/new-e2e-scenario`: el Hub pide las secciones del escenario en su formato y las guarda (no se escriben archivos en el repo).
52
+ - `/new-e2e-test`: el Hub lanza el agente de código con `Modo Hub (borrador)` y el bloque **Plan aprobado por QA**; el comando sigue **Ejecutar plan aprobado** y termina con el resumen en el orden de commits de abajo.
53
+
54
+ Nunca se piden passwords, API keys ni PATs: las credenciales se refieren por persona o por nombre de variable (ver [CREDENTIALS.md](CREDENTIALS.md)).
55
+
56
+ ## Repos generados con 0.3.4 o anterior
57
+
58
+ Los comandos de un repo ya generado no se actualizan solos: el Hub sincroniza los que están en el repo. Para usar **Modo Hub (interactivo)** en un repo generado con 0.3.4 o anterior:
59
+
60
+ 1. Copiar de un proyecto generado con esta versión (misma plantilla) `docs/agent-commands/new-e2e-scenario.md`, `docs/agent-commands/new-e2e-test.md` y los bloques entre `<!-- huenei-template:start -->` y `<!-- huenei-template:end -->` de `AGENTS.md`, sin tocar `## Aplicación bajo prueba`.
61
+ 2. Commitear en la rama principal (por PR).
62
+ 3. En el Hub, correr «Re-sync commands» y confirmar el estado `SYNCED`.
18
63
 
19
- Después, cada escenario sigue el contrato de abajo.
64
+ Sin esa copia, las sesiones del Hub funcionan como antes (las instrucciones del Hub mandan y el comando no tiene la sección interactiva).
65
+
66
+ ## Flujo borrador → PR
67
+
68
+ El Hub genera escenarios y scripts como **borrador**. Cuando una persona los revisa y aprueba, un disparador del Hub:
69
+
70
+ 1. Crea una rama desde la rama principal del repo.
71
+ 2. Hace commits separados y en orden (tabla abajo).
72
+ 3. Hace push y abre el PR.
73
+
74
+ 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.
75
+
76
+ ### Orden de commits (Conventional Commits + id del escenario)
77
+
78
+ | # | Mensaje | Contenido |
79
+ |---|---------|-----------|
80
+ | 1 | `test(e2e): add scenario SC-123` | Escenario + `data/<id>` |
81
+ | 2 | `test(e2e): add role <rol>` | Catálogo de usuarios, login del rol y `.env.example` (solo si hay roles nuevos) |
82
+ | 3 | `test(e2e): add <abstracciones> for SC-123` | Page objects, tareas o app actions |
83
+ | 4 | `test(e2e): add spec SC-123` | Spec del escenario |
20
84
 
21
85
  ## Contrato
22
86
 
87
+ | Tema | Convención en este repo |
88
+ |------|-------------------------|
89
+ | Briefing del SUT | `AGENTS.md` → `## Aplicación bajo prueba` (fuente de verdad). `docs/PROJECT-CONTEXT.md` solo redirige ahí. |
90
+ | 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). |
91
+ | Datos de prueba | `data/<scenario-id>/` referenciado desde el escenario. |
92
+ | Usuarios de prueba | Variables `TEST_<ROLE>_EMAIL` / `TEST_<ROLE>_PASSWORD` en `.env` (ver `.env.example`). |
93
+ | URL base | `BASE_URL` en `.env`; sin ella, `pnpm env:check` y el config de tests fallan. |
94
+ | Agente | Generado con `--agent both`: skills en `.claude/skills/` (Cursor las lee también), comandos en `.claude/commands/` y `.cursor/commands/`. |
95
+ | 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. |
96
+
23
97
  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.
98
+ 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
99
  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
100
 
27
- ## Opción A: Cloud Agents API (worker del Hub)
28
-
29
- Para apps accesibles desde internet. El agente corre en una VM de Cursor con navegador propio y abre un PR.
30
-
31
- ```http
32
- POST https://api.cursor.com/v1/agents
33
- Authorization: Bearer <CURSOR_API_KEY>
34
- Content-Type: application/json
35
- ```
36
-
37
- ```json
38
- {
39
- "prompt": {
40
- "text": "Implementá el escenario scenarios/SC-123-checkout.md siguiendo AGENTS.md. Corré typecheck, lint y el test nuevo antes de terminar."
41
- },
42
- "repos": [
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
- ```
101
+ ## Resultados para el Hub
102
+
103
+ CI publica bajo `test-results/`:
104
+
105
+ | Archivo | Origen |
106
+ |---------|--------|
107
+ | `test-results/junit.xml` | Reporter JUnit (Playwright) / si el pipeline lo configura |
108
+ | `test-results/results.json` | Reporter JSON (Playwright) o hook `after:run` (Cypress) |
109
+
110
+ 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.
111
+
112
+ ## Fuera de alcance de este template
90
113
 
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.
114
+ - UI del Hub, auth del Hub, colas o workers.
115
+ - Cómo el Hub inyecta el contexto del proyecto en el agente (API propia del Hub).
116
+ - El disparador (ramas, commits, push, PR) y el dashboard viven en el Hub; este template solo define el contrato.