@mablhq/playwright-tools 2.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/Globals.js +69 -0
  2. package/LICENSE.txt +29 -0
  3. package/README.md +219 -0
  4. package/api/ApiError.js +11 -0
  5. package/api/atlassian/bitBucketApiClient.js +81 -0
  6. package/api/atlassian/entities/CodeAnnotation.js +9 -0
  7. package/api/atlassian/entities/CodeReport.js +15 -0
  8. package/api/atlassian/entities/PullRequest.js +2 -0
  9. package/api/basicApiClient.js +293 -0
  10. package/api/entities/Browser.js +11 -0
  11. package/api/entities/Email.js +14 -0
  12. package/api/entities/FindStrategy.js +10 -0
  13. package/api/entities/Label.js +2 -0
  14. package/api/entities/VersionedObject.js +2 -0
  15. package/api/entities/Workspace.js +2 -0
  16. package/api/featureSet.js +44 -0
  17. package/api/mablApiClient.js +1070 -0
  18. package/api/mablApiClientFactory.js +79 -0
  19. package/api/types.js +10 -0
  20. package/auth/AuthClient.js +38 -0
  21. package/auth/OktaClient.js +97 -0
  22. package/browserEngines/browserEngine.js +41 -0
  23. package/browserEngines/browserEngines.js +14 -0
  24. package/browserEngines/chromiumBrowserEngine.js +177 -0
  25. package/browserEngines/firefoxBrowserEngine.js +134 -0
  26. package/browserEngines/unsupportedBrowserEngine.js +29 -0
  27. package/browserEngines/webkitBrowerEngine.js +50 -0
  28. package/browserLauncher/browser.js +2 -0
  29. package/browserLauncher/browserEvent.js +11 -0
  30. package/browserLauncher/browserLauncher.js +17 -0
  31. package/browserLauncher/browserLauncherEventEmitter.js +2 -0
  32. package/browserLauncher/browserLauncherFactory.js +30 -0
  33. package/browserLauncher/elementHandle.js +30 -0
  34. package/browserLauncher/errors.js +26 -0
  35. package/browserLauncher/frame.js +17 -0
  36. package/browserLauncher/frameBase.js +10 -0
  37. package/browserLauncher/httpRequest.js +2 -0
  38. package/browserLauncher/httpResponse.js +2 -0
  39. package/browserLauncher/jsHandle.js +2 -0
  40. package/browserLauncher/page.js +2 -0
  41. package/browserLauncher/pageEvent.js +17 -0
  42. package/browserLauncher/playwrightBrowserLauncher/browserDelegate.js +2 -0
  43. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumBrowserDelegate.js +61 -0
  44. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +129 -0
  45. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +24 -0
  46. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +145 -0
  47. package/browserLauncher/playwrightBrowserLauncher/elementHandleDelegate.js +2 -0
  48. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxBrowserDelegate.js +50 -0
  49. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxElementHandleDelegate.js +11 -0
  50. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +36 -0
  51. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxPageDelegate.js +15 -0
  52. package/browserLauncher/playwrightBrowserLauncher/frameDelegate.js +2 -0
  53. package/browserLauncher/playwrightBrowserLauncher/internals.js +2 -0
  54. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractBrowserDelegate.js +15 -0
  55. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +73 -0
  56. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractFrameDelegate.js +13 -0
  57. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +81 -0
  58. package/browserLauncher/playwrightBrowserLauncher/pageDelegate.js +2 -0
  59. package/browserLauncher/playwrightBrowserLauncher/playwrightApiResponse.js +18 -0
  60. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +259 -0
  61. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +97 -0
  62. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +319 -0
  63. package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +265 -0
  64. package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +76 -0
  65. package/browserLauncher/playwrightBrowserLauncher/playwrightHttpResponse.js +26 -0
  66. package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +377 -0
  67. package/browserLauncher/playwrightBrowserLauncher/simplePlaywrightLogger.js +36 -0
  68. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitBrowserDelegate.js +50 -0
  69. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +16 -0
  70. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +19 -0
  71. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitPageDelegate.js +15 -0
  72. package/browserLauncher/playwrightBrowserLauncher/wrappers.js +25 -0
  73. package/browserLauncher/types.js +28 -0
  74. package/browserLauncher/utils.js +9 -0
  75. package/cli.js +66 -0
  76. package/commands/applications/applications.js +5 -0
  77. package/commands/applications/applications_cmds/describe.js +21 -0
  78. package/commands/applications/applications_cmds/list.js +56 -0
  79. package/commands/auth/auth.js +5 -0
  80. package/commands/auth/auth_cmds/activate-key.js +38 -0
  81. package/commands/auth/auth_cmds/clear.js +10 -0
  82. package/commands/auth/auth_cmds/info.js +10 -0
  83. package/commands/auth/auth_cmds/login.js +10 -0
  84. package/commands/branches/branches.js +5 -0
  85. package/commands/branches/branches_cmds/create.js +56 -0
  86. package/commands/branches/branches_cmds/describe.js +50 -0
  87. package/commands/branches/branches_cmds/list.js +84 -0
  88. package/commands/branches/branches_cmds/merge.js +56 -0
  89. package/commands/browserTypes.js +20 -0
  90. package/commands/commandUtil/awaitCompletion.js +67 -0
  91. package/commands/commandUtil/branches.js +44 -0
  92. package/commands/commandUtil/codeInsights.js +181 -0
  93. package/commands/commandUtil/describe.js +32 -0
  94. package/commands/commandUtil/fileUtil.js +50 -0
  95. package/commands/commandUtil/interfaces.js +4 -0
  96. package/commands/commandUtil/list.js +70 -0
  97. package/commands/commandUtil/util.js +127 -0
  98. package/commands/commandUtil/versionUtil.js +33 -0
  99. package/commands/config/config.js +5 -0
  100. package/commands/config/config_cmds/configKeys.js +28 -0
  101. package/commands/config/config_cmds/delete.js +29 -0
  102. package/commands/config/config_cmds/get.js +52 -0
  103. package/commands/config/config_cmds/install.js +119 -0
  104. package/commands/config/config_cmds/list.js +39 -0
  105. package/commands/config/config_cmds/set.js +80 -0
  106. package/commands/constants.js +160 -0
  107. package/commands/credentials/credentials.js +5 -0
  108. package/commands/credentials/credentials_cmds/list.js +66 -0
  109. package/commands/datatables/datatables.js +5 -0
  110. package/commands/datatables/datatables_cmds/create.js +61 -0
  111. package/commands/datatables/datatables_cmds/describe.js +17 -0
  112. package/commands/datatables/datatables_cmds/export.js +86 -0
  113. package/commands/datatables/datatables_cmds/list.js +18 -0
  114. package/commands/datatables/datatables_cmds/scenarios.js +35 -0
  115. package/commands/datatables/datatables_cmds/update.js +120 -0
  116. package/commands/datatables/utils.js +145 -0
  117. package/commands/deploy/deploy.js +5 -0
  118. package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +100 -0
  119. package/commands/deploy/deploy_cmds/create.js +342 -0
  120. package/commands/deploy/deploy_cmds/describe.js +54 -0
  121. package/commands/deploy/deploy_cmds/executionResultPresenter.js +117 -0
  122. package/commands/deploy/deploy_cmds/list.js +74 -0
  123. package/commands/deploy/deploy_cmds/watch.js +44 -0
  124. package/commands/environments/environments.js +5 -0
  125. package/commands/environments/environments_cmds/build-files.js +5 -0
  126. package/commands/environments/environments_cmds/build-files_cmds/add.js +73 -0
  127. package/commands/environments/environments_cmds/build-files_cmds/list.js +54 -0
  128. package/commands/environments/environments_cmds/build-files_cmds/update.js +71 -0
  129. package/commands/environments/environments_cmds/create.js +153 -0
  130. package/commands/environments/environments_cmds/delete.js +32 -0
  131. package/commands/environments/environments_cmds/describe.js +28 -0
  132. package/commands/environments/environments_cmds/list.js +56 -0
  133. package/commands/environments/environments_cmds/update.js +46 -0
  134. package/commands/environments/environments_cmds/urls.js +5 -0
  135. package/commands/environments/environments_cmds/urls_cmds/add.js +91 -0
  136. package/commands/environments/environments_cmds/urls_cmds/list.js +49 -0
  137. package/commands/flows/flows.js +5 -0
  138. package/commands/flows/flows_cmds/export.js +78 -0
  139. package/commands/flows/flows_cmds/list.js +64 -0
  140. package/commands/internal/internal.js +6 -0
  141. package/commands/link-agents/link-agents.js +5 -0
  142. package/commands/link-agents/link-agents_cmds/delete.js +38 -0
  143. package/commands/link-agents/link-agents_cmds/list.js +131 -0
  144. package/commands/link-agents/link-agents_cmds/terminate.js +31 -0
  145. package/commands/mobile-build-files/mobile-build-files.js +5 -0
  146. package/commands/mobile-build-files/mobile-build-files_cmds/delete.js +31 -0
  147. package/commands/mobile-build-files/mobile-build-files_cmds/download.js +50 -0
  148. package/commands/mobile-build-files/mobile-build-files_cmds/list.js +72 -0
  149. package/commands/mobile-build-files/mobile-build-files_cmds/upload.js +101 -0
  150. package/commands/plans/plans.js +5 -0
  151. package/commands/plans/plans_cmds/describe.js +23 -0
  152. package/commands/plans/plans_cmds/list.js +63 -0
  153. package/commands/test-runs/test-runs.js +5 -0
  154. package/commands/test-runs/test-runs_cmds/export.js +62 -0
  155. package/commands/tests/mobileEmulationUtil.js +46 -0
  156. package/commands/tests/tests.js +5 -0
  157. package/commands/tests/testsUtil.js +538 -0
  158. package/commands/tests/tests_cmds/create.js +130 -0
  159. package/commands/tests/tests_cmds/edit.js +111 -0
  160. package/commands/tests/tests_cmds/export.js +145 -0
  161. package/commands/tests/tests_cmds/import.js +5 -0
  162. package/commands/tests/tests_cmds/import_cmds/import_playwright.js +439 -0
  163. package/commands/tests/tests_cmds/import_cmds/import_selenium.js +295 -0
  164. package/commands/tests/tests_cmds/list.js +94 -0
  165. package/commands/tests/tests_cmds/run-cloud.js +314 -0
  166. package/commands/tests/tests_cmds/run-mobile.js +260 -0
  167. package/commands/tests/tests_cmds/run.js +314 -0
  168. package/commands/tests/tests_cmds/runUtils.js +60 -0
  169. package/commands/tests/tests_cmds/trainerUtil.js +12 -0
  170. package/commands/users/users.js +5 -0
  171. package/commands/users/users_cmds/list.js +58 -0
  172. package/commands/workspaces/workspace_cmds/copy.js +108 -0
  173. package/commands/workspaces/workspace_cmds/describe.js +21 -0
  174. package/commands/workspaces/workspace_cmds/list.js +67 -0
  175. package/commands/workspaces/workspaces.js +5 -0
  176. package/core/entityValidation/environmentsValidation.js +7 -0
  177. package/core/entityValidation/stepValidation.js +15 -0
  178. package/core/execution/ApiTestUtils.js +1060 -0
  179. package/core/execution/MailboxConstants.js +4 -0
  180. package/core/execution/PostmanUtils.js +53 -0
  181. package/core/execution/RunConfig.js +2 -0
  182. package/core/execution/TestResult.js +15 -0
  183. package/core/execution/VariableUtils.js +154 -0
  184. package/core/execution/VariablesSummary.js +2 -0
  185. package/core/execution/basic-types.js +2 -0
  186. package/core/execution/newman-types.js +42 -0
  187. package/core/messaging/actions/MobileTrainingActions.js +17 -0
  188. package/core/messaging/actions/pdfActions.js +27 -0
  189. package/core/messaging/actions/runnerActions.js +18 -0
  190. package/core/messaging/actions/trainingSessionActions.js +38 -0
  191. package/core/messaging/logLineMessaging.js +50 -0
  192. package/core/messaging/messaging.js +130 -0
  193. package/core/messaging/pageMessaging.js +9 -0
  194. package/core/trainer/openUtils.js +47 -0
  195. package/core/trainer/trainingSessions-types.js +35 -0
  196. package/core/trainer/trainingSessions.js +151 -0
  197. package/core/util.js +52 -0
  198. package/coreWebVitals/index.js +77 -0
  199. package/domUtil/index.js +1 -0
  200. package/env/defaultEnv.js +17 -0
  201. package/env/dev.js +17 -0
  202. package/env/env.js +76 -0
  203. package/env/local.js +17 -0
  204. package/env/prod.js +17 -0
  205. package/execution/index.js +8 -0
  206. package/execution/index.js.LICENSE.txt +254 -0
  207. package/execution/runAppiumServer.js +145 -0
  208. package/functions/apiTest/utils.js +47 -0
  209. package/functions/types.js +2 -0
  210. package/functions/utils.js +12 -0
  211. package/http/MablHttpAgent.js +73 -0
  212. package/http/RequestFilteringHttpAgent.js +119 -0
  213. package/http/RequestSecurityError.js +13 -0
  214. package/http/axiosProxyConfig.js +101 -0
  215. package/http/httpUtil.js +73 -0
  216. package/http/requestInterceptor.js +206 -0
  217. package/index.d.ts +241 -0
  218. package/index.js +14 -0
  219. package/mablApi/index.js +1 -0
  220. package/mablscript/MablAction.js +102 -0
  221. package/mablscript/MablStep.js +191 -0
  222. package/mablscript/MablStepV2.js +73 -0
  223. package/mablscript/MablSymbol.js +35 -0
  224. package/mablscript/actions/AwaitDownloadAction.js +14 -0
  225. package/mablscript/actions/AwaitPDFDownloadAction.js +19 -0
  226. package/mablscript/actions/ConditionAction.js +123 -0
  227. package/mablscript/actions/CountAction.js +16 -0
  228. package/mablscript/actions/ExtractAction.js +71 -0
  229. package/mablscript/actions/FindAction.js +301 -0
  230. package/mablscript/actions/GenerateEmailAddressAction.js +14 -0
  231. package/mablscript/actions/GenerateRandomStringAction.js +20 -0
  232. package/mablscript/actions/GetUrlAction.js +22 -0
  233. package/mablscript/actions/GetVariableValue.js +31 -0
  234. package/mablscript/actions/GetViewportAction.js +17 -0
  235. package/mablscript/actions/JavaScriptAction.js +219 -0
  236. package/mablscript/diffing/diffingUtil.js +229 -0
  237. package/mablscript/importer.js +576 -0
  238. package/mablscript/mobile/steps/CreateVariableMobileStep.js +53 -0
  239. package/mablscript/mobile/steps/EnterTextStep.js +45 -0
  240. package/mablscript/mobile/steps/HideKeyboardStep.js +20 -0
  241. package/mablscript/mobile/steps/InstallAppStep.js +22 -0
  242. package/mablscript/mobile/steps/NavigateBackStep.js +20 -0
  243. package/mablscript/mobile/steps/NavigateHomeStep.js +21 -0
  244. package/mablscript/mobile/steps/OpenAppStep.js +22 -0
  245. package/mablscript/mobile/steps/OpenLinkStep.js +19 -0
  246. package/mablscript/mobile/steps/PrepareSessionStep.js +19 -0
  247. package/mablscript/mobile/steps/PushFileStep.js +27 -0
  248. package/mablscript/mobile/steps/ScrollStep.js +87 -0
  249. package/mablscript/mobile/steps/SetOrientationStep.js +20 -0
  250. package/mablscript/mobile/steps/TapStep.js +37 -0
  251. package/mablscript/mobile/steps/UninstallAppStep.js +22 -0
  252. package/mablscript/mobile/steps/actions/MobileFindAction.js +23 -0
  253. package/mablscript/mobile/steps/stepUtil.js +113 -0
  254. package/mablscript/mobile/tests/StepTestsUtil.js +20 -0
  255. package/mablscript/mobile/tests/TestMobileFindDescriptors.js +282 -0
  256. package/mablscript/mobile/tests/steps/CreateVariableMobileStep.mobiletest.js +298 -0
  257. package/mablscript/mobile/tests/steps/EnterTextStep.mobiletest.js +79 -0
  258. package/mablscript/mobile/tests/steps/GeneralHumanization.mobiletest.js +304 -0
  259. package/mablscript/mobile/tests/steps/HideKeyboardStep.mobiletest.js +27 -0
  260. package/mablscript/mobile/tests/steps/InstallAppStep.mobiletest.js +20 -0
  261. package/mablscript/mobile/tests/steps/NavigateBackStep.mobiletest.js +27 -0
  262. package/mablscript/mobile/tests/steps/NavigateHomeStep.mobiletest.js +27 -0
  263. package/mablscript/mobile/tests/steps/OpenLinkStep.mobiletest.js +20 -0
  264. package/mablscript/mobile/tests/steps/PushFileStep.mobiletest.js +55 -0
  265. package/mablscript/mobile/tests/steps/ScrollStep.mobiletest.js +386 -0
  266. package/mablscript/mobile/tests/steps/SetOrientationStep.mobiletest.js +32 -0
  267. package/mablscript/mobile/tests/steps/TapStep.mobiletest.js +57 -0
  268. package/mablscript/mobile/tests/steps/UninstallAppStep.mobiletest.js +20 -0
  269. package/mablscript/steps/AbstractAssertionsAndVariablesStep.js +52 -0
  270. package/mablscript/steps/AccessibilityCheck.js +108 -0
  271. package/mablscript/steps/ActionsUtils.js +18 -0
  272. package/mablscript/steps/AssertStep.js +318 -0
  273. package/mablscript/steps/AssertStepOld.js +159 -0
  274. package/mablscript/steps/AwaitTabStep.js +69 -0
  275. package/mablscript/steps/AwaitUploadsStep.js +26 -0
  276. package/mablscript/steps/ClearCookiesStep.js +26 -0
  277. package/mablscript/steps/ClickAndHoldStep.js +76 -0
  278. package/mablscript/steps/ClickStep.js +58 -0
  279. package/mablscript/steps/CookieUtils.js +54 -0
  280. package/mablscript/steps/CreateVariableStep.js +236 -0
  281. package/mablscript/steps/DatabaseQueryStep.js +28 -0
  282. package/mablscript/steps/DoubleClickStep.js +64 -0
  283. package/mablscript/steps/DownloadStep.js +96 -0
  284. package/mablscript/steps/EchoStep.js +34 -0
  285. package/mablscript/steps/ElseIfConditionStep.js +32 -0
  286. package/mablscript/steps/ElseStep.js +27 -0
  287. package/mablscript/steps/EndStep.js +27 -0
  288. package/mablscript/steps/EnterAuthCodeStep.js +59 -0
  289. package/mablscript/steps/EnterTextStep.js +96 -0
  290. package/mablscript/steps/EvaluateFlowStep.js +51 -0
  291. package/mablscript/steps/EvaluateJavaScriptStep.js +50 -0
  292. package/mablscript/steps/HoverStep.js +63 -0
  293. package/mablscript/steps/IfConditionStep.js +191 -0
  294. package/mablscript/steps/NavigateStep.js +30 -0
  295. package/mablscript/steps/OpenEmailStep.js +46 -0
  296. package/mablscript/steps/ReleaseStep.js +76 -0
  297. package/mablscript/steps/RemoveCookieStep.js +36 -0
  298. package/mablscript/steps/RightClickStep.js +58 -0
  299. package/mablscript/steps/SelectStep.js +82 -0
  300. package/mablscript/steps/SendHttpRequestStep.js +48 -0
  301. package/mablscript/steps/SendKeyStep.js +84 -0
  302. package/mablscript/steps/SetCookieStep.js +70 -0
  303. package/mablscript/steps/SetFilesStep.js +71 -0
  304. package/mablscript/steps/SetViewportStep.js +38 -0
  305. package/mablscript/steps/SwitchContextStep.js +122 -0
  306. package/mablscript/steps/SyntheticStep.js +20 -0
  307. package/mablscript/steps/VisitUrlStep.js +68 -0
  308. package/mablscript/steps/WaitStep.js +37 -0
  309. package/mablscript/steps/WaitUntilStep.js +46 -0
  310. package/mablscript/types/AccessibilityCheckStepDescriptor.js +2 -0
  311. package/mablscript/types/AccessibilityCheckTypes.js +9 -0
  312. package/mablscript/types/AssertionsAndVariablesStepDescriptor.js +2 -0
  313. package/mablscript/types/AwaitTabDescriptor.js +2 -0
  314. package/mablscript/types/AwaitUploadStepDescriptor.js +2 -0
  315. package/mablscript/types/ClearCookiesStepDescriptor.js +2 -0
  316. package/mablscript/types/ClickAndHoldStepDescriptor.js +2 -0
  317. package/mablscript/types/ClickStepDescriptor.js +2 -0
  318. package/mablscript/types/ConditionDescriptor.js +133 -0
  319. package/mablscript/types/CountDescriptor.js +2 -0
  320. package/mablscript/types/CreateVariableStepDescriptor.js +12 -0
  321. package/mablscript/types/DownloadStepDescriptor.js +2 -0
  322. package/mablscript/types/EchoStepDescriptor.js +2 -0
  323. package/mablscript/types/EnterTextStepDescriptor.js +2 -0
  324. package/mablscript/types/EvaluateFlowStepDescriptor.js +2 -0
  325. package/mablscript/types/EvaluateJavaScriptStepDescriptor.js +2 -0
  326. package/mablscript/types/ExtractDescriptor.js +21 -0
  327. package/mablscript/types/GetCurrentLocationDescriptor.js +12 -0
  328. package/mablscript/types/GetVariableDescriptor.js +16 -0
  329. package/mablscript/types/GetViewportDescriptor.js +12 -0
  330. package/mablscript/types/HoverStepDescriptor.js +2 -0
  331. package/mablscript/types/NavigateStepDescriptor.js +7 -0
  332. package/mablscript/types/OpenEmailStepDescriptor.js +2 -0
  333. package/mablscript/types/OperatingSystemDescriptor.js +45 -0
  334. package/mablscript/types/ReleaseStepDescriptor.js +7 -0
  335. package/mablscript/types/RemoveCookieStepDescriptor.js +2 -0
  336. package/mablscript/types/SelectStepDescriptor.js +2 -0
  337. package/mablscript/types/SendHttpRequestTypes.js +2 -0
  338. package/mablscript/types/SendKeyStepDescriptor.js +30 -0
  339. package/mablscript/types/SetCookieStepDescriptor.js +2 -0
  340. package/mablscript/types/SetFilesStepDescriptor.js +2 -0
  341. package/mablscript/types/SetViewportStepDescriptor.js +2 -0
  342. package/mablscript/types/SnippetsDescriptor.js +36 -0
  343. package/mablscript/types/StepDescriptor.js +2 -0
  344. package/mablscript/types/SwitchContextStepDescriptor.js +15 -0
  345. package/mablscript/types/VariableNamespace.js +17 -0
  346. package/mablscript/types/VisitUrlStepDescriptor.js +2 -0
  347. package/mablscript/types/WaitStepDescriptor.js +2 -0
  348. package/mablscript/types/WaitUntilStepDescriptor.js +2 -0
  349. package/mablscript/types/mobile/CreateVariableMobileStepDescriptor.js +9 -0
  350. package/mablscript/types/mobile/EnterTextStepDescriptor.js +2 -0
  351. package/mablscript/types/mobile/HideKeyboardStepDescriptor.js +2 -0
  352. package/mablscript/types/mobile/InstallAppStepDescriptor.js +2 -0
  353. package/mablscript/types/mobile/NavigateBackStepDescriptor.js +2 -0
  354. package/mablscript/types/mobile/NavigateHomeStepDescriptor.js +2 -0
  355. package/mablscript/types/mobile/OpenAppStepDescriptor.js +2 -0
  356. package/mablscript/types/mobile/OpenLinkStepDescriptor.js +2 -0
  357. package/mablscript/types/mobile/PrepareSessionStepDescriptor.js +2 -0
  358. package/mablscript/types/mobile/PushFileDescriptor.js +2 -0
  359. package/mablscript/types/mobile/ScrollStepDescriptor.js +32 -0
  360. package/mablscript/types/mobile/SetOrientationStepDescriptor.js +8 -0
  361. package/mablscript/types/mobile/StepWithMobileFindDescriptor.js +8 -0
  362. package/mablscript/types/mobile/TapStepDescriptor.js +8 -0
  363. package/mablscript/types/mobile/UninstallAppStepDescriptor.js +2 -0
  364. package/mablscriptFind/index.js +2 -0
  365. package/mablscriptFind/index.js.LICENSE.txt +25 -0
  366. package/middleware.js +42 -0
  367. package/mobile/index.js +2 -0
  368. package/mobile/types.js +8 -0
  369. package/observers/ObserverBase.js +11 -0
  370. package/observers/mockObserver.js +47 -0
  371. package/package.json +107 -0
  372. package/popupDismissal/candidate.js +2 -0
  373. package/popupDismissal/index.js +255 -0
  374. package/providers/authenticationProvider.js +254 -0
  375. package/providers/cliConfigProvider.js +271 -0
  376. package/providers/exportRequestProvider.js +196 -0
  377. package/providers/logging/loggingProvider.js +90 -0
  378. package/providers/scmContextInterfaces.js +14 -0
  379. package/providers/scmContextProvider.js +335 -0
  380. package/providers/scmContextProviderV2.js +122 -0
  381. package/providers/types.js +9 -0
  382. package/proxy/index.js +2 -0
  383. package/proxy/index.js.LICENSE.txt +12 -0
  384. package/proxy/lib/xpath.js +1 -0
  385. package/reporters/__tests__/resources/sampleData.js +162 -0
  386. package/reporters/mochAwesome/interfaces.js +2 -0
  387. package/reporters/mochAwesome/mochAwesomeReporter.js +227 -0
  388. package/reporters/reporter.js +46 -0
  389. package/resources/actionabilityCheck.js +160 -0
  390. package/resources/coreWebVitals.js +1 -0
  391. package/resources/mablFind.js +2 -0
  392. package/resources/media/mabl_test_audio.wav +0 -0
  393. package/resources/media/mabl_test_pattern.y4m +3 -0
  394. package/resources/pdf-viewer/EmbeddedPdfHandler.js +1 -0
  395. package/resources/pdf-viewer/embeddedPdfDetection.js +225 -0
  396. package/resources/pdf-viewer/index.html +1 -0
  397. package/resources/pdf-viewer/index.js +2 -0
  398. package/resources/pdf-viewer/libEmbeddedPdfHandler.js +279 -0
  399. package/resources/pdf-viewer/libmablPdfViewer.js +21909 -0
  400. package/resources/pdf-viewer/mabl_attention_move.gif +0 -0
  401. package/resources/pdf-viewer/mabl_error_artwork_Unplugged.gif +0 -0
  402. package/resources/pdf-viewer/pdf.worker.9251738a897f697389be.js +2 -0
  403. package/resources/pdf-viewer/pdf.worker.9e2021092643447a5b9f.js +81 -0
  404. package/resources/popupDismissal.js +1 -0
  405. package/resources/webdriver.js +19 -0
  406. package/socketTunnel/index.js +2 -0
  407. package/socketTunnel/index.js.LICENSE.txt +68 -0
  408. package/upload/index.js +2 -0
  409. package/upload/index.js.LICENSE.txt +27 -0
  410. package/util/CloudStorageWriter.js +45 -0
  411. package/util/FileCache.js +180 -0
  412. package/util/IdentifierUtil.js +57 -0
  413. package/util/InternalMetricsTrackingSingleton.js +36 -0
  414. package/util/Lazy.js +90 -0
  415. package/util/MobileAppFileCache.js +103 -0
  416. package/util/RichPromise.js +53 -0
  417. package/util/TestOutputWriter.js +104 -0
  418. package/util/actionabilityUtil.js +165 -0
  419. package/util/analytics-events.js +14 -0
  420. package/util/analytics.js +176 -0
  421. package/util/asyncUtil.js +61 -0
  422. package/util/browserTestUtils.js +17 -0
  423. package/util/clickUtil.js +68 -0
  424. package/util/downloadUtil.js +87 -0
  425. package/util/encodingUtil.js +50 -0
  426. package/util/fileUploadUtil.js +146 -0
  427. package/util/javaScriptStepMigration.js +115 -0
  428. package/util/jestUtil.js +21 -0
  429. package/util/logUtils.js +131 -0
  430. package/util/markdownUtil.js +125 -0
  431. package/util/postInstallMessage.js +14 -0
  432. package/util/pureUtil.js +175 -0
  433. package/util/resourceUtil.js +90 -0
  434. package/util/timeUtil.js +31 -0
  435. package/utilities.js +7 -0
  436. package/webdriver/index.js +44 -0
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnterAuthCodeStep = void 0;
4
+ const FindAction_1 = require("../actions/FindAction");
5
+ const MablStep_1 = require("../MablStep");
6
+ const domUtil_1 = require("../../domUtil");
7
+ const ActionsUtils_1 = require("./ActionsUtils");
8
+ class EnterAuthCodeStep extends MablStep_1.MablStep {
9
+ constructor(name, args, actions) {
10
+ super(name, args, actions, EnterAuthCodeStep.stepName);
11
+ this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
12
+ }
13
+ getStepName() {
14
+ return 'EnterAuthCode';
15
+ }
16
+ toStepDescriptor() {
17
+ const find = this.findAction.toDescriptor();
18
+ switch (find.findType) {
19
+ case domUtil_1.FindType.FIND_FIRST:
20
+ case domUtil_1.FindType.FIND_LAST:
21
+ case domUtil_1.FindType.FIND_ANY:
22
+ case domUtil_1.FindType.FIND_ONE:
23
+ return {
24
+ find,
25
+ descriptorToActionMap: new Map().set(find, this.findAction),
26
+ actionCode: this.actionCode,
27
+ };
28
+ default:
29
+ throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
30
+ }
31
+ }
32
+ getFormattedStep(_fullLocatorsOn) {
33
+ const step = {
34
+ EnterAuthCode: {
35
+ ...super.annotationsAsYml(),
36
+ ...this.findAction.toYaml(),
37
+ },
38
+ };
39
+ if (this.stepId()) {
40
+ step.EnterAuthCode.id = this.stepId();
41
+ }
42
+ return step;
43
+ }
44
+ static fromYaml(_stepName, stepArgs) {
45
+ const step = new EnterAuthCodeStep(EnterAuthCodeStep.stepName, [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
46
+ step.setStepId(stepArgs.id);
47
+ return step;
48
+ }
49
+ toMablscript() {
50
+ return `${this.findAction.toMablscript()}.enter_auth_code()`;
51
+ }
52
+ getInputVariables() {
53
+ return this.findAction.getInputVariables();
54
+ }
55
+ }
56
+ exports.EnterAuthCodeStep = EnterAuthCodeStep;
57
+ EnterAuthCodeStep.stepName = 'enter_auth_code';
58
+ EnterAuthCodeStep.mablScriptStepNames = [EnterAuthCodeStep.stepName];
59
+ EnterAuthCodeStep.yamlMablScriptNames = ['EnterAuthCode'];
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnterTextStep = void 0;
4
+ const FindAction_1 = require("../actions/FindAction");
5
+ const MablAction_1 = require("../MablAction");
6
+ const MablStep_1 = require("../MablStep");
7
+ const domUtil_1 = require("../../domUtil");
8
+ class EnterTextStep extends MablStep_1.MablStep {
9
+ constructor(name, args, actions) {
10
+ super(name, args, actions, 'enter_text');
11
+ const arg = this.getActionArgs()[0];
12
+ this.text = (0, MablAction_1.parseArgument)(arg);
13
+ this.validate();
14
+ if ((0, domUtil_1.isFindElementType)(this.actions[0].getActionName())) {
15
+ this.findAction = this.actions[0];
16
+ }
17
+ else {
18
+ throw new Error(`Unexpected find action for ${name} step: ${JSON.stringify(this.actions[0])}`);
19
+ }
20
+ }
21
+ validate() {
22
+ if (this.actions.length !== 1 && !(this.actions[0] instanceof FindAction_1.FindAction)) {
23
+ throw new Error('Enter text steps should have exactly on sub action and it should be a find');
24
+ }
25
+ }
26
+ getStepName() {
27
+ return 'EnterText';
28
+ }
29
+ toStepDescriptor() {
30
+ const find = this.findAction.toDescriptor();
31
+ switch (find.findType) {
32
+ case domUtil_1.FindType.FIND_FIRST:
33
+ case domUtil_1.FindType.FIND_LAST:
34
+ case domUtil_1.FindType.FIND_ANY:
35
+ case domUtil_1.FindType.FIND_ONE:
36
+ return {
37
+ find,
38
+ descriptorToActionMap: new Map().set(find, this.findAction),
39
+ text: this.text,
40
+ actionCode: this.actionCode,
41
+ };
42
+ default:
43
+ throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
44
+ }
45
+ }
46
+ getFormattedStep() {
47
+ var _a;
48
+ const step = this.toStepDescriptor();
49
+ const stepName = this.getStepName();
50
+ const formatted = {
51
+ [stepName]: {},
52
+ };
53
+ if (this.annotationsOnStep()) {
54
+ formatted[stepName].annotation = this.annotation;
55
+ }
56
+ if (this.description) {
57
+ formatted[stepName].description = this.description;
58
+ }
59
+ if (step.find.findType === domUtil_1.FindType.FIND_ONE) {
60
+ formatted[stepName].selector = step.find.findTarget.selector;
61
+ if ((_a = step.find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
62
+ formatted[stepName].selectorAncestors =
63
+ step.find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
64
+ }
65
+ }
66
+ else {
67
+ formatted[stepName].selector = step.find.findTarget;
68
+ }
69
+ formatted[stepName].findType = FindAction_1.findTypesToFormattedType[step.find.findType];
70
+ formatted[stepName].text = this.text.toString();
71
+ if (this.stepId()) {
72
+ formatted[stepName].id = this.stepId();
73
+ }
74
+ return formatted;
75
+ }
76
+ static fromYaml(_stepName, stepArgs) {
77
+ const step = new EnterTextStep('enter_text', [stepArgs.text], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
78
+ step.setStepId(stepArgs.id);
79
+ return step;
80
+ }
81
+ toMablscript() {
82
+ const enterText = typeof this.text === 'string'
83
+ ? `"${(0, domUtil_1.escapeMablscriptString)(this.text)}"`
84
+ : this.substituteMablscriptVariable(this.text);
85
+ return `${this.findAction.toMablscript()}.enter_text(${enterText})`;
86
+ }
87
+ getInputVariables() {
88
+ return (0, MablAction_1.distinctStrings)([
89
+ ...this.findAction.getInputVariables(),
90
+ ...MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.text),
91
+ ]);
92
+ }
93
+ }
94
+ exports.EnterTextStep = EnterTextStep;
95
+ EnterTextStep.mablScriptStepNames = ['enter_text'];
96
+ EnterTextStep.yamlMablScriptNames = ['EnterText'];
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEvaluateFlowStep = exports.EvaluateFlowStep = exports.EVALUATE_FLOW_STEP_NAME = void 0;
4
+ const domUtil_1 = require("../../domUtil");
5
+ const MablStep_1 = require("../MablStep");
6
+ exports.EVALUATE_FLOW_STEP_NAME = 'EvaluateFlow';
7
+ class EvaluateFlowStep extends MablStep_1.MablStep {
8
+ constructor(name, args, actions) {
9
+ super(name, args, actions, 'evaluate_flow');
10
+ if (args.length < 1 || args.length > 2) {
11
+ throw new Error('EvaluateFlowStep expects 1 or 2 arguments');
12
+ }
13
+ this.flowDescriptor = this.getActionArgs()[0];
14
+ if (args.length === 2) {
15
+ this.config = this.getActionArgs()[1];
16
+ }
17
+ }
18
+ getStepName() {
19
+ return exports.EVALUATE_FLOW_STEP_NAME;
20
+ }
21
+ toStepDescriptor() {
22
+ return {
23
+ descriptor: this.flowDescriptor,
24
+ config: this.config,
25
+ actionCode: this.actionCode,
26
+ };
27
+ }
28
+ static fromYaml(_stepName, stepArgs) {
29
+ const { descriptor, config } = stepArgs;
30
+ const step = new EvaluateFlowStep(EvaluateFlowStep.mablScriptStepNames[0], [descriptor, config], []);
31
+ step.setStepId(stepArgs.id);
32
+ return step;
33
+ }
34
+ toMablscript() {
35
+ const flowReference = (0, domUtil_1.buildStepArgumentString)({
36
+ params: { ...this.flowDescriptor },
37
+ legacy: true,
38
+ });
39
+ const flowConfig = this.config
40
+ ? ', ' + (0, domUtil_1.buildStepArgumentString)({ params: { ...this.config }, legacy: true })
41
+ : '';
42
+ return `${EvaluateFlowStep.mablScriptStepNames[0]}(${flowReference}${flowConfig})`;
43
+ }
44
+ }
45
+ exports.EvaluateFlowStep = EvaluateFlowStep;
46
+ EvaluateFlowStep.mablScriptStepNames = ['evaluate_flow'];
47
+ EvaluateFlowStep.yamlMablScriptNames = [exports.EVALUATE_FLOW_STEP_NAME];
48
+ function isEvaluateFlowStep(step) {
49
+ return (step === null || step === void 0 ? void 0 : step.getStepName()) === exports.EVALUATE_FLOW_STEP_NAME;
50
+ }
51
+ exports.isEvaluateFlowStep = isEvaluateFlowStep;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEvaluateJavaScriptStep = exports.EvaluateJavaScriptStep = void 0;
4
+ const MablStep_1 = require("../MablStep");
5
+ const JavaScriptAction_1 = require("../actions/JavaScriptAction");
6
+ const STEP_NAME = 'EvaluateJavaScript';
7
+ class EvaluateJavaScriptStep extends MablStep_1.MablStep {
8
+ constructor(name, args, actions) {
9
+ super(name, args, actions || [], 'evaluate_js');
10
+ this.evaluateJsAction = new JavaScriptAction_1.JavaScriptAction(JavaScriptAction_1.JavaScriptAction.mablscriptName, args);
11
+ }
12
+ getStepName() {
13
+ return STEP_NAME;
14
+ }
15
+ toStepDescriptor() {
16
+ return this.evaluateJsAction.toDescriptor();
17
+ }
18
+ getFormattedStep() {
19
+ const step = {
20
+ [STEP_NAME]: {
21
+ ...super.annotationsAsYml(),
22
+ ...this.evaluateJsAction.toYaml(),
23
+ },
24
+ };
25
+ if (this.stepId()) {
26
+ step[STEP_NAME].id = this.stepId();
27
+ }
28
+ return step;
29
+ }
30
+ static fromYaml(_stepName, stepArgs) {
31
+ const evaluateJsAction = JavaScriptAction_1.JavaScriptAction.fromYaml(stepArgs);
32
+ const step = new EvaluateJavaScriptStep(evaluateJsAction.name, evaluateJsAction.args);
33
+ step.setStepId(stepArgs.id);
34
+ return step;
35
+ }
36
+ toMablscript() {
37
+ return this.evaluateJsAction.toMablscript();
38
+ }
39
+ getInputVariables() {
40
+ return this.evaluateJsAction.getInputVariables();
41
+ }
42
+ }
43
+ exports.EvaluateJavaScriptStep = EvaluateJavaScriptStep;
44
+ EvaluateJavaScriptStep.stepName = STEP_NAME;
45
+ EvaluateJavaScriptStep.mablScriptStepNames = [JavaScriptAction_1.JavaScriptAction.mablscriptName];
46
+ EvaluateJavaScriptStep.yamlMablScriptNames = [STEP_NAME];
47
+ function isEvaluateJavaScriptStep(value) {
48
+ return (value === null || value === void 0 ? void 0 : value.getStepName) && (value === null || value === void 0 ? void 0 : value.getStepName()) === STEP_NAME;
49
+ }
50
+ exports.isEvaluateJavaScriptStep = isEvaluateJavaScriptStep;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HoverStep = void 0;
4
+ const FindAction_1 = require("../actions/FindAction");
5
+ const MablStep_1 = require("../MablStep");
6
+ const domUtil_1 = require("../../domUtil");
7
+ class HoverStep extends MablStep_1.MablStep {
8
+ constructor(name, args, actions) {
9
+ super(name, args, actions, 'hover');
10
+ this.validate();
11
+ this.findAction = this.actions[0];
12
+ }
13
+ validate() {
14
+ if (this.actions.length !== 1 && !(this.actions[0] instanceof FindAction_1.FindAction)) {
15
+ throw new Error('Hover steps should have exactly on sub action and it should be a find');
16
+ }
17
+ }
18
+ getStepName() {
19
+ return 'Hover';
20
+ }
21
+ toStepDescriptor() {
22
+ const find = this.findAction.toDescriptor();
23
+ switch (find.findType) {
24
+ case domUtil_1.FindType.FIND_FIRST:
25
+ case domUtil_1.FindType.FIND_LAST:
26
+ case domUtil_1.FindType.FIND_ANY:
27
+ case domUtil_1.FindType.FIND_ONE:
28
+ return {
29
+ find,
30
+ descriptorToActionMap: new Map().set(find, this.findAction),
31
+ actionCode: this.actionCode,
32
+ };
33
+ default:
34
+ throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
35
+ }
36
+ }
37
+ getFormattedStep(_fullLocatorsOn) {
38
+ const step = {
39
+ Hover: {
40
+ ...super.annotationsAsYml(),
41
+ ...this.findAction.toYaml(),
42
+ },
43
+ };
44
+ if (this.stepId()) {
45
+ step.Hover.id = this.stepId();
46
+ }
47
+ return step;
48
+ }
49
+ static fromYaml(_stepName, stepArgs) {
50
+ const step = new HoverStep('hover', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
51
+ step.setStepId(stepArgs.id);
52
+ return step;
53
+ }
54
+ toMablscript() {
55
+ return `${this.findAction.toMablscript()}.hover()`;
56
+ }
57
+ getInputVariables() {
58
+ return this.findAction.getInputVariables();
59
+ }
60
+ }
61
+ exports.HoverStep = HoverStep;
62
+ HoverStep.mablScriptStepNames = ['hover'];
63
+ HoverStep.yamlMablScriptNames = ['Hover'];
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIfConditionStep = exports.IfConditionStep = void 0;
4
+ const ConditionAction_1 = require("../actions/ConditionAction");
5
+ const GetVariableValue_1 = require("../actions/GetVariableValue");
6
+ const AssertStep_1 = require("./AssertStep");
7
+ const FindAction_1 = require("../actions/FindAction");
8
+ const MablAction_1 = require("../MablAction");
9
+ const MablStep_1 = require("../MablStep");
10
+ const ExtractAction_1 = require("../actions/ExtractAction");
11
+ const domUtil_1 = require("../../domUtil");
12
+ const JavaScriptAction_1 = require("../actions/JavaScriptAction");
13
+ const GetUrlAction_1 = require("../actions/GetUrlAction");
14
+ const ConditionDescriptor_1 = require("../types/ConditionDescriptor");
15
+ class IfConditionStep extends MablStep_1.MablStep {
16
+ constructor(name, args, actions) {
17
+ super(name, args, actions, 'conditional_if');
18
+ const candidatePrimaryActions = actions.filter((action) => action instanceof FindAction_1.FindAction ||
19
+ action instanceof GetVariableValue_1.GetVariableValue ||
20
+ action instanceof GetUrlAction_1.GetUrlAction ||
21
+ action instanceof JavaScriptAction_1.JavaScriptAction);
22
+ if (candidatePrimaryActions.length > 1) {
23
+ throw new Error(`Too many primary actions. Only one primary action is allowed of: Find, Get Url, Get Variable, or Javascript actions`);
24
+ }
25
+ if (candidatePrimaryActions[0] === undefined) {
26
+ throw new Error(`At least one primary action is required: Find, Get Url, Get Variable, or Javascript action.`);
27
+ }
28
+ this.primaryAction = candidatePrimaryActions[0];
29
+ this.conditionAction = actions.find((action) => action instanceof ConditionAction_1.ConditionAction);
30
+ this.extractAction = actions.find((action) => action instanceof ExtractAction_1.ExtractAction);
31
+ }
32
+ getStepName() {
33
+ return 'If';
34
+ }
35
+ toStepDescriptor() {
36
+ var _a, _b;
37
+ const conditionDescriptor = this.conditionAction !== undefined
38
+ ? (_a = this.conditionAction) === null || _a === void 0 ? void 0 : _a.conditionDescriptor
39
+ : { conditionType: ConditionDescriptor_1.ConditionType.Truthy };
40
+ const find = this.primaryAction.toDescriptor();
41
+ return {
42
+ find,
43
+ extractDescriptor: (_b = this.extractAction) === null || _b === void 0 ? void 0 : _b.extractDescriptor,
44
+ conditionDescriptor,
45
+ onFailure: AssertStep_1.OnFailure.FailImmediately,
46
+ descriptorToActionMap: new Map().set(find, this.primaryAction),
47
+ actionCode: this.actionCode,
48
+ };
49
+ }
50
+ getFormattedStep(_fullLocatorsOn) {
51
+ const result = {};
52
+ result[this.getStepName()] = this.toYamlConditionDetails();
53
+ if (this.stepId()) {
54
+ result[this.getStepName()].id = this.stepId();
55
+ }
56
+ return result;
57
+ }
58
+ toYamlConditionDetails() {
59
+ const details = {
60
+ ...super.annotationsAsYml(),
61
+ };
62
+ if (this.conditionAction) {
63
+ details.condition =
64
+ ConditionDescriptor_1.AssertionConditionFieldToStepName[(0, ConditionDescriptor_1.getAssertionConditionFieldFromDescriptor)(this.conditionAction.conditionDescriptor)];
65
+ details.conditionValue = (0, ConditionDescriptor_1.getOptionalComparatorValue)(this.conditionAction.conditionDescriptor);
66
+ const optionalConditionOptions = (0, ConditionDescriptor_1.getOptionalConditionOptions)(this.conditionAction.conditionDescriptor);
67
+ details.conditionOptions = this.conditionAction.hasOptionsAtInstantiation
68
+ ? optionalConditionOptions
69
+ : undefined;
70
+ if (this.conditionAction.conditionDescriptor.conditionType ===
71
+ ConditionDescriptor_1.ConditionType.AIPrompt) {
72
+ details.aiPrompt = {
73
+ userPrompt: this.conditionAction.conditionDescriptor.userPrompt,
74
+ metaPrompt: this.conditionAction.conditionDescriptor.metaPrompt,
75
+ criteria: this.conditionAction.conditionDescriptor.criteria,
76
+ };
77
+ }
78
+ }
79
+ if (this.primaryAction instanceof GetVariableValue_1.GetVariableValue) {
80
+ details.variableName = this.substituteMablscriptVariable(this.primaryAction.variable);
81
+ }
82
+ if (this.primaryAction instanceof JavaScriptAction_1.JavaScriptAction) {
83
+ const jsYaml = JavaScriptAction_1.JavaScriptAction.toYamlFromJavaScriptDescriptor(this.primaryAction.javaScript);
84
+ if (jsYaml.snippet) {
85
+ details.snippet = jsYaml.snippet;
86
+ details.snippet.parameterOverrides = jsYaml.parameterOverrides;
87
+ }
88
+ else {
89
+ details.snippet = jsYaml;
90
+ }
91
+ }
92
+ if (this.extractAction) {
93
+ details.attribute = this.extractAction.extractionAttribute;
94
+ }
95
+ if (this.primaryAction instanceof FindAction_1.FindAction) {
96
+ const find = this.primaryAction.toDescriptor();
97
+ switch (find.findType) {
98
+ case domUtil_1.FindType.FIND_FIRST:
99
+ case domUtil_1.FindType.FIND_LAST:
100
+ case domUtil_1.FindType.FIND_ANY:
101
+ case domUtil_1.FindType.FIND_ALL:
102
+ details.selector = find.findTarget;
103
+ break;
104
+ case domUtil_1.FindType.FIND_ONE:
105
+ details.selector = find.findTarget.selector;
106
+ if (find.findOptions) {
107
+ details.findOptions = find.findOptions;
108
+ }
109
+ break;
110
+ }
111
+ }
112
+ return details;
113
+ }
114
+ static getActionsFromYamlForCondition(stepArgs) {
115
+ var _a, _b, _c, _d, _e;
116
+ const actions = [];
117
+ if (stepArgs.selector) {
118
+ const findAction = FindAction_1.FindAction.findActionFromStepArgs(stepArgs);
119
+ actions.push(findAction);
120
+ }
121
+ if (stepArgs.attribute) {
122
+ const extractArgs = stepArgs.metadata
123
+ ? [stepArgs.attribute, stepArgs.metadata]
124
+ : [stepArgs.attribute];
125
+ actions.push(new ExtractAction_1.ExtractAction('extract_attribute', extractArgs));
126
+ }
127
+ if (stepArgs.variableName) {
128
+ actions.push(new GetVariableValue_1.GetVariableValue('get_variable_value', [
129
+ `{{@${stepArgs.variableName}}}`,
130
+ ]));
131
+ }
132
+ if (stepArgs.snippet) {
133
+ actions.push(JavaScriptAction_1.JavaScriptAction.fromYaml(stepArgs.snippet));
134
+ }
135
+ if (stepArgs.condition) {
136
+ const conditionType = ConditionDescriptor_1.AssertionStepNameToField[stepArgs.condition];
137
+ if (conditionType === 'ai_prompt') {
138
+ actions.push(new ConditionAction_1.ConditionAction(this.getConditionActionNameForConditionType(conditionType), [
139
+ (_b = (_a = stepArgs.aiPrompt) === null || _a === void 0 ? void 0 : _a.userPrompt) !== null && _b !== void 0 ? _b : stepArgs.userPrompt,
140
+ {
141
+ metaPrompt: (_d = (_c = stepArgs.aiPrompt) === null || _c === void 0 ? void 0 : _c.metaPrompt) !== null && _d !== void 0 ? _d : stepArgs.metaPrompt,
142
+ criteria: (_e = stepArgs.aiPrompt) === null || _e === void 0 ? void 0 : _e.criteria,
143
+ },
144
+ ]));
145
+ }
146
+ else {
147
+ actions.push(new ConditionAction_1.ConditionAction(this.getConditionActionNameForConditionType(conditionType), [
148
+ ConditionDescriptor_1.AssertionStepNameToField[stepArgs.condition],
149
+ stepArgs.conditionValue,
150
+ stepArgs.conditionOptions,
151
+ ]));
152
+ }
153
+ }
154
+ return actions;
155
+ }
156
+ static getConditionActionNameForConditionType(conditionType) {
157
+ if (conditionType === 'present' || conditionType === 'not_present') {
158
+ return 'evaluate_presence';
159
+ }
160
+ else if (conditionType === 'ai_prompt') {
161
+ return 'evaluate_ai_prompt';
162
+ }
163
+ return 'evaluate_condition';
164
+ }
165
+ static fromYaml(_stepName, stepArgs) {
166
+ const actions = IfConditionStep.getActionsFromYamlForCondition(stepArgs);
167
+ const step = new IfConditionStep('conditional_if', [], actions);
168
+ step.setStepId(stepArgs.id);
169
+ return step;
170
+ }
171
+ toMablscript() {
172
+ return `${this.actions.reduce((mablscript, action) => `${mablscript}${action.toMablscript()}.`, '')}conditional_if()`;
173
+ }
174
+ getInputVariables() {
175
+ var _a, _b, _c, _d;
176
+ return (0, MablAction_1.distinctStrings)([
177
+ ...this.primaryAction.getInputVariables(),
178
+ ...((_b = (_a = this.conditionAction) === null || _a === void 0 ? void 0 : _a.getInputVariables()) !== null && _b !== void 0 ? _b : []),
179
+ ...((_d = (_c = this.extractAction) === null || _c === void 0 ? void 0 : _c.getInputVariables()) !== null && _d !== void 0 ? _d : []),
180
+ ]);
181
+ }
182
+ }
183
+ exports.IfConditionStep = IfConditionStep;
184
+ IfConditionStep.stepName = 'conditional_if';
185
+ IfConditionStep.mablScriptStepNames = [IfConditionStep.stepName];
186
+ IfConditionStep.yamlMablScriptNames = ['If'];
187
+ function isIfConditionStep(value) {
188
+ return ((value === null || value === void 0 ? void 0 : value.getStepName) &&
189
+ (value === null || value === void 0 ? void 0 : value.getStepName()) === IfConditionStep.yamlMablScriptNames[0]);
190
+ }
191
+ exports.isIfConditionStep = isIfConditionStep;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigateStep = void 0;
4
+ const MablStep_1 = require("../MablStep");
5
+ class NavigateStep extends MablStep_1.MablStep {
6
+ constructor(name, args, actions) {
7
+ super(name, args, actions, 'navigate');
8
+ this.navigation = this.getActionArgs()[0];
9
+ }
10
+ getStepName() {
11
+ return 'Navigate';
12
+ }
13
+ toStepDescriptor() {
14
+ return {
15
+ navigation: this.navigation,
16
+ actionCode: this.actionCode,
17
+ };
18
+ }
19
+ static fromYaml(_stepName, stepArgs) {
20
+ const step = new NavigateStep('navigate', [stepArgs.navigation], []);
21
+ step.setStepId(stepArgs.id);
22
+ return step;
23
+ }
24
+ toMablscript() {
25
+ return `navigate("${this.navigation}")`;
26
+ }
27
+ }
28
+ exports.NavigateStep = NavigateStep;
29
+ NavigateStep.mablScriptStepNames = ['navigate'];
30
+ NavigateStep.yamlMablScriptNames = ['Navigate'];
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenEmailStep = void 0;
4
+ const FindAction_1 = require("../actions/FindAction");
5
+ const MablStep_1 = require("../MablStep");
6
+ class OpenEmailStep extends MablStep_1.MablStep {
7
+ constructor(name, args, actions) {
8
+ super(name, args, actions, OpenEmailStep.stepName);
9
+ this.tabUuid = this.getActionArgs()[0] || {};
10
+ this.validate();
11
+ this.findAction = this.actions[0];
12
+ }
13
+ validate() {
14
+ if (this.actions.length !== 1 && !(this.actions[0] instanceof FindAction_1.FindAction)) {
15
+ throw new Error('Open email steps should have exactly one sub action and it should be a find');
16
+ }
17
+ }
18
+ getStepName() {
19
+ return 'OpenEmail';
20
+ }
21
+ toStepDescriptor() {
22
+ const find = this.findAction.toDescriptor();
23
+ return {
24
+ tab: this.tabUuid,
25
+ selector: find.findTarget.selector,
26
+ findType: 'FindEmail',
27
+ configuration: find.findTarget.configuration,
28
+ actionCode: this.actionCode,
29
+ };
30
+ }
31
+ static fromYaml(_stepName, stepArgs) {
32
+ const step = new OpenEmailStep(OpenEmailStep.stepName, [stepArgs.tab], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
33
+ step.setStepId(stepArgs.id);
34
+ return step;
35
+ }
36
+ toMablscript() {
37
+ return `${this.findAction.toMablscript()}.open_email("${this.tabUuid}")`;
38
+ }
39
+ getInputVariables() {
40
+ return this.findAction.getInputVariables();
41
+ }
42
+ }
43
+ exports.OpenEmailStep = OpenEmailStep;
44
+ OpenEmailStep.stepName = 'open_email';
45
+ OpenEmailStep.mablScriptStepNames = [OpenEmailStep.stepName];
46
+ OpenEmailStep.yamlMablScriptNames = ['OpenEmail'];
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReleaseStep = void 0;
4
+ const FindAction_1 = require("../actions/FindAction");
5
+ const MablStep_1 = require("../MablStep");
6
+ const MablAction_1 = require("../MablAction");
7
+ const domUtil_1 = require("../../domUtil");
8
+ const ActionsUtils_1 = require("./ActionsUtils");
9
+ const ReleaseStepDescriptor_1 = require("../types/ReleaseStepDescriptor");
10
+ class ReleaseStep extends MablStep_1.MablStep {
11
+ constructor(name, args, actions) {
12
+ var _a;
13
+ super(name, args, actions, 'release');
14
+ this.findAction = ActionsUtils_1.ActionsUtils.validateSingleFindAction(this.actions);
15
+ this.releaseArgs = (_a = this.parseArgs(args)) !== null && _a !== void 0 ? _a : { isHtml5: false };
16
+ }
17
+ parseArgs(args) {
18
+ if (args.length === 0) {
19
+ return undefined;
20
+ }
21
+ if (args.length !== 1) {
22
+ throw new Error(`Unexpected number of arguments to ${this.getStepName()} step.`);
23
+ }
24
+ if (!(0, ReleaseStepDescriptor_1.isReleaseArgs)(args[0])) {
25
+ throw new Error(`Invalid argument passed to ${this.getStepName()} step.`);
26
+ }
27
+ return args[0];
28
+ }
29
+ getStepName() {
30
+ return 'Release';
31
+ }
32
+ toStepDescriptor() {
33
+ const find = this.findAction.toDescriptor();
34
+ switch (find.findType) {
35
+ case domUtil_1.FindType.FIND_FIRST:
36
+ case domUtil_1.FindType.FIND_LAST:
37
+ case domUtil_1.FindType.FIND_ANY:
38
+ case domUtil_1.FindType.FIND_ONE:
39
+ return {
40
+ find,
41
+ descriptorToActionMap: new Map().set(find, this.findAction),
42
+ actionCode: this.actionCode,
43
+ releaseArgs: this.releaseArgs,
44
+ };
45
+ default:
46
+ throw new Error(`Error generating step descriptor for ${this.getStepName()}: Unexpected find type ${find.findType}`);
47
+ }
48
+ }
49
+ getFormattedStep(_fullLocatorsOn) {
50
+ const step = {
51
+ Release: {
52
+ ...super.annotationsAsYml(),
53
+ ...this.findAction.toYaml(),
54
+ },
55
+ };
56
+ if (this.stepId()) {
57
+ step.Release.id = this.stepId();
58
+ }
59
+ return step;
60
+ }
61
+ static fromYaml(_stepName, stepArgs) {
62
+ const step = new ReleaseStep('release', [], [FindAction_1.FindAction.findActionFromStepArgs(stepArgs)]);
63
+ step.setStepId(stepArgs.id);
64
+ return step;
65
+ }
66
+ toMablscript() {
67
+ const args = (0, MablAction_1.convertObjectToMablscriptArgs)(this.releaseArgs);
68
+ return `${this.findAction.toMablscript()}.release(${args})`;
69
+ }
70
+ getInputVariables() {
71
+ return this.findAction.getInputVariables();
72
+ }
73
+ }
74
+ exports.ReleaseStep = ReleaseStep;
75
+ ReleaseStep.mablScriptStepNames = ['release'];
76
+ ReleaseStep.yamlMablScriptNames = ['Release'];