@sun-asterisk/sungen 2.6.15 → 2.7.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/cli/index.js +3 -1
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/exporters/feature-parser.d.ts +9 -2
  4. package/dist/exporters/feature-parser.d.ts.map +1 -1
  5. package/dist/exporters/feature-parser.js +12 -4
  6. package/dist/exporters/feature-parser.js.map +1 -1
  7. package/dist/orchestrator/ai-rules-updater.d.ts.map +1 -1
  8. package/dist/orchestrator/ai-rules-updater.js +10 -0
  9. package/dist/orchestrator/ai-rules-updater.js.map +1 -1
  10. package/dist/orchestrator/project-initializer.d.ts +5 -0
  11. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  12. package/dist/orchestrator/project-initializer.js +16 -0
  13. package/dist/orchestrator/project-initializer.js.map +1 -1
  14. package/dist/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +9 -1
  15. package/dist/orchestrator/templates/ai-instructions/claude-cmd-review.md +13 -12
  16. package/dist/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -2
  17. package/dist/orchestrator/templates/ai-instructions/claude-config.md +1 -1
  18. package/dist/orchestrator/templates/ai-instructions/claude-skill-delivery.md +1 -1
  19. package/dist/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +14 -0
  20. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +57 -11
  21. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +41 -31
  22. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +386 -326
  23. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +268 -90
  24. package/dist/orchestrator/templates/ai-instructions/claude-skill-test-design-techniques.md +23 -49
  25. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-a-data-entry.md +203 -0
  26. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-b-data-ops.md +179 -0
  27. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-c-data-explore.md +233 -0
  28. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-d-display.md +226 -0
  29. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-e-identity.md +177 -0
  30. package/dist/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +69 -240
  31. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +9 -1
  32. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-review.md +13 -12
  33. package/dist/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +4 -2
  34. package/dist/orchestrator/templates/ai-instructions/copilot-config.md +1 -1
  35. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +1 -1
  36. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +15 -21
  37. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +61 -15
  38. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +41 -31
  39. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +371 -324
  40. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +262 -102
  41. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-test-design-techniques.md +23 -49
  42. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-a-data-entry.md +203 -0
  43. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-b-data-ops.md +179 -0
  44. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-c-data-explore.md +233 -0
  45. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-d-display.md +226 -0
  46. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-e-identity.md +177 -0
  47. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +69 -240
  48. package/dist/orchestrator/templates/qa-context.md +90 -0
  49. package/dist/orchestrator/templates/readme.md +16 -13
  50. package/package.json +9 -1
  51. package/src/cli/index.ts +4 -1
  52. package/src/exporters/feature-parser.ts +12 -4
  53. package/src/orchestrator/ai-rules-updater.ts +10 -0
  54. package/src/orchestrator/project-initializer.ts +20 -0
  55. package/src/orchestrator/templates/ai-instructions/claude-cmd-create-test.md +9 -1
  56. package/src/orchestrator/templates/ai-instructions/claude-cmd-review.md +13 -12
  57. package/src/orchestrator/templates/ai-instructions/claude-cmd-run-test.md +4 -2
  58. package/src/orchestrator/templates/ai-instructions/claude-config.md +1 -1
  59. package/src/orchestrator/templates/ai-instructions/claude-skill-delivery.md +1 -1
  60. package/src/orchestrator/templates/ai-instructions/claude-skill-gherkin-syntax.md +14 -0
  61. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +57 -11
  62. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +41 -31
  63. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +386 -326
  64. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-review.md +268 -90
  65. package/src/orchestrator/templates/ai-instructions/claude-skill-test-design-techniques.md +23 -49
  66. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-a-data-entry.md +203 -0
  67. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-b-data-ops.md +179 -0
  68. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-c-data-explore.md +233 -0
  69. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-d-display.md +226 -0
  70. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint-group-e-identity.md +177 -0
  71. package/src/orchestrator/templates/ai-instructions/claude-skill-viewpoint.md +69 -240
  72. package/src/orchestrator/templates/ai-instructions/copilot-cmd-create-test.md +9 -1
  73. package/src/orchestrator/templates/ai-instructions/copilot-cmd-review.md +13 -12
  74. package/src/orchestrator/templates/ai-instructions/copilot-cmd-run-test.md +4 -2
  75. package/src/orchestrator/templates/ai-instructions/copilot-config.md +1 -1
  76. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-delivery.md +1 -1
  77. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-gherkin-syntax.md +15 -21
  78. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +61 -15
  79. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +41 -31
  80. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +371 -324
  81. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-review.md +262 -102
  82. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-test-design-techniques.md +23 -49
  83. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-a-data-entry.md +203 -0
  84. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-b-data-ops.md +179 -0
  85. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-c-data-explore.md +233 -0
  86. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-d-display.md +226 -0
  87. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint-group-e-identity.md +177 -0
  88. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-viewpoint.md +69 -240
  89. package/src/orchestrator/templates/qa-context.md +90 -0
  90. package/src/orchestrator/templates/readme.md +16 -13
