@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,342 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDeploymentEventWebappUrl = exports.printDeploymentEventResultOutput = void 0;
4
+ const env_1 = require("../../../env/env");
5
+ const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
6
+ const mablApi_1 = require("../../../mablApi");
7
+ const util_1 = require("../../commandUtil/util");
8
+ const branches_1 = require("../../commandUtil/branches");
9
+ const awaitDeploymentCompletion_1 = require("./awaitDeploymentCompletion");
10
+ const scmContextProvider_1 = require("../../../providers/scmContextProvider");
11
+ const scmContextProviderV2_1 = require("../../../providers/scmContextProviderV2");
12
+ const cliConfigProvider_1 = require("../../../providers/cliConfigProvider");
13
+ const configKeys_1 = require("../../config/config_cmds/configKeys");
14
+ const codeInsights_1 = require("../../commandUtil/codeInsights");
15
+ const constants_1 = require("../../constants");
16
+ const describe_1 = require("../../commandUtil/describe");
17
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
18
+ const chalk = require('chalk');
19
+ const CommandArgAwaitCompletion = 'await-completion';
20
+ const CommandArgRebaselineImages = 'rebaseline-images';
21
+ const CommandArgRepositoryUrl = 'repository-url';
22
+ const CommandArgSetStaticBaseline = 'set-static-baseline';
23
+ const CommandArgSnapshotBranch = 'snapshot-from';
24
+ exports.command = 'create';
25
+ exports.describe = 'Trigger a deployment event via the mabl API';
26
+ exports.builder = (yargs) => {
27
+ yargs
28
+ .option(constants_1.CommandArgApplicationId, {
29
+ alias: constants_1.CommandArgAliases.ApplicationId,
30
+ describe: 'Application to run the mabl tests for. If provided, mabl will only trigger plans that contain this application',
31
+ nargs: 1,
32
+ type: 'string',
33
+ })
34
+ .option(constants_1.CommandArgEnvironmentId, {
35
+ alias: constants_1.CommandArgAliases.EnvironmentId,
36
+ describe: 'Environment to run the mabl tests for. If provided, mabl will only trigger plans that contain this environment',
37
+ nargs: 1,
38
+ type: 'string',
39
+ })
40
+ .option(constants_1.CommandArgOverrideEnvironmentId, {
41
+ describe: 'Override environment to run the tests against. Not used to select plans to run. Requires `--application-id`.',
42
+ nargs: 1,
43
+ type: 'string',
44
+ })
45
+ .option(CommandArgAwaitCompletion, {
46
+ describe: 'Block until mabl tests complete.',
47
+ type: 'boolean',
48
+ default: false,
49
+ })
50
+ .option(constants_1.CommandArgFastFailure, {
51
+ describe: `If using \'--${CommandArgAwaitCompletion}\', exit on first failed test`,
52
+ type: 'boolean',
53
+ default: false,
54
+ })
55
+ .implies(constants_1.CommandArgFastFailure, CommandArgAwaitCompletion)
56
+ .option(constants_1.CommandArgSilent, {
57
+ describe: "Don't output runtime status",
58
+ type: 'boolean',
59
+ default: false,
60
+ })
61
+ .option(constants_1.CommandArgOutput, {
62
+ alias: constants_1.CommandArgAliases.OutputType,
63
+ describe: 'Specify final result output format. Implies: --silent',
64
+ choices: constants_1.DefaultOutputFormatChoices,
65
+ })
66
+ .option(constants_1.CommandArgWorkspaceId, {
67
+ alias: constants_1.CommandArgAliases.WorkspaceId,
68
+ describe: 'Workspace containing target environment and/or application',
69
+ nargs: 1,
70
+ type: 'string',
71
+ })
72
+ .option(constants_1.CommandArgBrowsers, {
73
+ alias: constants_1.CommandArgAliases.Browsers,
74
+ describe: 'Space delimited browsers to test against (e.g. "chrome firefox")',
75
+ type: 'array',
76
+ default: [],
77
+ choices: constants_1.BrowserTypeSelections,
78
+ })
79
+ .option(constants_1.CommandArgLabelsInclude, {
80
+ alias: 'l',
81
+ describe: 'Space delimited plan labels. Run plans that match any label.',
82
+ type: 'array',
83
+ default: [],
84
+ })
85
+ .option(constants_1.CommandArgHttpHeaders, {
86
+ describe: 'Space delimited HTTP headers added to browser requests (e.g. "x-header:foo")',
87
+ type: 'array',
88
+ default: [],
89
+ })
90
+ .option(constants_1.CommandArgUrl, {
91
+ alias: constants_1.CommandArgAliases.Url,
92
+ describe: 'URL to use for deployment',
93
+ type: 'string',
94
+ })
95
+ .option(constants_1.CommandArgUrlApp, {
96
+ describe: 'Application/web URL to use for deployment',
97
+ nargs: 1,
98
+ type: 'string',
99
+ })
100
+ .option(constants_1.CommandArgUrlApi, {
101
+ describe: 'API URL to to use for deployment',
102
+ nargs: 1,
103
+ type: 'string',
104
+ })
105
+ .option(constants_1.CommandArgAndroidMobileAppFileId, {
106
+ describe: 'Android mobile app file to use for deployment',
107
+ nargs: 1,
108
+ type: 'string',
109
+ })
110
+ .option(constants_1.CommandArgiOSdMobileAppFileId, {
111
+ describe: 'iOS mobile app file to use for deployment',
112
+ nargs: 1,
113
+ type: 'string',
114
+ })
115
+ .option(constants_1.CommandArgApiKey, {
116
+ alias: constants_1.CommandArgAliases.ApiKey,
117
+ describe: 'API key (found in the mabl web app)',
118
+ nargs: 1,
119
+ type: 'string',
120
+ })
121
+ .option(CommandArgRebaselineImages, {
122
+ alias: 'rbi',
123
+ describe: 'Rebaseline visual change models',
124
+ type: 'boolean',
125
+ default: false,
126
+ })
127
+ .option(CommandArgSetStaticBaseline, {
128
+ alias: 'ssbi',
129
+ describe: 'Set run as fixed baseline for visual change models',
130
+ type: 'boolean',
131
+ default: false,
132
+ })
133
+ .option(constants_1.CommandArgRevision, {
134
+ alias: constants_1.CommandArgAliases.Revision,
135
+ describe: 'Code revision hash (application under test)',
136
+ nargs: 1,
137
+ type: 'string',
138
+ })
139
+ .option(CommandArgRepositoryUrl, {
140
+ describe: 'Code repository URL (e.g. git@github.com:foo/bar.git)',
141
+ nargs: 1,
142
+ type: 'string',
143
+ })
144
+ .option(constants_1.CommandArgMablBranch, {
145
+ describe: 'mabl branch to run tests against',
146
+ nargs: 1,
147
+ type: 'string',
148
+ })
149
+ .option(constants_1.CommandArgMablAutoBranch, {
150
+ describe: 'Create a mabl branch when a mabl-branch target is specified that does not exist',
151
+ type: 'boolean',
152
+ default: false,
153
+ })
154
+ .option(CommandArgSnapshotBranch, {
155
+ describe: 'Snapshot the current state of the tests from a mabl branch onto the environment. Use "master" for the mainline branch. Requires setting environment-id.',
156
+ nargs: 1,
157
+ type: 'string',
158
+ })
159
+ .option('target-runtime-version', {
160
+ hidden: true,
161
+ nargs: 1,
162
+ type: 'string',
163
+ })
164
+ .option('runner-type', {
165
+ hidden: true,
166
+ nargs: 1,
167
+ type: 'string',
168
+ choices: [
169
+ mablApi_1.PlanOverrideOptions.NodejsRuntimeVariantEnum.Playwright,
170
+ mablApi_1.PlanOverrideOptions.NodejsRuntimeVariantEnum.Puppeteer,
171
+ ],
172
+ })
173
+ .implies(constants_1.CommandArgMablAutoBranch, constants_1.CommandArgMablBranch)
174
+ .implies(CommandArgSnapshotBranch, constants_1.CommandArgEnvironmentId)
175
+ .implies(constants_1.CommandArgOverrideEnvironmentId, constants_1.CommandArgApplicationId)
176
+ .check((argv) => {
177
+ if (!(argv[constants_1.CommandArgApplicationId] || argv[constants_1.CommandArgEnvironmentId])) {
178
+ throw new Error(`At least one of ${constants_1.CommandArgApplicationId} or ${constants_1.CommandArgEnvironmentId} required`);
179
+ }
180
+ const branchName = argv[constants_1.CommandArgMablBranch];
181
+ if (branchName !== undefined && !(0, branches_1.isValidMablBranchName)(branchName)) {
182
+ throw new Error(`[${branchName}] is not a valid mabl branch name. Please specify a valid name`);
183
+ }
184
+ const snapshotFromBranch = argv[CommandArgSnapshotBranch];
185
+ if (snapshotFromBranch !== undefined &&
186
+ !(0, branches_1.isValidMablBranchName)(snapshotFromBranch)) {
187
+ throw new Error(`[${snapshotFromBranch}] is not a valid mabl branch name to snapshot from. Please specify a valid name`);
188
+ }
189
+ (0, util_1.validateArrayInputs)(argv[constants_1.CommandArgBrowsers], 'browser names must be SPACE delimited, e.g. "--browsers=chrome firefox"');
190
+ (0, util_1.validateArrayInputs)(argv[constants_1.CommandArgLabelsInclude], 'label names must be SPACE delimited, e.g. "--labels=foo bar"');
191
+ (0, util_1.validateArrayInputs)(argv[constants_1.CommandArgHttpHeaders], 'HTTP headers must be SPACE delimited, e.g. "--http-headers="foo:bar" "baz:qux"');
192
+ const httpHeaders = argv[constants_1.CommandArgHttpHeaders];
193
+ argv[constants_1.CommandArgHttpHeaders] = (0, util_1.validateValuePairInputs)('HTTP header', httpHeaders);
194
+ const repositoryUrl = argv['repository-url'];
195
+ if (repositoryUrl !== undefined && repositoryUrl.trim() === '') {
196
+ throw new Error(`repository-url cannot be set to empty value`);
197
+ }
198
+ return true;
199
+ });
200
+ };
201
+ exports.handler = (0, util_1.failWrapper)(createDeployment);
202
+ async function createDeployment(parsed) {
203
+ var _a, _b, _c;
204
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClientFromOptionalApiKey(parsed['api-key']);
205
+ if (parsed.output) {
206
+ parsed.silent = true;
207
+ }
208
+ if (!parsed.silent) {
209
+ loggingProvider_1.logger.info('Creating Deployment...');
210
+ }
211
+ const applicationId = parsed['application-id'];
212
+ const environmentId = parsed['environment-id'];
213
+ const workspaceId = await (0, util_1.getWorkspaceIdFromAppOrEnv)(apiClient, applicationId, environmentId);
214
+ const environmentOverride = parsed[constants_1.CommandArgOverrideEnvironmentId];
215
+ let deploymentIds;
216
+ if (environmentOverride) {
217
+ deploymentIds = (_a = (await apiClient.queryDeploymentEntities(workspaceId, environmentOverride, applicationId)).deployments) === null || _a === void 0 ? void 0 : _a.map((deployment) => deployment.id);
218
+ if (!deploymentIds || deploymentIds.length === 0) {
219
+ loggingProvider_1.logger.error(chalk.red.bold(`Application ${applicationId} is not defined in override environment ${environmentOverride}`));
220
+ process.exit(1);
221
+ }
222
+ }
223
+ const androidMobileAppFileId = parsed[constants_1.CommandArgAndroidMobileAppFileId];
224
+ if (!!androidMobileAppFileId) {
225
+ await apiClient.getMobileAppFile(androidMobileAppFileId);
226
+ }
227
+ const iOSMobileAppFileId = parsed[constants_1.CommandArgiOSdMobileAppFileId];
228
+ if (!!iOSMobileAppFileId) {
229
+ await apiClient.getMobileAppFile(iOSMobileAppFileId);
230
+ }
231
+ const mablBranch = parsed['mabl-branch'];
232
+ await (0, branches_1.checkBranchNameAndAutoBranchMaybe)(workspaceId, apiClient, mablBranch, parsed['auto-branch']);
233
+ const snapshotFromBranch = parsed['snapshot-from'];
234
+ const httpHeaders = parsed['http-headers'];
235
+ const scmMetadata = await attemptSourceControlMetadataCollection(parsed);
236
+ const deploymentEvent = await apiClient.postDeploymentEvent({
237
+ browserTypes: parsed.browsers,
238
+ labels: parsed.labels,
239
+ rebaselineImages: parsed['rebaseline-images'],
240
+ setStaticBaseline: parsed['set-static-baseline'],
241
+ applicationId,
242
+ httpHeaders,
243
+ environmentId,
244
+ uri: parsed.url,
245
+ apiUrl: parsed.apiUrl,
246
+ appUrl: parsed.appUrl,
247
+ androidMobileAppFileId,
248
+ iOSMobileAppFileId,
249
+ mablBranch,
250
+ snapshotFromBranch,
251
+ sourceControlMetadata: scmMetadata,
252
+ deploymentIds,
253
+ targetRuntimeVersion: parsed['target-runtime-version'],
254
+ });
255
+ const outputWebappLink = getDeploymentEventWebappUrl(deploymentEvent);
256
+ if (!parsed.output) {
257
+ loggingProvider_1.logger.info(chalk.magenta.bold(`Deployment triggered. View output at: ${outputWebappLink}`));
258
+ }
259
+ if (!parsed['await-completion']) {
260
+ return printDeploymentEventResultOutput(deploymentEvent.id, outputWebappLink, parsed.output);
261
+ }
262
+ const waiter = new awaitDeploymentCompletion_1.AwaitDeploymentCompletion(apiClient, parsed['fast-failure'], parsed.silent);
263
+ const pollingResult = await waiter.awaitCompletion(deploymentEvent.id);
264
+ const isSuccess = ((_c = (_b = pollingResult === null || pollingResult === void 0 ? void 0 : pollingResult.newEntity) === null || _b === void 0 ? void 0 : _b.event_status) === null || _c === void 0 ? void 0 : _c.succeeded) || false;
265
+ try {
266
+ await (0, codeInsights_1.maybeOutputToBitbucket)(pollingResult.newEntity, deploymentEvent.id, outputWebappLink);
267
+ }
268
+ catch (error) {
269
+ loggingProvider_1.logger.info(chalk.yellow.bold('Unable to generate code insights due to BitBucket integration API error'));
270
+ loggingProvider_1.logger.info(`details: ${error}`);
271
+ }
272
+ const textOutput = printDeploymentEventResultOutput(deploymentEvent.id, outputWebappLink, parsed.output, pollingResult === null || pollingResult === void 0 ? void 0 : pollingResult.newEntity);
273
+ if (!isSuccess) {
274
+ process.exit(1);
275
+ }
276
+ return textOutput;
277
+ }
278
+ function printDeploymentEventResultOutput(deploymentEventId, outputWebappLink, outputMode, executionResult) {
279
+ switch (outputMode) {
280
+ case constants_1.OutputFormats.Json:
281
+ case constants_1.OutputFormats.Yaml:
282
+ const resultPayload = {
283
+ id: deploymentEventId,
284
+ href: outputWebappLink,
285
+ execution_results: executionResult,
286
+ };
287
+ return (0, describe_1.outputEntity)(resultPayload, outputMode);
288
+ default:
289
+ return outputWebappLink;
290
+ }
291
+ }
292
+ exports.printDeploymentEventResultOutput = printDeploymentEventResultOutput;
293
+ async function attemptSourceControlMetadataCollection(parsed) {
294
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
295
+ const userSuppliedRepositoryUrl = parsed['repository-url'];
296
+ if (await cliConfigProvider_1.CliConfigProvider.getConfigProperty(configKeys_1.configKeys.enableSourceControlMetadataCollection)) {
297
+ const buildInfo = await new scmContextProvider_1.ScmContextProvider(process.env).extractScmAndBuildInfo();
298
+ const sourceControlBranch = ((_a = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _a === void 0 ? void 0 : _a.branchName) || ((_b = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _b === void 0 ? void 0 : _b.branchName);
299
+ const sourceControlTag = ((_c = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _c === void 0 ? void 0 : _c.tagName) || ((_d = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _d === void 0 ? void 0 : _d.tagName);
300
+ const sourceControlRepoUrl = userSuppliedRepositoryUrl ||
301
+ ((_e = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _e === void 0 ? void 0 : _e.repoUrl) ||
302
+ ((_f = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _f === void 0 ? void 0 : _f.repoUrl);
303
+ const sourceControlRepoName = ((_g = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _g === void 0 ? void 0 : _g.repoName) || ((_h = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _h === void 0 ? void 0 : _h.repoName);
304
+ const revision = parsed.revision ||
305
+ ((_j = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _j === void 0 ? void 0 : _j.commitSha) ||
306
+ ((_k = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _k === void 0 ? void 0 : _k.commitSha) ||
307
+ ((_l = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _l === void 0 ? void 0 : _l.revision);
308
+ return {
309
+ branchName: sourceControlBranch,
310
+ tag: sourceControlTag,
311
+ revision,
312
+ repoUrl: sourceControlRepoUrl,
313
+ repoName: sourceControlRepoName,
314
+ };
315
+ }
316
+ const buildInfo = new scmContextProviderV2_1.ScmContextProviderV2(process.env).extractScmAndBuildInfo();
317
+ if (buildInfo) {
318
+ const sourceControlBranch = (_m = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _m === void 0 ? void 0 : _m.branchName;
319
+ const sourceControlTag = (_o = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _o === void 0 ? void 0 : _o.tagName;
320
+ const sourceControlRepoUrl = userSuppliedRepositoryUrl !== null && userSuppliedRepositoryUrl !== void 0 ? userSuppliedRepositoryUrl : (_p = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _p === void 0 ? void 0 : _p.repoUrl;
321
+ const sourceControlRepoName = (_q = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _q === void 0 ? void 0 : _q.repoName;
322
+ const revision = (_v = (_t = (_r = parsed.revision) !== null && _r !== void 0 ? _r : (_s = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _s === void 0 ? void 0 : _s.commitSha) !== null && _t !== void 0 ? _t : (_u = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _u === void 0 ? void 0 : _u.revision) !== null && _v !== void 0 ? _v : (_w = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _w === void 0 ? void 0 : _w.revisionId;
323
+ return {
324
+ branchName: sourceControlBranch,
325
+ tag: sourceControlTag,
326
+ revision,
327
+ repoUrl: sourceControlRepoUrl,
328
+ repoName: sourceControlRepoName,
329
+ integrationType: (_x = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _x === void 0 ? void 0 : _x.buildType,
330
+ buildInfoUrl: (_y = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _y === void 0 ? void 0 : _y.buildInfoUrl,
331
+ buildId: (_z = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _z === void 0 ? void 0 : _z.buildId,
332
+ };
333
+ }
334
+ return {
335
+ revision: parsed.revision,
336
+ repoUrl: userSuppliedRepositoryUrl,
337
+ };
338
+ }
339
+ function getDeploymentEventWebappUrl(deploymentEvent) {
340
+ return `${env_1.BASE_APP_URL}/workspaces/${deploymentEvent.workspace_id}/events/${deploymentEvent.id}`;
341
+ }
342
+ exports.getDeploymentEventWebappUrl = getDeploymentEventWebappUrl;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const js_yaml_1 = require("js-yaml");
4
+ const env_1 = require("../../../env/env");
5
+ const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
6
+ const util_1 = require("../../commandUtil/util");
7
+ const constants_1 = require("../../constants");
8
+ const markdownUtil_1 = require("../../../util/markdownUtil");
9
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
10
+ const chalk = require('chalk');
11
+ exports.command = 'describe <id>';
12
+ exports.describe = 'Describe a specific mabl deployment event';
13
+ exports.builder = {
14
+ [constants_1.CommandArgOutput]: {
15
+ alias: constants_1.CommandArgAliases.OutputType,
16
+ describe: 'Specify and alternate output for the deployment data',
17
+ choices: [...constants_1.DefaultOutputFormatChoices, constants_1.OutputFormats.Markdown],
18
+ },
19
+ };
20
+ exports.handler = (0, util_1.failWrapper)(getDeployment);
21
+ async function getDeployment(parsed) {
22
+ const output = parsed.output;
23
+ const deploymentId = parsed.id;
24
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
25
+ const deployment = await apiClient.getDeploymentEvent(deploymentId);
26
+ switch (output) {
27
+ case constants_1.OutputFormats.Markdown:
28
+ if (deployment.run_result) {
29
+ const executionResult = deployment.run_result;
30
+ loggingProvider_1.logger.info((0, markdownUtil_1.formatResultsAsGithubMarkdown)(executionResult));
31
+ }
32
+ break;
33
+ case constants_1.OutputFormats.Json:
34
+ loggingProvider_1.logger.info(JSON.stringify(deployment, null, 2));
35
+ break;
36
+ case constants_1.OutputFormats.Yaml:
37
+ loggingProvider_1.logger.info((0, js_yaml_1.dump)(deployment));
38
+ break;
39
+ default:
40
+ if (deployment.run_result) {
41
+ const { executions, ...rest } = deployment.run_result;
42
+ deployment.run_result = rest;
43
+ }
44
+ delete deployment.triggered_plan_run_summaries;
45
+ const workspaceId = await (0, util_1.getWorkspaceIdFromAppOrEnv)(apiClient, deployment.application_id, deployment.environment_id);
46
+ loggingProvider_1.logger.info((0, js_yaml_1.dump)(deployment));
47
+ loggingProvider_1.logger.info(`VIEW RESULTS: ${chalk.cyan(getOutputLink(workspaceId, deployment.id))}`);
48
+ break;
49
+ }
50
+ return deployment.id;
51
+ }
52
+ function getOutputLink(workspaceId, deploymentId) {
53
+ return `${env_1.BASE_APP_URL}/workspaces/${workspaceId}/events/${deploymentId}`;
54
+ }
@@ -0,0 +1,117 @@
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.ExecutionResultPresenter = void 0;
7
+ const change_case_1 = require("change-case");
8
+ const mablApi_1 = require("../../../mablApi");
9
+ const cli_table3_1 = __importDefault(require("cli-table3"));
10
+ const timeUtil_1 = require("../../../util/timeUtil");
11
+ const chalk = require('chalk');
12
+ class ExecutionResultPresenter {
13
+ entityToString(results, columnWidth) {
14
+ var _a;
15
+ const columnLabels = [
16
+ 'Plan Name',
17
+ 'Test Name',
18
+ 'Id',
19
+ 'Browser',
20
+ 'Status',
21
+ 'Run Time',
22
+ ];
23
+ const tableConfig = {
24
+ head: columnLabels,
25
+ };
26
+ if (columnWidth) {
27
+ tableConfig.colWidths = Array(columnLabels.length - 1).fill(columnWidth);
28
+ }
29
+ const table = new cli_table3_1.default(tableConfig);
30
+ const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
31
+ finalExecutions.forEach((summary) => {
32
+ var _a, _b, _c, _d, _e;
33
+ const retryPrefix = ((_a = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _a === void 0 ? void 0 : _a.is_retry) ? '[Retry] ' : '';
34
+ const planId = summary.plan.id;
35
+ const planName = retryPrefix + ((_c = (_b = summary.plan) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '<plan name unavailable>');
36
+ const planRunStatus = summary.plan_execution.status;
37
+ const journeyMap = new Map();
38
+ (_d = summary === null || summary === void 0 ? void 0 : summary.journeys) === null || _d === void 0 ? void 0 : _d.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
39
+ const statusChalk = this.mapPlanRunStatusToColor(planRunStatus);
40
+ table.push([
41
+ `${planName}`,
42
+ '---',
43
+ planId,
44
+ '---',
45
+ statusChalk(this.maybeCapitalize(planRunStatus.toString())),
46
+ summaryToElapsedTime(summary),
47
+ ]);
48
+ (_e = summary === null || summary === void 0 ? void 0 : summary.journey_executions) === null || _e === void 0 ? void 0 : _e.forEach((journeyRun) => {
49
+ var _a, _b, _c, _d;
50
+ const journeyId = journeyRun.journey_execution_id;
51
+ const journeyStatus = this.maybeCapitalize((_b = (_a = journeyRun.status) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '<status unavailable>');
52
+ const journeyBrowser = this.maybeCapitalize((_c = journeyRun.browser_type) !== null && _c !== void 0 ? _c : '<unknown browser>');
53
+ const journeySummary = journeyMap.get(journeyRun.journey_id);
54
+ const journeyName = `${retryPrefix}${(_d = journeySummary === null || journeySummary === void 0 ? void 0 : journeySummary.name) !== null && _d !== void 0 ? _d : '<test name >'}`;
55
+ const statusChalk = this.mapJourneyRunStatusToColor(journeyRun.status);
56
+ table.push([
57
+ '',
58
+ `${journeyName}`,
59
+ journeyId,
60
+ journeyBrowser,
61
+ statusChalk(journeyStatus),
62
+ journeyRunToElapsedTime(journeyRun),
63
+ ]);
64
+ });
65
+ });
66
+ return table.toString();
67
+ }
68
+ maybeCapitalize(input) {
69
+ if (input) {
70
+ return (0, change_case_1.capitalCase)(input.replace('_', ' '));
71
+ }
72
+ return;
73
+ }
74
+ mapPlanRunStatusToColor(status) {
75
+ switch (status) {
76
+ case mablApi_1.PlanExecutionResult.StatusEnum.Queued:
77
+ return chalk.gray;
78
+ case mablApi_1.PlanExecutionResult.StatusEnum.Scheduled:
79
+ return chalk.white;
80
+ case mablApi_1.PlanExecutionResult.StatusEnum.Succeeded:
81
+ case mablApi_1.PlanExecutionResult.StatusEnum.Completed:
82
+ return chalk.green;
83
+ case mablApi_1.PlanExecutionResult.StatusEnum.Failed:
84
+ return chalk.red;
85
+ case mablApi_1.PlanExecutionResult.StatusEnum.Terminated:
86
+ case mablApi_1.PlanExecutionResult.StatusEnum.Cancelled:
87
+ return chalk.yellow;
88
+ default:
89
+ return chalk.reset;
90
+ }
91
+ }
92
+ mapJourneyRunStatusToColor(status) {
93
+ switch (status) {
94
+ case mablApi_1.TestRunResult.StatusEnum.Queued:
95
+ case mablApi_1.TestRunResult.StatusEnum.RateLimited:
96
+ return chalk.gray;
97
+ case mablApi_1.TestRunResult.StatusEnum.Running:
98
+ return chalk.white;
99
+ case mablApi_1.TestRunResult.StatusEnum.Completed:
100
+ return chalk.green;
101
+ case mablApi_1.TestRunResult.StatusEnum.Failed:
102
+ return chalk.red;
103
+ case mablApi_1.TestRunResult.StatusEnum.Terminated:
104
+ case mablApi_1.TestRunResult.StatusEnum.Skipped:
105
+ return chalk.yellow;
106
+ default:
107
+ return chalk.reset;
108
+ }
109
+ }
110
+ }
111
+ exports.ExecutionResultPresenter = ExecutionResultPresenter;
112
+ function journeyRunToElapsedTime(journeyRun) {
113
+ return (0, timeUtil_1.elapsedTimeToString)(journeyRun.start_time, journeyRun.stop_time);
114
+ }
115
+ function summaryToElapsedTime(summary) {
116
+ return (0, timeUtil_1.elapsedTimeToString)(summary.start_time, summary.stop_time);
117
+ }
@@ -0,0 +1,74 @@
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 js_yaml_1 = require("js-yaml");
7
+ const cli_table3_1 = __importDefault(require("cli-table3"));
8
+ const moment = require("moment");
9
+ const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
10
+ const util_1 = require("../../commandUtil/util");
11
+ const list_1 = require("../../commandUtil/list");
12
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
13
+ const constants_1 = require("../../constants");
14
+ exports.command = 'list';
15
+ exports.describe = 'List recent mabl deployment events';
16
+ exports.builder = (0, list_1.getListBuilderOptions)('deployments');
17
+ exports.handler = (0, util_1.failWrapper)(listDeployments);
18
+ async function listDeployments(parsed) {
19
+ const output = parsed.output;
20
+ const limit = parsed.limit;
21
+ const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
22
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
23
+ const deployments = await apiClient.getDeploymentEvents(workspaceId, limit);
24
+ printDeployments(deployments, output);
25
+ return deployments.length;
26
+ }
27
+ function printDeployments(deployments, output) {
28
+ switch (output) {
29
+ case 'json':
30
+ loggingProvider_1.logger.info(JSON.stringify(deployments, null, 2));
31
+ break;
32
+ case 'yaml':
33
+ loggingProvider_1.logger.info((0, js_yaml_1.dump)(deployments));
34
+ break;
35
+ default:
36
+ const table = new cli_table3_1.default({
37
+ head: ['ID', 'Time', 'Application/Env.', 'Pass', 'Fail', 'Total'],
38
+ });
39
+ deployments.forEach((deployment) => {
40
+ var _a, _b, _c, _d, _e, _f;
41
+ table.push([
42
+ { rowSpan: 2, content: deployment.id, vAlign: 'center' },
43
+ {
44
+ rowSpan: 2,
45
+ content: moment
46
+ .utc(deployment.received_time)
47
+ .format(constants_1.ListTimeFormat),
48
+ vAlign: 'center',
49
+ },
50
+ deployment.application_id || 'none',
51
+ {
52
+ rowSpan: 2,
53
+ content: (_b = (_a = deployment.run_result) === null || _a === void 0 ? void 0 : _a.journey_execution_metrics) === null || _b === void 0 ? void 0 : _b.passed,
54
+ vAlign: 'center',
55
+ hAlign: 'center',
56
+ },
57
+ {
58
+ rowSpan: 2,
59
+ content: (_d = (_c = deployment.run_result) === null || _c === void 0 ? void 0 : _c.journey_execution_metrics) === null || _d === void 0 ? void 0 : _d.failed,
60
+ vAlign: 'center',
61
+ hAlign: 'center',
62
+ },
63
+ {
64
+ rowSpan: 2,
65
+ content: (_f = (_e = deployment.run_result) === null || _e === void 0 ? void 0 : _e.journey_execution_metrics) === null || _f === void 0 ? void 0 : _f.total,
66
+ vAlign: 'center',
67
+ hAlign: 'center',
68
+ },
69
+ ], [deployment.environment_id || 'none']);
70
+ });
71
+ loggingProvider_1.logger.info(table.toString());
72
+ break;
73
+ }
74
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
4
+ const util_1 = require("../../commandUtil/util");
5
+ const constants_1 = require("../../constants");
6
+ const awaitDeploymentCompletion_1 = require("./awaitDeploymentCompletion");
7
+ const create_1 = require("./create");
8
+ exports.command = 'watch <id>';
9
+ exports.describe =
10
+ 'Watch a mabl deployment event until completion, with results';
11
+ exports.builder = (yargs) => {
12
+ yargs
13
+ .option(constants_1.CommandArgFastFailure, {
14
+ describe: `Exit on first failed test`,
15
+ type: 'boolean',
16
+ default: false,
17
+ })
18
+ .option(constants_1.CommandArgSilent, {
19
+ describe: "Don't output runtime status",
20
+ type: 'boolean',
21
+ default: false,
22
+ })
23
+ .implies(constants_1.CommandArgOutput, constants_1.CommandArgSilent)
24
+ .option(constants_1.CommandArgOutput, {
25
+ alias: constants_1.CommandArgAliases.OutputType,
26
+ describe: 'Specify final result output format. Implies: --silent',
27
+ choices: constants_1.DefaultOutputFormatChoices,
28
+ });
29
+ };
30
+ exports.handler = (0, util_1.failWrapper)(getWatch);
31
+ async function getWatch(parsed) {
32
+ var _a, _b;
33
+ const deploymentId = parsed.id;
34
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
35
+ const deploymentEvent = await apiClient.getDeploymentEvent(deploymentId);
36
+ const outputWebappLink = (0, create_1.getDeploymentEventWebappUrl)(deploymentEvent);
37
+ const waiter = new awaitDeploymentCompletion_1.AwaitDeploymentCompletion(apiClient, parsed['fast-failure'], parsed.silent);
38
+ const pollingResult = await waiter.awaitCompletion(deploymentEvent.id);
39
+ const isSuccess = ((_b = (_a = pollingResult === null || pollingResult === void 0 ? void 0 : pollingResult.newEntity) === null || _a === void 0 ? void 0 : _a.event_status) === null || _b === void 0 ? void 0 : _b.succeeded) || false;
40
+ if (!isSuccess) {
41
+ process.exit(1);
42
+ }
43
+ return outputWebappLink;
44
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = 'environments <command>';
4
+ exports.describe = 'Manage your environments';
5
+ exports.builder = (yargs) => yargs.commandDir('environments_cmds').demandCommand();
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = 'build-files <command>';
4
+ exports.describe = 'Manage your environment build files';
5
+ exports.builder = (yargs) => yargs.commandDir('build-files_cmds').demandCommand();