@sun-asterisk/sungen 3.2.28 → 3.2.30

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 (486) hide show
  1. package/dist/capabilities/discover.d.ts +29 -0
  2. package/dist/capabilities/discover.d.ts.map +1 -1
  3. package/dist/capabilities/discover.js +144 -10
  4. package/dist/capabilities/discover.js.map +1 -1
  5. package/dist/capabilities/registry.d.ts +18 -0
  6. package/dist/capabilities/registry.d.ts.map +1 -1
  7. package/dist/capabilities/registry.js +25 -0
  8. package/dist/capabilities/registry.js.map +1 -1
  9. package/dist/cli/commands/audit.d.ts.map +1 -1
  10. package/dist/cli/commands/audit.js +9 -0
  11. package/dist/cli/commands/audit.js.map +1 -1
  12. package/dist/cli/commands/capability.js +1 -1
  13. package/dist/cli/commands/capability.js.map +1 -1
  14. package/dist/cli/commands/delivery.d.ts.map +1 -1
  15. package/dist/cli/commands/delivery.js +2 -1
  16. package/dist/cli/commands/delivery.js.map +1 -1
  17. package/dist/cli/commands/generate.d.ts.map +1 -1
  18. package/dist/cli/commands/generate.js +6 -2
  19. package/dist/cli/commands/generate.js.map +1 -1
  20. package/dist/cli/commands/inspect.js +1 -1
  21. package/dist/cli/commands/inspect.js.map +1 -1
  22. package/dist/cli/commands/results-merge.d.ts.map +1 -1
  23. package/dist/cli/commands/results-merge.js +9 -2
  24. package/dist/cli/commands/results-merge.js.map +1 -1
  25. package/dist/cli/commands/results-sanitize.d.ts +24 -0
  26. package/dist/cli/commands/results-sanitize.d.ts.map +1 -0
  27. package/dist/cli/commands/results-sanitize.js +126 -0
  28. package/dist/cli/commands/results-sanitize.js.map +1 -0
  29. package/dist/cli/commands/script-check.d.ts.map +1 -1
  30. package/dist/cli/commands/script-check.js +3 -1
  31. package/dist/cli/commands/script-check.js.map +1 -1
  32. package/dist/cli/commands/update.d.ts.map +1 -1
  33. package/dist/cli/commands/update.js +3 -0
  34. package/dist/cli/commands/update.js.map +1 -1
  35. package/dist/dashboard/templates/index.html +1 -1
  36. package/dist/exporters/api-testcase-formatter.d.ts +3 -6
  37. package/dist/exporters/api-testcase-formatter.d.ts.map +1 -1
  38. package/dist/exporters/api-testcase-formatter.js +7 -10
  39. package/dist/exporters/api-testcase-formatter.js.map +1 -1
  40. package/dist/exporters/feature-parser.d.ts +1 -1
  41. package/dist/exporters/feature-parser.js +1 -1
  42. package/dist/exporters/matrix/build.d.ts.map +1 -1
  43. package/dist/exporters/matrix/build.js +18 -3
  44. package/dist/exporters/matrix/build.js.map +1 -1
  45. package/dist/exporters/matrix/item-labels.d.ts +35 -0
  46. package/dist/exporters/matrix/item-labels.d.ts.map +1 -0
  47. package/dist/exporters/matrix/item-labels.js +90 -0
  48. package/dist/exporters/matrix/item-labels.js.map +1 -0
  49. package/dist/exporters/matrix/render-coverage-sheet.d.ts +14 -0
  50. package/dist/exporters/matrix/render-coverage-sheet.d.ts.map +1 -0
  51. package/dist/exporters/matrix/render-coverage-sheet.js +162 -0
  52. package/dist/exporters/matrix/render-coverage-sheet.js.map +1 -0
  53. package/dist/exporters/matrix/render-csv.d.ts.map +1 -1
  54. package/dist/exporters/matrix/render-csv.js +3 -1
  55. package/dist/exporters/matrix/render-csv.js.map +1 -1
  56. package/dist/exporters/matrix/render-overview-sheet.d.ts +20 -0
  57. package/dist/exporters/matrix/render-overview-sheet.d.ts.map +1 -0
  58. package/dist/exporters/matrix/render-overview-sheet.js +32 -0
  59. package/dist/exporters/matrix/render-overview-sheet.js.map +1 -0
  60. package/dist/exporters/matrix/render-testcase-sheet.d.ts +30 -0
  61. package/dist/exporters/matrix/render-testcase-sheet.d.ts.map +1 -0
  62. package/dist/exporters/matrix/render-testcase-sheet.js +156 -0
  63. package/dist/exporters/matrix/render-testcase-sheet.js.map +1 -0
  64. package/dist/exporters/matrix/render-xlsx.d.ts +41 -31
  65. package/dist/exporters/matrix/render-xlsx.d.ts.map +1 -1
  66. package/dist/exporters/matrix/render-xlsx.js +72 -425
  67. package/dist/exporters/matrix/render-xlsx.js.map +1 -1
  68. package/dist/exporters/matrix/result-totals.d.ts +23 -0
  69. package/dist/exporters/matrix/result-totals.d.ts.map +1 -0
  70. package/dist/exporters/matrix/result-totals.js +21 -0
  71. package/dist/exporters/matrix/result-totals.js.map +1 -0
  72. package/dist/exporters/matrix/testcase-summary-band.d.ts +30 -0
  73. package/dist/exporters/matrix/testcase-summary-band.d.ts.map +1 -0
  74. package/dist/exporters/matrix/testcase-summary-band.js +71 -0
  75. package/dist/exporters/matrix/testcase-summary-band.js.map +1 -0
  76. package/dist/exporters/matrix/wording.d.ts.map +1 -1
  77. package/dist/exporters/matrix/wording.js +13 -0
  78. package/dist/exporters/matrix/wording.js.map +1 -1
  79. package/dist/exporters/matrix/xlsx-cells.d.ts +38 -0
  80. package/dist/exporters/matrix/xlsx-cells.d.ts.map +1 -0
  81. package/dist/exporters/matrix/xlsx-cells.js +52 -0
  82. package/dist/exporters/matrix/xlsx-cells.js.map +1 -0
  83. package/dist/exporters/qa-env-secret-denylist.js +2 -2
  84. package/dist/exporters/qa-env-secret-denylist.js.map +1 -1
  85. package/dist/exporters/report-path-sanitizer.d.ts +38 -0
  86. package/dist/exporters/report-path-sanitizer.d.ts.map +1 -0
  87. package/dist/exporters/report-path-sanitizer.js +137 -0
  88. package/dist/exporters/report-path-sanitizer.js.map +1 -0
  89. package/dist/exporters/result-variants.d.ts.map +1 -1
  90. package/dist/exporters/result-variants.js +2 -1
  91. package/dist/exporters/result-variants.js.map +1 -1
  92. package/dist/exporters/sensitive-key.d.ts +31 -0
  93. package/dist/exporters/sensitive-key.d.ts.map +1 -0
  94. package/dist/exporters/sensitive-key.js +50 -0
  95. package/dist/exporters/sensitive-key.js.map +1 -0
  96. package/dist/exporters/test-data-resolver.d.ts +4 -1
  97. package/dist/exporters/test-data-resolver.d.ts.map +1 -1
  98. package/dist/exporters/test-data-resolver.js +12 -2
  99. package/dist/exporters/test-data-resolver.js.map +1 -1
  100. package/dist/exporters/xlsx-report-builder.d.ts +12 -1
  101. package/dist/exporters/xlsx-report-builder.d.ts.map +1 -1
  102. package/dist/exporters/xlsx-report-builder.js +10 -2
  103. package/dist/exporters/xlsx-report-builder.js.map +1 -1
  104. package/dist/generators/gherkin-parser/index.d.ts +10 -0
  105. package/dist/generators/gherkin-parser/index.d.ts.map +1 -1
  106. package/dist/generators/gherkin-parser/index.js +20 -12
  107. package/dist/generators/gherkin-parser/index.js.map +1 -1
  108. package/dist/generators/gherkin-parser/parent-scope-clause.d.ts +54 -0
  109. package/dist/generators/gherkin-parser/parent-scope-clause.d.ts.map +1 -0
  110. package/dist/generators/gherkin-parser/parent-scope-clause.js +109 -0
  111. package/dist/generators/gherkin-parser/parent-scope-clause.js.map +1 -0
  112. package/dist/generators/test-generator/adapters/adapter-interface.d.ts +23 -18
  113. package/dist/generators/test-generator/adapters/adapter-interface.d.ts.map +1 -1
  114. package/dist/generators/test-generator/adapters/appium/appium-adapter.d.ts +4 -19
  115. package/dist/generators/test-generator/adapters/appium/appium-adapter.d.ts.map +1 -1
  116. package/dist/generators/test-generator/adapters/appium/appium-adapter.js.map +1 -1
  117. package/dist/generators/test-generator/adapters/appium/os-support.d.ts +53 -0
  118. package/dist/generators/test-generator/adapters/appium/os-support.d.ts.map +1 -0
  119. package/dist/generators/test-generator/adapters/appium/os-support.js +200 -0
  120. package/dist/generators/test-generator/adapters/appium/os-support.js.map +1 -0
  121. package/dist/generators/test-generator/adapters/appium/templates/after-all.hbs +18 -0
  122. package/dist/generators/test-generator/adapters/appium/templates/after-each.hbs +18 -0
  123. package/dist/generators/test-generator/adapters/appium/templates/before-all.hbs +18 -0
  124. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/alert-fill-action.hbs +9 -2
  125. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/capture-variable.hbs +24 -1
  126. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/click-at-position-action.hbs +1 -0
  127. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/click-element-with-text.hbs +1 -1
  128. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/double-click-action.hbs +7 -0
  129. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/frame-enter-action.hbs +3 -6
  130. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/hover-action.hbs +6 -2
  131. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/hover-element-with-text.hbs +4 -3
  132. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/table-paginate-action.hbs +3 -0
  133. package/dist/generators/test-generator/adapters/appium/templates/steps/actions/unknown-element-action.hbs +9 -0
  134. package/dist/generators/test-generator/adapters/appium/templates/steps/assertions/have-value-assertion.hbs +34 -1
  135. package/dist/generators/test-generator/adapters/appium/templates/steps/assertions/label-value-assertion.hbs +14 -6
  136. package/dist/generators/test-generator/adapters/appium/templates/steps/assertions/visible-assertion.hbs +1 -1
  137. package/dist/generators/test-generator/adapters/appium/templates/steps/gestures/go-back-action.hbs +21 -0
  138. package/dist/generators/test-generator/adapters/appium/templates/steps/gestures/long-press-action.hbs +4 -0
  139. package/dist/generators/test-generator/adapters/appium/templates/steps/gestures/pinch-zoom-action.hbs +4 -0
  140. package/dist/generators/test-generator/adapters/appium/templates/steps/gestures/set-geolocation-action.hbs +16 -0
  141. package/dist/generators/test-generator/adapters/appium/templates/steps/partials/locator.hbs +9 -1
  142. package/dist/generators/test-generator/adapters/appium/templates/test-file.hbs +62 -23
  143. package/dist/generators/test-generator/adapters/index.d.ts +1 -1
  144. package/dist/generators/test-generator/adapters/index.d.ts.map +1 -1
  145. package/dist/generators/test-generator/adapters/playwright/playwright-adapter.d.ts +4 -19
  146. package/dist/generators/test-generator/adapters/playwright/playwright-adapter.d.ts.map +1 -1
  147. package/dist/generators/test-generator/adapters/playwright/playwright-adapter.js.map +1 -1
  148. package/dist/generators/test-generator/adapters/playwright/templates/after-all.hbs +19 -1
  149. package/dist/generators/test-generator/adapters/playwright/templates/after-each.hbs +18 -0
  150. package/dist/generators/test-generator/adapters/playwright/templates/before-all.hbs +19 -1
  151. package/dist/generators/test-generator/adapters/playwright/templates/imports.hbs +3 -0
  152. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/check-action.hbs +6 -1
  153. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/click-at-position-action.hbs +23 -0
  154. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/expand-action.hbs +8 -8
  155. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/fill-editor-action.hbs +7 -2
  156. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/table-action-in-row-nth.hbs +7 -2
  157. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/table-action-in-row.hbs +7 -2
  158. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/table-paginate-action.hbs +5 -0
  159. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/uncheck-action.hbs +3 -1
  160. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/unknown-element-action.hbs +1 -1
  161. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/wait-for-page.hbs +18 -1
  162. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +32 -4
  163. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-element.hbs +5 -2
  164. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/checked-assertion.hbs +5 -1
  165. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/column-cell-assertion.hbs +13 -2
  166. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/contain-text-assertion.hbs +1 -1
  167. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/disabled-with-role-variable-assertion.hbs +2 -2
  168. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/disabled-with-variable-assertion.hbs +1 -1
  169. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/have-text-assertion.hbs +1 -1
  170. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/hidden-with-role-variable-assertion.hbs +2 -2
  171. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/hidden-with-variable-assertion.hbs +1 -1
  172. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/not-checked-assertion.hbs +2 -1
  173. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/selected-assertion.hbs +21 -3
  174. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/state-with-filter-assertion.hbs +20 -2
  175. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/table-empty.hbs +4 -1
  176. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/table-match-data.hbs +4 -1
  177. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/table-row-count.hbs +4 -1
  178. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/table-row-exists.hbs +12 -4
  179. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/table-row-not-exists.hbs +14 -2
  180. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/visible-with-role-variable-assertion.hbs +3 -3
  181. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/visible-with-value-assertion.hbs +1 -1
  182. package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/visible-with-variable-assertion.hbs +1 -1
  183. package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/checked-opts.hbs +8 -0
  184. package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/locator-base.hbs +8 -8
  185. package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/locator-nth.hbs +1 -1
  186. package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/locator-strategies/id.hbs +1 -1
  187. package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/locator-strategies/testid.hbs +1 -1
  188. package/dist/generators/test-generator/adapters/playwright/templates/steps/partials/locator.hbs +8 -8
  189. package/dist/generators/test-generator/adapters/playwright/templates/test-file.hbs +10 -8
  190. package/dist/generators/test-generator/code-generator.d.ts +37 -0
  191. package/dist/generators/test-generator/code-generator.d.ts.map +1 -1
  192. package/dist/generators/test-generator/code-generator.js +165 -40
  193. package/dist/generators/test-generator/code-generator.js.map +1 -1
  194. package/dist/generators/test-generator/diagnostics.d.ts +116 -6
  195. package/dist/generators/test-generator/diagnostics.d.ts.map +1 -1
  196. package/dist/generators/test-generator/diagnostics.js +115 -5
  197. package/dist/generators/test-generator/diagnostics.js.map +1 -1
  198. package/dist/generators/test-generator/patterns/index.d.ts +57 -11
  199. package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
  200. package/dist/generators/test-generator/patterns/index.js +163 -21
  201. package/dist/generators/test-generator/patterns/index.js.map +1 -1
  202. package/dist/generators/test-generator/patterns/types.d.ts +8 -0
  203. package/dist/generators/test-generator/patterns/types.d.ts.map +1 -1
  204. package/dist/generators/test-generator/patterns/with-parent-scope.d.ts +18 -0
  205. package/dist/generators/test-generator/patterns/with-parent-scope.d.ts.map +1 -0
  206. package/dist/generators/test-generator/patterns/with-parent-scope.js +40 -0
  207. package/dist/generators/test-generator/patterns/with-parent-scope.js.map +1 -0
  208. package/dist/generators/test-generator/step-mapper.d.ts +103 -10
  209. package/dist/generators/test-generator/step-mapper.d.ts.map +1 -1
  210. package/dist/generators/test-generator/step-mapper.js +266 -45
  211. package/dist/generators/test-generator/step-mapper.js.map +1 -1
  212. package/dist/generators/test-generator/template-engine.d.ts +4 -19
  213. package/dist/generators/test-generator/template-engine.d.ts.map +1 -1
  214. package/dist/generators/test-generator/template-engine.js +17 -12
  215. package/dist/generators/test-generator/template-engine.js.map +1 -1
  216. package/dist/generators/test-generator/utils/data-resolver.d.ts +7 -0
  217. package/dist/generators/test-generator/utils/data-resolver.d.ts.map +1 -1
  218. package/dist/generators/test-generator/utils/data-resolver.js +19 -2
  219. package/dist/generators/test-generator/utils/data-resolver.js.map +1 -1
  220. package/dist/generators/test-generator/utils/dialog-scope-identity.d.ts +41 -0
  221. package/dist/generators/test-generator/utils/dialog-scope-identity.d.ts.map +1 -0
  222. package/dist/generators/test-generator/utils/dialog-scope-identity.js +61 -0
  223. package/dist/generators/test-generator/utils/dialog-scope-identity.js.map +1 -0
  224. package/dist/generators/test-generator/utils/escape-js-string.d.ts +17 -0
  225. package/dist/generators/test-generator/utils/escape-js-string.d.ts.map +1 -0
  226. package/dist/generators/test-generator/utils/escape-js-string.js +29 -0
  227. package/dist/generators/test-generator/utils/escape-js-string.js.map +1 -0
  228. package/dist/generators/test-generator/utils/nearest-match.d.ts +24 -0
  229. package/dist/generators/test-generator/utils/nearest-match.d.ts.map +1 -0
  230. package/dist/generators/test-generator/utils/nearest-match.js +56 -0
  231. package/dist/generators/test-generator/utils/nearest-match.js.map +1 -0
  232. package/dist/generators/test-generator/utils/selector-entry-fields.d.ts +58 -0
  233. package/dist/generators/test-generator/utils/selector-entry-fields.d.ts.map +1 -0
  234. package/dist/generators/test-generator/utils/selector-entry-fields.js +119 -0
  235. package/dist/generators/test-generator/utils/selector-entry-fields.js.map +1 -0
  236. package/dist/generators/test-generator/utils/selector-entry-walk.d.ts +25 -0
  237. package/dist/generators/test-generator/utils/selector-entry-walk.d.ts.map +1 -0
  238. package/dist/generators/test-generator/utils/selector-entry-walk.js +54 -0
  239. package/dist/generators/test-generator/utils/selector-entry-walk.js.map +1 -0
  240. package/dist/generators/test-generator/utils/selector-nth-validation.d.ts +59 -0
  241. package/dist/generators/test-generator/utils/selector-nth-validation.d.ts.map +1 -0
  242. package/dist/generators/test-generator/utils/selector-nth-validation.js +91 -0
  243. package/dist/generators/test-generator/utils/selector-nth-validation.js.map +1 -0
  244. package/dist/generators/test-generator/utils/selector-resolver.d.ts +53 -2
  245. package/dist/generators/test-generator/utils/selector-resolver.d.ts.map +1 -1
  246. package/dist/generators/test-generator/utils/selector-resolver.js +273 -27
  247. package/dist/generators/test-generator/utils/selector-resolver.js.map +1 -1
  248. package/dist/generators/test-generator/utils/selector-type-validation.d.ts +51 -0
  249. package/dist/generators/test-generator/utils/selector-type-validation.d.ts.map +1 -0
  250. package/dist/generators/test-generator/utils/selector-type-validation.js +77 -0
  251. package/dist/generators/test-generator/utils/selector-type-validation.js.map +1 -0
  252. package/dist/harness/audit.d.ts +3 -1
  253. package/dist/harness/audit.d.ts.map +1 -1
  254. package/dist/harness/audit.js +51 -28
  255. package/dist/harness/audit.js.map +1 -1
  256. package/dist/harness/capability-plan.d.ts +4 -0
  257. package/dist/harness/capability-plan.d.ts.map +1 -1
  258. package/dist/harness/capability-plan.js +32 -2
  259. package/dist/harness/capability-plan.js.map +1 -1
  260. package/dist/harness/catalog/drivers.yaml +1 -1
  261. package/dist/harness/catalog/universal-viewpoints.yaml +145 -0
  262. package/dist/harness/data-driven-lint.d.ts.map +1 -1
  263. package/dist/harness/data-driven-lint.js +217 -33
  264. package/dist/harness/data-driven-lint.js.map +1 -1
  265. package/dist/harness/parse.d.ts +6 -0
  266. package/dist/harness/parse.d.ts.map +1 -1
  267. package/dist/harness/parse.js +1 -1
  268. package/dist/harness/parse.js.map +1 -1
  269. package/dist/harness/repair.d.ts.map +1 -1
  270. package/dist/harness/repair.js +8 -1
  271. package/dist/harness/repair.js.map +1 -1
  272. package/dist/harness/script-check.d.ts +2 -2
  273. package/dist/harness/script-check.d.ts.map +1 -1
  274. package/dist/harness/script-check.js +186 -25
  275. package/dist/harness/script-check.js.map +1 -1
  276. package/dist/harness/sensors.d.ts +48 -0
  277. package/dist/harness/sensors.d.ts.map +1 -1
  278. package/dist/harness/sensors.js +26 -1
  279. package/dist/harness/sensors.js.map +1 -1
  280. package/dist/harness/viewpoint-ledger.d.ts +10 -0
  281. package/dist/harness/viewpoint-ledger.d.ts.map +1 -1
  282. package/dist/harness/viewpoint-ledger.js +23 -2
  283. package/dist/harness/viewpoint-ledger.js.map +1 -1
  284. package/dist/index.d.ts +2 -0
  285. package/dist/index.d.ts.map +1 -1
  286. package/dist/index.js +10 -1
  287. package/dist/index.js.map +1 -1
  288. package/dist/orchestrator/project-initializer.d.ts +6 -0
  289. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  290. package/dist/orchestrator/project-initializer.js +16 -0
  291. package/dist/orchestrator/project-initializer.js.map +1 -1
  292. package/dist/orchestrator/report-sanitize-reporter-install.d.ts +24 -0
  293. package/dist/orchestrator/report-sanitize-reporter-install.d.ts.map +1 -0
  294. package/dist/orchestrator/report-sanitize-reporter-install.js +161 -0
  295. package/dist/orchestrator/report-sanitize-reporter-install.js.map +1 -0
  296. package/dist/orchestrator/templates/ai-src/commands/delivery.md +4 -3
  297. package/dist/orchestrator/templates/ai-src/commands/run-test.md +9 -1
  298. package/dist/orchestrator/templates/ai-src/skills/sungen-api-coverage-model/SKILL.md +10 -0
  299. package/dist/orchestrator/templates/ai-src/skills/sungen-delivery/SKILL.md +14 -5
  300. package/dist/orchestrator/templates/ai-src/skills/sungen-error-mapping/SKILL.md +62 -3
  301. package/dist/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +126 -11
  302. package/dist/orchestrator/templates/ai-src/skills/sungen-mobile-gestures/SKILL.md +16 -1
  303. package/dist/orchestrator/templates/ai-src/skills/sungen-selector-fix/SKILL.md +12 -0
  304. package/dist/orchestrator/templates/ai-src/skills/sungen-selector-keys/SKILL.md +19 -5
  305. package/dist/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +88 -2
  306. package/dist/orchestrator/templates/ai-src/skills/sungen-tc-review/SKILL.md +62 -5
  307. package/dist/orchestrator/templates/ai-src/skills/sungen-test-design-techniques/SKILL.md +13 -0
  308. package/dist/orchestrator/templates/ai-src/skills/sungen-viewpoint/SKILL.md +59 -10
  309. package/dist/orchestrator/templates/ai-src/skills/sungen-viewpoint/group-f-mobile-native.md +419 -0
  310. package/dist/orchestrator/templates/playwright.config.ts +7 -0
  311. package/dist/orchestrator/templates/readme.md +1 -1
  312. package/dist/orchestrator/templates/specs-checked-state.d.ts +83 -0
  313. package/dist/orchestrator/templates/specs-checked-state.d.ts.map +1 -0
  314. package/dist/orchestrator/templates/specs-checked-state.js +261 -0
  315. package/dist/orchestrator/templates/specs-checked-state.js.map +1 -0
  316. package/dist/orchestrator/templates/specs-checked-state.ts +324 -0
  317. package/dist/orchestrator/templates/specs-pw-shape-reporter.ts +0 -0
  318. package/dist/orchestrator/templates/specs-report-path-sanitize-reporter.d.ts +36 -0
  319. package/dist/orchestrator/templates/specs-report-path-sanitize-reporter.d.ts.map +1 -0
  320. package/dist/orchestrator/templates/specs-report-path-sanitize-reporter.js +155 -0
  321. package/dist/orchestrator/templates/specs-report-path-sanitize-reporter.js.map +1 -0
  322. package/dist/orchestrator/templates/specs-report-path-sanitize-reporter.ts +142 -0
  323. package/dist/orchestrator/templates/specs-url-assert.d.ts +50 -25
  324. package/dist/orchestrator/templates/specs-url-assert.d.ts.map +1 -1
  325. package/dist/orchestrator/templates/specs-url-assert.js +65 -24
  326. package/dist/orchestrator/templates/specs-url-assert.js.map +1 -1
  327. package/dist/orchestrator/templates/specs-url-assert.ts +101 -28
  328. package/dist/orchestrator/templates/wdio.conf.ts +105 -1
  329. package/dist/utils/selector-types.d.ts +43 -1
  330. package/dist/utils/selector-types.d.ts.map +1 -1
  331. package/dist/utils/selector-types.js +51 -7
  332. package/dist/utils/selector-types.js.map +1 -1
  333. package/package.json +3 -3
  334. package/src/capabilities/discover.ts +146 -10
  335. package/src/capabilities/registry.ts +30 -0
  336. package/src/cli/commands/audit.ts +9 -0
  337. package/src/cli/commands/capability.ts +1 -1
  338. package/src/cli/commands/delivery.ts +2 -1
  339. package/src/cli/commands/generate.ts +5 -2
  340. package/src/cli/commands/inspect.ts +1 -1
  341. package/src/cli/commands/results-merge.ts +9 -2
  342. package/src/cli/commands/results-sanitize.ts +98 -0
  343. package/src/cli/commands/script-check.ts +3 -1
  344. package/src/cli/commands/update.ts +3 -0
  345. package/src/dashboard/templates/index.html +1 -1
  346. package/src/exporters/api-testcase-formatter.ts +5 -7
  347. package/src/exporters/feature-parser.ts +1 -1
  348. package/src/exporters/matrix/build.ts +17 -3
  349. package/src/exporters/matrix/item-labels.ts +78 -0
  350. package/src/exporters/matrix/render-coverage-sheet.ts +170 -0
  351. package/src/exporters/matrix/render-csv.ts +3 -1
  352. package/src/exporters/matrix/render-overview-sheet.ts +51 -0
  353. package/src/exporters/matrix/render-testcase-sheet.ts +178 -0
  354. package/src/exporters/matrix/render-xlsx.ts +67 -448
  355. package/src/exporters/matrix/result-totals.ts +37 -0
  356. package/src/exporters/matrix/testcase-summary-band.ts +74 -0
  357. package/src/exporters/matrix/wording.ts +13 -0
  358. package/src/exporters/matrix/xlsx-cells.ts +56 -0
  359. package/src/exporters/qa-env-secret-denylist.ts +1 -1
  360. package/src/exporters/report-path-sanitizer.ts +144 -0
  361. package/src/exporters/result-variants.ts +2 -1
  362. package/src/exporters/sensitive-key.ts +48 -0
  363. package/src/exporters/test-data-resolver.ts +12 -2
  364. package/src/exporters/xlsx-report-builder.ts +16 -2
  365. package/src/generators/gherkin-parser/index.ts +22 -11
  366. package/src/generators/gherkin-parser/parent-scope-clause.ts +130 -0
  367. package/src/generators/test-generator/adapters/adapter-interface.ts +25 -3
  368. package/src/generators/test-generator/adapters/appium/appium-adapter.ts +4 -4
  369. package/src/generators/test-generator/adapters/appium/os-support.ts +176 -0
  370. package/src/generators/test-generator/adapters/appium/templates/after-all.hbs +18 -0
  371. package/src/generators/test-generator/adapters/appium/templates/after-each.hbs +18 -0
  372. package/src/generators/test-generator/adapters/appium/templates/before-all.hbs +18 -0
  373. package/src/generators/test-generator/adapters/appium/templates/steps/actions/alert-fill-action.hbs +9 -2
  374. package/src/generators/test-generator/adapters/appium/templates/steps/actions/capture-variable.hbs +24 -1
  375. package/src/generators/test-generator/adapters/appium/templates/steps/actions/click-at-position-action.hbs +1 -0
  376. package/src/generators/test-generator/adapters/appium/templates/steps/actions/click-element-with-text.hbs +1 -1
  377. package/src/generators/test-generator/adapters/appium/templates/steps/actions/double-click-action.hbs +7 -0
  378. package/src/generators/test-generator/adapters/appium/templates/steps/actions/frame-enter-action.hbs +3 -6
  379. package/src/generators/test-generator/adapters/appium/templates/steps/actions/hover-action.hbs +6 -2
  380. package/src/generators/test-generator/adapters/appium/templates/steps/actions/hover-element-with-text.hbs +4 -3
  381. package/src/generators/test-generator/adapters/appium/templates/steps/actions/table-paginate-action.hbs +3 -0
  382. package/src/generators/test-generator/adapters/appium/templates/steps/actions/unknown-element-action.hbs +9 -0
  383. package/src/generators/test-generator/adapters/appium/templates/steps/assertions/have-value-assertion.hbs +34 -1
  384. package/src/generators/test-generator/adapters/appium/templates/steps/assertions/label-value-assertion.hbs +14 -6
  385. package/src/generators/test-generator/adapters/appium/templates/steps/assertions/visible-assertion.hbs +1 -1
  386. package/src/generators/test-generator/adapters/appium/templates/steps/gestures/go-back-action.hbs +21 -0
  387. package/src/generators/test-generator/adapters/appium/templates/steps/gestures/long-press-action.hbs +4 -0
  388. package/src/generators/test-generator/adapters/appium/templates/steps/gestures/pinch-zoom-action.hbs +4 -0
  389. package/src/generators/test-generator/adapters/appium/templates/steps/gestures/set-geolocation-action.hbs +16 -0
  390. package/src/generators/test-generator/adapters/appium/templates/steps/partials/locator.hbs +9 -1
  391. package/src/generators/test-generator/adapters/appium/templates/test-file.hbs +62 -23
  392. package/src/generators/test-generator/adapters/index.ts +1 -1
  393. package/src/generators/test-generator/adapters/playwright/playwright-adapter.ts +4 -4
  394. package/src/generators/test-generator/adapters/playwright/templates/after-all.hbs +19 -1
  395. package/src/generators/test-generator/adapters/playwright/templates/after-each.hbs +18 -0
  396. package/src/generators/test-generator/adapters/playwright/templates/before-all.hbs +19 -1
  397. package/src/generators/test-generator/adapters/playwright/templates/imports.hbs +3 -0
  398. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/check-action.hbs +6 -1
  399. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/click-at-position-action.hbs +23 -0
  400. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/expand-action.hbs +8 -8
  401. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/fill-editor-action.hbs +7 -2
  402. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/table-action-in-row-nth.hbs +7 -2
  403. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/table-action-in-row.hbs +7 -2
  404. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/table-paginate-action.hbs +5 -0
  405. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/uncheck-action.hbs +3 -1
  406. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/unknown-element-action.hbs +1 -1
  407. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/wait-for-page.hbs +18 -1
  408. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-assertion.hbs +32 -4
  409. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/all-contain-element.hbs +5 -2
  410. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/checked-assertion.hbs +5 -1
  411. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/column-cell-assertion.hbs +13 -2
  412. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/contain-text-assertion.hbs +1 -1
  413. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/disabled-with-role-variable-assertion.hbs +2 -2
  414. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/disabled-with-variable-assertion.hbs +1 -1
  415. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/have-text-assertion.hbs +1 -1
  416. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/hidden-with-role-variable-assertion.hbs +2 -2
  417. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/hidden-with-variable-assertion.hbs +1 -1
  418. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/not-checked-assertion.hbs +2 -1
  419. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/selected-assertion.hbs +21 -3
  420. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/state-with-filter-assertion.hbs +20 -2
  421. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/table-empty.hbs +4 -1
  422. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/table-match-data.hbs +4 -1
  423. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/table-row-count.hbs +4 -1
  424. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/table-row-exists.hbs +12 -4
  425. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/table-row-not-exists.hbs +14 -2
  426. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/visible-with-role-variable-assertion.hbs +3 -3
  427. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/visible-with-value-assertion.hbs +1 -1
  428. package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/visible-with-variable-assertion.hbs +1 -1
  429. package/src/generators/test-generator/adapters/playwright/templates/steps/partials/checked-opts.hbs +8 -0
  430. package/src/generators/test-generator/adapters/playwright/templates/steps/partials/locator-base.hbs +8 -8
  431. package/src/generators/test-generator/adapters/playwright/templates/steps/partials/locator-nth.hbs +1 -1
  432. package/src/generators/test-generator/adapters/playwright/templates/steps/partials/locator-strategies/id.hbs +1 -1
  433. package/src/generators/test-generator/adapters/playwright/templates/steps/partials/locator-strategies/testid.hbs +1 -1
  434. package/src/generators/test-generator/adapters/playwright/templates/steps/partials/locator.hbs +8 -8
  435. package/src/generators/test-generator/adapters/playwright/templates/test-file.hbs +10 -8
  436. package/src/generators/test-generator/code-generator.ts +181 -46
  437. package/src/generators/test-generator/diagnostics.ts +117 -6
  438. package/src/generators/test-generator/patterns/index.ts +175 -24
  439. package/src/generators/test-generator/patterns/types.ts +8 -0
  440. package/src/generators/test-generator/patterns/with-parent-scope.ts +41 -0
  441. package/src/generators/test-generator/step-mapper.ts +277 -43
  442. package/src/generators/test-generator/template-engine.ts +21 -21
  443. package/src/generators/test-generator/utils/data-resolver.ts +23 -2
  444. package/src/generators/test-generator/utils/dialog-scope-identity.ts +71 -0
  445. package/src/generators/test-generator/utils/escape-js-string.ts +24 -0
  446. package/src/generators/test-generator/utils/nearest-match.ts +55 -0
  447. package/src/generators/test-generator/utils/selector-entry-fields.ts +131 -0
  448. package/src/generators/test-generator/utils/selector-entry-walk.ts +58 -0
  449. package/src/generators/test-generator/utils/selector-nth-validation.ts +99 -0
  450. package/src/generators/test-generator/utils/selector-resolver.ts +333 -28
  451. package/src/generators/test-generator/utils/selector-type-validation.ts +87 -0
  452. package/src/harness/audit.ts +55 -30
  453. package/src/harness/capability-plan.ts +33 -1
  454. package/src/harness/catalog/drivers.yaml +1 -1
  455. package/src/harness/catalog/universal-viewpoints.yaml +145 -0
  456. package/src/harness/data-driven-lint.ts +192 -32
  457. package/src/harness/parse.ts +7 -1
  458. package/src/harness/repair.ts +8 -1
  459. package/src/harness/script-check.ts +186 -21
  460. package/src/harness/sensors.ts +75 -1
  461. package/src/harness/viewpoint-ledger.ts +26 -5
  462. package/src/index.ts +7 -0
  463. package/src/orchestrator/project-initializer.ts +17 -0
  464. package/src/orchestrator/report-sanitize-reporter-install.ts +109 -0
  465. package/src/orchestrator/templates/ai-src/commands/delivery.md +4 -3
  466. package/src/orchestrator/templates/ai-src/commands/run-test.md +9 -1
  467. package/src/orchestrator/templates/ai-src/skills/sungen-api-coverage-model/SKILL.md +10 -0
  468. package/src/orchestrator/templates/ai-src/skills/sungen-delivery/SKILL.md +14 -5
  469. package/src/orchestrator/templates/ai-src/skills/sungen-error-mapping/SKILL.md +62 -3
  470. package/src/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +126 -11
  471. package/src/orchestrator/templates/ai-src/skills/sungen-mobile-gestures/SKILL.md +16 -1
  472. package/src/orchestrator/templates/ai-src/skills/sungen-selector-fix/SKILL.md +12 -0
  473. package/src/orchestrator/templates/ai-src/skills/sungen-selector-keys/SKILL.md +19 -5
  474. package/src/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +88 -2
  475. package/src/orchestrator/templates/ai-src/skills/sungen-tc-review/SKILL.md +62 -5
  476. package/src/orchestrator/templates/ai-src/skills/sungen-test-design-techniques/SKILL.md +13 -0
  477. package/src/orchestrator/templates/ai-src/skills/sungen-viewpoint/SKILL.md +59 -10
  478. package/src/orchestrator/templates/ai-src/skills/sungen-viewpoint/group-f-mobile-native.md +419 -0
  479. package/src/orchestrator/templates/playwright.config.ts +7 -0
  480. package/src/orchestrator/templates/readme.md +1 -1
  481. package/src/orchestrator/templates/specs-checked-state.ts +324 -0
  482. package/src/orchestrator/templates/specs-pw-shape-reporter.ts +0 -0
  483. package/src/orchestrator/templates/specs-report-path-sanitize-reporter.ts +142 -0
  484. package/src/orchestrator/templates/specs-url-assert.ts +101 -28
  485. package/src/orchestrator/templates/wdio.conf.ts +105 -1
  486. package/src/utils/selector-types.ts +54 -5
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Identity of a locator as the `locator` partial actually renders it — issue #692.
3
+ *
4
+ * `Given User is on [X] dialog` records a scope root, and the `pageRoot` helper prefixes every
5
+ * locator rendered afterwards with it. That is the whole point of the scope — except when a later
6
+ * step names the SAME element as the scope root, where the prefix nests the dialog inside itself:
7
+ *
8
+ * page.getByRole('dialog', { name: 'Confirm' }).getByRole('dialog', { name: 'Confirm' })
9
+ *
10
+ * A dialog cannot contain itself, so that query can never resolve. It compiles clean, emits no
11
+ * diagnostic, and fails as a plain timeout — which reads as "the dialog never opened" rather than
12
+ * "the query is impossible". Re-asserting the dialog you are scoped inside is the natural thing to
13
+ * write straight after the `Given`, so the scope root is made idempotent instead.
14
+ *
15
+ * The guard needs exactly one question answered: does this element render to the same locator as
16
+ * the active scope root? So the key carries the fields the partial reads FOR THAT STRATEGY and
17
+ * nothing else — two entries share a key iff they render the same expression. Comparing role+name
18
+ * alone (the shape the issue first suggested) would miss `type: locator` and `type: testid`
19
+ * dialogs, which self-nest just the same.
20
+ *
21
+ * Deliberately says nothing about a `with {{v}}` filtered root: that root is
22
+ * `getByRole('dialog').filter({ hasText })`, which is not expressible as the element's own
23
+ * locator, so an identity match there would be meaningless. The caller skips the guard in that
24
+ * case — see the `dialogFilterText` check in `pageRoot`.
25
+ */
26
+
27
+ /** The subset of a resolved selector that the `locator` partial reads. */
28
+ export interface LocatorIdentityFields {
29
+ strategy?: string;
30
+ value?: string;
31
+ role?: string;
32
+ name?: string;
33
+ exact?: boolean;
34
+ nth?: number;
35
+ scope?: string;
36
+ }
37
+
38
+ /**
39
+ * A stable key for the locator `fields` renders to, or undefined when there is no strategy to
40
+ * render (nothing to compare, so no guard).
41
+ */
42
+ export function locatorIdentityKey(fields: LocatorIdentityFields | undefined): string | undefined {
43
+ if (!fields || !fields.strategy) return undefined;
44
+
45
+ // `scope: dialog` is the dialog-rooting sentinel rather than part of the element's own
46
+ // identity — renderDialogRoot strips it before rendering the root for the same reason.
47
+ const scope = fields.scope && fields.scope !== 'dialog' ? fields.scope : '';
48
+ const nth = typeof fields.nth === 'number' && fields.nth >= 0 ? String(fields.nth) : '';
49
+ const exact = fields.exact ? '1' : '';
50
+
51
+ const parts: string[] = [];
52
+ switch (fields.strategy) {
53
+ case 'role':
54
+ // getByRole reads role/name/exact — never `value`.
55
+ parts.push('role', fields.role || '', fields.name || '', exact);
56
+ break;
57
+ case 'testid':
58
+ parts.push('testid', fields.value || '');
59
+ break;
60
+ case 'placeholder':
61
+ case 'label':
62
+ case 'text':
63
+ parts.push(fields.strategy, fields.value || '', exact);
64
+ break;
65
+ default:
66
+ // 'locator', 'id', 'css' and the partial's own default all render locator('<value>').
67
+ parts.push('locator', fields.value || '');
68
+ }
69
+
70
+ return [...parts, `nth=${nth}`, `scope=${scope}`].join('|');
71
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Escape a raw string for embedding inside a SINGLE-QUOTED JS string literal.
3
+ *
4
+ * Order matters: backslash first, or the escapes added afterwards get re-escaped. Getting this
5
+ * half-right is worse than not doing it — a value ending in `\` turns `'…\'` into an escaped
6
+ * closing quote, and the string literal runs on into the rest of the file, so the generated
7
+ * `.spec.ts` stops parsing and EVERY scenario in it is lost rather than the one step.
8
+ *
9
+ * The line terminators are not cosmetic either: a card's accessible text is routinely a composite
10
+ * of several lines (a Flutter content-desc, a multi-line heading), and a literal newline inside
11
+ * `'…'` is a syntax error.
12
+ *
13
+ * Lives here rather than inside the Handlebars helper because the pattern layer also builds locator
14
+ * strings by hand — the parent-scope chain among them — and two copies of this rule drift.
15
+ */
16
+ export function escapeSingleQuoted(text: unknown): string {
17
+ if (text == null) return '';
18
+ return String(text)
19
+ .replace(/\\/g, '\\\\')
20
+ .replace(/'/g, "\\'")
21
+ .replace(/\n/g, '\\n')
22
+ .replace(/\r/g, '\\r')
23
+ .replace(/\t/g, '\\t');
24
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Nearest-known-spelling suggestion, shared by the selector-surface checks.
3
+ *
4
+ * Two checks need the same judgement about the same class of author mistake — SG-W004 on an entry
5
+ * FIELD nobody reads (#712) and SG-E027 on an entry `type:` VALUE nothing dispatches (#711) — so
6
+ * the rule lives in one place rather than being re-tuned independently in each. The tuning is the
7
+ * substance here, not the edit distance:
8
+ *
9
+ * - A case-only difference is returned first and always. `testId` for `testid` and
10
+ * `contentEditable` for `contenteditable` are the single likeliest way to write either
11
+ * wrongly, and both surfaces are lowercase throughout, so this is a near-certainty rather
12
+ * than a guess.
13
+ * - Otherwise a distance of 1-2 is a typo worth naming.
14
+ * - Anything further is a DIFFERENT word, and guessing at it sends the author somewhere wrong.
15
+ * `selector` is not a misspelling of `locator` — it is someone reasonably assuming a field
16
+ * that does not exist, and "did you mean locator?" would be a worse answer than silence.
17
+ * The caller supplies its own hint for that case.
18
+ */
19
+
20
+ /** Levenshtein distance. Bounded use only — these are short identifiers. */
21
+ function distance(a: string, b: string): number {
22
+ const m = a.length, n = b.length;
23
+ let prev = Array.from({ length: n + 1 }, (_, j) => j);
24
+ for (let i = 1; i <= m; i++) {
25
+ const curr = [i];
26
+ for (let j = 1; j <= n; j++) {
27
+ curr[j] = Math.min(
28
+ prev[j] + 1,
29
+ curr[j - 1] + 1,
30
+ prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1),
31
+ );
32
+ }
33
+ prev = curr;
34
+ }
35
+ return prev[n];
36
+ }
37
+
38
+ /**
39
+ * The nearest candidate to `value`, when one is close enough to be a likely typo rather than a
40
+ * different word. Returns undefined when nothing is close enough to name honestly.
41
+ */
42
+ export function nearestMatch(
43
+ value: string, candidates: Iterable<string>, maxDistance = 2,
44
+ ): string | undefined {
45
+ const lower = value.toLowerCase();
46
+ const all = [...candidates];
47
+ for (const c of all) if (c.toLowerCase() === lower) return c;
48
+ let best: string | undefined;
49
+ let bestDist = Infinity;
50
+ for (const c of all) {
51
+ const d = distance(lower, c.toLowerCase());
52
+ if (d < bestDist) { bestDist = d; best = c; }
53
+ }
54
+ return bestDist <= maxDistance ? best : undefined;
55
+ }
@@ -0,0 +1,131 @@
1
+ /**
2
+ * The selector-entry field partition, and the SG-W004 check built on it (issue #712).
3
+ *
4
+ * The root cause behind #690, #711 and #712 is one shape: `selectors.yaml` has a DOCUMENTED
5
+ * surface wider than the compiler's IMPLEMENTED surface, and nothing compared the two. A field
6
+ * could be declared on `SelectorEntry`, assigned onto `ResolvedSelector`, and printed in the
7
+ * public reference while no consumer ever read it back — discovered only by grepping.
8
+ *
9
+ * This module states the contract as a partition, the same way #690 answered the equivalent
10
+ * question for `type:` values (STRATEGY_SELECTOR_TYPES vs NON_STRATEGY_SELECTOR_TYPES). Every
11
+ * field an author may write belongs to exactly one set, each entry naming who reads it — so the
12
+ * next unconsumed field is a failing check with a name attached, not an archaeology exercise.
13
+ *
14
+ * The check is deliberately a WARNING, not an error. An unknown key is inert (the compiler simply
15
+ * never reads it), so refusing to compile would break projects over a stray comment-turned-key
16
+ * while teaching nothing extra. `--strict` already turns the whole channel non-zero for CI.
17
+ */
18
+
19
+ import type { DiagnosticsCollector } from '../diagnostics';
20
+ import { nearestMatch } from './nearest-match';
21
+ import { walkSelectorEntries } from './selector-entry-walk';
22
+
23
+ /**
24
+ * Fields a consumer actually reads. The comment on each names WHO — that is the part that rots,
25
+ * so it is recorded next to the claim rather than in prose elsewhere. Adding a field here without
26
+ * a named consumer re-opens exactly the hole #712 was filed for.
27
+ */
28
+ export const CONSUMED_ENTRY_FIELDS: ReadonlySet<string> = new Set([
29
+ 'locator', // resolveFromEntry → strategy 'css'/'locator'
30
+ 'type', // the strategy switch; also ResolvedSelector.selectorType (#690)
31
+ 'value', // every strategy template
32
+ 'name', // role templates; `name: null` disables the filter
33
+ 'nth', // locator-nth partial
34
+ 'exact', // has-text-value partial / anchored-regex assertions
35
+ 'inputMethod', // driver-ui fill pattern → fill-editor-action
36
+ 'scope', // dialog/landmark scoping in the locator partial
37
+ 'match', // collapses into `exact` for getByText
38
+ 'anchor', // page assertions — the rendered-content proof (#662)
39
+ 'android', // appium adapter → androidSelector (#392)
40
+ 'ios', // appium adapter → iosSelector (#392)
41
+ 'variant', // widget recipes / native select / upload subtype
42
+ 'trigger', // upload step — the visible button over a hidden input
43
+ 'frame', // frame-enter/exit steps → page.frameLocator
44
+ 'contenteditable', // resolveFromEntry → inputMethod 'pressSequentially' (#712)
45
+ 'columns', // table column-index lookup in StepMapper
46
+ 'pagination', // driver-ui table-paginate pattern (#712)
47
+ 'rows', // table row templates, the row-shape universe (#688, SG-W016)
48
+ 'attribute', // "has attribute" assertions → toHaveAttribute
49
+ 'pattern', // regex for the attribute value
50
+ 'expanded', // expand/collapse state signal
51
+ // Two spellings of ONE signal — how a control that publishes no ARIA marks its ON state, as a
52
+ // class or as a boolean attribute (issue #730). Normalised to `checkedClass`/`checkedAttribute`
53
+ // in selector-resolver, then read by setCheckedState/expectCheckedState via the checked-opts
54
+ // partial.
55
+ 'checked', // checked state signal → setCheckedState/expectCheckedState
56
+ 'selected', // alias of `checked` for card/tab pickers
57
+ ]);
58
+
59
+ /**
60
+ * Fields that are metadata by design — written for humans or for a non-codegen consumer, with no
61
+ * template behind them. Empty today: every field the schema accepts is now read by something.
62
+ *
63
+ * It is kept (rather than folded away) as the declared home for the NEXT such field, so that
64
+ * "nothing reads this" is an explicit, reviewable choice recorded here instead of an accident
65
+ * nobody notices for a release — which is precisely how `pagination:` and `contenteditable:`
66
+ * survived as documented no-ops.
67
+ */
68
+ export const DECLARATIVE_ENTRY_FIELDS: ReadonlySet<string> = new Set([]);
69
+
70
+ /** Everything an author may legitimately write on an entry. */
71
+ export const KNOWN_ENTRY_FIELDS: ReadonlySet<string> = new Set([
72
+ ...CONSUMED_ENTRY_FIELDS,
73
+ ...DECLARATIVE_ENTRY_FIELDS,
74
+ ]);
75
+
76
+ /** Keys of a `columns.<name>` definition — a column def is not a SelectorEntry. */
77
+ export const COLUMN_DEF_FIELDS: ReadonlySet<string> = new Set(['index', 'header', 'elements']);
78
+
79
+ export interface UnknownField {
80
+ /** Dotted path to the offending key, e.g. `orders.pagination` or `login.anchor`. */
81
+ path: string;
82
+ field: string;
83
+ /** A near-miss known field, when one is close enough to be worth naming. */
84
+ suggestion?: string;
85
+ }
86
+
87
+ /** Every key in `file` that no consumer will ever read. */
88
+ export function collectUnknownEntryFields(file: Record<string, unknown>): UnknownField[] {
89
+ const out: UnknownField[] = [];
90
+ walkSelectorEntries(file, {
91
+ entry(entry, path) {
92
+ for (const field of Object.keys(entry)) {
93
+ if (KNOWN_ENTRY_FIELDS.has(field)) continue;
94
+ out.push({ path, field, suggestion: nearestMatch(field, KNOWN_ENTRY_FIELDS) });
95
+ }
96
+ },
97
+ // A column DEFINITION has its own small key set — this is the one check that judges it, and
98
+ // the reason the walk offers the visit at all.
99
+ columnDef(def, path) {
100
+ for (const field of Object.keys(def)) {
101
+ if (COLUMN_DEF_FIELDS.has(field)) continue;
102
+ out.push({ path, field, suggestion: nearestMatch(field, COLUMN_DEF_FIELDS) });
103
+ }
104
+ },
105
+ });
106
+ return out;
107
+ }
108
+
109
+ /**
110
+ * SG-W004 — report every entry field nothing reads.
111
+ *
112
+ * Runs once per selector FILE (the resolver's load is cached), not once per step, so a table named
113
+ * by twenty row steps is reported once. Silent when there is no diagnostics channel attached.
114
+ */
115
+ export function reportUnknownEntryFields(
116
+ file: Record<string, unknown>,
117
+ opts: { feature?: string; diagnostics?: DiagnosticsCollector },
118
+ ): void {
119
+ const sink = opts.diagnostics;
120
+ if (!sink) return;
121
+ for (const { path, field, suggestion } of collectUnknownEntryFields(file)) {
122
+ const hint = suggestion
123
+ ? ` Did you mean "${suggestion}"?`
124
+ : ' A locator goes in "value:" (with a "type:") or "locator:" (raw CSS).';
125
+ sink.add('SG-W004',
126
+ `selectors.yaml entry "${path}" declares "${field}", which no consumer reads — `
127
+ + `writing it has no effect on the generated test and never will.${hint} `
128
+ + `See the selector reference for the fields an entry supports.`,
129
+ { feature: opts.feature });
130
+ }
131
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * One walk over the entries of a `selectors.yaml` file, shared by every per-entry check.
3
+ *
4
+ * SG-W004 (#712), SG-E027 (#711) and SG-W018 (#720) ask three different questions about the same
5
+ * shape — an unknown KEY, an unknown VALUE for `type:`, an out-of-contract VALUE for `nth:` — and
6
+ * each shipped its own copy of the same recursion. Three copies of "where do entries live" is how
7
+ * a check silently stops covering a nesting level: #711's gate has an explicit case for
8
+ * `columns.*.elements.*` precisely because that level was easy to miss. The recursion lives here
9
+ * once, so a new nesting level is added in one place and every check gains it at the same moment.
10
+ */
11
+
12
+ /** Sub-entries that are themselves full SelectorEntry values, so they recurse. */
13
+ export const NESTED_ENTRY_FIELDS = ['anchor', 'android', 'ios'] as const;
14
+
15
+ export function isEntryObject(v: unknown): v is Record<string, unknown> {
16
+ return !!v && typeof v === 'object' && !Array.isArray(v);
17
+ }
18
+
19
+ export interface WalkVisitors {
20
+ /** Every SelectorEntry in the file, with its dotted path (`save`, `greeting.ios`, …). */
21
+ entry(entry: Record<string, unknown>, path: string): void;
22
+ /**
23
+ * Each `columns.<name>` DEFINITION, which is not a SelectorEntry (it holds index/header/
24
+ * elements). Only SG-W004 has business with these; the other checks omit it.
25
+ */
26
+ columnDef?(def: Record<string, unknown>, path: string): void;
27
+ }
28
+
29
+ function walkEntry(entry: Record<string, unknown>, entryPath: string, visit: WalkVisitors): void {
30
+ visit.entry(entry, entryPath);
31
+
32
+ for (const sub of NESTED_ENTRY_FIELDS) {
33
+ const v = entry[sub];
34
+ if (isEntryObject(v)) walkEntry(v, `${entryPath}.${sub}`, visit);
35
+ }
36
+
37
+ // A column DEFINITION is not a SelectorEntry, but the entries under its `elements:` map are,
38
+ // and each carries its own `type:` / `nth:`.
39
+ const columns = entry.columns;
40
+ if (!isEntryObject(columns)) return;
41
+ for (const [colName, colDef] of Object.entries(columns)) {
42
+ if (!isEntryObject(colDef)) continue;
43
+ const colPath = `${entryPath}.columns.${colName}`;
44
+ visit.columnDef?.(colDef, colPath);
45
+ const elements = colDef.elements;
46
+ if (!isEntryObject(elements)) continue;
47
+ for (const [elName, elEntry] of Object.entries(elements)) {
48
+ if (isEntryObject(elEntry)) walkEntry(elEntry, `${colPath}.elements.${elName}`, visit);
49
+ }
50
+ }
51
+ }
52
+
53
+ /** Visit every entry (and, on request, every column definition) in a parsed selector file. */
54
+ export function walkSelectorEntries(file: Record<string, unknown>, visit: WalkVisitors): void {
55
+ for (const [label, entry] of Object.entries(file)) {
56
+ if (isEntryObject(entry)) walkEntry(entry, label, visit);
57
+ }
58
+ }
@@ -0,0 +1,99 @@
1
+ /**
2
+ * SG-W018 — an `nth:` value outside the contract (issue #720).
3
+ *
4
+ * `nth:` was the one SelectorEntry field whose VALUE nothing validated. The key is recognised
5
+ * (it is in CONSUMED_ENTRY_FIELDS, so SG-W004 stays quiet) and the entry's `type:` is valid (so
6
+ * SG-E027 stays quiet) — every check we own stopped at the key. What landed in the value went
7
+ * straight to two adapters that disagreed about what a valid `nth` even is:
8
+ *
9
+ * nth: -1 web → the filter vanished (`.getByRole('combobox')`, byte-identical to deleting
10
+ * the line), mobile → `$$('~x')[-1]`, which is `undefined` in JavaScript
11
+ * nth: 'last' web → dropped, mobile → `$$('~x')[last]` — a bare identifier, valid syntax and a
12
+ * ReferenceError at run time, so even the SG-E022 parse self-check passed it
13
+ * nth: 1.5 emitted verbatim into `.nth(1.5)` / `[1.5]`
14
+ *
15
+ * Zero diagnostics in every case. `SelectorEntry.nth` is typed `number?`, but YAML is parsed, not
16
+ * type-checked — the declared type buys nothing at the boundary. Same family as #712 (an
17
+ * unrecognised KEY) and #711 (an unrecognised VALUE for `type:`), one level deeper again.
18
+ *
19
+ * THE CONTRACT: an integer `>= -1`. `0..N` is the zero-based index; `-1` means the last match
20
+ * (Playwright's `.last()` IS `.nth(-1)`, and the appium side now renders `.at(-1)`). Anything
21
+ * else is ignored by the resolver — normalised to `undefined` before it can reach a template —
22
+ * and reported here, so "ignored" is something the author is told rather than something they
23
+ * discover from a strict-mode violation.
24
+ *
25
+ * A WARNING, not an error, on SG-W004's reasoning: the value is inert once dropped, the selector
26
+ * still resolves (it just does not filter by position), and `--strict` already turns the channel
27
+ * non-zero for CI.
28
+ */
29
+
30
+ import type { DiagnosticsCollector } from '../diagnostics';
31
+ import { walkSelectorEntries } from './selector-entry-walk';
32
+
33
+ /** True for the values `nth:` accepts: an integer index `>= 0`, or `-1` for the last match. */
34
+ export function isValidNth(v: unknown): v is number {
35
+ return typeof v === 'number' && Number.isInteger(v) && v >= -1;
36
+ }
37
+
38
+ /**
39
+ * The one normalisation every resolve path runs `nth` through: a valid index, or `undefined`.
40
+ *
41
+ * Returning `undefined` rather than the raw value is what makes the SG-W018 message true — and
42
+ * it is the half that keeps broken JavaScript out of the emitted spec even on paths this check
43
+ * does not walk (the legacy selector format), because a template only ever sees a real index.
44
+ */
45
+ export function normalizeNth(v: unknown): number | undefined {
46
+ return isValidNth(v) ? v : undefined;
47
+ }
48
+
49
+ export interface InvalidNth {
50
+ /** Dotted path to the offending entry, e.g. `danh muc` or `greeting.android`. */
51
+ path: string;
52
+ /** The `nth:` value exactly as written, for quoting back at the author. */
53
+ nth: unknown;
54
+ }
55
+
56
+ /** Every entry in `file` whose `nth:` is present but outside the contract. */
57
+ export function collectInvalidNth(file: Record<string, unknown>): InvalidNth[] {
58
+ const out: InvalidNth[] = [];
59
+ walkSelectorEntries(file, {
60
+ entry(entry, path) {
61
+ // An ABSENT `nth:` is the common case and means "no positional filter". An explicit
62
+ // `nth: null` is read the same way — the resolver has always treated null as unset, and
63
+ // reporting it would fire on a legitimate "no index here" written out loud.
64
+ if (entry.nth === undefined || entry.nth === null) return;
65
+ if (isValidNth(entry.nth)) return;
66
+ out.push({ path, nth: entry.nth });
67
+ },
68
+ });
69
+ return out;
70
+ }
71
+
72
+ /**
73
+ * SG-W018 — report every entry whose `nth:` the compiler cannot use.
74
+ *
75
+ * Runs once per selector FILE (the resolver's load is cached), so an entry named by twenty steps
76
+ * is reported once — the same load point and the same reason as SG-W004 and SG-E027. Silent when
77
+ * no diagnostics channel is attached: `generate` must not depend on diagnostics being wired.
78
+ */
79
+ export function reportInvalidNth(
80
+ file: Record<string, unknown>,
81
+ opts: { feature?: string; diagnostics?: DiagnosticsCollector },
82
+ ): void {
83
+ const sink = opts.diagnostics;
84
+ if (!sink) return;
85
+ for (const { path, nth } of collectInvalidNth(file)) {
86
+ // Quoted for a string so `nth: 'last'` reads back as the string it is; `String()` for a number
87
+ // so -2, 1.5 and .nan survive as written (JSON.stringify renders NaN as `null`, which would
88
+ // quote a value the author never typed).
89
+ const written = typeof nth === 'string' ? `"${nth}"`
90
+ : typeof nth === 'number' ? String(nth)
91
+ : JSON.stringify(nth) ?? String(nth);
92
+ sink.add('SG-W018',
93
+ `selectors.yaml entry "${path}" declares nth: ${written}, which is not a valid index — `
94
+ + `it is IGNORED, so the selector does not filter by position and a step naming it resolves `
95
+ + `to every match (strict mode then fails at run time naming the DOM, never this line). `
96
+ + `Use an integer >= 0 for a zero-based index, or -1 for the last match.`,
97
+ { feature: opts.feature });
98
+ }
99
+ }