testeiya 0.3.9 → 0.3.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 (176) hide show
  1. package/README.md +312 -27
  2. package/dist/prompt/index.js +6 -2
  3. package/dist/prompt/index.js.map +1 -1
  4. package/dist/prompt/print.js +8 -0
  5. package/dist/prompt/print.js.map +1 -1
  6. package/dist/prompt/system-prompt.js +14 -4
  7. package/dist/prompt/system-prompt.js.map +1 -1
  8. package/dist/prompt/testomatio.js +3 -3
  9. package/dist/prompt/tools.js +15 -7
  10. package/dist/prompt/tools.js.map +1 -1
  11. package/dist/src/args.js +147 -47
  12. package/dist/src/args.js.map +1 -1
  13. package/dist/src/cli.js +50 -14
  14. package/dist/src/cli.js.map +1 -1
  15. package/dist/src/doctor.js +186 -0
  16. package/dist/src/doctor.js.map +1 -0
  17. package/dist/src/env.js +29 -5
  18. package/dist/src/env.js.map +1 -1
  19. package/dist/src/mcp.js +3 -3
  20. package/dist/src/mcp.js.map +1 -1
  21. package/dist/src/model.js +15 -10
  22. package/dist/src/model.js.map +1 -1
  23. package/dist/src/models.js +38 -0
  24. package/dist/src/models.js.map +1 -0
  25. package/dist/src/output.js +185 -0
  26. package/dist/src/output.js.map +1 -0
  27. package/dist/src/run.js +116 -24
  28. package/dist/src/run.js.map +1 -1
  29. package/dist/src/session.js +38 -23
  30. package/dist/src/session.js.map +1 -1
  31. package/dist/src/sessions.js +61 -0
  32. package/dist/src/sessions.js.map +1 -0
  33. package/package.json +7 -3
  34. package/prompt/index.ts +11 -2
  35. package/prompt/print.ts +9 -0
  36. package/prompt/system-prompt.ts +18 -4
  37. package/prompt/testomatio.ts +3 -3
  38. package/prompt/tools.ts +15 -7
  39. package/skills/codeceptjs/ci-fix-tests/SKILL.md +119 -0
  40. package/skills/codeceptjs/codeceptjs-auth/SKILL.md +141 -0
  41. package/skills/codeceptjs/codeceptjs-exploration/SKILL.md +100 -0
  42. package/skills/codeceptjs/codeceptjs-fundamentals/SKILL.md +196 -0
  43. package/skills/codeceptjs/codeceptjs-run-analysis/SKILL.md +83 -0
  44. package/skills/codeceptjs/debugging-codeceptjs-tests/SKILL.md +126 -0
  45. package/skills/codeceptjs/migrate-codeceptjs-4/SKILL.md +109 -0
  46. package/skills/codeceptjs/migrate-cypress-to-codeceptjs/SKILL.md +295 -0
  47. package/skills/codeceptjs/migrate-protractor-to-codeceptjs/SKILL.md +339 -0
  48. package/skills/codeceptjs/migrate-selenium-java-to-codeceptjs/SKILL.md +459 -0
  49. package/skills/codeceptjs/migrate-testcafe-to-codeceptjs/SKILL.md +338 -0
  50. package/skills/codeceptjs/refactoring-codeceptjs-tests/SKILL.md +78 -0
  51. package/skills/codeceptjs/writing-codeceptjs-tests/SKILL.md +102 -0
  52. package/skills/playwright/playwright-best-practices/SKILL.md +303 -0
  53. package/skills/playwright/playwright-best-practices/advanced/authentication-flows.md +360 -0
  54. package/skills/playwright/playwright-best-practices/advanced/authentication.md +871 -0
  55. package/skills/playwright/playwright-best-practices/advanced/clock-mocking.md +364 -0
  56. package/skills/playwright/playwright-best-practices/advanced/mobile-testing.md +409 -0
  57. package/skills/playwright/playwright-best-practices/advanced/multi-context.md +288 -0
  58. package/skills/playwright/playwright-best-practices/advanced/multi-user.md +393 -0
  59. package/skills/playwright/playwright-best-practices/advanced/network-advanced.md +452 -0
  60. package/skills/playwright/playwright-best-practices/advanced/third-party.md +464 -0
  61. package/skills/playwright/playwright-best-practices/architecture/pom-vs-fixtures.md +363 -0
  62. package/skills/playwright/playwright-best-practices/architecture/test-architecture.md +369 -0
  63. package/skills/playwright/playwright-best-practices/architecture/when-to-mock.md +383 -0
  64. package/skills/playwright/playwright-best-practices/browser-apis/browser-apis.md +391 -0
  65. package/skills/playwright/playwright-best-practices/browser-apis/iframes.md +403 -0
  66. package/skills/playwright/playwright-best-practices/browser-apis/service-workers.md +504 -0
  67. package/skills/playwright/playwright-best-practices/browser-apis/websockets.md +403 -0
  68. package/skills/playwright/playwright-best-practices/core/annotations.md +424 -0
  69. package/skills/playwright/playwright-best-practices/core/assertions-waiting.md +361 -0
  70. package/skills/playwright/playwright-best-practices/core/configuration.md +452 -0
  71. package/skills/playwright/playwright-best-practices/core/fixtures-hooks.md +417 -0
  72. package/skills/playwright/playwright-best-practices/core/global-setup.md +434 -0
  73. package/skills/playwright/playwright-best-practices/core/locators.md +242 -0
  74. package/skills/playwright/playwright-best-practices/core/page-object-model.md +315 -0
  75. package/skills/playwright/playwright-best-practices/core/projects-dependencies.md +453 -0
  76. package/skills/playwright/playwright-best-practices/core/test-data.md +492 -0
  77. package/skills/playwright/playwright-best-practices/core/test-suite-structure.md +361 -0
  78. package/skills/playwright/playwright-best-practices/core/test-tags.md +298 -0
  79. package/skills/playwright/playwright-best-practices/debugging/console-errors.md +420 -0
  80. package/skills/playwright/playwright-best-practices/debugging/debugging.md +504 -0
  81. package/skills/playwright/playwright-best-practices/debugging/error-testing.md +360 -0
  82. package/skills/playwright/playwright-best-practices/debugging/flaky-tests.md +496 -0
  83. package/skills/playwright/playwright-best-practices/frameworks/angular.md +530 -0
  84. package/skills/playwright/playwright-best-practices/frameworks/nextjs.md +469 -0
  85. package/skills/playwright/playwright-best-practices/frameworks/react.md +531 -0
  86. package/skills/playwright/playwright-best-practices/frameworks/vue.md +574 -0
  87. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/ci-cd.md +468 -0
  88. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/docker.md +283 -0
  89. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/github-actions.md +546 -0
  90. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/gitlab.md +397 -0
  91. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/other-providers.md +521 -0
  92. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/parallel-sharding.md +371 -0
  93. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/performance.md +453 -0
  94. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/reporting.md +424 -0
  95. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/test-coverage.md +497 -0
  96. package/skills/playwright/playwright-best-practices/testing-patterns/accessibility.md +359 -0
  97. package/skills/playwright/playwright-best-practices/testing-patterns/api-testing.md +719 -0
  98. package/skills/playwright/playwright-best-practices/testing-patterns/browser-extensions.md +506 -0
  99. package/skills/playwright/playwright-best-practices/testing-patterns/canvas-webgl.md +493 -0
  100. package/skills/playwright/playwright-best-practices/testing-patterns/component-testing.md +500 -0
  101. package/skills/playwright/playwright-best-practices/testing-patterns/drag-drop.md +576 -0
  102. package/skills/playwright/playwright-best-practices/testing-patterns/electron.md +509 -0
  103. package/skills/playwright/playwright-best-practices/testing-patterns/file-operations.md +377 -0
  104. package/skills/playwright/playwright-best-practices/testing-patterns/file-upload-download.md +562 -0
  105. package/skills/playwright/playwright-best-practices/testing-patterns/forms-validation.md +561 -0
  106. package/skills/playwright/playwright-best-practices/testing-patterns/graphql-testing.md +331 -0
  107. package/skills/playwright/playwright-best-practices/testing-patterns/i18n.md +508 -0
  108. package/skills/playwright/playwright-best-practices/testing-patterns/performance-testing.md +476 -0
  109. package/skills/playwright/playwright-best-practices/testing-patterns/security-testing.md +430 -0
  110. package/skills/playwright/playwright-best-practices/testing-patterns/visual-regression.md +634 -0
  111. package/skills/playwright/playwright-cli/SKILL.md +420 -0
  112. package/skills/playwright/playwright-cli/references/element-attributes.md +23 -0
  113. package/skills/playwright/playwright-cli/references/playwright-tests.md +39 -0
  114. package/skills/playwright/playwright-cli/references/request-mocking.md +87 -0
  115. package/skills/playwright/playwright-cli/references/running-code.md +241 -0
  116. package/skills/playwright/playwright-cli/references/session-management.md +225 -0
  117. package/skills/playwright/playwright-cli/references/storage-state.md +275 -0
  118. package/skills/playwright/playwright-cli/references/test-generation.md +433 -0
  119. package/skills/playwright/playwright-cli/references/tracing.md +139 -0
  120. package/skills/playwright/playwright-cli/references/video-recording.md +143 -0
  121. package/skills/skills.lock.json +39 -36
  122. package/skills/testomatio/explorbot/explorbot-fundamentals/SKILL.md +76 -0
  123. package/skills/testomatio/explorbot/explorbot-fundamentals/references/no-install.md +36 -0
  124. package/skills/testomatio/explorbot/explorbot-plan/SKILL.md +108 -0
  125. package/skills/testomatio/explorbot/explorbot-setup/SKILL.md +86 -0
  126. package/skills/testomatio/qa-process/qa-explain-behavior/SKILL.md +111 -0
  127. package/skills/testomatio/qa-process/qa-explain-behavior/references/answer-shapes.md +116 -0
  128. package/skills/testomatio/qa-process/qa-explain-behavior/references/examples.md +157 -0
  129. package/skills/testomatio/qa-process/qa-lead-strategy-advisor/SKILL.md +91 -0
  130. package/skills/testomatio/qa-process/qa-lead-strategy-advisor/references/output-format.md +71 -0
  131. package/skills/testomatio/qa-process/testing-workflow/SKILL.md +227 -0
  132. package/skills/testomatio/test-automation/automate-manual-test-cases/CLAUDE.md +56 -0
  133. package/skills/testomatio/test-automation/automate-manual-test-cases/SKILL.md +242 -0
  134. package/skills/testomatio/test-automation/automate-manual-test-cases/references/CODECEPTJS_BEST_PRACTICES.md +182 -0
  135. package/skills/testomatio/test-automation/automate-manual-test-cases/references/FINAL_SUMMARY_TEMPLATE.md +22 -0
  136. package/skills/testomatio/test-automation/automate-manual-test-cases/references/PLAYWRIGHT_BEST_PRACTICES.md +90 -0
  137. package/skills/testomatio/test-automation/automate-manual-test-cases/references/POM_BEST_PRACTICES.md +53 -0
  138. package/skills/testomatio/test-automation/automate-manual-test-cases/references/TEST_DATA_MANAGEMENT.md +52 -0
  139. package/skills/testomatio/test-automation/debug-fix-failed-flaky-autotests/SKILL.md +107 -0
  140. package/skills/testomatio/test-automation/debug-fix-failed-flaky-autotests/references/DEBUGGING_QUICK_REFERENCE.md +113 -0
  141. package/skills/testomatio/test-automation/qa-automation-test-consolidation/SKILL.md +29 -0
  142. package/skills/testomatio/test-automation/qa-data-seeder/SKILL.md +83 -0
  143. package/skills/testomatio/test-automation/run-tests-with-testomatio-reporter/SKILL.md +153 -0
  144. package/skills/testomatio/test-automation/setup-change-aware-pr-testing/SKILL.md +190 -0
  145. package/skills/testomatio/test-automation/setup-ci-automation/SKILL.md +76 -0
  146. package/skills/testomatio/test-automation/testomat-allure-adapter/SKILL.md +289 -0
  147. package/skills/testomatio/test-management/detect-duplicate-test-cases/SKILL.md +86 -0
  148. package/skills/testomatio/test-management/detect-duplicate-test-cases/references/DUPLICATE_INSTRUCTIONS.md +54 -0
  149. package/skills/testomatio/test-management/improve-test-cases/SKILL.md +114 -0
  150. package/skills/testomatio/test-management/improve-test-cases/references/TESTOMAT_MARKDOWN_EXAMPLE.md +66 -0
  151. package/skills/testomatio/test-management/pull-request-diff-analyzer/SKILL.md +141 -0
  152. package/skills/testomatio/test-management/qa-e2e-tests-reporting/SKILL.md +354 -0
  153. package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_ARTIFACTS.md +82 -0
  154. package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_HTML_REPORT.md +37 -0
  155. package/skills/testomatio/test-management/qa-e2e-tests-reporting/references/TESTOMATIO_REPORTERS_CONFIG.md +118 -0
  156. package/skills/testomatio/test-management/qa-pr-requirements-analyzer/SKILL.md +149 -0
  157. package/skills/testomatio/test-management/qa-pr-requirements-analyzer/references/summary-example.md +54 -0
  158. package/skills/testomatio/test-management/qa-requirement-reviewer/SKILL.md +126 -0
  159. package/skills/testomatio/test-management/qa-requirement-reviewer/references/requirements_reviewer_examples.md +128 -0
  160. package/skills/testomatio/test-management/qa-split-testing-levels-pyramid/SKILL.md +55 -0
  161. package/skills/testomatio/test-management/qa-sprint-report-by-testomatio/SKILL.md +220 -0
  162. package/skills/testomatio/test-management/qa-sprint-report-by-testomatio/references/qa-sprint-report.md +126 -0
  163. package/skills/testomatio/test-management/qa-test-code-coverage/SKILL.md +174 -0
  164. package/skills/testomatio/test-management/qa-test-code-coverage/references/COVERAGE_FILE_FORMAT.md +138 -0
  165. package/skills/testomatio/test-management/qa-test-code-coverage/references/E2E_FRAMEWORKS.md +65 -0
  166. package/skills/testomatio/test-management/qa-test-code-coverage/scripts/check-coverage.mjs +40 -0
  167. package/skills/testomatio/test-management/qa-thinking/SKILL.md +36 -0
  168. package/skills/testomatio/test-management/qa-write-test-cases/SKILL.md +267 -0
  169. package/skills/testomatio/test-management/qa-write-test-cases/references/test-case-format.md +387 -0
  170. package/skills/testomatio/test-management/qa-write-test-cases/references/testomat-tms-guide.md +72 -0
  171. package/skills/testomatio/test-management/qa-write-test-cases/references/writing-rule.md +159 -0
  172. package/skills/testomatio/test-management/scan-automation-project/SKILL.md +152 -0
  173. package/skills/testomatio/test-management/sync-test-cases-with-tms/SKILL.md +107 -0
  174. package/skills/testomatio/test-management/sync-test-cases-with-tms/references/TESTOMATIO_CLI.md +140 -0
  175. package/skills/testomatio/test-management/testomatio-mcp/SKILL.md +195 -0
  176. package/skills/testomatio/test-management/testomatio-mcp/references/MCP_SETUP.md +177 -0
