@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,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.maybeOutputToBitbucket = exports.putCodeReportAndAnnotations = exports.generateCodeAnnotationsForReport = exports.generateCodeReportForCommit = void 0;
4
+ const CodeReport_1 = require("../../api/atlassian/entities/CodeReport");
5
+ const moment = require("moment");
6
+ const bitBucketApiClient_1 = require("../../api/atlassian/bitBucketApiClient");
7
+ const CodeAnnotation_1 = require("../../api/atlassian/entities/CodeAnnotation");
8
+ const loggingProvider_1 = require("../../providers/logging/loggingProvider");
9
+ const logUtils_1 = require("../../util/logUtils");
10
+ const pureUtil_1 = require("../../util/pureUtil");
11
+ const chalk = require('chalk');
12
+ const bitbucketUserKey = 'MABL_BITBUCKET_USER';
13
+ const bitbucketAppToken = 'MABL_BITBUCKET_APP_TOKEN';
14
+ function generateCodeReportForCommit(executionEventId, outputLink, executionResult) {
15
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
16
+ const codeReport = {
17
+ report_type: CodeReport_1.CodeReportType.TEST,
18
+ external_id: `${executionEventId}-cr`,
19
+ title: `mabl tests`,
20
+ details: `mabl tests for mabl deployment ${executionEventId}`,
21
+ result: ((_a = executionResult.event_status) === null || _a === void 0 ? void 0 : _a.succeeded)
22
+ ? CodeReport_1.CodeInsightsResult.PASSED
23
+ : CodeReport_1.CodeInsightsResult.FAILED,
24
+ reporter: `mabl`,
25
+ link: outputLink,
26
+ logo_url: 'https://storage.cloud.google.com/mabl-email-static-assets/mabl_logo.png',
27
+ created_on: moment().toISOString(),
28
+ };
29
+ codeReport.data = [
30
+ {
31
+ title: 'mabl App',
32
+ type: 'LINK',
33
+ value: {
34
+ text: 'View results',
35
+ href: outputLink,
36
+ },
37
+ },
38
+ {
39
+ title: 'Plans run',
40
+ type: 'NUMBER',
41
+ value: (_b = executionResult.plan_execution_metrics) === null || _b === void 0 ? void 0 : _b.total,
42
+ },
43
+ {
44
+ title: 'Plans failed',
45
+ type: 'NUMBER',
46
+ value: (_c = executionResult.plan_execution_metrics) === null || _c === void 0 ? void 0 : _c.failed,
47
+ },
48
+ {
49
+ title: 'Tests run',
50
+ type: 'NUMBER',
51
+ value: (_d = executionResult.journey_execution_metrics) === null || _d === void 0 ? void 0 : _d.total,
52
+ },
53
+ {
54
+ title: 'Tests failed',
55
+ type: 'NUMBER',
56
+ value: (_e = executionResult.journey_execution_metrics) === null || _e === void 0 ? void 0 : _e.failed,
57
+ },
58
+ ];
59
+ if ((_g = (_f = executionResult.journey_execution_metrics) === null || _f === void 0 ? void 0 : _f.total) !== null && _g !== void 0 ? _g : 0 > 0) {
60
+ const percentPassing = parseFloat(((((_j = (_h = executionResult.journey_execution_metrics) === null || _h === void 0 ? void 0 : _h.passed) !== null && _j !== void 0 ? _j : 0) /
61
+ ((_l = (_k = executionResult.journey_execution_metrics) === null || _k === void 0 ? void 0 : _k.total) !== null && _l !== void 0 ? _l : 1)) *
62
+ 100).toFixed(2));
63
+ codeReport.data.push({
64
+ title: 'Tests passing percent',
65
+ type: 'PERCENTAGE',
66
+ value: percentPassing,
67
+ });
68
+ }
69
+ if (executionResult.executions) {
70
+ const minStartTimes = [];
71
+ executionResult.executions.forEach((execution) => {
72
+ if (execution.start_time) {
73
+ minStartTimes.push(execution.start_time);
74
+ }
75
+ });
76
+ const maxStartTimes = [];
77
+ executionResult.executions.forEach((execution) => {
78
+ if (execution.stop_time) {
79
+ maxStartTimes.push(execution.stop_time);
80
+ }
81
+ });
82
+ if (maxStartTimes && minStartTimes) {
83
+ const duration = Math.max(...maxStartTimes) - Math.min(...minStartTimes);
84
+ codeReport.data.push({
85
+ title: 'Total duration',
86
+ type: 'DURATION',
87
+ value: duration,
88
+ });
89
+ }
90
+ }
91
+ return codeReport;
92
+ }
93
+ exports.generateCodeReportForCommit = generateCodeReportForCommit;
94
+ function generateCodeAnnotationsForReport(executionResult) {
95
+ const codeAnnotations = [];
96
+ if (executionResult.executions) {
97
+ executionResult.executions.forEach((execution) => {
98
+ if (execution.journey_executions) {
99
+ execution.journey_executions.forEach((testExecution) => {
100
+ const codeAnnotation = {
101
+ external_id: `${testExecution.journey_execution_id}-ca`,
102
+ annotation_type: CodeAnnotation_1.CodeInsightsAnnotationType.BUG,
103
+ summary: generateAnnotationSummary(testExecution, execution.journeys),
104
+ result: testExecution.success
105
+ ? CodeReport_1.CodeInsightsResult.PASSED
106
+ : CodeReport_1.CodeInsightsResult.FAILED,
107
+ details: generateAnnotationDetails(testExecution),
108
+ link: testExecution.app_href,
109
+ created_on: moment(testExecution.stop_time).toISOString(),
110
+ };
111
+ codeAnnotations.push(codeAnnotation);
112
+ });
113
+ }
114
+ });
115
+ }
116
+ return codeAnnotations;
117
+ }
118
+ exports.generateCodeAnnotationsForReport = generateCodeAnnotationsForReport;
119
+ function generateAnnotationDetails(testExecution) {
120
+ var _a;
121
+ if (testExecution.success) {
122
+ return `Test was successful - Browser: "${testExecution.browser_type}"`;
123
+ }
124
+ return `Failure Error: "${(_a = testExecution.failure_summary) === null || _a === void 0 ? void 0 : _a.error}" - Browser: "${testExecution.browser_type}"`;
125
+ }
126
+ function generateAnnotationSummary(testExecution, journeySummaries) {
127
+ let testForAnnotation;
128
+ if (journeySummaries) {
129
+ testForAnnotation = journeySummaries.find((test) => test.id === testExecution.journey_id);
130
+ }
131
+ if (testForAnnotation) {
132
+ return `${testForAnnotation.name}`;
133
+ }
134
+ return `"${testExecution.journey_id}" test finished with status ${testExecution.status}`;
135
+ }
136
+ async function putCodeReportAndAnnotations(executionResult, executionEventId, outputLink, workspace, repoSlug, node, isCustomBitBucketPipe, noProxy) {
137
+ const codeReport = generateCodeReportForCommit(executionEventId, outputLink, executionResult);
138
+ const bitBucketApiClient = getBitBucketApiClient(isCustomBitBucketPipe, noProxy);
139
+ const codeReportResponse = await bitBucketApiClient.putCodeReport(codeReport, workspace, repoSlug, node);
140
+ const codeAnnotations = generateCodeAnnotationsForReport(executionResult);
141
+ const requests = codeAnnotations.map((annotation) => bitBucketApiClient.putCodeAnnotation(annotation, workspace, repoSlug, node, codeReportResponse.external_id));
142
+ const results = await Promise.allSettled(requests);
143
+ (0, logUtils_1.logPromiseSettledRejections)(results);
144
+ if (results.some(pureUtil_1.isRejectedPromise)) {
145
+ throw new Error('Error writing Code Annotations to Bitbucket');
146
+ }
147
+ return codeReportResponse;
148
+ }
149
+ exports.putCodeReportAndAnnotations = putCodeReportAndAnnotations;
150
+ async function maybeOutputToBitbucket(executionResult, deploymentId, outputLink) {
151
+ var _a, _b, _c, _d;
152
+ const repoSlug = (_a = process.env.BITBUCKET_REPO_SLUG) !== null && _a !== void 0 ? _a : '';
153
+ const workspace = (_b = process.env.BITBUCKET_REPO_OWNER) !== null && _b !== void 0 ? _b : '';
154
+ const node = (_c = process.env.BITBUCKET_COMMIT) !== null && _c !== void 0 ? _c : '';
155
+ const isCustomBitBucketPipe = process.env.IS_CUSTOM_BITBUCKET_PIPE === 'true';
156
+ const noProxy = process.env.CODE_INSIGHTS_PROXY_OFF === 'true';
157
+ if (repoSlug &&
158
+ workspace &&
159
+ node &&
160
+ ((_d = executionResult === null || executionResult === void 0 ? void 0 : executionResult.executions) === null || _d === void 0 ? void 0 : _d.length) &&
161
+ executionResult.executions.length > 0) {
162
+ const codeReport = await putCodeReportAndAnnotations(executionResult, deploymentId, outputLink, workspace, repoSlug, node, isCustomBitBucketPipe, noProxy);
163
+ loggingProvider_1.logger.info(chalk.cyan(`Bitbucket Code Insights Report generated ${codeReport.uuid}`));
164
+ }
165
+ return;
166
+ }
167
+ exports.maybeOutputToBitbucket = maybeOutputToBitbucket;
168
+ function getBitBucketApiClient(isCustomPipe, noProxy) {
169
+ if (noProxy) {
170
+ const username = process.env[bitbucketUserKey];
171
+ const token = process.env[bitbucketAppToken];
172
+ if (!username || !token) {
173
+ throw new Error(`Auth config not supplied for Bitbucket output. Please define ${bitbucketUserKey} and ${bitbucketAppToken} environment variables`);
174
+ }
175
+ return new bitBucketApiClient_1.BitBucketApiClient(username, token, isCustomPipe, noProxy);
176
+ }
177
+ if (isCustomPipe) {
178
+ return new bitBucketApiClient_1.BitBucketApiClient('', '', isCustomPipe, noProxy);
179
+ }
180
+ return new bitBucketApiClient_1.BitBucketApiClient('', '', isCustomPipe, noProxy);
181
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.outputEntity = exports.getDescribeBuilderOptions = void 0;
4
+ const js_yaml_1 = require("js-yaml");
5
+ const loggingProvider_1 = require("../../providers/logging/loggingProvider");
6
+ const constants_1 = require("../constants");
7
+ function getDescribeBuilderOptions() {
8
+ return {
9
+ [constants_1.CommandArgOutput]: {
10
+ describe: `Specify output format`,
11
+ alias: constants_1.CommandArgAliases.OutputType,
12
+ choices: [constants_1.OutputFormats.Json, constants_1.OutputFormats.Yaml],
13
+ },
14
+ };
15
+ }
16
+ exports.getDescribeBuilderOptions = getDescribeBuilderOptions;
17
+ function outputEntity(entity, outputMode) {
18
+ loggingProvider_1.logger.logNewLine();
19
+ let content;
20
+ switch (outputMode) {
21
+ case constants_1.OutputFormats.Json:
22
+ content = JSON.stringify(entity, null, 2);
23
+ break;
24
+ case constants_1.OutputFormats.Yaml:
25
+ default:
26
+ content = (0, js_yaml_1.dump)(entity);
27
+ break;
28
+ }
29
+ loggingProvider_1.logger.info(content);
30
+ return content;
31
+ }
32
+ exports.outputEntity = outputEntity;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.writeExportedEntityToFile = void 0;
30
+ const fs = __importStar(require("fs"));
31
+ const path_1 = __importDefault(require("path"));
32
+ const loggingProvider_1 = require("../../providers/logging/loggingProvider");
33
+ const chalk = require('chalk');
34
+ function writeExportedEntityToFile(output, fileExtension, entityId, fileName) {
35
+ fileName = fileName !== null && fileName !== void 0 ? fileName : `${entityId}.mabl.${fileExtension}`.replace(':', '-');
36
+ const filePath = path_1.default.resolve(fileName);
37
+ const dirname = path_1.default.dirname(filePath);
38
+ try {
39
+ fs.mkdirSync(dirname, { recursive: true });
40
+ fs.writeFileSync(filePath, output);
41
+ loggingProvider_1.logger.info(`Created file: ${fileName}`);
42
+ }
43
+ catch (err) {
44
+ loggingProvider_1.logger.info(chalk.red.bold(`Error exporting flow to filesystem: ${err}`));
45
+ }
46
+ return fileName;
47
+ }
48
+ exports.writeExportedEntityToFile = writeExportedEntityToFile;
49
+ const tester = 'hello:there:friend';
50
+ `mobileTestRun-${tester}-${Date.now()}`.replace(/:/g, '-');
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_LISTING_RESULT_LIMIT = void 0;
4
+ exports.DEFAULT_LISTING_RESULT_LIMIT = 10;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.outputEntities = exports.getListBuilderOptions = void 0;
7
+ const interfaces_1 = require("./interfaces");
8
+ const constants_1 = require("../constants");
9
+ const loggingProvider_1 = require("../../providers/logging/loggingProvider");
10
+ const js_yaml_1 = require("js-yaml");
11
+ const cli_table3_1 = __importDefault(require("cli-table3"));
12
+ const moment = require("moment");
13
+ function getListBuilderOptions(pluralEntityName) {
14
+ return (yargs) => {
15
+ yargs
16
+ .option(constants_1.CommandArgWorkspaceId, {
17
+ alias: constants_1.CommandArgAliases.WorkspaceId,
18
+ describe: `Workspace to list ${pluralEntityName} for`,
19
+ nargs: 1,
20
+ type: 'string',
21
+ })
22
+ .option(constants_1.CommandArgLimitOutput, {
23
+ alias: constants_1.CommandArgAliases.LimitOutput,
24
+ describe: `The number of ${pluralEntityName} to return'`,
25
+ default: interfaces_1.DEFAULT_LISTING_RESULT_LIMIT,
26
+ nargs: 1,
27
+ type: 'string',
28
+ })
29
+ .option(constants_1.CommandArgOutput, {
30
+ alias: constants_1.CommandArgAliases.OutputType,
31
+ choices: constants_1.DefaultOutputFormatChoices,
32
+ describe: 'Specify result output format',
33
+ nargs: 1,
34
+ });
35
+ };
36
+ }
37
+ exports.getListBuilderOptions = getListBuilderOptions;
38
+ function outputEntities(entities, outputMode) {
39
+ loggingProvider_1.logger.logNewLine();
40
+ let content;
41
+ switch (outputMode) {
42
+ case constants_1.OutputFormats.Json:
43
+ content = JSON.stringify(entities, null, 2);
44
+ break;
45
+ case constants_1.OutputFormats.Yaml:
46
+ content = (0, js_yaml_1.dump)(entities);
47
+ break;
48
+ default:
49
+ const table = new cli_table3_1.default({
50
+ head: ['ID', 'Name', 'Created time'],
51
+ wordWrap: true,
52
+ });
53
+ entities.forEach((entity) => {
54
+ table.push([
55
+ { rowSpan: 1, content: entity.id, vAlign: 'center' },
56
+ { rowSpan: 1, content: entity.name, vAlign: 'center' },
57
+ {
58
+ rowSpan: 1,
59
+ content: moment.utc(entity.created_time).format(constants_1.ListTimeFormat),
60
+ vAlign: 'center',
61
+ },
62
+ ]);
63
+ });
64
+ content = table.toString();
65
+ break;
66
+ }
67
+ loggingProvider_1.logger.info(content);
68
+ return content;
69
+ }
70
+ exports.outputEntities = outputEntities;
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getCredentialType = exports.parseColonJoinedVariablePair = exports.validateValuePairInputs = exports.validateArrayInputs = exports.getWorkspaceIdFromAppOrEnv = exports.getJourneyFlowArray = exports.TEST_WITHOUT_FLOWS_MESSAGE = exports.getWorkspaceId = exports.failWrapper = exports.getDescribeDescriptions = void 0;
7
+ const mablApi_1 = require("../../mablApi");
8
+ const cliConfigProvider_1 = require("../../providers/cliConfigProvider");
9
+ const constants_1 = require("../constants");
10
+ const loggingProvider_1 = require("../../providers/logging/loggingProvider");
11
+ const pluralize_1 = __importDefault(require("pluralize"));
12
+ const chalk = require('chalk');
13
+ function getDescribeDescriptions(entityName) {
14
+ return `Describe a specific ${entityName}`;
15
+ }
16
+ exports.getDescribeDescriptions = getDescribeDescriptions;
17
+ function failWrapper(func, exitCodeOnError = 1) {
18
+ return (parsed) => func(parsed).catch((error) => {
19
+ var _a;
20
+ loggingProvider_1.logger.error(chalk.red.bold((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : 'An unexpected error occurred'));
21
+ loggingProvider_1.logger.error(error.stack);
22
+ if (exitCodeOnError) {
23
+ process.exitCode = exitCodeOnError;
24
+ }
25
+ });
26
+ }
27
+ exports.failWrapper = failWrapper;
28
+ async function getWorkspaceId(parsed) {
29
+ const workspaceId = parsed[constants_1.CommandArgWorkspaceId];
30
+ if (workspaceId) {
31
+ return workspaceId;
32
+ }
33
+ const configuredWorkspace = await cliConfigProvider_1.CliConfigProvider.getWorkspace();
34
+ if (configuredWorkspace === null || configuredWorkspace === void 0 ? void 0 : configuredWorkspace.id) {
35
+ return configuredWorkspace.id;
36
+ }
37
+ throw new Error('Please specify a workspace ID (--workspace-id) or configure a default in the CLI (mabl config set workspace <id>)');
38
+ }
39
+ exports.getWorkspaceId = getWorkspaceId;
40
+ exports.TEST_WITHOUT_FLOWS_MESSAGE = `Test does not have any flows. You may need to specify a branch [--${constants_1.CommandArgMablBranch}] if the test is not on master.`;
41
+ async function getJourneyFlowArray(journey, apiClient, branchName) {
42
+ var _a;
43
+ if (!((_a = journey.flows) === null || _a === void 0 ? void 0 : _a.length)) {
44
+ throw new Error(exports.TEST_WITHOUT_FLOWS_MESSAGE);
45
+ }
46
+ const flows = {};
47
+ const requests = journey.flows.map((flowId) => apiClient
48
+ .getFlow(flowId, branchName)
49
+ .then((result) => (flows[flowId] = result)));
50
+ await Promise.all(requests);
51
+ return journey.flows.map((flowId) => flows[flowId]).filter((flow) => flow);
52
+ }
53
+ exports.getJourneyFlowArray = getJourneyFlowArray;
54
+ async function getWorkspaceIdFromAppOrEnv(apiClient, applicationId, environmentId) {
55
+ if (applicationId) {
56
+ const application = await apiClient.getApplication(applicationId);
57
+ return application.organization_id;
58
+ }
59
+ else if (environmentId) {
60
+ const environment = await apiClient.getEnvironment(environmentId);
61
+ return environment.organization_id;
62
+ }
63
+ throw new Error('Either Application or Environment ID must be provided');
64
+ }
65
+ exports.getWorkspaceIdFromAppOrEnv = getWorkspaceIdFromAppOrEnv;
66
+ function validateArrayInputs(possibleInput, errorMessage) {
67
+ if (possibleInput !== undefined) {
68
+ const labels = possibleInput;
69
+ if (labels.some((label) => /[,|;]/.test(label))) {
70
+ throw new Error(errorMessage);
71
+ }
72
+ }
73
+ }
74
+ exports.validateArrayInputs = validateArrayInputs;
75
+ function validateValuePairInputs(inputName, inputs) {
76
+ if (inputs) {
77
+ const missingColonInputs = inputs
78
+ .map((input) => input.trim())
79
+ .filter((input) => !/^([^:]+)?:(.+)?$/m.test(input));
80
+ if (missingColonInputs.length > 0) {
81
+ throw new Error(`${inputName} ${(0, pluralize_1.default)('value', missingColonInputs.length)} must separate kev/value with a colon ':', [${missingColonInputs.join(',')}]`);
82
+ }
83
+ const missingNameInputs = inputs
84
+ .map((input) => input.replace(/^[ ]+/, ''))
85
+ .filter((input) => !/^([^:]+):(.+)?$/m.test(input));
86
+ if (missingNameInputs.length > 0) {
87
+ throw new Error(`${inputName} ${(0, pluralize_1.default)('name', missingNameInputs.length)} cannot be blank [${missingNameInputs.join(',')}]`);
88
+ }
89
+ const illegalCharacterHeaders = inputs.filter((input) => /[\n\r]/m.test(input));
90
+ if (illegalCharacterHeaders.length > 0) {
91
+ const escapedHeaders = illegalCharacterHeaders.map((input) => input.replace('\n', '\\n').replace('\r', '\\r'));
92
+ throw new Error(`${inputName} shouldn't contain carriage return or line feed characters [${escapedHeaders.join(',')}]`);
93
+ }
94
+ const wrappingWhitespace = inputs.filter((header) => !/^([^\s:]{1,2}|[^\s:][^:]+[^\s:]):([^\s:]{1,2}|[^\s:][^:]+[^\s:])?$/m.test(header));
95
+ if (wrappingWhitespace.length > 0) {
96
+ const cleanFunction = (header) => {
97
+ const { name, value } = parseColonJoinedVariablePair(header);
98
+ return [name, value].map((part) => part.trim()).join(':');
99
+ };
100
+ const cleaned = inputs.map(cleanFunction);
101
+ const cleanedAffectedHeaders = wrappingWhitespace.map(cleanFunction);
102
+ loggingProvider_1.logger.info(chalk.yellow.bold(`${inputName} wrapping whitespace detected. Whitespace has been trimmed to [`) +
103
+ chalk.white.bold(cleanedAffectedHeaders.join(',')) +
104
+ chalk.yellow.bold(']'));
105
+ return cleaned;
106
+ }
107
+ }
108
+ return inputs;
109
+ }
110
+ exports.validateValuePairInputs = validateValuePairInputs;
111
+ function parseColonJoinedVariablePair(input) {
112
+ const name = input.substring(0, input.indexOf(':'));
113
+ const value = input.substring(input.indexOf(':') + 1);
114
+ return { name, value };
115
+ }
116
+ exports.parseColonJoinedVariablePair = parseColonJoinedVariablePair;
117
+ function getCredentialType(credential) {
118
+ if (credential.cloud_only) {
119
+ return credential.type === mablApi_1.Credentials.TypeEnum.Basic
120
+ ? 'Cloud'
121
+ : 'Cloud with MFA';
122
+ }
123
+ return credential.type === mablApi_1.Credentials.TypeEnum.Basic
124
+ ? 'Basic'
125
+ : 'Basic with MFA';
126
+ }
127
+ exports.getCredentialType = getCredentialType;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compareNodeVersions = exports.extractNodeVersionTuple = exports.nodeVersionToString = void 0;
4
+ function nodeVersionToString(nodeVersion) {
5
+ return `v${nodeVersion.major}.${nodeVersion.minor}.${nodeVersion.point}`;
6
+ }
7
+ exports.nodeVersionToString = nodeVersionToString;
8
+ const NODE_VERSION_REGEX = /(\d+)\.(\d+)(\.(\d+))?/;
9
+ function extractNodeVersionTuple(stringWithVersion) {
10
+ var _a, _b, _c;
11
+ const matches = stringWithVersion === null || stringWithVersion === void 0 ? void 0 : stringWithVersion.match(NODE_VERSION_REGEX);
12
+ return {
13
+ major: parseInt((_a = matches === null || matches === void 0 ? void 0 : matches[1]) !== null && _a !== void 0 ? _a : '0'),
14
+ minor: parseInt((_b = matches === null || matches === void 0 ? void 0 : matches[2]) !== null && _b !== void 0 ? _b : '0'),
15
+ point: parseInt((_c = matches === null || matches === void 0 ? void 0 : matches[4]) !== null && _c !== void 0 ? _c : '0'),
16
+ };
17
+ }
18
+ exports.extractNodeVersionTuple = extractNodeVersionTuple;
19
+ function compareNodeVersions(left, right) {
20
+ function toInt(version) {
21
+ return version.major * 1000000 + version.minor * 1000 + version.point;
22
+ }
23
+ const leftInt = toInt(left);
24
+ const rightInt = toInt(right);
25
+ if (leftInt === rightInt) {
26
+ return 0;
27
+ }
28
+ else if (leftInt > rightInt) {
29
+ return 1;
30
+ }
31
+ return -1;
32
+ }
33
+ exports.compareNodeVersions = compareNodeVersions;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = 'config <command>';
4
+ exports.describe = 'Configure defaults for the mabl CLI';
5
+ exports.builder = (yargs) => yargs.commandDir('config_cmds').demandCommand();
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidProxyType = exports.isValidProxyMode = exports.proxyTypes = exports.proxyModes = exports.validConfigKeyChoices = exports.configKeys = void 0;
4
+ exports.configKeys = Object.freeze({
5
+ browserPath: 'browser.path',
6
+ enableSourceControlMetadataCollection: 'alpha.scm_metadata.enable',
7
+ defaultWorkspaceId: 'workspace',
8
+ proxy: 'http.proxy',
9
+ sslVerify: 'http.sslVerify',
10
+ proxyMode: 'http.proxyMode',
11
+ proxyType: 'http.proxyType',
12
+ });
13
+ exports.validConfigKeyChoices = Object.values(exports.configKeys);
14
+ exports.proxyModes = [
15
+ 'mabl',
16
+ 'test',
17
+ 'all',
18
+ 'none',
19
+ ];
20
+ exports.proxyTypes = ['legacy', 'current'];
21
+ function isValidProxyMode(value) {
22
+ return exports.proxyModes.indexOf(value) !== -1;
23
+ }
24
+ exports.isValidProxyMode = isValidProxyMode;
25
+ function isValidProxyType(value) {
26
+ return exports.proxyTypes.indexOf(value) !== -1;
27
+ }
28
+ exports.isValidProxyType = isValidProxyType;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
4
+ const set_1 = require("./set");
5
+ const configKeys_1 = require("./configKeys");
6
+ const list_1 = require("./list");
7
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
8
+ exports.command = `delete <${set_1.configKeyCommandArg}>`;
9
+ exports.describe = 'Delete a config value';
10
+ exports.builder = (yargs) => {
11
+ yargs.positional(set_1.configKeyCommandArg, {
12
+ describe: 'configuration key to delete',
13
+ type: 'string',
14
+ choices: configKeys_1.validConfigKeyChoices,
15
+ });
16
+ };
17
+ exports.handler = deleteConfig;
18
+ async function deleteConfig(parsed) {
19
+ const key = parsed['config-key'];
20
+ switch (key) {
21
+ case configKeys_1.configKeys.defaultWorkspaceId:
22
+ await cliConfigProvider_1.CliConfigProvider.clearWorkspace();
23
+ break;
24
+ default:
25
+ await cliConfigProvider_1.CliConfigProvider.clearConfigProperty(key);
26
+ }
27
+ loggingProvider_1.logger.info(`Deleted config for [${key}]`);
28
+ return (0, list_1.listConfig)();
29
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
7
+ const set_1 = require("./set");
8
+ const configKeys_1 = require("./configKeys");
9
+ const cli_table3_1 = __importDefault(require("cli-table3"));
10
+ const list_1 = require("./list");
11
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
12
+ exports.command = `get <${set_1.configKeyCommandArg}>`;
13
+ exports.describe = 'Get a config value';
14
+ exports.builder = (yargs) => {
15
+ yargs.positional(set_1.configKeyCommandArg, {
16
+ describe: 'desired configuration key',
17
+ type: 'string',
18
+ });
19
+ };
20
+ exports.handler = getConfig;
21
+ async function getConfig(parsed) {
22
+ const key = parsed['config-key'];
23
+ const table = new cli_table3_1.default({
24
+ head: ['Config', 'Value', 'Details'],
25
+ });
26
+ let value;
27
+ switch (key) {
28
+ case configKeys_1.configKeys.defaultWorkspaceId:
29
+ const workspace = await cliConfigProvider_1.CliConfigProvider.getWorkspace();
30
+ if (workspace) {
31
+ table.push([key, workspace.id, workspace.name]);
32
+ value = workspace.id;
33
+ }
34
+ else {
35
+ table.push([key, list_1.defaultTupleValue, list_1.defaultTupleValue]);
36
+ }
37
+ break;
38
+ default:
39
+ if (!Object.values(configKeys_1.configKeys).includes(key)) {
40
+ throw new Error(`Unknown key [${key}]`);
41
+ }
42
+ const propertyValue = await cliConfigProvider_1.CliConfigProvider.getConfigProperty(key);
43
+ if (propertyValue !== undefined) {
44
+ table.push([key, propertyValue, list_1.defaultTupleValue]);
45
+ }
46
+ else {
47
+ table.push([key, list_1.defaultTupleValue, list_1.defaultTupleValue]);
48
+ }
49
+ }
50
+ loggingProvider_1.logger.info(table.toString());
51
+ return value;
52
+ }