@@ -55,13 +55,23 @@ When running Phase 0 for a **flow** (`qa/flows/<name>/`), check existing screen
55
55
  - Read `baseURL` from `playwright.config.ts`.
56
56
  - `browser_navigate` to the page URL.
57
57
  - If redirected to login → **ask the user to log in manually in the MCP browser**, wait for confirmation, then continue. Never use `sungen makeauth`. Never inject cookies via `browser_evaluate`.
58
- 5. **Snapshot**: take **ONE** `browser_snapshot`. All Phase 0 selectors come from this single snapshot.
58
+ 5. **Snapshot**: Wait for the page to fully load before snapshotting.
59
+ - Check if the page is still loading (spinner visible, skeleton placeholders, empty table with 0 rows). If so, use `browser_wait_for` to wait until content is rendered.
60
+ - Then take **ONE** `browser_snapshot`. All Phase 0 selectors come from this single snapshot.
59
61
  6. **Generate YAML entries**:
60
62
  - Keys: follow `sungen-selector-keys` (lowercase, Unicode preserved, `--type` / `--N` suffixes).
61
- - Selector priority: follow the table in **Diagnosis & Fix § Step 3** (`testid` > `role`+name > `placeholder` > `label` > `locator` > `text`).
63
+ - Selector priority: follow the table in **Diagnosis & Fix § Step 3** (`testid` > `role`+name > `label` > `placeholder` > `text` > `locator` CSS last resort).
62
64
  - Copy names **character-for-character** from the snapshot. Never infer from the Gherkin label.
63
65
  - If an element is auto-inferable per `sungen-selector-keys` § Auto-Infer, **omit it** from YAML — keep the file minimal.
64
66
  - **i18n sites**: if the site supports multiple languages, use `{{variable}}` in `name`/`value` fields instead of hardcoded text. Add corresponding `lbl_*` keys to `test-data.yaml` + locale overlay files (see `sungen-selector-keys` § i18n).
