@athenaflow/plugin-e2e-test-builder 2.0.9 → 2.0.10

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 (167) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/dist/{2.0.8 → 2.0.10}/.agents/plugins/marketplace.json +1 -1
  4. package/dist/{2.0.9 → 2.0.10}/claude/plugin/.claude-plugin/plugin.json +1 -1
  5. package/dist/{2.0.9 → 2.0.10}/claude/plugin/package.json +8 -2
  6. package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/add-e2e-tests/SKILL.md +18 -65
  7. package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/add-e2e-tests/agents/openai.yaml +1 -1
  8. package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/add-e2e-tests/references/error-recovery.md +3 -3
  9. package/dist/{2.0.8/codex → 2.0.10/claude}/plugin/skills/add-e2e-tests/references/scaffolding.md +1 -1
  10. package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/fix-flaky-tests/SKILL.md +1 -1
  11. package/dist/{2.0.8/codex → 2.0.10/claude}/plugin/skills/fix-flaky-tests/references/fix-patterns.md +3 -2
  12. package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/generate-test-cases/SKILL.md +8 -2
  13. package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/plan-test-coverage/SKILL.md +7 -6
  14. package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-cases/SKILL.md +3 -4
  15. package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/SKILL.md +4 -3
  16. package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/api-setup-teardown.md +1 -1
  17. package/dist/{2.0.9 → 2.0.10}/codex/plugin/.codex-plugin/plugin.json +1 -1
  18. package/dist/{2.0.9 → 2.0.10}/codex/plugin/package.json +8 -2
  19. package/dist/{2.0.9 → 2.0.10}/codex/plugin/skills/add-e2e-tests/SKILL.md +18 -65
  20. package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/add-e2e-tests/agents/openai.yaml +1 -1
  21. package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/add-e2e-tests/references/error-recovery.md +3 -3
  22. package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/add-e2e-tests/references/scaffolding.md +1 -1
  23. package/dist/{2.0.8/claude → 2.0.10/codex}/plugin/skills/fix-flaky-tests/SKILL.md +1 -1
  24. package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/fix-flaky-tests/references/fix-patterns.md +3 -2
  25. package/dist/{2.0.9 → 2.0.10}/codex/plugin/skills/generate-test-cases/SKILL.md +8 -2
  26. package/dist/{2.0.9 → 2.0.10}/codex/plugin/skills/plan-test-coverage/SKILL.md +7 -6
  27. package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/review-test-cases/SKILL.md +3 -4
  28. package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/write-test-code/SKILL.md +4 -3
  29. package/dist/{2.0.9/claude → 2.0.10/codex}/plugin/skills/write-test-code/references/api-setup-teardown.md +1 -1
  30. package/dist/{2.0.9 → 2.0.10}/release.json +1 -1
  31. package/package.json +7 -1
  32. package/skills/add-e2e-tests/SKILL.md +18 -65
  33. package/skills/add-e2e-tests/agents/openai.yaml +1 -1
  34. package/skills/add-e2e-tests/references/error-recovery.md +3 -3
  35. package/skills/add-e2e-tests/references/scaffolding.md +1 -1
  36. package/skills/fix-flaky-tests/SKILL.md +1 -1
  37. package/skills/fix-flaky-tests/references/fix-patterns.md +3 -2
  38. package/skills/generate-test-cases/SKILL.md +8 -2
  39. package/skills/plan-test-coverage/SKILL.md +7 -6
  40. package/skills/review-test-cases/SKILL.md +3 -4
  41. package/skills/write-test-code/SKILL.md +4 -3
  42. package/skills/write-test-code/references/api-setup-teardown.md +1 -1
  43. package/dist/2.0.8/claude/plugin/.claude-plugin/plugin.json +0 -20
  44. package/dist/2.0.8/claude/plugin/package.json +0 -9
  45. package/dist/2.0.8/claude/plugin/skills/add-e2e-tests/SKILL.md +0 -217
  46. package/dist/2.0.8/claude/plugin/skills/add-e2e-tests/agents/claude.yaml +0 -1
  47. package/dist/2.0.8/claude/plugin/skills/add-e2e-tests/references/scaffolding.md +0 -12
  48. package/dist/2.0.8/claude/plugin/skills/add-e2e-tests/references/tracker-template.md +0 -53
  49. package/dist/2.0.8/claude/plugin/skills/fix-flaky-tests/references/fix-patterns.md +0 -91
  50. package/dist/2.0.8/claude/plugin/skills/generate-test-cases/SKILL.md +0 -184
  51. package/dist/2.0.8/claude/plugin/skills/plan-test-coverage/SKILL.md +0 -116
  52. package/dist/2.0.8/codex/plugin/.codex-plugin/plugin.json +0 -15
  53. package/dist/2.0.8/codex/plugin/package.json +0 -9
  54. package/dist/2.0.8/codex/plugin/skills/add-e2e-tests/SKILL.md +0 -217
  55. package/dist/2.0.8/codex/plugin/skills/add-e2e-tests/agents/claude.yaml +0 -1
  56. package/dist/2.0.8/codex/plugin/skills/add-e2e-tests/references/error-recovery.md +0 -43
  57. package/dist/2.0.8/codex/plugin/skills/add-e2e-tests/references/tracker-template.md +0 -53
  58. package/dist/2.0.8/codex/plugin/skills/fix-flaky-tests/SKILL.md +0 -160
  59. package/dist/2.0.8/codex/plugin/skills/generate-test-cases/SKILL.md +0 -184
  60. package/dist/2.0.8/codex/plugin/skills/plan-test-coverage/SKILL.md +0 -116
  61. package/dist/2.0.8/codex/plugin/skills/review-test-cases/SKILL.md +0 -147
  62. package/dist/2.0.8/codex/plugin/skills/write-test-code/SKILL.md +0 -227
  63. package/dist/2.0.8/codex/plugin/skills/write-test-code/references/api-setup-teardown.md +0 -83
  64. package/dist/2.0.8/release.json +0 -18
  65. package/dist/2.0.9/.agents/plugins/marketplace.json +0 -14
  66. package/dist/2.0.9/claude/plugin/skills/add-e2e-tests/agents/openai.yaml +0 -10
  67. package/dist/2.0.9/claude/plugin/skills/add-e2e-tests/references/authentication.md +0 -8
  68. package/dist/2.0.9/claude/plugin/skills/add-e2e-tests/references/tracker-template.md +0 -53
  69. package/dist/2.0.9/claude/plugin/skills/analyze-test-codebase/SKILL.md +0 -142
  70. package/dist/2.0.9/claude/plugin/skills/analyze-test-codebase/agents/claude.yaml +0 -3
  71. package/dist/2.0.9/claude/plugin/skills/analyze-test-codebase/agents/openai.yaml +0 -4
  72. package/dist/2.0.9/claude/plugin/skills/fix-flaky-tests/agents/claude.yaml +0 -3
  73. package/dist/2.0.9/claude/plugin/skills/fix-flaky-tests/agents/openai.yaml +0 -10
  74. package/dist/2.0.9/claude/plugin/skills/generate-test-cases/agents/claude.yaml +0 -3
  75. package/dist/2.0.9/claude/plugin/skills/generate-test-cases/agents/openai.yaml +0 -10
  76. package/dist/2.0.9/claude/plugin/skills/generate-test-cases/references/scenario-categories.md +0 -36
  77. package/dist/2.0.9/claude/plugin/skills/plan-test-coverage/agents/claude.yaml +0 -3
  78. package/dist/2.0.9/claude/plugin/skills/plan-test-coverage/agents/openai.yaml +0 -10
  79. package/dist/2.0.9/claude/plugin/skills/review-test-cases/agents/claude.yaml +0 -3
  80. package/dist/2.0.9/claude/plugin/skills/review-test-cases/agents/openai.yaml +0 -10
  81. package/dist/2.0.9/claude/plugin/skills/review-test-code/SKILL.md +0 -189
  82. package/dist/2.0.9/claude/plugin/skills/review-test-code/agents/claude.yaml +0 -3
  83. package/dist/2.0.9/claude/plugin/skills/review-test-code/agents/openai.yaml +0 -10
  84. package/dist/2.0.9/claude/plugin/skills/write-test-code/agents/claude.yaml +0 -3
  85. package/dist/2.0.9/claude/plugin/skills/write-test-code/agents/openai.yaml +0 -10
  86. package/dist/2.0.9/claude/plugin/skills/write-test-code/references/anti-patterns.md +0 -88
  87. package/dist/2.0.9/claude/plugin/skills/write-test-code/references/auth-patterns.md +0 -63
  88. package/dist/2.0.9/claude/plugin/skills/write-test-code/references/mapping-tables.md +0 -56
  89. package/dist/2.0.9/claude/plugin/skills/write-test-code/references/network-interception.md +0 -56
  90. package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/agents/openai.yaml +0 -10
  91. package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/references/authentication.md +0 -8
  92. package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/references/error-recovery.md +0 -43
  93. package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/references/scaffolding.md +0 -12
  94. package/dist/2.0.9/codex/plugin/skills/add-e2e-tests/references/tracker-template.md +0 -53
  95. package/dist/2.0.9/codex/plugin/skills/analyze-test-codebase/SKILL.md +0 -142
  96. package/dist/2.0.9/codex/plugin/skills/analyze-test-codebase/agents/claude.yaml +0 -3
  97. package/dist/2.0.9/codex/plugin/skills/analyze-test-codebase/agents/openai.yaml +0 -4
  98. package/dist/2.0.9/codex/plugin/skills/fix-flaky-tests/SKILL.md +0 -160
  99. package/dist/2.0.9/codex/plugin/skills/fix-flaky-tests/agents/claude.yaml +0 -3
  100. package/dist/2.0.9/codex/plugin/skills/fix-flaky-tests/agents/openai.yaml +0 -10
  101. package/dist/2.0.9/codex/plugin/skills/fix-flaky-tests/references/fix-patterns.md +0 -91
  102. package/dist/2.0.9/codex/plugin/skills/generate-test-cases/agents/claude.yaml +0 -3
  103. package/dist/2.0.9/codex/plugin/skills/generate-test-cases/agents/openai.yaml +0 -10
  104. package/dist/2.0.9/codex/plugin/skills/generate-test-cases/references/scenario-categories.md +0 -36
  105. package/dist/2.0.9/codex/plugin/skills/plan-test-coverage/agents/claude.yaml +0 -3
  106. package/dist/2.0.9/codex/plugin/skills/plan-test-coverage/agents/openai.yaml +0 -10
  107. package/dist/2.0.9/codex/plugin/skills/review-test-cases/SKILL.md +0 -147
  108. package/dist/2.0.9/codex/plugin/skills/review-test-cases/agents/claude.yaml +0 -3
  109. package/dist/2.0.9/codex/plugin/skills/review-test-cases/agents/openai.yaml +0 -10
  110. package/dist/2.0.9/codex/plugin/skills/review-test-code/SKILL.md +0 -189
  111. package/dist/2.0.9/codex/plugin/skills/review-test-code/agents/claude.yaml +0 -3
  112. package/dist/2.0.9/codex/plugin/skills/review-test-code/agents/openai.yaml +0 -10
  113. package/dist/2.0.9/codex/plugin/skills/write-test-code/SKILL.md +0 -227
  114. package/dist/2.0.9/codex/plugin/skills/write-test-code/agents/claude.yaml +0 -3
  115. package/dist/2.0.9/codex/plugin/skills/write-test-code/agents/openai.yaml +0 -10
  116. package/dist/2.0.9/codex/plugin/skills/write-test-code/references/anti-patterns.md +0 -88
  117. package/dist/2.0.9/codex/plugin/skills/write-test-code/references/api-setup-teardown.md +0 -83
  118. package/dist/2.0.9/codex/plugin/skills/write-test-code/references/auth-patterns.md +0 -63
  119. package/dist/2.0.9/codex/plugin/skills/write-test-code/references/mapping-tables.md +0 -56
  120. package/dist/2.0.9/codex/plugin/skills/write-test-code/references/network-interception.md +0 -56
  121. package/skills/add-e2e-tests/references/tracker-template.md +0 -53
  122. /package/dist/{2.0.9 → 2.0.10}/claude/plugin/skills/add-e2e-tests/agents/claude.yaml +0 -0
  123. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/add-e2e-tests/references/authentication.md +0 -0
  124. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/analyze-test-codebase/SKILL.md +0 -0
  125. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/analyze-test-codebase/agents/claude.yaml +0 -0
  126. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/analyze-test-codebase/agents/openai.yaml +0 -0
  127. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/fix-flaky-tests/agents/claude.yaml +0 -0
  128. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/fix-flaky-tests/agents/openai.yaml +0 -0
  129. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/generate-test-cases/agents/claude.yaml +0 -0
  130. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/generate-test-cases/agents/openai.yaml +0 -0
  131. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/generate-test-cases/references/scenario-categories.md +0 -0
  132. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/plan-test-coverage/agents/claude.yaml +0 -0
  133. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/plan-test-coverage/agents/openai.yaml +0 -0
  134. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-cases/agents/claude.yaml +0 -0
  135. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-cases/agents/openai.yaml +0 -0
  136. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-code/SKILL.md +0 -0
  137. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-code/agents/claude.yaml +0 -0
  138. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/review-test-code/agents/openai.yaml +0 -0
  139. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/agents/claude.yaml +0 -0
  140. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/agents/openai.yaml +0 -0
  141. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/anti-patterns.md +0 -0
  142. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/auth-patterns.md +0 -0
  143. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/mapping-tables.md +0 -0
  144. /package/dist/{2.0.8 → 2.0.10}/claude/plugin/skills/write-test-code/references/network-interception.md +0 -0
  145. /package/dist/{2.0.9 → 2.0.10}/codex/plugin/skills/add-e2e-tests/agents/claude.yaml +0 -0
  146. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/add-e2e-tests/references/authentication.md +0 -0
  147. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/analyze-test-codebase/SKILL.md +0 -0
  148. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/analyze-test-codebase/agents/claude.yaml +0 -0
  149. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/analyze-test-codebase/agents/openai.yaml +0 -0
  150. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/fix-flaky-tests/agents/claude.yaml +0 -0
  151. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/fix-flaky-tests/agents/openai.yaml +0 -0
  152. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/generate-test-cases/agents/claude.yaml +0 -0
  153. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/generate-test-cases/agents/openai.yaml +0 -0
  154. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/generate-test-cases/references/scenario-categories.md +0 -0
  155. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/plan-test-coverage/agents/claude.yaml +0 -0
  156. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/plan-test-coverage/agents/openai.yaml +0 -0
  157. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-cases/agents/claude.yaml +0 -0
  158. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-cases/agents/openai.yaml +0 -0
  159. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-code/SKILL.md +0 -0
  160. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-code/agents/claude.yaml +0 -0
  161. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/review-test-code/agents/openai.yaml +0 -0
  162. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/agents/claude.yaml +0 -0
  163. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/agents/openai.yaml +0 -0
  164. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/references/anti-patterns.md +0 -0
  165. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/references/auth-patterns.md +0 -0
  166. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/references/mapping-tables.md +0 -0
  167. /package/dist/{2.0.8 → 2.0.10}/codex/plugin/skills/write-test-code/references/network-interception.md +0 -0
