@empiricalrun/playwright-utils 0.22.6 → 0.23.0

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 (274) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bundled/test-gen/actions/assert.d.ts +4 -0
  3. package/bundled/test-gen/actions/assert.d.ts.map +1 -0
  4. package/bundled/test-gen/actions/assert.js +50 -0
  5. package/bundled/test-gen/actions/click.d.ts +4 -0
  6. package/bundled/test-gen/actions/click.d.ts.map +1 -0
  7. package/bundled/test-gen/actions/click.js +51 -0
  8. package/bundled/test-gen/actions/constants/index.d.ts +2 -0
  9. package/bundled/test-gen/actions/constants/index.d.ts.map +1 -0
  10. package/bundled/test-gen/actions/constants/index.js +4 -0
  11. package/bundled/test-gen/actions/done.d.ts +4 -0
  12. package/bundled/test-gen/actions/done.d.ts.map +1 -0
  13. package/bundled/test-gen/actions/done.js +30 -0
  14. package/bundled/test-gen/actions/fill.d.ts +4 -0
  15. package/bundled/test-gen/actions/fill.d.ts.map +1 -0
  16. package/bundled/test-gen/actions/fill.js +82 -0
  17. package/bundled/test-gen/actions/goto.d.ts +4 -0
  18. package/bundled/test-gen/actions/goto.d.ts.map +1 -0
  19. package/bundled/test-gen/actions/goto.js +47 -0
  20. package/bundled/test-gen/actions/hover.d.ts +4 -0
  21. package/bundled/test-gen/actions/hover.d.ts.map +1 -0
  22. package/bundled/test-gen/actions/hover.js +51 -0
  23. package/bundled/test-gen/actions/index.d.ts +30 -0
  24. package/bundled/test-gen/actions/index.d.ts.map +1 -0
  25. package/bundled/test-gen/actions/index.js +159 -0
  26. package/bundled/test-gen/actions/next-task.d.ts +53 -0
  27. package/bundled/test-gen/actions/next-task.d.ts.map +1 -0
  28. package/bundled/test-gen/actions/next-task.js +58 -0
  29. package/bundled/test-gen/actions/press.d.ts +4 -0
  30. package/bundled/test-gen/actions/press.d.ts.map +1 -0
  31. package/bundled/test-gen/actions/press.js +56 -0
  32. package/bundled/test-gen/actions/skill.d.ts +21 -0
  33. package/bundled/test-gen/actions/skill.d.ts.map +1 -0
  34. package/bundled/test-gen/actions/skill.js +127 -0
  35. package/bundled/test-gen/actions/text-content.d.ts +4 -0
  36. package/bundled/test-gen/actions/text-content.d.ts.map +1 -0
  37. package/bundled/test-gen/actions/text-content.js +58 -0
  38. package/bundled/test-gen/actions/utils/index.d.ts +10 -0
  39. package/bundled/test-gen/actions/utils/index.d.ts.map +1 -0
  40. package/bundled/test-gen/actions/utils/index.js +109 -0
  41. package/bundled/test-gen/agent/browsing/index.d.ts +15 -0
  42. package/bundled/test-gen/agent/browsing/index.d.ts.map +1 -0
  43. package/bundled/test-gen/agent/browsing/index.js +68 -0
  44. package/bundled/test-gen/agent/browsing/run.d.ts +19 -0
  45. package/bundled/test-gen/agent/browsing/run.d.ts.map +1 -0
  46. package/bundled/test-gen/agent/browsing/run.js +88 -0
  47. package/bundled/test-gen/agent/browsing/utils.d.ts +41 -0
  48. package/bundled/test-gen/agent/browsing/utils.d.ts.map +1 -0
  49. package/bundled/test-gen/agent/browsing/utils.js +406 -0
  50. package/bundled/test-gen/agent/codegen/create-test-block.d.ts +9 -0
  51. package/bundled/test-gen/agent/codegen/create-test-block.d.ts.map +1 -0
  52. package/bundled/test-gen/agent/codegen/create-test-block.js +63 -0
  53. package/bundled/test-gen/agent/codegen/fix-ts-errors.d.ts +13 -0
  54. package/bundled/test-gen/agent/codegen/fix-ts-errors.d.ts.map +1 -0
  55. package/bundled/test-gen/agent/codegen/fix-ts-errors.js +80 -0
  56. package/bundled/test-gen/agent/codegen/generate-code-apply-changes.d.ts +13 -0
  57. package/bundled/test-gen/agent/codegen/generate-code-apply-changes.d.ts.map +1 -0
  58. package/bundled/test-gen/agent/codegen/generate-code-apply-changes.js +381 -0
  59. package/bundled/test-gen/agent/codegen/lexical-scoped-vars.d.ts +9 -0
  60. package/bundled/test-gen/agent/codegen/lexical-scoped-vars.d.ts.map +1 -0
  61. package/bundled/test-gen/agent/codegen/lexical-scoped-vars.js +56 -0
  62. package/bundled/test-gen/agent/codegen/repo-edit.d.ts +23 -0
  63. package/bundled/test-gen/agent/codegen/repo-edit.d.ts.map +1 -0
  64. package/bundled/test-gen/agent/codegen/repo-edit.js +86 -0
  65. package/bundled/test-gen/agent/codegen/run.d.ts +16 -0
  66. package/bundled/test-gen/agent/codegen/run.d.ts.map +1 -0
  67. package/bundled/test-gen/agent/codegen/run.js +119 -0
  68. package/bundled/test-gen/agent/codegen/skills-retriever.d.ts +26 -0
  69. package/bundled/test-gen/agent/codegen/skills-retriever.d.ts.map +1 -0
  70. package/bundled/test-gen/agent/codegen/skills-retriever.js +93 -0
  71. package/bundled/test-gen/agent/codegen/test-update-feedback.d.ts +12 -0
  72. package/bundled/test-gen/agent/codegen/test-update-feedback.d.ts.map +1 -0
  73. package/bundled/test-gen/agent/codegen/test-update-feedback.js +50 -0
  74. package/bundled/test-gen/agent/codegen/types.d.ts +25 -0
  75. package/bundled/test-gen/agent/codegen/types.d.ts.map +1 -0
  76. package/bundled/test-gen/agent/codegen/types.js +8 -0
  77. package/bundled/test-gen/agent/codegen/update-flow.d.ts +34 -0
  78. package/bundled/test-gen/agent/codegen/update-flow.d.ts.map +1 -0
  79. package/bundled/test-gen/agent/codegen/update-flow.js +300 -0
  80. package/bundled/test-gen/agent/codegen/use-skill.d.ts +11 -0
  81. package/bundled/test-gen/agent/codegen/use-skill.d.ts.map +1 -0
  82. package/bundled/test-gen/agent/codegen/use-skill.js +54 -0
  83. package/bundled/test-gen/agent/codegen/utils.d.ts +126 -0
  84. package/bundled/test-gen/agent/codegen/utils.d.ts.map +1 -0
  85. package/bundled/test-gen/agent/codegen/utils.js +416 -0
  86. package/bundled/test-gen/agent/diagnosis-agent/index.d.ts +18 -0
  87. package/bundled/test-gen/agent/diagnosis-agent/index.d.ts.map +1 -0
  88. package/bundled/test-gen/agent/diagnosis-agent/index.js +105 -0
  89. package/bundled/test-gen/agent/diagnosis-agent/strict-mode-violation.d.ts +9 -0
  90. package/bundled/test-gen/agent/diagnosis-agent/strict-mode-violation.d.ts.map +1 -0
  91. package/bundled/test-gen/agent/diagnosis-agent/strict-mode-violation.js +31 -0
  92. package/bundled/test-gen/agent/enrich-prompt/index.d.ts +12 -0
  93. package/bundled/test-gen/agent/enrich-prompt/index.d.ts.map +1 -0
  94. package/bundled/test-gen/agent/enrich-prompt/index.js +81 -0
  95. package/bundled/test-gen/agent/enrich-prompt/utils.d.ts +6 -0
  96. package/bundled/test-gen/agent/enrich-prompt/utils.d.ts.map +1 -0
  97. package/bundled/test-gen/agent/enrich-prompt/utils.js +12 -0
  98. package/bundled/test-gen/agent/infer-agent/index.d.ts +10 -0
  99. package/bundled/test-gen/agent/infer-agent/index.d.ts.map +1 -0
  100. package/bundled/test-gen/agent/infer-agent/index.js +70 -0
  101. package/bundled/test-gen/agent/master/action-tool-calls.d.ts +42 -0
  102. package/bundled/test-gen/agent/master/action-tool-calls.d.ts.map +1 -0
  103. package/bundled/test-gen/agent/master/action-tool-calls.js +87 -0
  104. package/bundled/test-gen/agent/master/browser-tests/fixtures.d.ts +9 -0
  105. package/bundled/test-gen/agent/master/browser-tests/fixtures.d.ts.map +1 -0
  106. package/bundled/test-gen/agent/master/browser-tests/fixtures.js +33 -0
  107. package/bundled/test-gen/agent/master/browser-tests/index.spec.d.ts +2 -0
  108. package/bundled/test-gen/agent/master/browser-tests/index.spec.d.ts.map +1 -0
  109. package/bundled/test-gen/agent/master/browser-tests/index.spec.js +113 -0
  110. package/bundled/test-gen/agent/master/browser-tests/skills.spec.d.ts +2 -0
  111. package/bundled/test-gen/agent/master/browser-tests/skills.spec.d.ts.map +1 -0
  112. package/bundled/test-gen/agent/master/browser-tests/skills.spec.js +109 -0
  113. package/bundled/test-gen/agent/master/element-annotation.d.ts +30 -0
  114. package/bundled/test-gen/agent/master/element-annotation.d.ts.map +1 -0
  115. package/bundled/test-gen/agent/master/element-annotation.js +195 -0
  116. package/bundled/test-gen/agent/master/execute-browser-action.d.ts +24 -0
  117. package/bundled/test-gen/agent/master/execute-browser-action.d.ts.map +1 -0
  118. package/bundled/test-gen/agent/master/execute-browser-action.js +124 -0
  119. package/bundled/test-gen/agent/master/execute-skill-action.d.ts +11 -0
  120. package/bundled/test-gen/agent/master/execute-skill-action.d.ts.map +1 -0
  121. package/bundled/test-gen/agent/master/execute-skill-action.js +25 -0
  122. package/bundled/test-gen/agent/master/icon-descriptor/index.d.ts +22 -0
  123. package/bundled/test-gen/agent/master/icon-descriptor/index.d.ts.map +1 -0
  124. package/bundled/test-gen/agent/master/icon-descriptor/index.js +250 -0
  125. package/bundled/test-gen/agent/master/icon-descriptor/normalize-svg.d.ts +2 -0
  126. package/bundled/test-gen/agent/master/icon-descriptor/normalize-svg.d.ts.map +1 -0
  127. package/bundled/test-gen/agent/master/icon-descriptor/normalize-svg.js +248 -0
  128. package/bundled/test-gen/agent/master/next-action.d.ts +22 -0
  129. package/bundled/test-gen/agent/master/next-action.d.ts.map +1 -0
  130. package/bundled/test-gen/agent/master/next-action.js +104 -0
  131. package/bundled/test-gen/agent/master/planner.d.ts +15 -0
  132. package/bundled/test-gen/agent/master/planner.d.ts.map +1 -0
  133. package/bundled/test-gen/agent/master/planner.js +144 -0
  134. package/bundled/test-gen/agent/master/run.d.ts +15 -0
  135. package/bundled/test-gen/agent/master/run.d.ts.map +1 -0
  136. package/bundled/test-gen/agent/master/run.js +274 -0
  137. package/bundled/test-gen/agent/master/scroller.d.ts +15 -0
  138. package/bundled/test-gen/agent/master/scroller.d.ts.map +1 -0
  139. package/bundled/test-gen/agent/master/scroller.js +375 -0
  140. package/bundled/test-gen/agent/master/with-hints.d.ts +17 -0
  141. package/bundled/test-gen/agent/master/with-hints.d.ts.map +1 -0
  142. package/bundled/test-gen/agent/master/with-hints.js +102 -0
  143. package/bundled/test-gen/agent/planner/run-time-planner.d.ts +15 -0
  144. package/bundled/test-gen/agent/planner/run-time-planner.d.ts.map +1 -0
  145. package/bundled/test-gen/agent/planner/run-time-planner.js +100 -0
  146. package/bundled/test-gen/agent/planner/run.d.ts +7 -0
  147. package/bundled/test-gen/agent/planner/run.d.ts.map +1 -0
  148. package/bundled/test-gen/agent/planner/run.js +127 -0
  149. package/bundled/test-gen/agent/utils.d.ts +2 -0
  150. package/bundled/test-gen/agent/utils.d.ts.map +1 -0
  151. package/bundled/test-gen/agent/utils.js +12 -0
  152. package/bundled/test-gen/bin/index.d.ts +3 -0
  153. package/bundled/test-gen/bin/index.d.ts.map +1 -0
  154. package/bundled/test-gen/bin/index.js +212 -0
  155. package/bundled/test-gen/bin/logger/index.d.ts +14 -0
  156. package/bundled/test-gen/bin/logger/index.d.ts.map +1 -0
  157. package/bundled/test-gen/bin/logger/index.js +57 -0
  158. package/bundled/test-gen/bin/utils/context.d.ts +13 -0
  159. package/bundled/test-gen/bin/utils/context.d.ts.map +1 -0
  160. package/bundled/test-gen/bin/utils/context.js +67 -0
  161. package/bundled/test-gen/bin/utils/fs/index.d.ts +6 -0
  162. package/bundled/test-gen/bin/utils/fs/index.d.ts.map +1 -0
  163. package/bundled/test-gen/bin/utils/fs/index.js +63 -0
  164. package/bundled/test-gen/bin/utils/index.d.ts +9 -0
  165. package/bundled/test-gen/bin/utils/index.d.ts.map +1 -0
  166. package/bundled/test-gen/bin/utils/index.js +64 -0
  167. package/bundled/test-gen/bin/utils/platform/web/index.d.ts +78 -0
  168. package/bundled/test-gen/bin/utils/platform/web/index.d.ts.map +1 -0
  169. package/bundled/test-gen/bin/utils/platform/web/index.js +544 -0
  170. package/bundled/test-gen/bin/utils/platform/web/test-files/ts-path-import-validate.d.ts +2 -0
  171. package/bundled/test-gen/bin/utils/platform/web/test-files/ts-path-import-validate.d.ts.map +1 -0
  172. package/bundled/test-gen/bin/utils/platform/web/test-files/ts-path-import-validate.js +7 -0
  173. package/bundled/test-gen/bin/utils/scenarios/index.d.ts +6 -0
  174. package/bundled/test-gen/bin/utils/scenarios/index.d.ts.map +1 -0
  175. package/bundled/test-gen/bin/utils/scenarios/index.js +57 -0
  176. package/bundled/test-gen/browser-injected-scripts/annotate-elements.js +615 -0
  177. package/bundled/test-gen/browser-injected-scripts/annotate-elements.spec.d.ts +2 -0
  178. package/bundled/test-gen/browser-injected-scripts/annotate-elements.spec.d.ts.map +1 -0
  179. package/bundled/test-gen/browser-injected-scripts/annotate-elements.spec.js +207 -0
  180. package/bundled/test-gen/browser-injected-scripts/annotate-elements.spec.ts +332 -0
  181. package/bundled/test-gen/constants/index.d.ts +7 -0
  182. package/bundled/test-gen/constants/index.d.ts.map +1 -0
  183. package/bundled/test-gen/constants/index.js +18 -0
  184. package/bundled/test-gen/errors/index.d.ts +5 -0
  185. package/bundled/test-gen/errors/index.d.ts.map +1 -0
  186. package/bundled/test-gen/errors/index.js +9 -0
  187. package/bundled/test-gen/evals/add-scenario-agent.evals.d.ts +4 -0
  188. package/bundled/test-gen/evals/add-scenario-agent.evals.d.ts.map +1 -0
  189. package/bundled/test-gen/evals/add-scenario-agent.evals.js +44 -0
  190. package/bundled/test-gen/evals/append-create-test-agent.evals.d.ts +4 -0
  191. package/bundled/test-gen/evals/append-create-test-agent.evals.d.ts.map +1 -0
  192. package/bundled/test-gen/evals/append-create-test-agent.evals.js +117 -0
  193. package/bundled/test-gen/evals/fetch-pom-skills-agent.evals.d.ts +4 -0
  194. package/bundled/test-gen/evals/fetch-pom-skills-agent.evals.d.ts.map +1 -0
  195. package/bundled/test-gen/evals/fetch-pom-skills-agent.evals.js +36 -0
  196. package/bundled/test-gen/evals/infer-master-or-code-agent.evals.d.ts +4 -0
  197. package/bundled/test-gen/evals/infer-master-or-code-agent.evals.d.ts.map +1 -0
  198. package/bundled/test-gen/evals/infer-master-or-code-agent.evals.js +22 -0
  199. package/bundled/test-gen/evals/master-agent.evals.d.ts +4 -0
  200. package/bundled/test-gen/evals/master-agent.evals.d.ts.map +1 -0
  201. package/bundled/test-gen/evals/master-agent.evals.js +35 -0
  202. package/bundled/test-gen/evals/type.d.ts +12 -0
  203. package/bundled/test-gen/evals/type.d.ts.map +1 -0
  204. package/bundled/test-gen/evals/type.js +2 -0
  205. package/bundled/test-gen/evals/update-scenario-agent.evals.d.ts +4 -0
  206. package/bundled/test-gen/evals/update-scenario-agent.evals.d.ts.map +1 -0
  207. package/bundled/test-gen/evals/update-scenario-agent.evals.js +47 -0
  208. package/bundled/test-gen/file/client.d.ts +14 -0
  209. package/bundled/test-gen/file/client.d.ts.map +1 -0
  210. package/bundled/test-gen/file/client.js +48 -0
  211. package/bundled/test-gen/file/server.d.ts +13 -0
  212. package/bundled/test-gen/file/server.d.ts.map +1 -0
  213. package/bundled/test-gen/file/server.js +52 -0
  214. package/bundled/test-gen/human-in-the-loop/cli.d.ts +2 -0
  215. package/bundled/test-gen/human-in-the-loop/cli.d.ts.map +1 -0
  216. package/bundled/test-gen/human-in-the-loop/cli.js +24 -0
  217. package/bundled/test-gen/human-in-the-loop/index.d.ts +12 -0
  218. package/bundled/test-gen/human-in-the-loop/index.d.ts.map +1 -0
  219. package/bundled/test-gen/human-in-the-loop/index.js +30 -0
  220. package/bundled/test-gen/human-in-the-loop/ipc.d.ts +4 -0
  221. package/bundled/test-gen/human-in-the-loop/ipc.d.ts.map +1 -0
  222. package/bundled/test-gen/human-in-the-loop/ipc.js +47 -0
  223. package/bundled/test-gen/index.d.ts +4 -0
  224. package/bundled/test-gen/index.d.ts.map +1 -0
  225. package/bundled/test-gen/index.js +55 -0
  226. package/bundled/test-gen/package.json +106 -0
  227. package/bundled/test-gen/page/index.d.ts +11 -0
  228. package/bundled/test-gen/page/index.d.ts.map +1 -0
  229. package/bundled/test-gen/page/index.js +16 -0
  230. package/bundled/test-gen/prompts/lib/ts-transformer.d.ts +4 -0
  231. package/bundled/test-gen/prompts/lib/ts-transformer.d.ts.map +1 -0
  232. package/bundled/test-gen/prompts/lib/ts-transformer.js +92 -0
  233. package/bundled/test-gen/reporter/index.d.ts +33 -0
  234. package/bundled/test-gen/reporter/index.d.ts.map +1 -0
  235. package/bundled/test-gen/reporter/index.js +161 -0
  236. package/bundled/test-gen/session/index.d.ts +20 -0
  237. package/bundled/test-gen/session/index.d.ts.map +1 -0
  238. package/bundled/test-gen/session/index.js +105 -0
  239. package/bundled/test-gen/test-build/index.d.ts +10 -0
  240. package/bundled/test-gen/test-build/index.d.ts.map +1 -0
  241. package/bundled/test-gen/test-build/index.js +30 -0
  242. package/bundled/test-gen/types/index.d.ts +69 -0
  243. package/bundled/test-gen/types/index.d.ts.map +1 -0
  244. package/bundled/test-gen/types/index.js +2 -0
  245. package/bundled/test-gen/uploader/index.d.ts +26 -0
  246. package/bundled/test-gen/uploader/index.d.ts.map +1 -0
  247. package/bundled/test-gen/uploader/index.js +102 -0
  248. package/bundled/test-gen/utils/env.d.ts +2 -0
  249. package/bundled/test-gen/utils/env.d.ts.map +1 -0
  250. package/bundled/test-gen/utils/env.js +9 -0
  251. package/bundled/test-gen/utils/exec.d.ts +4 -0
  252. package/bundled/test-gen/utils/exec.d.ts.map +1 -0
  253. package/bundled/test-gen/utils/exec.js +45 -0
  254. package/bundled/test-gen/utils/file.d.ts +2 -0
  255. package/bundled/test-gen/utils/file.d.ts.map +1 -0
  256. package/bundled/test-gen/utils/file.js +25 -0
  257. package/bundled/test-gen/utils/html.d.ts +4 -0
  258. package/bundled/test-gen/utils/html.d.ts.map +1 -0
  259. package/bundled/test-gen/utils/html.js +46 -0
  260. package/bundled/test-gen/utils/index.d.ts +2 -0
  261. package/bundled/test-gen/utils/index.d.ts.map +1 -0
  262. package/bundled/test-gen/utils/index.js +5 -0
  263. package/bundled/test-gen/utils/pw-test.d.ts +3 -0
  264. package/bundled/test-gen/utils/pw-test.d.ts.map +1 -0
  265. package/bundled/test-gen/utils/pw-test.js +26 -0
  266. package/bundled/test-gen/utils/slug.d.ts +2 -0
  267. package/bundled/test-gen/utils/slug.d.ts.map +1 -0
  268. package/bundled/test-gen/utils/slug.js +18 -0
  269. package/bundled/test-gen/utils/string.d.ts +2 -0
  270. package/bundled/test-gen/utils/string.d.ts.map +1 -0
  271. package/bundled/test-gen/utils/string.js +9 -0
  272. package/dist/overlay-tests/click.spec.js +1 -1
  273. package/package.json +3 -3
  274. package/scripts/prepare-publish.js +42 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @empiricalrun/playwright-utils