67
+ - **Selector quality rule**: the Playwright MCP accessibility tree snapshot gives you roles and accessible names directly — use them. Do NOT write XPath or class-based CSS selectors. Only write `type: locator` when no role/text/label/placeholder/testid is available, and restrict the CSS to `#id` or `[data-*]` / `[aria-*]` attribute selectors.
68
+ 6b. **Cross-verify Gherkin labels vs snapshot** (prevents the #1 production failure):
69
+ - For **every** `[Reference]` in the `.feature` that will rely on auto-infer (not written to YAML), check the snapshot:
70
+ - `[X] button` — is there a button with accessible name **exactly** `X`?
71
+ - `[X] field` — does an input have placeholder **exactly** `X`? Does it even have a placeholder?
72
+ - `[X] heading` / `text` / `message` — is that text literally visible in the snapshot?
73
+ - If any mismatch → write an explicit YAML entry using the real DOM name. Do not leave a mismatch to be caught at runtime.
74
+ - **Typical mismatch cases**: Gherkin uses English label (`[Submit]`) but app displays Vietnamese (`"Gửi"`); placeholder is descriptive (`"Nhập email của bạn"`) not a bare field name (`"Email"`); button text includes an icon glyph before/after the word.
65
75
  7. **Substring ambiguity check**: for each `role` + `name` selector, check if any other element in the snapshot has a name that **contains** this name as a substring (e.g., `"Đăng ký"` vs `"Đăng ký bằng Google"`). If yes → add `exact: true` to prevent strict mode violation at runtime.
66
76
  8. **Merge, don't overwrite**: preserve the page selector and any user-authored entries in `selectors.yaml`. Only add missing keys.
67
77
  9. **Show summary + confirm**: list the keys that will be added, ask the user to approve, then write the file.
@@ -69,9 +79,13 @@ When running Phase 0 for a **flow** (`qa/flows/<name>/`), check existing screen
69
79
 
70
80
  ### Common Phase 0 pitfalls
71
81
 
72
- - Writing keys inferred from the Gherkin label instead of the snapshot name → Phase 1 will fail with "no element found".
82
+ - Writing keys inferred from the Gherkin label instead of the snapshot name → Phase 1 will fail with `No element found`.
73
83
  - Skipping Phase 0.5 when an auth redirect happened → snapshot captures the login page, all selectors wrong.
84
+ - Taking snapshot while page is still loading (spinner visible, table empty) → selectors for dynamic content will be missing or wrong.
85
+ - Skipping step 6b for "simple" elements like buttons → silent mismatch between Gherkin label and DOM name fails at runtime.
74
86
  - Using `browser_evaluate` alone to scrape cookies → misses httpOnly session cookies. Always use `browser_storage_state` (or the `browser_run_code` fallback).
87
+ - Writing XPath or class-based CSS selectors → breaks on DOM/style refactoring. Use role/testid/text/label/placeholder from the accessibility tree.
88
+ - Falling back to `locator: 'div.some-class > span'` when the element IS visible in the accessibility snapshot with a role + name → the snapshot gives you `getByRole` for free; use it.
75
89
  - Overwriting user-authored selectors → always merge.
76
90
 
77
91
  ---
@@ -98,10 +112,10 @@ When running Phase 0 for a **flow** (`qa/flows/<name>/`), check existing screen
98
112
  |---|---|---|
99
113
  | 1 | `testid` | Dev annotation `data-testid=X` in component metadata |
100
114
  | 2 | `role` + name | Component type is Button/Link + has text label |
101
- | 3 | `placeholder` | Component type is Input/Field + has placeholder text |
102
- | 4 | `label` | Component has associated label text (not placeholder) |
103
- | 5 | `locator` (CSS) | No accessible name derivable from Figma data |
104
- | 6 | `text` | Plain text node (not inside interactive component) |
115
+ | 3 | `label` | Component has associated label text (not placeholder) |
116
+ | 4 | `placeholder` | Component type is Input/Field + has placeholder text |
117
+ | 5 | `text` | Plain text node (not inside interactive component) |
118
+ | 6 | `locator` (CSS) | Last resort `#id` or `[attr=value]` only, never classes or XPath |
105
119
 
106
120
  See `sungen-figma-source` skill for the authoritative heuristics table mapping Figma signals to YAML entry types.
107
121
 
@@ -271,12 +285,24 @@ Selector priority (use first applicable):
271
285
 
272
286
  | Priority | type | When |
273
287
  |---|---|---|
274
- | 1 | `testid` | `data-testid` exists |
275
- | 2 | `role` + exact name | Interactive elements |
276
- | 3 | `placeholder` | Input with placeholder |
277
- | 4 | `label` | Form field with `<label>` |
278
- | 5 | `locator` (CSS) | No accessible name |
279
- | 6 | `text` | Static text only |
288
+ | 1 | `testid` | `data-testid` or any stable test attribute exists |
289
+ | 2 | `role` + exact name | Interactive elements with an accessible name |
290
+ | 3 | `label` | Form field with a visible `<label>` |
291
+ | 4 | `placeholder` | Input/textarea with a placeholder attribute |
292
+ | 5 | `text` | Static visible text content |
293
+ | 6 | `locator` (CSS) | Last resort — `#id` or `[attr=value]` **only** (see restrictions below) |
294
+
295
+ > ⚠️ **Playwright best practice** ([source](https://playwright.dev/docs/best-practices#use-locators)): user-facing locators (`role`, `label`, `text`, `placeholder`, `testid`) are resilient to refactoring and far less likely to break. CSS class selectors and XPath break whenever a developer renames a class or restructures the DOM — even without changing the UI.
296
+ >
297
+ > **Never write these in `selectors.yaml`**:
298
+ > - XPath: `xpath=//div[@class='...']` or `//button[contains(@class,'btn')]`
299
+ > - Class-based CSS: `div.btn-primary`, `.modal-footer > .submit-btn`
300
+ > - Deep structural CSS: `div:nth-child(3) > ul > li > button`
301
+ >
302
+ > **Acceptable CSS (last resort only)**:
303
+ > - Stable `id`: `#submit-button` (only if the id is truly stable and not dynamic)
304
+ > - Data attributes: `[data-id="123"]`, `[aria-controls="menu"]`
305
+ > - Input type: `input[type="file"]` (when no testid/label exists)
280
306
 
281
307
  **Exact name rule**: copy name character-for-character from snapshot. Never infer from Gherkin label.
282
308
 
@@ -290,9 +316,9 @@ Common fixes:
290
316
  - Name mismatch → copy exact name from snapshot
291
317
  - Multiple matches → add `nth` or `exact: true`
292
318
  - Substring ambiguity (e.g., `"Submit"` matches `"Submit"` and `"Submit & Continue"`) → add `exact: true`
293
- - No accessible name → use `testid` or `locator` (CSS)
319
+ - No accessible name → use `testid`; only fall back to `locator` CSS as last resort
294
320
  - Element in iframe → add `frame` field
295
- - Dynamic content → use `testid` or structural `role` + `nth`
321
+ - Dynamic content → use `testid` or `role` + `nth`
296
322
 
297
323
  ### Step 4: Recompile After Fix
298
324
 
@@ -309,6 +335,26 @@ Then re-run only the current phase's failing tests, not all tests.
309
335
 
310
336
  ---
311
337
 
338
+ ## Common Failure Patterns
339
+
340
+ Quick reference for the most frequent production failures:
341
+
342
+ | Symptom | Root cause | Fix |
343
+ |---------|-----------|-----|
344
+ | `No element found` on button/link/heading | Gherkin `[Reference]` label ≠ DOM accessible name (different language or text) | Write explicit YAML: `type: role, value: button, name: "<exact DOM name>"` |
345
+ | `No element found` on `[X] field` | Field has no placeholder, or placeholder ≠ X | Write explicit YAML: `type: label, value: "Actual label"` or `type: placeholder, value: "Actual placeholder"` |
346
+ | `No element found` on `[X] text` / `message` | Visible text differs from Gherkin label, or text is dynamic | Write explicit YAML or use `{{variable}}` for dynamic content |
347
+ | `strict mode violation` | Multiple elements match the same name/text | Add `exact: true` to YAML entry, or add `nth` |
348
+ | `toBeVisible` timeout on dynamic content | Snapshot was taken while page was still loading | Wait for spinner/skeleton to clear before snapshotting; add `browser_wait_for` |
349
+ | All tests fail with page navigate error | Page selector URL wrong or baseURL mismatch | Re-check `playwright.config.ts` `baseURL` and page selector `value` path |
350
+ | Auth redirect on every test | `specs/.auth/<role>.json` missing or expired | Run Phase 0.5 to capture fresh session |
351
+ | Table row assertions fail | `columns` config has wrong indices | Count column headers left-to-right (0-indexed) from snapshot |
352
+ | Wrong text assertions on locale page | Hardcoded Vietnamese/English text in YAML `name`/`value` | Use `{{lbl_*}}` variables with locale overlay files |
353
+ | Element inside iframe not found | `frame` field missing in YAML entry | Add `frame: "iframe[src*='...']"` to the selector entry |
354
+ | Selector breaks after UI redesign with no functional change | CSS class or XPath used — brittle to style refactoring | Rewrite with `role`/`testid`/`label`/`text` from accessibility snapshot |
355
+
356
+ ---
357
+
312
358
  ## Table Selectors
313
359
 
314
360
  For table patterns, add table selectors with `columns` config:
@@ -166,37 +166,47 @@ Resolver searches in this order:
166
166
 
167
167
  If no YAML key exists, the resolver infers from the Gherkin element type:
168
168
 
169
- | Gherkin | Inferred locator |
170
- |---|---|
171
- | `[X] button` | `getByRole('button', { name: 'X' })` |
172
- | `[X] link` | `getByRole('link', { name: 'X' })` |
173
- | `[X] heading` / `header` | `getByRole('heading', { name: 'X' })` |
174
- | `[X] checkbox` | `getByRole('checkbox', { name: 'X' })` |
175
- | `[X] radio` | `getByRole('radio', { name: 'X' })` |
176
- | `[X] field` | `getByPlaceholder('X')` |
177
- | `[X] text` / `message` / `label` | `getByText('X')` |
178
- | `[X] logo/image/icon` | `getByRole('img', { name: 'X' })` |
179
- | `[X] search` | `getByRole('searchbox', { name: 'X' })` |
180
- | `[X] option` | `getByRole('option', { name: 'X' })` |
181
- | `[X] slider` | `getByRole('slider', { name: 'X' })` |
182
- | `[X] toggle` | `getByRole('switch', { name: 'X' })` |
183
- | `[X] tab` | `getByRole('tab', { name: 'X' })` |
184
- | `[X] table` | `getByRole('table', { name: 'X' })` |
185
- | `[X] list` | `getByRole('list', { name: 'X' })` |
186
- | `[X] column` | `getByRole('columnheader', { name: 'X' })` |
187
- | `[X] dialog` / `modal` / `drawer` | `getByRole('dialog', { name: 'X' })` |
188
- | `[X] dropdown` / `select` | `getByRole('combobox', { name: 'X' })` |
189
- | `[X] menuitem` | `getByRole('menuitem', { name: 'X' })` |
190
- | `[X] progressbar` | `getByRole('progressbar', { name: 'X' })` |
191
- | `[X] section` | `getByRole('region', { name: 'X' })` |
192
- | `[X] card` | `getByRole('article', { name: 'X' })` |
193
- | `[X] item` | `getByRole('listitem', { name: 'X' })` |
194
- | `[X] cell` | `getByRole('cell', { name: 'X' })` |
195
- | `[X] spinner` | `getByRole('status', { name: 'X' })` |
196
- | `[X] breadcrumb` | `getByRole('navigation', { name: 'X' })` |
197
- | `[X] badge` / `tooltip` / `tag` | `getByText('X')` |
198
-
199
- **Only add a YAML entry when** the auto-inferred locator won't work (wrong name, need testid, need nth, etc.).
169
+ > ⚠️ **Auto-infer pitfall the #1 cause of selector failures in production.**
170
+ >
171
+ > `[X] button` auto-infers as `getByRole('button', { name: 'X' })`. This **only works** when the button's accessible name in the DOM is **exactly `X`** — same language, same text, same casing.
172
+ >
173
+ > The Gherkin `[Reference]` is your human label for the element, **not** the DOM name. If the app is in Vietnamese (or any language where the Gherkin label differs from DOM text), auto-infer will produce `No element found` at runtime. **Write an explicit YAML entry** with the real DOM name instead.
174
+ >
175
+ > **Decision rule**: auto-infer is safe ONLY when you have confirmed in the snapshot that the DOM element's accessible name / placeholder text is literally `X`. When in doubt → write YAML.
176
+
177
+ | Gherkin | Inferred locator | Safe when… |
178
+ |---|---|---|
179
+ | `[X] button` | `getByRole('button', { name: 'X' })` | Button's accessible name = X |
180
+ | `[X] link` | `getByRole('link', { name: 'X' })` | Link text = X |
181
+ | `[X] heading` / `header` | `getByRole('heading', { name: 'X' })` | Heading text = X |
182
+ | `[X] checkbox` | `getByRole('checkbox', { name: 'X' })` | Checkbox label = X |
183
+ | `[X] radio` | `getByRole('radio', { name: 'X' })` | Radio label = X |
184
+ | `[X] field` | `getByPlaceholder('X')` | Placeholder text = X AND field has a placeholder |
185
+ | `[X] text` / `message` / `label` | `getByText('X')` | Visible text = X (partial match) |
186
+ | `[X] logo/image/icon` | `getByRole('img', { name: 'X' })` | Image alt = X |
187
+ | `[X] search` | `getByRole('searchbox', { name: 'X' })` | Searchbox label = X |
188
+ | `[X] option` | `getByRole('option', { name: 'X' })` | Option text = X |
189
+ | `[X] slider` | `getByRole('slider', { name: 'X' })` | Slider label = X |
190
+ | `[X] toggle` | `getByRole('switch', { name: 'X' })` | Toggle label = X |
191
+ | `[X] tab` | `getByRole('tab', { name: 'X' })` | Tab text = X |
192
+ | `[X] table` | `getByRole('table', { name: 'X' })` | Table aria-label = X |
193
+ | `[X] list` | `getByRole('list', { name: 'X' })` | List aria-label = X |
194
+ | `[X] column` | `getByRole('columnheader', { name: 'X' })` | Column header text = X |
195
+ | `[X] dialog` / `modal` / `drawer` | `getByRole('dialog', { name: 'X' })` | Dialog aria-label/heading = X |
196
+ | `[X] dropdown` / `select` | `getByRole('combobox', { name: 'X' })` | Combobox label = X |
197
+ | `[X] menuitem` | `getByRole('menuitem', { name: 'X' })` | Menu item text = X |
198
+ | `[X] progressbar` | `getByRole('progressbar', { name: 'X' })` | Progressbar label = X |
199
+ | `[X] section` | `getByRole('region', { name: 'X' })` | Section aria-label = X |
200
+ | `[X] card` | `getByRole('article', { name: 'X' })` | Card aria-label = X |
201
+ | `[X] item` | `getByRole('listitem', { name: 'X' })` | List item text = X |
202
+ | `[X] cell` | `getByRole('cell', { name: 'X' })` | Cell text = X |
203
+ | `[X] spinner` | `getByRole('status', { name: 'X' })` | Spinner aria-label = X |
204
+ | `[X] breadcrumb` | `getByRole('navigation', { name: 'X' })` | Navigation aria-label = X |
205
+ | `[X] badge` / `tooltip` / `tag` | `getByText('X')` | Visible text = X |
206
+
207
+ **Special note on `[X] field`**: `getByPlaceholder('X')` only works when (1) the field has a placeholder attribute AND (2) the placeholder text equals X. For fields without placeholders (floating labels, aria-label), write explicit YAML: `type: label, value: "Actual label text"`.
208
+
209
+ **Only add a YAML entry when** auto-infer cannot work: DOM name differs from Gherkin label, need `testid`, need `nth`, need `exact: true`, or the field type requires explicit config.
200
210
 
201
211
  ### Types requiring YAML entry (no auto-infer)
202
212