@@ -1,184 +0,0 @@
1
- ---
2
- name: generate-test-cases
3
- description: >
4
- Use when the user wants detailed TC-ID test case specifications for a web app feature, not executable code. It explores the target flow, covers happy paths, validation failures, edge cases, and required error states, then writes structured specs under `test-cases/`. Use it after coverage planning or when the user explicitly asks for test cases or TC-IDs. It does not write Playwright code.
5
- allowed-tools: Read Write Bash Glob Grep Task
6
- ---
7
-
8
- # Generate Test Cases
9
-
10
- Generate comprehensive, structured test case specifications for a web application by exploring it live in a browser.
11
-
12
- ## Input
13
-
14
- Parse the target URL and user journey description from: $ARGUMENTS
15
-
16
- ## Workflow
17
-
18
- ### Step 1: Understand the Journey and Existing Coverage
19
-
20
- Parse the journey description to identify:
21
- - **Base URL** and target feature area
22
- - **Primary user goal** (what the happy path achieves)
23
- - **Key interaction points** (forms, buttons, navigation, selections)
24
- - **Implicit requirements** (validation, authentication, authorization)
25
-
26
- Check for existing test coverage before exploring:
27
- - Search for existing test files related to this feature (`Grep` for feature keywords in `**/*.spec.ts`, `**/*.test.ts`)
28
- - Read any existing `test-cases/*.md` spec files for this feature
29
- - Note existing TC-IDs to avoid conflicts — continue numbering from the highest existing ID
30
- - Focus on gaps in existing coverage
31
-
32
- ### Step 2: Explore the Happy Path
33
-
34
- Use a subagent for browser exploration when that saves context. Pass it:
35
- - The URL and journey description
36
- - Instructions to walk through each step using `find`, `get_form`, `get_field`
37
- - Instructions to catalog all interactive elements, form fields, navigation options
38
- - Instructions to use `get_element` on key elements to capture the best Playwright selector
39
- - Instructions to return results in this structured format for each step:
40
-
41
- ```
42
- Step: <what was done>
43
- URL: <current URL after action>
44
- Elements found:
45
- - Submit button: getByRole('button', { name: /submit/i })
46
- - Email field: getByLabel(/email/i)
47
- - Error message: getByText(/required/i)
48
- Observations: <what appeared, validation messages, state changes>
49
- ```
50
-
51
- This structured output ensures selectors survive the handoff to the spec file and ultimately to `write-test-code`.
52
-
53
- ### Step 3: Explore Alternative and Failure Paths
54
-
55
- Launch another subagent, or continue in the main thread if the flow is small, to systematically probe beyond the happy path:
56
-
57
- **Validation & Error Handling:**
58
- - Submit forms with empty required fields
59
- - Enter invalid formats (wrong email, short passwords, letters in number fields)
60
- - Exceed field length limits, use special characters and Unicode
61
-
62
- **Boundary Conditions:**
63
- - Min/max values for numeric fields
64
- - Single character and max length strings
65
- - Zero quantities, negative numbers, date boundaries
66
-
67
- **State & Navigation:**
68
- - Browser back/forward during multi-step flows
69
- - Page refresh mid-flow
70
- - Accessing later steps directly via URL
71
-
72
- **UI & Interaction:**
73
- - Rapid repeated clicks on submit buttons
74
- - Dropdown default values, empty options
75
- - Loading states, disabled states, conditional visibility
76
-
77
- **Access & Authorization (observe only):**
78
- - Redirect behavior for unauthenticated users
79
- - Permission-related error messages
80
-
81
- ### Step 4: Reason About Additional Scenarios
82
-
83
- After exploration, reason about scenarios that could not be directly triggered but must be covered:
84
-
85
- - **Network & Performance** — failure modes, slow responses, large data sets, offline behavior
86
- - **Accessibility (WCAG 2.1 AA)** — keyboard navigation, screen reader support, focus management, contrast
87
- - **Visual Consistency** — layout stability, responsive breakpoints, dark mode
88
- - **Cross-browser** — Safari/Firefox/mobile-specific behavioral differences
89
- - **Concurrent & Session** — session expiry, multi-tab conflicts, race conditions
90
-
91
- See [references/scenario-categories.md](references/scenario-categories.md) for detailed checklists within each category.
92
-
93
- ### Step 5: Generate Test Case Specifications
94
-
95
- Write structured test cases to `test-cases/<feature-name>.md`.
96
-
97
- ## Output Specification
98
-
99
- ### Test Case Format
100
-
101
- ```markdown
102
- ### TC-<FEATURE>-<NUMBER>: <Descriptive title>
103
-
104
- **Priority:** Critical | High | Medium | Low
105
- **Category:** Happy Path | Validation | Error Handling | Edge Case | Boundary | Security | Accessibility | Visual | Performance | Network Error | UX
106
- **Preconditions:**
107
- - <What must be true before this test>
108
-
109
- **Steps:**
110
- 1. <Action the tester performs>
111
- 2. <Next action>
112
-
113
- **Expected Result:**
114
- - <What should happen>
115
-
116
- **Selectors observed:**
117
- - <element>: `getByRole('button', { name: /submit/i })` or `getByLabel(/email/i)` — from `get_element`/`find` during exploration
118
- - (Include selectors for key interactive elements so `write-test-code` doesn't have to rediscover them)
119
-
120
- **Notes:**
121
- - <Additional context discovered during exploration>
122
- ```
123
-
124
- ### Output Organization
125
-
126
- ```markdown
127
- # Test Cases: <Feature Name>
128
-
129
- **URL:** <base URL>
130
- **Generated:** <date>
131
- **Journey:** <brief description>
132
-
133
- ## Summary
134
- - Total test cases: <count>
135
- - Critical: <count> | High: <count> | Medium: <count> | Low: <count>
136
-
137
- ## Happy Path
138
- ## Validation & Error Handling
139
- ## Edge Cases
140
- ## Boundary Conditions
141
- ## Security & Access
142
- ## Network Error Scenarios
143
- ## Visual & Responsive
144
- ## Performance & Loading
145
- ## Accessibility & UX
146
- ```
147
-
148
- ### File Naming Convention
149
-
150
- When generating specs that span multiple roles or test categories, recommend role-based file naming (`*.admin.spec.ts`, `*.user.spec.ts`) or Playwright tag annotations (`@admin`, `@smoke`) in the spec. This enables selective execution via `--grep @admin` or glob patterns instead of fragile `testIgnore` regex in playwright.config.ts. NEVER recommend a `testIgnore` regex that must be updated for every new test file.
151
-
152
- ### TC-ID Convention
153
-
154
- - Format: `TC-<FEATURE>-<NNN>` where NNN is zero-padded to 3 digits
155
- - Feature abbreviation: short and clear (LOGIN, CHECKOUT, SEARCH, SIGNUP)
156
- - Start at 001, sequential, unique within the document
157
- - Happy path first, then validation, then edge cases
158
-
159
- ## Quality Standards
160
-
161
- - Every test case must be **independently executable** — no hidden dependencies
162
- - Steps must be **concrete and unambiguous** — "click the Submit button" not "submit the form"
163
- - Expected results must be **observable and verifiable** — include actual error messages observed
164
- - Priority must be **justified** — Critical = blocks core journey, High = significant, Medium = secondary, Low = cosmetic
165
- - Every feature spec MUST include at minimum: one network error scenario (500/timeout), one empty state scenario, and one session/auth edge case (if the feature requires auth). These are non-negotiable — omitting them is a BLOCKER in the review-test-cases quality gate.
166
- - **Test case count guidance:** Aim for 15-30 test cases per feature area as a baseline. Fewer than 10 suggests missing error paths or edge cases. More than 40 suggests the feature should be split into sub-features with separate spec files. Prioritize breadth of category coverage over depth within a single category.
167
-
168
- ## Blocking Conditions
169
-
170
- Report and work around:
171
- - **Login/auth walls**: Document as precondition, test observable behavior
172
- - **CAPTCHA**: Report, skip, note in preconditions
173
- - **Payment gateways**: Don't enter real data, document flow up to that point
174
- - **Rate limiting**: Slow down, note rate limit behavior as a test case
175
-
176
- ## Example Usage
177
-
178
- ```
179
- Claude Code: /generate-test-cases https://example.com/login User logs in with email and password, sees dashboard
180
- Codex: $generate-test-cases https://example.com/login User logs in with email and password, sees dashboard
181
-
182
- Claude Code: /generate-test-cases https://shop.example.com User searches for product, adds to cart, proceeds to checkout
183
- Codex: $generate-test-cases https://shop.example.com User searches for product, adds to cart, proceeds to checkout
184
- ```
@@ -1,116 +0,0 @@
1
- ---
2
- name: plan-test-coverage
3
- description: >
4
- Use before writing specs or test code to decide what E2E coverage is needed first. It scans existing tests, inspects the target flow, finds coverage gaps, and produces a prioritized P0/P1/P2 plan with TC-IDs. Use it for requests like "what tests do I need", "coverage gaps", or "what TC-IDs are missing". It does not write detailed specs or executable tests.
5
- allowed-tools: Read Glob Grep Task mcp__browser__ping mcp__browser__navigate mcp__browser__find mcp__browser__get_element mcp__browser__get_form mcp__browser__get_field mcp__browser__click mcp__browser__type mcp__browser__press mcp__browser__select mcp__browser__hover mcp__browser__drag mcp__browser__scroll mcp__browser__scroll_to mcp__browser__wheel mcp__browser__snapshot mcp__browser__screenshot mcp__browser__go_back mcp__browser__go_forward mcp__browser__reload mcp__browser__list_pages mcp__browser__close_page
6
- ---
7
-
8
- # Plan Test Coverage
9
-
10
- Plan what E2E tests to write for a feature by analyzing existing test coverage and doing a quick site inspection.
11
-
12
- ## Workflow
13
-
14
- 1. **Parse input** — extract the target URL and feature area from: $ARGUMENTS
15
-
16
- 2. **Check existing test coverage**:
17
- - Search for existing test files related to the feature:
18
- ```
19
- Grep for feature keywords in **/*.spec.ts, **/*.test.ts
20
- ```
21
- - Identify what's already covered and what's missing
22
- - Note existing TC-IDs for the feature area to avoid conflicts
23
-
24
- 3. **Quick site inspection** (lightweight, not full exploration):
25
- - Follow the `agent-web-interface-guide` skill's browsing patterns (orient before acting, use `list_pages` for session awareness, close only pages you opened)
26
- - Navigate to the URL in a dedicated page
27
- - Use `find` to catalog the main interactive elements
28
- - Use `get_form` or `get_field` if the page has forms worth covering
29
- - Identify the key user flows visible on the page
30
- - Close only the page you opened when done; do not rely on a session-wide close
31
-
32
- 4. **Identify test categories** — for the feature, determine tests needed across:
33
- - **Critical path** — core happy path that must never break
34
- - **Input validation** — form fields, required fields, format constraints
35
- - **Error states** — network errors, server errors, empty states
36
- - **Edge cases** — boundary values, special characters, concurrent actions
37
- - **Cross-feature** — interactions with other features (e.g., auth + checkout)
38
- - **Accessibility** — keyboard navigation, screen reader support, focus management
39
- - **Visual regression** — layout consistency, responsive breakpoints (375px, 768px, 1280px)
40
- - **Performance** — loading states, lazy loading, large data sets
41
- - **Network errors** — server 500s, timeouts, offline behavior
42
-
43
- Not all categories apply to every project. Include Accessibility, Visual Regression, and Cross-Browser sections only when the project has explicit requirements, tooling, or configuration for them. Omit them from the output plan if not relevant — a focused plan is more useful than a padded one.
44
-
45
- 5. **Prioritize** — rank tests by:
46
- - **P0 (Must have)**: Core user journey, auth flows, data corruption prevention. Blocks revenue/signups if broken.
47
- - **P1 (Should have)**: Input validation, common error paths, accessibility basics (keyboard navigation, form labels)
48
- - **P2 (Nice to have)**: Edge cases, visual regression, performance scenarios, cross-browser specifics, rare error paths
49
-
50
- 6. **Output test plan**:
51
-
52
- ```markdown
53
- ## Test Coverage Plan: <Feature>
54
-
55
- **URL:** <url>
56
- **Date:** <date>
57
- **Existing coverage:** <N tests already exist / none>
58
-
59
- ### Already Covered
60
- - TC-FEATURE-001: <description> (in `tests/feature.spec.ts`)
61
- - ...
62
-
63
- ### Proposed New Tests
64
-
65
- #### P0 — Critical Path
66
- | TC-ID | Description | Why Critical |
67
- |-------|-------------|-------------|
68
- | TC-FEATURE-010 | Happy path: user completes full flow | Core revenue path |
69
-
70
- #### P1 — Validation & Errors
71
- | TC-ID | Description | Why Important |
72
- |-------|-------------|--------------|
73
- | TC-FEATURE-020 | Submit with empty required fields | Common user error |
74
-
75
- #### P2 — Edge Cases
76
- | TC-ID | Description | Notes |
77
- |-------|-------------|-------|
78
- | TC-FEATURE-030 | Special characters in search input | Unicode handling |
79
-
80
- #### Accessibility (include if project has accessibility requirements or WCAG compliance goals)
81
- | TC-ID | Description | WCAG Criterion |
82
- |-------|-------------|----------------|
83
- | TC-FEATURE-A01 | Keyboard-only navigation through flow | 2.1.1 Keyboard |
84
- | TC-FEATURE-A02 | Form errors announced to screen readers | 1.3.1 Info and Relationships |
85
-
86
- #### Visual Regression (if project has visual testing setup)
87
- | TC-ID | Description | Viewport |
88
- |-------|-------------|----------|
89
- | TC-FEATURE-V01 | Layout consistency at mobile width | 375x812 |
90
-
91
- #### Cross-Browser Matrix (include if project runs tests across multiple browsers)
92
- | Browser | Priority | Reason |
93
- |---------|----------|--------|
94
- | Chromium | P0 | Primary target |
95
- | Firefox | P1 | Second largest desktop share |
96
- | WebKit/Safari | P1 | Required for iOS users |
97
-
98
- ### Recommended Order
99
- 1. Write P0 tests first (N tests)
100
- 2. Then P1 validation + accessibility basics (N tests)
101
- 3. P2 edge cases, visual regression, and performance as time allows
102
-
103
- ### Next Steps
104
- - Invoke the `generate-test-cases` skill with the target URL and journey for detailed test specs
105
- - Invoke the `write-test-code` skill to implement the tests
106
- ```
107
-
108
- ## Example Usage
109
-
110
- ```
111
- Claude Code: /plan-test-coverage https://myapp.com/checkout Checkout flow
112
- Codex: $plan-test-coverage https://myapp.com/checkout Checkout flow
113
-
114
- Claude Code: /plan-test-coverage https://myapp.com/login Authentication
115
- Codex: $plan-test-coverage https://myapp.com/login Authentication
116
- ```
@@ -1,147 +0,0 @@
1
- ---
2
- name: review-test-cases
3
- description: >
4
- This skill should be used when a quality review of TC-ID test case specifications is needed before writing executable
5
- test code. It reviews the spec artifact only; it does not implement or rewrite tests.
6
- Triggers: "review test cases", "check test specs", "review TC-IDs", "audit test coverage",
7
- "are my test cases good", "validate test specs", "review test-cases/*.md",
8
- "check for gaps in test cases", "review before writing tests", "quality check test specs".
9
- Inserted as a quality gate between generate-test-cases and write-test-code — catches
10
- gaps, duplication, weak assertions, missing error paths, and invented scenarios before they get
11
- encoded into test code. Review-only — does NOT modify the spec file, does NOT write test code.
12
- The write-test-code skill should be used for implementation.
13
- allowed-tools: Read Glob Grep Task
14
- ---
15
-
16
- # Review Test Cases
17
-
18
- Review TC-ID test case specifications for completeness, accuracy, and quality before they are implemented as executable Playwright tests. This is a quality gate — catch problems in the spec, not in the code.
19
-
20
- ## Input
21
-
22
- Parse the spec file path from: $ARGUMENTS
23
-
24
- If no argument provided, search for `test-cases/*.md` files and review the most recently modified one.
25
-
26
- ## Workflow
27
-
28
- ### Step 1: Load the Spec and Context
29
-
30
- 1. Read the test case spec file
31
- 2. Read any related files for context:
32
- - `e2e-plan/conventions.md` or `e2e-plan/coverage-plan.md` if they exist
33
- - `e2e-tracker.md` if it exists (to understand what was explored)
34
- 3. Extract the target URL from the spec header
35
-
36
- ### Step 2: Run the Review Checklist
37
-
38
- Evaluate every test case against each criterion. Track findings by severity:
39
-
40
- - **BLOCKER** — must fix before writing tests (missing critical paths, invented behavior, wrong URL)
41
- - **WARNING** — should fix, will cause problems in implementation (vague steps, weak assertions, duplication)
42
- - **SUGGESTION** — optional improvement (priority adjustment, better categorization, additional edge case)
43
-
44
- #### 2a. Coverage Completeness
45
-
46
- | Check | What to Look For |
47
- |-------|-----------------|
48
- | Happy path present | At least one Critical-priority test covers the primary success flow end-to-end |
49
- | Error paths covered (MINIMUM) | Every spec MUST have at least: (1) one server error test (500), (2) one network failure test (timeout/offline), (3) one empty state test. If auth is involved: (4) one session expiry test. Missing any of these is a BLOCKER, not a suggestion |
50
- | Boundary conditions | Min/max values, empty inputs, special characters, long strings |
51
- | Authentication edge cases | Session expiry, unauthorized access, role-based differences (if applicable) |
52
- | Navigation edge cases | Back/forward, direct URL access, refresh mid-flow |
53
- | Missing user actions | Every interactive element on the page should appear in at least one test case |
54
-
55
- #### 2b. Specification Quality
56
-
57
- | Check | What to Look For |
58
- |-------|-----------------|
59
- | Steps are concrete | "Click the Submit button" not "submit the form"; "Enter 'test@example.com' in Email field" not "enter email" |
60
- | Expected results are observable | Specific text, URL change, element state — not "page updates" or "works correctly" |
61
- | Preconditions are explicit | Auth state, test data, feature flags, starting URL — nothing assumed |
62
- | TC-IDs are sequential | No gaps, no duplicates, correct feature prefix |
63
- | Priority is justified | Critical = blocks core journey; not everything is Critical |
64
- | Categories are accurate | Happy Path vs Validation vs Edge Case — correctly classified |
65
-
66
- #### 2c. Invented vs Observed
67
-
68
- This is the most important check. Test cases should trace back to behavior that was actually observed or deliberately triggered during exploration, not assumed.
69
-
70
- Red flags for invented scenarios:
71
- - Specific error message text that wasn't observed (e.g., "Please enter a valid email" when the actual message might differ)
72
- - Assumptions about validation rules without exploration evidence (e.g., "minimum 8 characters" without trying it)
73
- - Test cases for UI elements that may not exist (e.g., "retry button" on error page without visiting the error page)
74
- - Server-side behavior assumptions (e.g., "rate limit after 5 attempts" without evidence)
75
-
76
- When suspicious: delegate a spot-check to a subagent with browser access (Task tool). Pass it the target URL, the specific TC-IDs under suspicion, and the claims to verify (element existence, error message text, validation behavior). The subagent should return structured evidence: what it found, what matched, what differed.
77
-
78
- #### 2d. Duplication and Overlap
79
-
80
- - Flag test cases that test the same behavior with trivially different inputs
81
- - Flag test cases where the steps are identical but expected results differ only cosmetically
82
- - Merging candidates: cases that could be combined into a single parameterized test without losing coverage
83
-
84
- #### 2e. Implementability
85
-
86
- - Flag steps that cannot be automated with Playwright (e.g., "verify email arrives", "check database directly")
87
- - Flag preconditions that require manual setup with no automation path
88
- - Flag assertions that require visual comparison without specifying tolerance
89
- - Flag test cases that depend on third-party services (payment processors, OAuth providers) without a mock strategy
90
-
91
- ### Step 3: Produce the Review Report
92
-
93
- Output a structured review with this format:
94
-
95
- ```markdown
96
- # Test Case Review: <feature>
97
-
98
- **Spec file:** <path>
99
- **Total test cases:** <count>
100
- **Review date:** <date>
101
-
102
- ## Verdict: PASS | PASS WITH WARNINGS | NEEDS REVISION
103
-
104
- ## Blockers (<count>)
105
- - **TC-<ID>**: <issue description>
106
-
107
- ## Warnings (<count>)
108
- - **TC-<ID>**: <issue description>
109
-
110
- ## Suggestions (<count>)
111
- - **TC-<ID>**: <issue description>
112
-
113
- ## Coverage Gaps
114
- - <Missing scenario that should be added>
115
-
116
- ## Duplication
117
- - **TC-<ID>** and **TC-<ID>**: <overlap description>
118
-
119
- ## Summary
120
- <2-3 sentences on overall spec quality and what to address before implementation>
121
- ```
122
-
123
- ### Step 4: Verdict Rules
124
-
125
- - **PASS** — no blockers, 2 or fewer warnings. Proceed to write-test-code.
126
- - **PASS WITH WARNINGS** — no blockers, 3+ warnings. Can proceed but should address warnings.
127
- - **NEEDS REVISION** — 1+ blockers. Do not proceed to write-test-code until blockers are resolved.
128
-
129
- Example: 0 blockers + 2 warnings = PASS. 0 blockers + 3 warnings = PASS WITH WARNINGS. 1+ blockers = NEEDS REVISION regardless of warning count.
130
-
131
- ## Principles
132
-
133
- - **Review-only** — never modify the spec file; report findings for the author to act on
134
- - **Evidence over opinion** — cite specific TC-IDs and quote specific steps/assertions when flagging issues
135
- - **Spot-check against live site** — delegate to a subagent with browser access to verify 2-3 suspicious claims rather than trusting all text at face value
136
- - **Bounded output** — the review report should be actionable and finite, not an exhaustive rewrite
137
- - **Severity matters** — distinguish blockers from suggestions; not every imperfection is worth fixing before implementation
138
-
139
- ## Example Usage
140
-
141
- ```
142
- Claude Code: /review-test-cases test-cases/login.md
143
- Codex: $review-test-cases test-cases/login.md
144
-
145
- Claude Code: /review-test-cases test-cases/checkout.md
146
- Codex: $review-test-cases test-cases/checkout.md
147
- ```
@@ -1,227 +0,0 @@
1
- ---
2
- name: write-test-code
3
- description: >
4
- This skill should be used when writing, refactoring, or modifying Playwright E2E test code.
5
- It covers creating test files from TC-ID specs, converting browser exploration results to
6
- executable tests, refactoring locators or fixtures, adding API mocking, test data
7
- setup/teardown, and parallel-safe isolation. Includes locator strategy hierarchy, auth setup
8
- patterns, fixture design, teardown strategies, and network interception recipes.
9
- Triggers: "write a test for", "add a test case", "refactor this locator", "add error path
10
- tests", "convert specs to code", "add API mocking", "set up auth for tests".
11
- NOT for: full pipeline from scratch (use add-e2e-tests), exploring live sites (use
12
- agent-web-interface-guide), generating specs without code (use plan-test-coverage or
13
- generate-test-cases), diagnosing flaky tests (use fix-flaky-tests).
14
- allowed-tools: Read Write Edit Bash Glob Grep Task
15
- ---
16
-
17
- # Write E2E Tests
18
-
19
- Write, refactor, or fix Playwright E2E tests. Convert browser exploration results or test case specifications into executable, stable test code.
20
-
21
- ## Input
22
-
23
- Parse the test description or spec file path from: $ARGUMENTS
24
-
25
- ## Workflow
26
-
27
- ### 1. Understand the Request
28
- - Identify the user journey to test and success criteria
29
- - Identify preconditions (auth, seeded data, feature flags, env)
30
- - If a test case spec file path is provided, read it for TC-IDs and expected behaviors
31
-
32
- ### 2. Inspect Repo Conventions (CRITICAL — before writing any code)
33
- - Search for `playwright.config.ts` / `playwright.config.js` — extract `baseURL`, `testDir`, projects
34
- - Search for existing tests, fixtures, page objects, locator patterns, test data modules
35
- - Read 2-3 existing test files to match the project's naming, structure, and locator strategy
36
- - Check for custom fixtures, POM patterns, auth setup (storageState, global setup)
37
- - Follow the project's existing style unless it clearly causes flakiness
38
-
39
- ### 3. Verify Key Selectors Against the Live Site
40
- - If a test case spec file includes **Selectors observed**, use those as your starting point
41
- - If no spec or selectors are available, browse the target page using `agent-web-interface-guide` to discover the actual selectors before writing code — do not guess
42
- - Spot-check 2-3 critical selectors with `find` or `get_element` to confirm they resolve to the intended elements
43
-
44
- ### 4. Implement Tests
45
- - Add/adjust fixtures and page objects first (if needed)
46
- - Write tests in a story-like flow with AAA structure: Arrange → Act → Assert
47
- - Add assertions that represent user outcomes
48
- - **For large suites:** Use subagents (Task tool) to write individual test files in parallel.
49
- Pass each subagent the test case spec path, codebase conventions from Step 2, and the
50
- operating principles from this skill. Only split when files have independent responsibilities.
51
-
52
- ### 5. Stabilize
53
- - Replace any sleeps with meaningful waits
54
- - Tighten locators to avoid ambiguity
55
- - For network-driven flows, use `page.waitForResponse` for critical checkpoints
56
-
57
- ### 6. Verify
58
- - Run the smallest relevant test command: `npx playwright test <file> --reporter=list 2>&1`
59
- - In CI or headless environments (no display), never use `--headed` — it will fail silently or hang
60
- - Use `--headed` only during local interactive debugging when you need to visually observe the test
61
- - Fix root causes rather than extending timeouts
62
-
63
- ### 7. Summarize
64
- Return:
65
- 1. **What I changed** (bullets)
66
- 2. **Test case IDs added** (list all new TC-IDs with brief description)
67
- 3. **Why it's stable** (locator/wait strategy used)
68
- 4. **How to run** (exact commands)
69
- 5. **Notes / follow-ups** (optional)
70
-
71
- ## Operating Principles (Non-Negotiable)
72
-
73
- ### Test User Outcomes
74
- Assert what the user sees — visible text, URL changes, enabled/disabled states — not internal state, CSS classes, or component hierarchy.
75
-
76
- ### No Arbitrary Sleeps
77
- Avoid `page.waitForTimeout()` except as a last-resort debug aid — remove before finishing.
78
-
79
- ### Locator Strategy
80
- | Priority | Method | When to Use |
81
- |----------|--------|-------------|
82
- | 1 | `getByRole('role', { name })` | Buttons, links, headings, form controls |
83
- | 2 | `getByLabel()` | Form fields with visible labels |
84
- | 3 | `getByPlaceholder()` | Inputs with placeholder text |
85
- | 4 | `getByTestId()` | When data-testid is available |
86
- | 5 | `getByText()` | Short, stable text (avoid marketing copy) |
87
- | 6 | CSS selectors | Last resort, always scoped tightly |
88
-
89
- Avoid `.first()` / `.nth()` unless a strong, documented reason exists — scope locators to a container instead.
90
-
91
- **Within-file consistency:** Every test file must use ONE locator approach for equivalent elements. Do not mix `getByPlaceholder('Email')` in one test with `page.locator('input[placeholder="Email"]')` in another test within the same file. When adding tests to an existing file, match the locator style already in use. If the existing style is suboptimal, refactor all locators in the file together — do not create inconsistency.
92
-
93
- ### Waiting Strategy
94
- - Prefer Playwright auto-waits via actions and `expect(...)` assertions
95
- - If explicit waiting needed, wait for meaningful state: visibility, enabled, URL, specific network response, spinner gone
96
-
97
- ### Test Case IDs
98
- - Every test MUST have a unique TC-ID: `TC-<FEATURE>-<NUMBER>`
99
- - Include in test title: `test('TC-LOGIN-001: User can log in with valid credentials', ...)`
100
- - Sequential within feature area, never reused
101
- - When adding to existing file, check existing IDs and continue the sequence
102
-
103
- ### POM + Fixtures
104
- - If the project has a `pages/` directory or BasePage class, ALL new tests MUST use Page Objects for interactions
105
- - Page Objects contain HOW (locators + interactions)
106
- - Tests contain WHAT (behavior/outcome to verify)
107
- - Keep page objects thin and composable
108
- - If the boilerplate shipped a BasePage that no tests reference, either extend it for your feature or flag it for removal — do not leave dead infrastructure
109
-
110
- ### Determinism and Isolation
111
- - Tests must not depend on execution order
112
- - Use unique test data per test or suite
113
- - **Parallel-safe mutations:** When `fullyParallel: true` is configured, tests run concurrently across workers. A test that creates a record (e.g., a ticket) and then asserts it appears in a list WILL race with other tests creating records. Solutions: (a) assert on the specific record you created (filter/search by the unique ID from your API setup), not on list position or count; (b) use `test.describe.serial` for flows that genuinely require sequence (create-then-verify); (c) scope list assertions with `.filter({ hasText: uniqueIdentifier })` to avoid seeing other workers' data.
114
-
115
- ### Assertions
116
- - Use Playwright `expect` matchers (auto-retry, better error messages)
117
- - Avoid `isVisible()` + `expect(true)` pattern
118
-
119
- ### Configuration Hygiene
120
- - Use `baseURL` and relative navigation (`page.goto('/')`)
121
- - Avoid hardcoded domains/URLs in tests
122
- - Configure `trace: 'on-first-retry'`, `screenshot: 'only-on-failure'`, `video: 'on-first-retry'` for CI debugging
123
- - Set `retries: process.env.CI ? 2 : 0` — retries in CI only
124
- - View traces with `npx playwright show-trace trace.zip` to time-travel through failures
125
- - If `tsconfig.json` defines path aliases (e.g., `@pages/*`, `@fixtures/*`, `@utils/*`), use them in imports instead of relative paths. Check tsconfig paths before writing any import statement.
126
-
127
- ### Authentication Setup
128
- Use `storageState` for most projects (log in once in global setup, reuse across tests).
129
- For parallel workers needing separate accounts, use worker-scoped fixtures.
130
- For multi-role tests (admin + user), create separate browser contexts.
131
- Per-test login is only for testing the login flow itself.
132
- Never hardcode tokens — use environment variables or `.env.test`.
133
-
134
- See [references/auth-patterns.md](references/auth-patterns.md) for full patterns with code examples.
135
-
136
- ### API-Driven Test Setup and Teardown
137
- Use API calls (not UI clicks) to seed test data — 10-50x faster and more reliable.
138
- Use UI setup only when the creation flow IS the test. Tests that create persistent data
139
- MUST clean up: use `afterEach` API deletion, fixture-with-cleanup, or bulk `globalTeardown`.
140
- If no cleanup endpoint exists, document the gap with a TODO.
141
-
142
- See [references/api-setup-teardown.md](references/api-setup-teardown.md) for full patterns with code examples.
143
-
144
- ### Network Interception and Error Paths
145
- Use `page.route()` to mock server errors, patch responses, assert backend calls, or block
146
- heavy resources. Every feature needs error path tests: server error (500), network timeout,
147
- and empty state at minimum.
148
-
149
- See [references/network-interception.md](references/network-interception.md) for full patterns with code examples.
150
-
151
- ### Custom Fixtures (test.extend)
152
-
153
- Use `test.extend` to create reusable test setup without duplicating code:
154
-
155
- ```typescript
156
- // fixtures/index.ts
157
- import { test as base, Page } from '@playwright/test';
158
- import { LoginPage } from '../pages/LoginPage';
159
-
160
- export const test = base.extend<{
161
- loginPage: LoginPage;
162
- authenticatedPage: Page;
163
- }>({
164
- loginPage: async ({ page }, use) => {
165
- await use(new LoginPage(page));
166
- },
167
- authenticatedPage: async ({ browser }, use) => {
168
- const context = await browser.newContext({
169
- storageState: 'tests/.auth/user.json'
170
- });
171
- const page = await context.newPage();
172
- await use(page);
173
- await context.close();
174
- },
175
- });
176
- export { expect } from '@playwright/test';
177
- ```
178
-
179
- Import `test` from your fixtures file, not from `@playwright/test`, in test files that need custom fixtures.
180
-
181
- ### Mapping Tables
182
- When converting journey specs or exploration results to code, consult the mapping tables
183
- for standard translations of scopes, actions, assertions, and target kinds to Playwright API calls.
184
- For low-confidence journey steps (<0.7), add extra assertions and include fallback locators as comments.
185
-
186
- See [references/mapping-tables.md](references/mapping-tables.md) for the full tables.
187
-
188
- ## Test Template
189
-
190
- ```typescript
191
- // If the project has custom fixtures (fixtures/index.ts), import from there:
192
- // import { test, expect } from '@fixtures/index';
193
- // Otherwise, use the default:
194
- import { test, expect } from '@playwright/test';
195
-
196
- test('TC-FEATURE-001: Description of test case', async ({ page }) => {
197
- // Arrange
198
- await page.goto('/feature-path');
199
-
200
- // Act
201
- await page.getByRole('button', { name: /submit/i }).click();
202
-
203
- // Assert
204
- await expect(page.getByText(/success/i)).toBeVisible();
205
- });
206
- ```
207
-
208
- Always check for a project fixtures file before using the default import. If custom fixtures exist, you MUST import from them to get access to page objects and custom setup.
209
-
210
- ## Anti-Patterns (Quick Reference)
211
- 1. Raw CSS selectors — use semantic locators
212
- 2. `waitForTimeout()` — use proper assertions/waits
213
- 3. Fragile `.nth()` / `.first()` — scope to container
214
- 4. Exact long text matches — use regex with key words
215
- 5. Unscoped locators — scope to container
216
- 6. Login via UI in every test — use storageState
217
- 7. UI clicks for test data setup — use API
218
- 8. No error path tests — add failure scenarios
219
- 9. Hardcoded test data — use API setup + dynamic values
220
- 10. Tests depending on execution order
221
- 11. `expect(await el.isVisible()).toBe(true)` — use `await expect(el).toBeVisible()`
222
- 12. `{ force: true }` — diagnose root cause instead
223
- 13. `networkidle` as default wait — use specific response waits
224
- 14. CSS utility class selectors (Tailwind/Bootstrap)
225
- 15. Asserting exact server-computed values — use patterns or seed data
226
-
227
- See [references/anti-patterns.md](references/anti-patterns.md) for detailed explanations and fix strategies.