2
2
 
3
+ ## 0.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3e8b943: chore: bundle test-gen package so that npx test-gen can install itself
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [0def0a2]
12
+ - @empiricalrun/test-gen@0.46.11
13
+
14
+ ## 0.22.7
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [b3ca74f]
19
+ - Updated dependencies [b484292]
20
+ - @empiricalrun/test-gen@0.46.10
21
+
3
22
  ## 0.22.6
4
23
 
5
24
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+ import { AssertTextVisibilityActionArgs, PlaywrightActionGenerator } from "../types";
2
+ export declare const PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME = "assert_text_visibility";
3
+ export declare const assertTextVisibilityActionGenerator: PlaywrightActionGenerator<AssertTextVisibilityActionArgs>;
4
+ //# sourceMappingURL=assert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/actions/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,6CAA6C,2BAChC,CAAC;AAE3B,eAAO,MAAM,mCAAmC,EAAE,yBAAyB,CACzE,8BAA8B,CAqD/B,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertTextVisibilityActionGenerator = exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME = void 0;
4
+ const constants_1 = require("./constants");
5
+ const utils_1 = require("./utils");
6
+ exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME = "assert_text_visibility";
7
+ const assertTextVisibilityActionGenerator = (page) => {
8
+ return {
9
+ execute: async ({ args }) => {
10
+ const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(args.css_selector, args.xpath, page.pwPageInstance, args?.elementAnnotation);
11
+ const exec = new Function("page", `return page.${locator}.isVisible({ timeout: 3000 })`);
12
+ await exec(page.pwPageInstance);
13
+ return {
14
+ locator,
15
+ };
16
+ },
17
+ template: (args, options) => {
18
+ return {
19
+ code: `await expect(${page.name}.${options.locator}).toBeVisible();`,
20
+ };
21
+ },
22
+ name: exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME,
23
+ schema: {
24
+ type: "function",
25
+ function: {
26
+ name: exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME,
27
+ description: "assert whether the given element on the page is visible",
28
+ parameters: {
29
+ type: "object",
30
+ properties: {
31
+ reason: {
32
+ type: "string",
33
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
34
+ },
35
+ xpath: {
36
+ type: "string",
37
+ description: "XPath selector to identify the element uniquely and click it. When creating XPATH selector, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
38
+ },
39
+ css_selector: {
40
+ type: "string",
41
+ description: "CSS selector to identify the element uniquely and click it. When creating CSS selectors, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
42
+ },
43
+ },
44
+ required: ["reason", "xpath", "css_selector"],
45
+ },
46
+ },
47
+ },
48
+ };
49
+ };
50
+ exports.assertTextVisibilityActionGenerator = assertTextVisibilityActionGenerator;
@@ -0,0 +1,4 @@
1
+ import { ClickActionArgs, PlaywrightActionGenerator } from "../types";
2
+ export declare const PLAYWRIGHT_CLICK_ACTION_NAME = "click_element";
3
+ export declare const clickActionGenerator: PlaywrightActionGenerator<ClickActionArgs>;
4
+ //# sourceMappingURL=click.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../src/actions/click.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAItE,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,CAC1D,eAAe,CAsDhB,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clickActionGenerator = exports.PLAYWRIGHT_CLICK_ACTION_NAME = void 0;
4
+ const constants_1 = require("./constants");
5
+ const utils_1 = require("./utils");
6
+ exports.PLAYWRIGHT_CLICK_ACTION_NAME = "click_element";
7
+ const clickActionGenerator = (page) => {
8
+ return {
9
+ execute: async ({ args }) => {
10
+ const selector = args.css_selector;
11
+ const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(selector, args.xpath, page.pwPageInstance, args?.elementAnnotation);
12
+ const exec = new Function("page", `return page.${locator}.click({ timeout: 3000 })`);
13
+ await exec(page.pwPageInstance);
14
+ return {
15
+ locator,
16
+ };
17
+ },
18
+ template: (args, options) => {
19
+ return {
20
+ code: `await ${page.name}.${options.locator}.click();`,
21
+ };
22
+ },
23
+ name: exports.PLAYWRIGHT_CLICK_ACTION_NAME,
24
+ schema: {
25
+ type: "function",
26
+ function: {
27
+ name: exports.PLAYWRIGHT_CLICK_ACTION_NAME,
28
+ description: "click an element on the page",
29
+ parameters: {
30
+ type: "object",
31
+ properties: {
32
+ reason: {
33
+ type: "string",
34
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
35
+ },
36
+ xpath: {
37
+ type: "string",
38
+ description: "XPath selector to identify the element uniquely and click it. When creating XPATH selector, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
39
+ },
40
+ css_selector: {
41
+ type: "string",
42
+ description: "CSS selector to identify the element uniquely and click it. When creating CSS selectors, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
43
+ },
44
+ },
45
+ required: ["reason", "xpath", "css_selector"],
46
+ },
47
+ },
48
+ },
49
+ };
50
+ };
51
+ exports.clickActionGenerator = clickActionGenerator;
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_ACTION_REASON_PROMPT = "reason for calling this function. the reason should align with the task provided";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,qFAC2C,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_ACTION_REASON_PROMPT = void 0;
4
+ exports.DEFAULT_ACTION_REASON_PROMPT = "reason for calling this function. the reason should align with the task provided";
@@ -0,0 +1,4 @@
1
+ import { BaseActionArgs, PlaywrightActionGenerator } from "../types";
2
+ export declare const PLAYWRIGHT_DONE_ACTION_NAME = "task_done";
3
+ export declare const doneActionGenerator: PlaywrightActionGenerator<BaseActionArgs>;
4
+ //# sourceMappingURL=done.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"done.d.ts","sourceRoot":"","sources":["../../src/actions/done.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrE,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CACzD,cAAc,CAwBf,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.doneActionGenerator = exports.PLAYWRIGHT_DONE_ACTION_NAME = void 0;
4
+ const constants_1 = require("./constants");
5
+ exports.PLAYWRIGHT_DONE_ACTION_NAME = "task_done";
6
+ const doneActionGenerator = () => {
7
+ return {
8
+ execute: async () => { },
9
+ template: () => ({ code: "" }),
10
+ name: exports.PLAYWRIGHT_DONE_ACTION_NAME,
11
+ schema: {
12
+ type: "function",
13
+ function: {
14
+ name: exports.PLAYWRIGHT_DONE_ACTION_NAME,
15
+ description: "end the task by calling this method",
16
+ parameters: {
17
+ type: "object",
18
+ properties: {
19
+ reason: {
20
+ type: "string",
21
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
22
+ },
23
+ },
24
+ required: [],
25
+ },
26
+ },
27
+ },
28
+ };
29
+ };
30
+ exports.doneActionGenerator = doneActionGenerator;
@@ -0,0 +1,4 @@
1
+ import { FillActionArgs, PlaywrightActionGenerator } from "../types";
2
+ export declare const PLAYWRIGHT_FILL_ACTION_NAME = "fill_input_element";
3
+ export declare const fillActionGenerator: PlaywrightActionGenerator<FillActionArgs>;
4
+ //# sourceMappingURL=fill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/actions/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrE,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CAAC,cAAc,CA+FzE,CAAC"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fillActionGenerator = exports.PLAYWRIGHT_FILL_ACTION_NAME = void 0;
4
+ const constants_1 = require("./constants");
5
+ const utils_1 = require("./utils");
6
+ exports.PLAYWRIGHT_FILL_ACTION_NAME = "fill_input_element";
7
+ const NO_STATE_VARIABLE = "NA";
8
+ const fillActionGenerator = (page, options) => {
9
+ const stateVariableNames = Object.keys(options?.stateVariables || {});
10
+ stateVariableNames.push(NO_STATE_VARIABLE);
11
+ return {
12
+ execute: async ({ args }) => {
13
+ const css = args.css_selector;
14
+ const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(css, args.xpath, page.pwPageInstance, args?.elementAnnotation);
15
+ const concernedStateVariable = options?.stateVariables[args.variable_name]
16
+ ? args.variable_name
17
+ : "";
18
+ const testCaseLine = `${locator}.fill(${options?.stateVariables[args.variable_name]
19
+ ? args.variable_name
20
+ : `"${args.text}"`})`;
21
+ const exec = new Function("page", ...(concernedStateVariable ? [concernedStateVariable] : []), `return page.${testCaseLine}`);
22
+ await exec(page.pwPageInstance, options?.stateVariables[args.variable_name]);
23
+ return {
24
+ locator,
25
+ testCaseLine,
26
+ };
27
+ },
28
+ template: (args, options) => {
29
+ return {
30
+ code: `await ${page.name}.${options.testCaseLine}`,
31
+ };
32
+ },
33
+ name: exports.PLAYWRIGHT_FILL_ACTION_NAME,
34
+ schema: {
35
+ type: "function",
36
+ function: {
37
+ name: exports.PLAYWRIGHT_FILL_ACTION_NAME,
38
+ description: "fill the input element with a particular text",
39
+ parameters: {
40
+ type: "object",
41
+ properties: {
42
+ reason: {
43
+ type: "string",
44
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
45
+ },
46
+ text: {
47
+ type: "string",
48
+ description: "The text to fill the input element with",
49
+ },
50
+ variable_name: {
51
+ type: "string",
52
+ enum: stateVariableNames,
53
+ description: `variable name whose value needs to be filled in the input element.
54
+ The variable name and values are:
55
+
56
+ ${JSON.stringify(stateVariableNames, null, 2)}
57
+
58
+ - Choose the variable name based on the value above.
59
+ - Set variable_name as 'NA' if there is no variable to be used.`,
60
+ },
61
+ xpath: {
62
+ type: "string",
63
+ description: "XPath selector to identify the element uniquely and click it. When creating XPATH selector, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
64
+ },
65
+ css_selector: {
66
+ type: "string",
67
+ description: "CSS selector to identify the element uniquely.When creating CSS selectors, ensure they are unique to the page and specific enough to select only one element.",
68
+ },
69
+ },
70
+ required: [
71
+ "reason",
72
+ "text",
73
+ "variable_name",
74
+ "xpath",
75
+ "css_selector",
76
+ ],
77
+ },
78
+ },
79
+ },
80
+ };
81
+ };
82
+ exports.fillActionGenerator = fillActionGenerator;
@@ -0,0 +1,4 @@
1
+ import { GotoActionArgs, PlaywrightActionGenerator } from "../types";
2
+ export declare const PLAYWRIGHT_GOTO_ACTION_NAME = "page_goto";
3
+ export declare const gotoActionGenerator: PlaywrightActionGenerator<GotoActionArgs>;
4
+ //# sourceMappingURL=goto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"goto.d.ts","sourceRoot":"","sources":["../../src/actions/goto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrE,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CAAC,cAAc,CA0CzE,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gotoActionGenerator = exports.PLAYWRIGHT_GOTO_ACTION_NAME = void 0;
4
+ const utils_1 = require("../agent/browsing/utils");
5
+ const constants_1 = require("./constants");
6
+ exports.PLAYWRIGHT_GOTO_ACTION_NAME = "page_goto";
7
+ const gotoActionGenerator = (page) => {
8
+ return {
9
+ execute: async ({ args }) => {
10
+ const url = args.url;
11
+ await page.pwPageInstance.goto(url);
12
+ await page.pwPageInstance.waitForTimeout(3000);
13
+ await (0, utils_1.injectPwLocatorGenerator)(page.pwPageInstance);
14
+ },
15
+ // TODO: args transformer to be kept at a single place
16
+ template: (args) => {
17
+ const url = args.url;
18
+ const code = `await ${page.name}.goto("${url}");`;
19
+ return {
20
+ code,
21
+ };
22
+ },
23
+ name: exports.PLAYWRIGHT_GOTO_ACTION_NAME,
24
+ schema: {
25
+ type: "function",
26
+ function: {
27
+ name: exports.PLAYWRIGHT_GOTO_ACTION_NAME,
28
+ description: "navigate the page to a new URL",
29
+ parameters: {
30
+ type: "object",
31
+ properties: {
32
+ reason: {
33
+ type: "string",
34
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
35
+ },
36
+ url: {
37
+ type: "string",
38
+ description: "URL to navigate page to. Must be prefixed with http or https (preferably https)",
39
+ },
40
+ },
41
+ required: ["reason", "url"],
42
+ },
43
+ },
44
+ },
45
+ };
46
+ };
47
+ exports.gotoActionGenerator = gotoActionGenerator;
@@ -0,0 +1,4 @@
1
+ import { HoverActionArgs, PlaywrightActionGenerator } from "../types";
2
+ export declare const PLAYWRIGHT_HOVER_ACTION_NAME = "hover_element";
3
+ export declare const hoverActionGenerator: PlaywrightActionGenerator<HoverActionArgs>;
4
+ //# sourceMappingURL=hover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/actions/hover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAItE,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,CAC1D,eAAe,CAsDhB,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hoverActionGenerator = exports.PLAYWRIGHT_HOVER_ACTION_NAME = void 0;
4
+ const constants_1 = require("./constants");
5
+ const utils_1 = require("./utils");
6
+ exports.PLAYWRIGHT_HOVER_ACTION_NAME = "hover_element";
7
+ const hoverActionGenerator = (page) => {
8
+ return {
9
+ execute: async ({ args }) => {
10
+ const selector = args.css_selector;
11
+ const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(selector, args.xpath, page.pwPageInstance, args?.elementAnnotation);
12
+ const exec = new Function("page", `return page.${locator}.hover({ timeout: 3000 })`);
13
+ await exec(page.pwPageInstance);
14
+ return {
15
+ locator,
16
+ };
17
+ },
18
+ template: (args, options) => {
19
+ return {
20
+ code: `await ${page.name}.${options.locator}.hover();`,
21
+ };
22
+ },
23
+ name: exports.PLAYWRIGHT_HOVER_ACTION_NAME,
24
+ schema: {
25
+ type: "function",
26
+ function: {
27
+ name: exports.PLAYWRIGHT_HOVER_ACTION_NAME,
28
+ description: "hover over an element on the page",
29
+ parameters: {
30
+ type: "object",
31
+ properties: {
32
+ reason: {
33
+ type: "string",
34
+ description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
35
+ },
36
+ xpath: {
37
+ type: "string",
38
+ description: "XPath selector to identify the element uniquely and hover over it. When creating XPATH selector, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
39
+ },
40
+ css_selector: {
41
+ type: "string",
42
+ description: "CSS selector to identify the element uniquely and hover over it. When creating CSS selectors, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
43
+ },
44
+ },
45
+ required: ["reason", "xpath", "css_selector"],
46
+ },
47
+ },
48
+ },
49
+ };
50
+ };
51
+ exports.hoverActionGenerator = hoverActionGenerator;
@@ -0,0 +1,30 @@
1
+ import { TraceClient } from "@empiricalrun/llm";
2
+ import { TestGenPage } from "../page";
3
+ import { ActionArgs, ActionSchema } from "../types";
4
+ export declare class PlaywrightActions {
5
+ private page;
6
+ private stateVariables;
7
+ private actionGenerators;
8
+ private recordedActions;
9
+ constructor(page: TestGenPage, stateVariables?: Record<string, any>);
10
+ executeAction(name: string | undefined, args: ActionArgs, trace?: TraceClient): Promise<string | undefined>;
11
+ getBrowsingActionSchemas(): ActionSchema[];
12
+ getMasterActionSchemas(): ActionSchema[];
13
+ generateCode(): {
14
+ code: string;
15
+ importPaths: string[];
16
+ };
17
+ getLastCodeLines(count: number): string[];
18
+ /**
19
+ * Function to check if the last three actions are repeated.
20
+ * If the steps / code are repeated then it means the generation is stuck in a loop.
21
+ *
22
+ * @return {boolean}
23
+ * @memberof PlaywrightActions
24
+ */
25
+ isStuckInLoop(): boolean;
26
+ isComplete(): boolean;
27
+ getStateVariables(): Record<string, any>;
28
+ setStateVariables(stateVariables: Record<string, any>): void;
29
+ }
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAEL,UAAU,EACV,YAAY,EAEb,MAAM,UAAU,CAAC;AAWlB,qBAAa,iBAAiB;IAQ1B,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,cAAc;IARxB,OAAO,CAAC,gBAAgB,CAAwC;IAChE,OAAO,CAAC,eAAe,CAInB;gBAEM,IAAI,EAAE,WAAW,EACjB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAgB5C,aAAa,CACjB,IAAI,oBAAa,EACjB,IAAI,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA0D9B,wBAAwB,IAAI,YAAY,EAAE;IAoB1C,sBAAsB,IAAI,YAAY,EAAE;IAWxC,YAAY,IAAI;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAUD,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAK9B;;;;;;OAMG;IACH,aAAa,IAAI,OAAO;IAQxB,UAAU;IAWV,iBAAiB;IAIjB,iBAAiB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAItD"}
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlaywrightActions = void 0;
4
+ const logger_1 = require("../bin/logger");
5
+ const errors_1 = require("../errors");
6
+ const reporter_1 = require("../reporter");
7
+ const assert_1 = require("./assert");
8
+ const click_1 = require("./click");
9
+ const done_1 = require("./done");
10
+ const fill_1 = require("./fill");
11
+ const goto_1 = require("./goto");
12
+ const hover_1 = require("./hover");
13
+ const press_1 = require("./press");
14
+ const skill_1 = require("./skill");
15
+ const text_content_1 = require("./text-content");
16
+ class PlaywrightActions {
17
+ page;
18
+ stateVariables;
19
+ actionGenerators;
20
+ recordedActions;
21
+ constructor(page, stateVariables = {}) {
22
+ this.page = page;
23
+ this.stateVariables = stateVariables;
24
+ this.actionGenerators = [
25
+ fill_1.fillActionGenerator,
26
+ goto_1.gotoActionGenerator,
27
+ click_1.clickActionGenerator,
28
+ hover_1.hoverActionGenerator,
29
+ press_1.pressActionGenerator,
30
+ done_1.doneActionGenerator,
31
+ assert_1.assertTextVisibilityActionGenerator,
32
+ text_content_1.textContentActionGenerator,
33
+ skill_1.skillActionGenerator,
34
+ ];
35
+ this.recordedActions = [];
36
+ }
37
+ async executeAction(name = "", args, trace) {
38
+ const [action] = this.actionGenerators
39
+ .map((a) => a(this.page, {
40
+ stateVariables: this.stateVariables,
41
+ setStateVariables: this.setStateVariables.bind(this),
42
+ }))
43
+ .filter((a) => a.name === name);
44
+ if (!action) {
45
+ throw Error(`No action registered for action: ${name}`);
46
+ }
47
+ const logger = new logger_1.CustomLogger({ useReporter: false });
48
+ const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
49
+ logger.logEmptyLine();
50
+ const actionSpan = trace?.span({
51
+ name: "execute-action",
52
+ input: {
53
+ name,
54
+ args,
55
+ },
56
+ });
57
+ try {
58
+ const templateOptions = (await action.execute({
59
+ args,
60
+ trace: actionSpan,
61
+ })) || {
62
+ locator: "",
63
+ };
64
+ // record successful actions
65
+ const { code, importPath } = action.template(args, templateOptions);
66
+ actionSpan?.end({
67
+ output: {
68
+ code,
69
+ },
70
+ });
71
+ this.recordedActions.push({ name, code, importPath });
72
+ if (code) {
73
+ logger.log(`action: ${name} \ncode: ${code} \nreason: ${args.reason}`);
74
+ void testgenUpdatesReporter.sendMessage("```ts\n" + code + "\n```");
75
+ }
76
+ return code;
77
+ }
78
+ catch (e) {
79
+ actionSpan?.end({
80
+ output: {
81
+ error: e.message,
82
+ },
83
+ });
84
+ logger.log(`action: ${name} \nreason: ${args.reason}`);
85
+ // if its already parsed error throw it as is
86
+ if (e instanceof errors_1.TestGenError) {
87
+ throw e;
88
+ }
89
+ else {
90
+ throw new errors_1.TestGenError(`Error executing ${name} action: ${e.message}`);
91
+ }
92
+ }
93
+ }
94
+ getBrowsingActionSchemas() {
95
+ return [
96
+ fill_1.fillActionGenerator,
97
+ goto_1.gotoActionGenerator,
98
+ click_1.clickActionGenerator,
99
+ press_1.pressActionGenerator,
100
+ done_1.doneActionGenerator,
101
+ assert_1.assertTextVisibilityActionGenerator,
102
+ text_content_1.textContentActionGenerator,
103
+ hover_1.hoverActionGenerator,
104
+ ]
105
+ .map((a) => a(this.page, {
106
+ stateVariables: this.stateVariables,
107
+ setStateVariables: this.setStateVariables.bind(this),
108
+ }))
109
+ .map((a) => a.schema);
110
+ }
111
+ getMasterActionSchemas() {
112
+ return [skill_1.skillActionGenerator]
113
+ .map((a) => a(this.page, {
114
+ stateVariables: this.stateVariables,
115
+ setStateVariables: this.setStateVariables.bind(this),
116
+ }))
117
+ .map((a) => a.schema);
118
+ }
119
+ generateCode() {
120
+ const importPaths = this.recordedActions
121
+ .map((a) => a.importPath || "")
122
+ .filter((a) => !!a);
123
+ return {
124
+ code: this.recordedActions.map((a) => a.code).join("\n"),
125
+ importPaths,
126
+ };
127
+ }
128
+ getLastCodeLines(count) {
129
+ const actions = this.recordedActions;
130
+ return actions.slice(-count).map((a) => a.code);
131
+ }
132
+ /**
133
+ * Function to check if the last three actions are repeated.
134
+ * If the steps / code are repeated then it means the generation is stuck in a loop.
135
+ *
136
+ * @return {boolean}
137
+ * @memberof PlaywrightActions
138
+ */
139
+ isStuckInLoop() {
140
+ const lastThreeLinesOfCode = this.getLastCodeLines(3);
141
+ const areLastActionsRepeatitive = lastThreeLinesOfCode.length === 3 &&
142
+ lastThreeLinesOfCode.every((a) => a === lastThreeLinesOfCode[0]);
143
+ return areLastActionsRepeatitive;
144
+ }
145
+ isComplete() {
146
+ const [doneAction] = this.recordedActions.filter((a) => a.name === done_1.PLAYWRIGHT_DONE_ACTION_NAME);
147
+ // filter out done action from recorded actions aftet execution is marked complete
148
+ this.recordedActions = this.recordedActions.filter((a) => a.name !== done_1.PLAYWRIGHT_DONE_ACTION_NAME);
149
+ return !!doneAction;
150
+ }
151
+ getStateVariables() {
152
+ return this.stateVariables;
153
+ }
154
+ setStateVariables(stateVariables) {
155
+ this.stateVariables = stateVariables;
156
+ console.log("setStateVariables", Object.keys(this.stateVariables));
157
+ }
158
+ }
159
+ exports.PlaywrightActions = PlaywrightActions;
@@ -0,0 +1,53 @@
1
+ export declare const NEXT_TASK = "next_task";
2
+ export declare const NextTaskAction: {
3
+ name: string;
4
+ schema: {
5
+ type: string;
6
+ function: {
7
+ name: string;
8
+ description: string;
9
+ parameters: {
10
+ type: string;
11
+ properties: {
12
+ reason: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ action: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ listOfAnnotations: {
21
+ type: string;
22
+ items: {
23
+ type: string;
24
+ properties: {
25
+ elementID: {
26
+ type: string;
27
+ };
28
+ text: {
29
+ type: string;
30
+ };
31
+ };
32
+ required: string[];
33
+ };
34
+ description: string;
35
+ };
36
+ unannotatedElements: {
37
+ type: string;
38
+ items: {
39
+ type: string;
40
+ };
41
+ description: string;
42
+ };
43
+ elementAnnotation: {
44
+ type: string;
45
+ description: string;
46
+ };
47
+ };
48
+ required: string[];
49
+ };
50
+ };
51
+ };
52
+ };
53
+ //# sourceMappingURL=next-task.d.ts.map