@@ -0,0 +1,182 @@
1
+ # CodeceptJS Best Practices
2
+
3
+ High-level CodeceptJS-specific recommendations. They complement general testing and POM best practices.
4
+ Prefer adapting to the existing project over enforcing new patterns.
5
+
6
+ ## Architecture
7
+
8
+ Think in layers of responsibility, not folders. Each layer has one job — do not mix locators, business logic, and assertions:
9
+
10
+ - Pages: dumb locator containers with simple UI interactions only. No business logic.
11
+ - Actors (I) / Custom Steps: own business logic; orchestrate Page actions into domain workflows, multi-step interactions, conditional logic.
12
+ - Helpers / Utilities: low-level technical operations — browser automation wrappers (Playwright, WebDriver, Puppeteer), API calls, DB access, file operations, custom locators.
13
+ - Test Data / Constants: shared configuration, constants, enums, mock data, fixtures.
14
+ - Plugins / Extensions: optional enhancements — auto-login, soft assertions, reporting.
15
+ - Tests / Specs: independent, readable, scenario-focused.
16
+
17
+ Choose the simplest approach that matches the project:
18
+ - If project uses Page Objects => use them.
19
+ - Else => interact directly in tests.
20
+
21
+ ### Register New Page Objects
22
+
23
+ After creating a new page object file, add it to:
24
+ 1. `codecept.conf.ts` — `include` section
25
+ 2. `steps.d.ts` — type declarations
26
+
27
+ ## Naming Rules
28
+
29
+ No abbreviations — always write full words:
30
+
31
+ | Wrong | Correct |
32
+ |-------|---------|
33
+ | `Nav` | `Navigation` |
34
+ | `Btn` | `Button` |
35
+ | `Pg` | `Page` |
36
+
37
+ Locator names must include the element type as a suffix:
38
+
39
+ | Wrong (no type) | Correct (with type) |
40
+ |-----------------|---------------------|
41
+ | `compareOverview` | `compareOverviewSection` |
42
+ | `finishRun` | `finishRunButton` |
43
+ | `runGroupTitle` | `runGroupTitleHeader` |
44
+
45
+ ## Locator Strategy
46
+
47
+ Priority:
48
+ 1. Semantic text / element roles (`I.seeElement()`, `{ name: 'field' }`).
49
+ 2. CSS ID selectors.
50
+ 3. `data-testid` (when semantic locators aren't possible).
51
+ 4. Custom locators (last resort).
52
+
53
+ ```javascript
54
+ // Good locators
55
+ I.click('Submit')
56
+ I.fillField('Email', 'user@test.com')
57
+ I.click({ testId: 'submit-form-btn' })
58
+ I.click('.btn-primary.submit-form') // only if necessary
59
+ ```
60
+
61
+ ### Reusing Locators
62
+
63
+ - Before creating a new locator, search `src/pages/`, `pages/`, `components/`.
64
+ - If a locator for the same element already exists — reuse it.
65
+ - Avoid duplicates (e.g. `reportButton` vs `combinedReportButton`) — they create confusion and maintenance issues.
66
+
67
+ ### Tab Active State Verification
68
+
69
+ After clicking a tab, verify it is active. Different implementations use different indicators:
70
+
71
+ ```typescript
72
+ private generateActiveTabLocator(tabName: string) {
73
+ return locate('[role="tab"][aria-selected="true"]').withText(tabName);
74
+ }
75
+
76
+ checkThatTabIsActive(tabName: string) {
77
+ const activeTab = this.generateActiveTabLocator(tabName);
78
+ I.waitForElement(activeTab, timeouts.THREE);
79
+ I.seeElement(activeTab);
80
+ }
81
+ ```
82
+
83
+ ## Custom Steps (Actor Methods)
84
+
85
+ - Multi-step logic belongs in Actor methods.
86
+ - Use for login, conditional flows, API+UI flows, or explicit waits.
87
+
88
+ ```javascript
89
+ module.exports = function() {
90
+ return actor({
91
+ async loginAs(email, password) {
92
+ I.amOnPage('/login')
93
+ I.fillField('Email', email)
94
+ I.fillField('Password', password)
95
+ I.click('Sign In')
96
+ I.waitForUrl('**/dashboard')
97
+ },
98
+
99
+ async ensureLoggedIn(user) {
100
+ const loggedIn = await I.grabNumberOfVisibleElements('.logout-button') > 0
101
+ if (!loggedIn) await this.loginAs(user.email, user.password)
102
+ }
103
+ })
104
+ }
105
+ ```
106
+
107
+ ## Fixtures & Hooks
108
+
109
+ - Use `Before` hook for setup and authentication.
110
+ - Use `After` hook for cleanup (API cleanup only, no UI).
111
+ - Reuse existing fixtures when present in the project.
112
+
113
+ ```typescript
114
+ Before(async ({ app }) => {
115
+ const login = await app.login(token);
116
+ app.setToken(`Bearer ${login.data.jwt}`);
117
+ loginAs("mainUser");
118
+ });
119
+
120
+ After(async ({ app }) => {
121
+ await app.cleanup();
122
+ });
123
+ ```
124
+
125
+ ### Test Data Usage
126
+
127
+ Prefer shared constants, enums, or test data over hardcoded values:
128
+
129
+ ```typescript
130
+ import { timeouts } from "../testData/timeout";
131
+
132
+ I.waitForElement(locator, timeouts.THREE); // 3s
133
+ ```
134
+
135
+ ### API in Preconditions, UI for Test Steps
136
+
137
+ - Before hook: use API to create test data (users, projects, runs, etc.).
138
+ - Scenario body: use UI interactions — that is what the test is verifying.
139
+ - Exception: simple navigation to a starting URL in Before is acceptable.
140
+
141
+ ### Formatting Rules
142
+
143
+ - One blank line between every action in Scenario body.
144
+ - No step comments inside Scenario body — method names must be self-documenting.
145
+ - No magic strings in test body — extract to `const` at top of file.
146
+ - No long `projectData.x.y.z.w` chains in test body — extract to named `const`.
147
+
148
+ ## Test Tags & Filtering
149
+
150
+ - Tagging and filtering are project-specific.
151
+ - If the project already uses tags (e.g., @Smoke, @Regression, @P0), follow existing conventions.
152
+ - Do not introduce new tagging systems unless explicitly required.
153
+
154
+ ## Debugging & Reporting
155
+
156
+ - Use `--debug` / `--verbose`.
157
+ - Save screenshots: `I.saveScreenshot('name.png')`.
158
+ - Playwright traces can be enabled in helper config.
159
+ - Custom helpers: `DebugHelper` for logs, screenshots, pause.
160
+
161
+ ## Anti-Patterns (Avoid)
162
+
163
+ - Never hardcode test data — use data files or environment variables.
164
+ - Never share state between tests — each test sets up its own state.
165
+ - Never commit secrets or credentials — use environment variables.
166
+ - Never ignore flaky tests — fix immediately with proper waits.
167
+ - Never skip test cleanup — use After hooks.
168
+ - Prefer semantic locators (`{ name: 'button' }`) over CSS-only (`.btn-primary`).
169
+
170
+ Code smells from legacy code (do not repeat):
171
+ - Hardcoded waits (like `I.wait(n)`).
172
+ - Inline cleanup inside test scenarios (`// cleanup`).
173
+ - Locators directly in test files instead of page objects.
174
+ - Hardcoded IDs and config values in tests.
175
+
176
+ ## Checklist
177
+
178
+ - [ ] Keep tests independent — each test sets up its own state
179
+ - [ ] Use test data constants instead of hardcoded values
180
+ - [ ] Follow naming rules (full words, element type suffix)
181
+ - [ ] Reuse existing locators before creating new ones
182
+ - [ ] Add assertions based on expected results from manual steps
@@ -0,0 +1,22 @@
1
+ # Final Summary Template
2
+
3
+ Use this template after completing the conversion process:
4
+
5
+ ```
6
+ **Summary:**
7
+ - Framework: [Playwright/CodeceptJS/Cypress]
8
+ - Tests generated: [N]
9
+ - Passed: [N]
10
+ - Needs review: [N]
11
+
12
+ **Generated Files:**
13
+ - [path/to/test1.spec.ts] ✅
14
+ - [path/to/test2.spec.ts] ⚠️ ([issue])
15
+ - [path/to/test3.spec.ts] ✅
16
+
17
+ **Key Issues:**
18
+ [Short description of main problems, if any]
19
+
20
+ **Next steps:**
21
+ ...
22
+ ```
@@ -0,0 +1,90 @@
1
+ # Playwright Best Practices
2
+
3
+ High-level Playwright-specific recommendations. They complement general testing and POM best practices.
4
+ Prefer adapting to the existing project over enforcing new patterns.
5
+
6
+ ## Architecture & Project Structure
7
+
8
+ - Do not assume a fixed architecture (e.g., Pages, Modules, Fixtures).
9
+ - Detect and follow the existing project structure.
10
+ - Common patterns may include:
11
+ - Pages: dumb locator containers with simple element interactions only.
12
+ - Modules: own all business logic, orchestrate Page actions into domain workflows.
13
+ - Fixtures: dependency injection — tests never instantiate Pages or Modules directly.
14
+ - `test.step()`: use for reporting, trace analysis, and debugging.
15
+
16
+ Choose the simplest approach that matches the project:
17
+ - If project uses Page Objects => use them.
18
+ - Else => interact directly in tests.
19
+
20
+ ## Locator Strategy
21
+
22
+ - Prefer user-facing and semantic locators.
23
+ - Use built-in Playwright locator strategies when possible.
24
+ - Prefer stability over brevity.
25
+ - Avoid selectors tied to layout or styling.
26
+
27
+ Priority:
28
+ 1. Role-based selectors (buttons, links, alerts).
29
+ 2. Labels (form inputs).
30
+ 3. Visible text.
31
+ 4. Test-specific attributes (data-testid).
32
+ 5. CSS selectors.
33
+
34
+ Stay consistent within the project:
35
+ - If the project relies on semantic locators => follow that pattern.
36
+ - If it uses test IDs => prefer `data-testid` as the primary selector.
37
+
38
+ ```typescript
39
+ // Preferred (semantic)
40
+ await page.getByRole('button', { name: 'Submit' }).click()
41
+ await page.getByLabel('Email').fill('user@test.com')
42
+
43
+ // Fallback (only if necessary)
44
+ await page.locator('.btn-primary.submit-form').click()
45
+ ```
46
+
47
+ ## Fixtures
48
+
49
+ - Playwright provides built-in fixtures (e.g., `page`, `context`, `request`).
50
+ - Reuse existing custom fixtures for setup, authentication, or shared state.
51
+ - If no fixture structure exists, simple tests can interact directly without introducing abstraction.
52
+ - Introduce new fixtures only when they clearly improve reuse, readability, or setup consistency.
53
+
54
+ ## API Testing
55
+
56
+ Playwright supports both API and UI interactions via `request`.
57
+
58
+ - Prefer API for: test setup, teardown, data preparation.
59
+ - Use UI for: behavior validation, end-user flows.
60
+ - Pattern: setup via API, verify via UI.
61
+
62
+ ## Test Tags & Filtering
63
+
64
+ - Tagging and filtering are project-specific.
65
+ - If the project already uses tags (e.g., @Smoke, @Regression, @P0), follow existing conventions.
66
+ - Do not introduce new tagging systems unless explicitly required.
67
+
68
+ ## Debugging & Reporting
69
+
70
+ - Use built-in Playwright debugging tools or Playwright MCP when needed: traces, screenshots, logs.
71
+ - Add extra steps or logs only if they improve clarity.
72
+ - Avoid excessive logging or noise in tests.
73
+
74
+ ## Anti-Patterns (Avoid)
75
+
76
+ - Never embed test data directly in test logic — prefer centralized test data (JSON, factories, or generators).
77
+ - Never share state between tests — each test is isolated.
78
+ - Never ignore flaky tests — fix immediately with proper waits.
79
+ - Never use arbitrary `sleep()` — use explicit waits instead.
80
+ - Never commit secrets or credentials — use environment variables.
81
+ - Never over-abstract simple test flows.
82
+
83
+ ## Checklist
84
+
85
+ - [ ] Use `test.step()` for reporting and trace analysis
86
+ - [ ] Use API for setup/teardown over UI when possible
87
+ - [ ] Keep tests independent — each test sets up its own state
88
+ - [ ] Use test data instead of hardcode
89
+ - [ ] Run tests in parallel (when safe)
90
+ - [ ] Implement soft assertions for non-critical checks
@@ -0,0 +1,53 @@
1
+ # Page Object Model (POM) Best Practices
2
+
3
+ ## Core Principles
4
+
5
+ ### Single Responsibility
6
+ - Each Page Object represents one page or a clearly defined UI component.
7
+ - Each method performs a single, clear action.
8
+ - Keep structure flat and simple.
9
+ - Avoid unnecessary abstractions.
10
+ - Introduce shared components only when reuse is clear.
11
+
12
+ ### Encapsulation
13
+ - Hide implementation details such as selectors and waiting logic.
14
+ - Expose only meaningful, high-level actions to tests.
15
+ - Do not expose raw selectors outside the Page Object.
16
+
17
+ ### Reusability
18
+ - Extract shared logic only when reuse is clear.
19
+ - Extract shared functionality into parent classes.
20
+ - Use composition over inheritance when appropriate.
21
+
22
+ ## Wait Strategies
23
+
24
+ - Use condition-based waits (element visible, enabled, loaded).
25
+ - Avoid fixed delays or hard waits.
26
+ - Rely on framework auto-waiting where available.
27
+ - Do not duplicate waiting logic unnecessarily.
28
+
29
+ ```typescript
30
+ // Bad: hard wait
31
+ await page.waitForTimeout(5000)
32
+ ```
33
+
34
+ ## Error Handling
35
+
36
+ - Do not override or wrap framework errors for UI interactions.
37
+ - Rely on built-in error handling for element actions.
38
+ - Avoid adding manual visibility or existence checks before actions.
39
+
40
+ - Add contextual error handling only for:
41
+ - API interactions
42
+ - Data processing
43
+ - Non-UI logic
44
+
45
+ ## Summary Checklist
46
+
47
+ - [ ] One class per page/component.
48
+ - [ ] Private/protected locators.
49
+ - [ ] Explicit waits over hard waits.
50
+ - [ ] Meaningful method names.
51
+ - [ ] No assertions in Page Objects.
52
+ - [ ] Reusable component structure.
53
+ - [ ] Clear error messages.
@@ -0,0 +1,52 @@
1
+ # Test Data Management
2
+
3
+ ## Core Principles
4
+
5
+ - Test data must support the test scenario, not define it.
6
+ - Keep test data minimal, relevant, and easy to understand.
7
+ - Ensure tests remain independent and do not rely on shared mutable data.
8
+ - Prefer clarity over reusability when in conflict.
9
+
10
+ ## Data Placement Strategy
11
+
12
+ When deciding where to store test data:
13
+ 1. If data is used only within a single test => Keep it simple or inline within that test.
14
+ 2. If data is reused across multiple tests => Extract it into a shared test-data.
15
+ 3. If data is large, structured, or tabular => Store it in external files (e.g., JSON, CSV).
16
+ - LOAD data from external file.
17
+ - ITERATE over dataset in tests.
18
+ 4. If data depends on environment (URLs, credentials, configs) => Use environment variables or configuration files.
19
+ - READ baseUrl from environment.
20
+ - USE baseUrl in test.
21
+
22
+ **Priority:** Start local - Extract only when reuse is clear.
23
+
24
+ ## Data Structure Guidelines
25
+
26
+ - Use clear, descriptive names for all data variables.
27
+ - Keep data structures simple and predictable.
28
+ - Avoid deeply nested or overly complex data unless required.
29
+ - Group related data logically (e.g., user profiles, product sets).
30
+
31
+ ## Test Isolation Rules
32
+
33
+ - Each test must be fully independent.
34
+ - Tests must not share mutable data or state.
35
+ - Avoid dependencies between tests.
36
+ - Prefer framework-provided isolation over manual resource handling.
37
+
38
+ ## Reusability Guidelines
39
+
40
+ - Reuse test data only when it reduces duplication and improves clarity.
41
+ - Do not over-centralize data if it makes tests harder to read.
42
+ - Keep frequently used data in shared modules.
43
+ - Keep unique or scenario-specific data close to the test.
44
+
45
+ ## Anti-Patterns to Avoid
46
+
47
+ - Hardcoding credentials or secrets in test files.
48
+ - Using real user or production data.
49
+ - Sharing state between tests.
50
+ - Creating test data without cleanup.
51
+ - Over-engineering data structures for simple scenarios.
52
+
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: debug-fix-failed-flaky-autotests
3
+ description: Diagnose and fix failing automated tests. Analyzes failures, inspects DOM, identifies root causes, and applies targeted fixes using framework tools and MCP/CLI debug modes. Use when tests fail, are flaky, or behave inconsistently (e.g., pass locally but fail in CI).
4
+ license: MIT
5
+ metadata:
6
+ author: Testomat.io
7
+ version: 1.0.0
8
+ ---
9
+
10
+ # Debug and Fix Failing Autotests
11
+
12
+ Diagnose failing automated tests and apply targeted fixes.
13
+ Follow the four steps in order.
14
+ Detailed fixes and code examples: [references/DEBUGGING_QUICK_REFERENCE.md](references/DEBUGGING_QUICK_REFERENCE.md).
15
+
16
+ ## Step 1: Analyze Failure
17
+
18
+ - Identify the framework. It determines the debug tools:
19
+ - Playwright: CLI debug, trace viewer, MCP snapshots.
20
+ - CodeceptJS: `--steps` mode, CDP inspection.
21
+ - Cypress: devTools, screenshots on failure.
22
+ - WebdriverIO: Selenium logs.
23
+ - Categorize the error:
24
+ - Locator (element missing/unreachable).
25
+ - Timing (timeout/race).
26
+ - Assertion (expected ≠ actual).
27
+ - Flow (navigation, preconditions).
28
+ - Infrastructure (CI/browser/network).
29
+ - End with a hypothesis: root cause + fix category.
30
+
31
+ ## Step 2: Inspect and Diagnose
32
+
33
+ - DOM inspection:
34
+ - Playwright: `page.locator('selector').evaluate(el => el.outerHTML)`.
35
+ - CodeceptJS: `I.executeScript(() => document.querySelector('.selector').outerHTML)`.
36
+ - MCP snapshot: capture live DOM state for complex elements.
37
+ - Console and network logs:
38
+ - Console: `page.on('console', msg => console.log(msg.text()))`.
39
+ - Failed requests: `page.on('requestfailed', r => console.log(r.failure().errorText))`.
40
+ - Trace analysis (Playwright): `npx playwright show-trace trace.zip`.
41
+ - Inspect timing and order of clicks, navigation, network requests.
42
+
43
+ ## Step 3: Apply Fix
44
+
45
+ **Fix in priority order: locators → timing → assertions → flow.**
46
+
47
+ - Locators: use stable selectors (`data-testid` → `aria-label` → `role` → `id` → `text` → CSS/XPath).
48
+ - Re-fetch stale elements, scroll hidden elements into view, use `.first()` for multiple matches.
49
+ - Timing: use framework-native waits (`waitFor`, `waitForNavigation`, `waitForLoadState('networkidle')`).
50
+ - **No hard sleeps** like `sleep(5000)` or `wait(2)`.
51
+ - Assertions: use contains/regex for flexible matching.
52
+ - Verify expected values against the test spec, not assumptions.
53
+ - Flow: ensure preconditions (login, navigation order, test data).
54
+ - Isolate test state from prior runs.
55
+
56
+ Before/after examples for each category: [references/DEBUGGING_QUICK_REFERENCE.md](references/DEBUGGING_QUICK_REFERENCE.md).
57
+
58
+ ## Step 4: Verify and Stabilize
59
+
60
+ Re-run the test:
61
+
62
+ ```bash
63
+ npx playwright test path/to/test.spec.ts
64
+ npx codeceptjs run path/to/test.js
65
+ ```
66
+
67
+ Test is stable when:
68
+ - Passes 2 consecutive runs.
69
+ - Uses resilient locators.
70
+ - Waits properly for dynamic content.
71
+
72
+ **Max 3 healing attempts total.** After 3 failed attempts: stop, document what was tried, ask the user for guidance.
73
+
74
+ Document the fix: root cause, applied fix, verification result.
75
+
76
+ ## MCP Debug Tools (Optional)
77
+
78
+ Use MCP when standard fixes fail, the UI is complex (dropdowns, modals, dynamic content), or live DOM inspection is needed:
79
+ - Playwright MCP: live snapshots, element counts, DOM inspection after each action.
80
+ - CodeceptJS MCP: CDP-based inspection, `--steps` mode for live debugging.
81
+
82
+ ## User Interaction
83
+
84
+ Ask when unclear:
85
+
86
+ ```
87
+ ❓ Which element should I target for this action?
88
+
89
+ Options:
90
+ 1. Submit button (data-testid="submit")
91
+ 2. Save button (aria-label="Save")
92
+ 3. Other (specify)
93
+ ```
94
+
95
+ Report progress:
96
+
97
+ ```
98
+ 🔍 Analyzing failure...
99
+ - Error: Element not found
100
+ - Context: Login test, line 42
101
+
102
+ 🔧 Applying fix...
103
+ - Issue: Selector too broad
104
+ - Fix: Using getByRole('button', { name: 'Login' })
105
+
106
+ ✅ Test passed! (Run 1/2)
107
+ ```
@@ -0,0 +1,113 @@
1
+ # Debugging Quick Reference
2
+
3
+ Fix in priority order: locators → timing → assertions → flow.
4
+
5
+ ---
6
+
7
+ ## Locator Fixes
8
+
9
+ | Problem | Avoid | Prefer |
10
+ |---------|-------|--------|
11
+ | Deep nesting | `.parent .child .grandchild` | `[data-testid="target"]` |
12
+ | Index-based | `button:nth-child(2)` | `getByRole('button', { name: 'Submit' })` |
13
+ | Partial text | `button:contains("Save")` | `getByText('Save', { exact: true })` |
14
+ | Dynamic classes | `.btn-primary-123` | `[data-testid="save-btn"]` |
15
+
16
+ Element state issues:
17
+
18
+ - Not found => wait for element before action.
19
+ - Not visible => scroll into view.
20
+ - Not clickable => wait for enabled state; check overlays.
21
+ - Stale element => re-fetch element before action.
22
+ - Multiple matches => filter or use `.first()`.
23
+
24
+ ---
25
+
26
+ ## Timing Fixes
27
+
28
+ Use framework-native waits instead of hard sleeps.
29
+
30
+ - Avoid hard sleeps (`sleep(5000)`, `wait(2)`) => flaky.
31
+ - Avoid implicit short waits => unreliable.
32
+ - Works locally, fails in CI => CI is slower; increase timeouts and add explicit waits.
33
+
34
+ **Playwright:**
35
+ ```typescript
36
+ await page.getByTestId('loader').waitFor({ state: 'hidden' });
37
+ await page.waitForURL('/dashboard/**');
38
+ await page.waitForResponse(r => r.status() === 200);
39
+ ```
40
+
41
+ **CodeceptJS:**
42
+ ```javascript
43
+ I.waitForNavigationVisible();
44
+ I.waitForResponse(response => response.status() === 200);
45
+ ```
46
+
47
+ ### Fix Race Conditions
48
+
49
+ Ensure assertions happen after dynamic content updates.
50
+ Use `expect` with Playwright's built-in waiting, or `locator.waitFor()` only if needed.
51
+
52
+ ```typescript
53
+ // Click triggers dynamic update
54
+ await page.getByRole('button', { name: 'Submit' }).click();
55
+
56
+ // Wait for result text to appear (optional, only if dynamically loaded)
57
+ await expect(page.getByTestId('result')).toHaveText('Success'); // automatically waits
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Assertion Fixes
63
+
64
+ - Exact match too strict => use `toContain()` or regex.
65
+ - Wrong expected value => verify against test spec.
66
+ - Timing issues => wait before assertion.
67
+ - Multiple elements => use `.first()` or `.nth(0)`.
68
+
69
+ Examples:
70
+
71
+ ```typescript
72
+ // Before: exact match fails on whitespace
73
+ expect(await page.locator('.title').textContent()).toBe('Hello World');
74
+
75
+ // After: contains check
76
+ await expect(page.locator('.title')).toContainText('Hello');
77
+
78
+ // Better: trim if exact needed
79
+ const text = (await page.locator('.title').textContent()).trim();
80
+ expect(text).toBe('Hello World');
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Flow Fixes
86
+
87
+ - Missing preconditions => ensure login, proper navigation, and required test data.
88
+ - Fails on 2nd run => add cleanup hooks.
89
+ - Depends on order => use `beforeEach` for fresh state.
90
+ - Shared state => isolate per test worker.
91
+
92
+ ---
93
+
94
+ ## Framework-Specific Commands
95
+
96
+ **Playwright:**
97
+ - Show trace: `npx playwright show-trace trace.zip`
98
+ - Run single file: `npx playwright test path/to/test.spec.ts`
99
+
100
+ **CodeceptJS:**
101
+ - Steps mode: `npx codeceptjs run --steps`
102
+ - Verbose: `npx codeceptjs run --verbose`
103
+ - Single file: `npx codeceptjs run path/to/test.js`
104
+
105
+ ---
106
+
107
+ ## Max 3 Healing Attempts
108
+
109
+ 1. Attempt 1: apply fix based on initial diagnosis.
110
+ 2. Attempt 2: if still fails, re-diagnose with new info.
111
+ 3. Attempt 3: last try with an alternative approach.
112
+
113
+ If still failing => STOP, document what was tried, ask the user for guidance.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: qa-automation-test-consolidation
3
+ description: Detect redundant tests, duplicated test logic, semantic overlaps, and parameterization opportunities across the entire test suite. Present recommendations and request user approval before refactoring.
4
+ license: MIT
5
+ metadata:
6
+ author: Testomat.io
7
+ version: 1.0.0
8
+ ---
9
+
10
+ ## Summary
11
+
12
+ This skill analyzes an entire test suite to identify duplicate tests, semantic overlaps, duplicated test logic, parameterization opportunities, and overlapping business-rule validations. It prioritizes behavioral similarity over code similarity and recommends refactorings that reduce maintenance effort while preserving test coverage and business intent. No changes are applied without explicit user approval.
13
+
14
+ ## How the Loop Works
15
+
16
+ - Analyze the entire test suite for consolidation opportunities;
17
+ - Group findings by type and confidence level;
18
+ - Present a summary of the proposed changes and request user approval;
19
+ - Apply the approved refactorings;
20
+ - Re-analyze the updated test suite to identify newly exposed consolidation opportunities;
21
+ - Repeat until no additional consolidation opportunities with a confidence level greater than 80% remain.
22
+
23
+ ## Definition of Done
24
+
25
+ - The entire test suite has been analyzed;
26
+ - All consolidation opportunities have been presented to the user;
27
+ - All approved refactorings have been applied;
28
+ - The test suite has been re-analyzed after each iteration;
29
+ - No duplicate tests, duplicated test logic, parameterization opportunities, or business-rule overlaps with a confidence level greater than 80% remain.