@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,314 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = void 0;
4
+ const util_1 = require("../../commandUtil/util");
5
+ const testsUtil_1 = require("../testsUtil");
6
+ const constants_1 = require("../../constants");
7
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
8
+ const mablApi_1 = require("../../../mablApi");
9
+ const execution_1 = require("../../../execution");
10
+ const defaultEnv_1 = require("../../../env/defaultEnv");
11
+ const runUtils_1 = require("./runUtils");
12
+ const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
13
+ const execution = require('../../../execution/index');
14
+ exports.command = `run`;
15
+ exports.describe =
16
+ "Run a test locally with headless support\nPre v1.0.0 'run' command behavior moved to 'run-legacy'";
17
+ exports.builder = (yargs) => {
18
+ yargs
19
+ .example('$0 tests run --id <id> --headless', 'run test locally by id in headless mode')
20
+ .example('$0 tests run --run-id <test-run-id>', 'run a test locally using the test configuration from a cloud run')
21
+ .option(constants_1.CommandArgId, {
22
+ describe: 'The id of the test to run',
23
+ type: 'string',
24
+ })
25
+ .option(constants_1.CommandArgTestFile, {
26
+ describe: 'the source file of the test to run',
27
+ type: 'string',
28
+ hidden: true,
29
+ })
30
+ .option(constants_1.CommandArgTestRunId, {
31
+ describe: 'The id of the test run to pull config from',
32
+ type: 'string',
33
+ })
34
+ .option(constants_1.CommandArgFromPlanId, {
35
+ describe: `The plan id to get a list of tests from.
36
+ Note: running tests with the --from-plan-id option is not a plan run. Advanced plan configurations, such as stages, browser settings or shared variables, are not applied.`,
37
+ type: 'string',
38
+ })
39
+ .option(constants_1.CommandArgMablBranch, {
40
+ describe: 'Mabl branch to run test against',
41
+ nargs: 1,
42
+ type: 'string',
43
+ })
44
+ .option(constants_1.CommandArgMablBranchChangesOnly, {
45
+ describe: 'Only execute tests changed on specified mabl branch',
46
+ type: 'boolean',
47
+ default: false,
48
+ })
49
+ .implies(constants_1.CommandArgMablBranchChangesOnly, constants_1.CommandArgMablBranch)
50
+ .option(constants_1.CommandArgLabelsInclude, {
51
+ describe: 'Space delimited test labels. Run tests that match any label.',
52
+ type: 'array',
53
+ conflicts: [constants_1.CommandArgId],
54
+ })
55
+ .option(constants_1.CommandArgLabelsExclude, {
56
+ describe: 'Space delimited test labels. Exclude tests that match any label.',
57
+ type: 'array',
58
+ conflicts: [constants_1.CommandArgId],
59
+ })
60
+ .option(constants_1.CommandArgWorkspaceId, {
61
+ alias: constants_1.CommandArgAliases.WorkspaceId,
62
+ describe: 'Workspace to run against',
63
+ nargs: 1,
64
+ type: 'string',
65
+ })
66
+ .option(constants_1.CommandArgEnvironmentId, {
67
+ alias: constants_1.CommandArgAliases.EnvironmentId,
68
+ describe: `Mabl environment to run under. Specify to ensure the test runs with environment variables and the latest find information.
69
+ Note: Setting the environment does not override the default URL. Please use the (—url) command to override the URL.`,
70
+ nargs: 1,
71
+ type: 'string',
72
+ })
73
+ .option(constants_1.CommandArgLocale, {
74
+ describe: 'Locale to run the test in, e.g. en-US',
75
+ nargs: 1,
76
+ type: 'string',
77
+ })
78
+ .option(constants_1.CommandArgTimezoneID, {
79
+ describe: 'Identifier of the timezone to run the test in, e.g. America/Buenos_Aires',
80
+ nargs: 1,
81
+ type: 'string',
82
+ })
83
+ .option('width', {
84
+ describe: 'Set the browser width in pixels',
85
+ default: 1366,
86
+ nargs: 1,
87
+ type: 'number',
88
+ })
89
+ .option('height', {
90
+ describe: 'Set the browser height in pixels',
91
+ default: 768,
92
+ nargs: 1,
93
+ type: 'number',
94
+ })
95
+ .option(constants_1.CommandArgUrl, {
96
+ alias: constants_1.CommandArgAliases.Url,
97
+ describe: 'URL to run the mabl test against',
98
+ nargs: 1,
99
+ type: 'string',
100
+ })
101
+ .option(constants_1.CommandArgCredentials, {
102
+ alias: constants_1.CommandArgAliases.Credentials,
103
+ describe: 'Credentials ID to run the test with',
104
+ nargs: 1,
105
+ type: 'string',
106
+ })
107
+ .option(constants_1.CommandArgDataTableId, {
108
+ describe: 'Run test using all the scenarios from the Data table ID',
109
+ nargs: 1,
110
+ type: 'string',
111
+ })
112
+ .option(constants_1.CommandArgScenarioId, {
113
+ describe: 'Run test using an specific scenario',
114
+ nargs: 1,
115
+ type: 'string',
116
+ })
117
+ .option(constants_1.CommandArgBasicAuthCredentials, {
118
+ alias: constants_1.CommandArgAliases.BasicAuthCredentials,
119
+ describe: 'Basic Authentication credentials to run the test with',
120
+ nargs: 1,
121
+ type: 'string',
122
+ })
123
+ .option('headless', {
124
+ describe: 'Should the test run headless or not',
125
+ default: false,
126
+ type: 'boolean',
127
+ })
128
+ .option('highlights', {
129
+ describe: 'Highlight elements before interacting with them. Highlighting introduces a small delay for each step.',
130
+ default: false,
131
+ type: 'boolean',
132
+ })
133
+ .option('keep-browser-open', {
134
+ describe: 'Prevent the browser from closing at the end of a test.',
135
+ default: false,
136
+ type: 'boolean',
137
+ })
138
+ .option(constants_1.CommandArgReporter, {
139
+ describe: 'Output test run information for specified reporter',
140
+ hidden: true,
141
+ type: 'string',
142
+ choices: [constants_1.ReporterOptions.Mochawesome],
143
+ })
144
+ .option(constants_1.CommandArgReporterOptions, {
145
+ describe: 'Reporter options as comma separated key/values pairs. e.g. "reportDir=path/to,json=true"',
146
+ hidden: true,
147
+ type: 'string',
148
+ })
149
+ .implies(constants_1.CommandArgReporterOptions, constants_1.CommandArgReporter)
150
+ .option(constants_1.CommandArgBrowserDisableIsolation, {
151
+ hidden: true,
152
+ describe: 'Disable cross origin isolation',
153
+ default: false,
154
+ type: 'boolean',
155
+ })
156
+ .option(constants_1.CommandArgBrowserIgnoreCertificateErrors, {
157
+ hidden: true,
158
+ describe: 'Ignore certificate errors',
159
+ default: false,
160
+ type: 'boolean',
161
+ })
162
+ .option(constants_1.CommandArgBrowserEnableExtensions, {
163
+ describe: 'Enable browser extensions on [Chrome] and [Edge]',
164
+ default: false,
165
+ type: 'boolean',
166
+ })
167
+ .option(constants_1.CommandArgHttpHeaders, {
168
+ describe: 'Space delimited HTTP headers added to browser requests (e.g. "x-header:foo")',
169
+ type: 'array',
170
+ })
171
+ .option(constants_1.CommandArgUserAgent, {
172
+ describe: 'Emulates a custom user-agent (e.g. "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4651.0 Safari/537.36")',
173
+ type: 'string',
174
+ })
175
+ .option(constants_1.CommandArgTestInteractionSpeed, {
176
+ describe: 'Set the speed that mabl interacts with webpages. Overrides test run settings if specified.',
177
+ type: 'string',
178
+ choices: Object.keys(mablApi_1.TestParameters.PageLoadWaitEnum).map((pageLoadWait) => pageLoadWait.toLowerCase()),
179
+ })
180
+ .option(constants_1.CommandArgBrowser, {
181
+ describe: `Target browser to execute the test against, must be one of ${constants_1.ValidBrowserTypesForLocalRuns}, defaults to ${constants_1.DefaultBrowserType}`,
182
+ type: 'string',
183
+ nargs: 1,
184
+ choices: constants_1.ValidBrowserTypesForLocalRuns,
185
+ hidden: true,
186
+ })
187
+ .option(constants_1.CommandArgUseTestExecutionProxy, {
188
+ describe: 'Route test HTTP traffic through a local proxy',
189
+ type: 'boolean',
190
+ hidden: true,
191
+ })
192
+ .check((argv) => {
193
+ (0, testsUtil_1.validateRunCommandWithLabels)(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude], argv[constants_1.CommandArgTestRunId], argv[constants_1.CommandArgFromPlanId], true, argv[constants_1.CommandArgTestFile]);
194
+ if (argv[constants_1.CommandArgDataTableId] &&
195
+ !argv[constants_1.CommandArgId] &&
196
+ !argv[constants_1.CommandArgFromPlanId]) {
197
+ throw new Error(`The ${constants_1.CommandArgDataTableId} option can only be used with the ${constants_1.CommandArgId} or the ${constants_1.CommandArgFromPlanId} option`);
198
+ }
199
+ if (argv[constants_1.CommandArgDataTableId] && argv[constants_1.CommandArgScenarioId]) {
200
+ throw new Error(`The ${constants_1.CommandArgScenarioId} option cannot be used with the ${constants_1.CommandArgDataTableId} option`);
201
+ }
202
+ const httpHeaders = argv[constants_1.CommandArgHttpHeaders];
203
+ (0, util_1.validateArrayInputs)(httpHeaders, 'HTTP headers must be SPACE delimited, e.g. "--http-headers "foo:bar" "baz:qux"');
204
+ argv[constants_1.CommandArgHttpHeaders] = (0, util_1.validateValuePairInputs)('HTTP header', httpHeaders);
205
+ return true;
206
+ });
207
+ };
208
+ const exitCodeOnError = 1;
209
+ exports.handler = (0, util_1.failWrapper)(run, exitCodeOnError);
210
+ async function run(parsed) {
211
+ var _a;
212
+ const commandStartTime = Date.now();
213
+ let workspaceId;
214
+ try {
215
+ workspaceId = await (0, util_1.getWorkspaceId)(parsed);
216
+ }
217
+ catch {
218
+ }
219
+ const extraHttpHeaders = {};
220
+ ((_a = parsed['http-headers']) !== null && _a !== void 0 ? _a : []).forEach((header) => {
221
+ const headerParts = header.split(':');
222
+ if (headerParts.length === 2 && headerParts[0] && headerParts[1]) {
223
+ extraHttpHeaders[headerParts[0].toLowerCase()] = headerParts[1];
224
+ }
225
+ });
226
+ const browserType = (0, testsUtil_1.parseBrowserType)(parsed[constants_1.CommandArgBrowser]);
227
+ let scenario;
228
+ if (parsed[constants_1.CommandArgScenarioId]) {
229
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
230
+ scenario = await apiClient.getScenario(parsed[constants_1.CommandArgScenarioId]);
231
+ if (!scenario) {
232
+ throw new Error(`Scenario with ID ${parsed[constants_1.CommandArgScenarioId]} not found`);
233
+ }
234
+ }
235
+ const parsedLocale = parsed[constants_1.CommandArgLocale];
236
+ const parsedTimezone = parsed[constants_1.CommandArgTimezoneID];
237
+ const localizationOptions = parsedLocale || parsedTimezone
238
+ ? {
239
+ locale: parsedLocale,
240
+ timezone_identifier: parsedTimezone,
241
+ }
242
+ : undefined;
243
+ const testRunnerConfig = {
244
+ _cliCreated: true,
245
+ basicAuthCredentialsId: parsed[constants_1.CommandArgBasicAuthCredentials],
246
+ branchName: parsed['mabl-branch'],
247
+ browserType,
248
+ credentialsId: parsed['credentials-id'],
249
+ dataTableVariables: scenario,
250
+ disableIsolation: parsed[constants_1.CommandArgBrowserDisableIsolation],
251
+ enableExtensions: parsed[constants_1.CommandArgBrowserEnableExtensions],
252
+ enableLink: false,
253
+ environmentId: parsed[constants_1.CommandArgEnvironmentId],
254
+ extraHttpHeaders,
255
+ filterHttpRequests: false,
256
+ fromPlanId: parsed['from-plan-id'],
257
+ headless: parsed.headless,
258
+ height: parsed.height,
259
+ highlights: parsed.highlights,
260
+ ignoreCertificateErrors: parsed[constants_1.CommandArgBrowserIgnoreCertificateErrors],
261
+ interactionSpeed: parsed[constants_1.CommandArgTestInteractionSpeed],
262
+ keepBrowserOpen: parsed['keep-browser-open'],
263
+ labelsExclude: parsed['exclude-labels'],
264
+ labelsInclude: parsed.labels,
265
+ localizationOptions,
266
+ runId: parsed['run-id'],
267
+ testFile: parsed[constants_1.CommandArgTestFile],
268
+ testId: parsed.id,
269
+ url: parsed.url,
270
+ useTestExecutionProxy: parsed[constants_1.CommandArgUseTestExecutionProxy],
271
+ userAgent: parsed[constants_1.CommandArgUserAgent],
272
+ usingDataTableId: parsed[constants_1.CommandArgDataTableId],
273
+ width: parsed.width,
274
+ workspaceId,
275
+ };
276
+ loggingProvider_1.logger.info('Warming up test runner...');
277
+ const mablTestsRunner = await execution.createBrowserTestsRunner(testRunnerConfig);
278
+ const results = await mablTestsRunner.run();
279
+ if ((mablTestsRunner === null || mablTestsRunner === void 0 ? void 0 : mablTestsRunner.mablTestRunners) !== undefined) {
280
+ mablTestsRunner.mablTestRunners
281
+ .filter((tr) => tr instanceof execution_1.MablTestRunner)
282
+ .forEach((tr) => {
283
+ const testContext = tr.testContext;
284
+ (0, testsUtil_1.cleanupTestResources)(testContext);
285
+ });
286
+ }
287
+ await (0, runUtils_1.logTestResults)(results, parsed, commandStartTime, generateRunCommandTemplate(parsed, results));
288
+ if (!testRunnerConfig.keepBrowserOpen) {
289
+ if (!results.success) {
290
+ process.exit(1);
291
+ }
292
+ }
293
+ }
294
+ exports.run = run;
295
+ function generateRunCommandTemplate(parsed, testResults) {
296
+ var _a, _b, _c, _d, _e, _f, _g;
297
+ const testResult = testResults.testResults[0];
298
+ let templateCommand = `${defaultEnv_1.SCRIPT_NAME} ${parsed._.join(' ')} \\\n`;
299
+ if ((_a = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _a === void 0 ? void 0 : _a.environmentId) {
300
+ templateCommand = `${templateCommand} --${constants_1.CommandArgEnvironmentId} ${(_b = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _b === void 0 ? void 0 : _b.environmentId} \\\n`;
301
+ }
302
+ if ((_c = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _c === void 0 ? void 0 : _c.credentialsId) {
303
+ templateCommand = `${templateCommand} --${constants_1.CommandArgCredentials} ${(_d = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _d === void 0 ? void 0 : _d.credentialsId} \\\n`;
304
+ }
305
+ if ((_e = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _e === void 0 ? void 0 : _e.url) {
306
+ templateCommand = `${templateCommand} --${constants_1.CommandArgUrl} ${(_f = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _f === void 0 ? void 0 : _f.url} \\\n`;
307
+ }
308
+ if ((_g = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _g === void 0 ? void 0 : _g.branch) {
309
+ templateCommand = `${templateCommand} --${constants_1.CommandArgMablBranch} ${testResult.rerunConfig.branch} \\\n`;
310
+ }
311
+ const testIdVal = parsed.id ? parsed.id : '<TEST-ID>';
312
+ templateCommand = `${templateCommand} --${constants_1.CommandArgId} ${testIdVal}`;
313
+ return templateCommand;
314
+ }
@@ -0,0 +1,60 @@
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.getPlatformFromTestRun = exports.logTestResults = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
9
+ const reporter_1 = require("../../../reporters/reporter");
10
+ const testsUtil_1 = require("../testsUtil");
11
+ const execution_1 = require("../../../execution");
12
+ async function logTestResults(results, parsed, commandStartTime, rerunCommandTemplate) {
13
+ loggingProvider_1.logger.logNewLine();
14
+ loggingProvider_1.logger.info(`Test count: ${results.numTotalTests}`);
15
+ loggingProvider_1.logger.info(`Passed: ${results.numPassedTests}`);
16
+ if (results.numPassedTests) {
17
+ results.testResults.forEach((result) => {
18
+ if (result.status === 'passed') {
19
+ loggingProvider_1.logger.info(` - ${getTestResultDescription(result)} (${(0, testsUtil_1.calculateTotalTimeSeconds)(result.startTime, result.endTime)}s)`);
20
+ }
21
+ });
22
+ }
23
+ loggingProvider_1.logger.info(`Skipped: ${results.numSkippedTests}`);
24
+ if (results.numSkippedTests) {
25
+ results.testResults.forEach((result) => {
26
+ if (result.status === 'skipped') {
27
+ loggingProvider_1.logger.info(chalk_1.default.yellow(` - ${getTestResultDescription(result)}`));
28
+ }
29
+ });
30
+ }
31
+ loggingProvider_1.logger.info(`Failed: ${results.numFailedTests}`);
32
+ if (results.numFailedTests) {
33
+ results.testResults.forEach((result) => {
34
+ if (result.status === 'failed') {
35
+ loggingProvider_1.logger.info(chalk_1.default.red(` - ${getTestResultDescription(result)} (${(0, testsUtil_1.calculateTotalTimeSeconds)(result.startTime, result.endTime)}s)`));
36
+ }
37
+ });
38
+ if (parsed.labels || parsed['from-plan-id'] || process.env.CI) {
39
+ loggingProvider_1.logger.info(`Rerun any failed test with the following command template:`);
40
+ loggingProvider_1.logger.info(`${chalk_1.default.magenta(rerunCommandTemplate)}`);
41
+ }
42
+ }
43
+ loggingProvider_1.logger.info(`Total time: ${(0, testsUtil_1.calculateTotalTimeSeconds)(commandStartTime, Date.now())} seconds`);
44
+ if (parsed.reporter) {
45
+ await (0, reporter_1.handleReportingForTestsRun)(parsed.reporter, results, parsed['reporter-options']);
46
+ }
47
+ }
48
+ exports.logTestResults = logTestResults;
49
+ function getTestResultDescription(result) {
50
+ return `${result.testName}${result.scenarioName ? ` - Scenario: ${result.scenarioName}` : ''}`;
51
+ }
52
+ function getPlatformFromTestRun(testRun) {
53
+ var _a, _b;
54
+ const platform = (_b = (_a = testRun.journey_parameters) === null || _a === void 0 ? void 0 : _a.mobile_device) === null || _b === void 0 ? void 0 : _b.platform;
55
+ if (!platform) {
56
+ throw new Error(`Unable to determine mobile platform from test run: ${testRun.id}`);
57
+ }
58
+ return (0, execution_1.parsePlatformName)(platform);
59
+ }
60
+ exports.getPlatformFromTestRun = getPlatformFromTestRun;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTrainerId = exports.LOCAL_TRAINER_ID = void 0;
4
+ const env_1 = require("../../../env/env");
5
+ exports.LOCAL_TRAINER_ID = 'jmeffipchlcmnkllcolcbmneknjckcpp';
6
+ function getTrainerId() {
7
+ if (env_1.LOCAL_TRAINER_PATH) {
8
+ return env_1.EXTENSION_ID;
9
+ }
10
+ return exports.LOCAL_TRAINER_ID;
11
+ }
12
+ exports.getTrainerId = getTrainerId;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = 'users <command>';
4
+ exports.describe = 'mabl users related commands';
5
+ exports.builder = (yargs) => yargs.commandDir('users_cmds').demandCommand();
@@ -0,0 +1,58 @@
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 mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
8
+ const cli_table3_1 = __importDefault(require("cli-table3"));
9
+ const moment = require("moment");
10
+ const util_1 = require("../../commandUtil/util");
11
+ const constants_1 = require("../../constants");
12
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
13
+ const list_1 = require("../../commandUtil/list");
14
+ exports.command = 'list';
15
+ exports.describe = 'List users from a workspace';
16
+ exports.builder = (0, list_1.getListBuilderOptions)('users');
17
+ exports.handler = (0, util_1.failWrapper)(listUsers);
18
+ async function listUsers(parsed) {
19
+ const output = parsed.output;
20
+ const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
21
+ const limit = parsed.limit;
22
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
23
+ const users = await apiClient.getUsers(workspaceId, limit);
24
+ printUsers(users, output, workspaceId);
25
+ return users.length;
26
+ }
27
+ function printUsers(users, outputFormat, workspaceId) {
28
+ switch (outputFormat) {
29
+ case 'json':
30
+ loggingProvider_1.logger.info(JSON.stringify(users, null, 2));
31
+ break;
32
+ case 'yaml':
33
+ loggingProvider_1.logger.info((0, js_yaml_1.dump)(users));
34
+ break;
35
+ default:
36
+ const table = new cli_table3_1.default({
37
+ head: ['ID', 'Name', 'Role', 'Email', 'Created time'],
38
+ wordWrap: true,
39
+ });
40
+ users.forEach((user) => {
41
+ var _a, _b, _c;
42
+ const userRole = (_c = (_b = (_a = user.roles) === null || _a === void 0 ? void 0 : _a.find((role) => role.organization_id === workspaceId)) === null || _b === void 0 ? void 0 : _b.role) !== null && _c !== void 0 ? _c : 'unknown';
43
+ table.push([
44
+ { rowSpan: 1, content: user.id, vAlign: 'center' },
45
+ { rowSpan: 1, content: user.name, vAlign: 'center' },
46
+ { rowSpan: 1, content: userRole, vAlign: 'center' },
47
+ { rowSpan: 1, content: user.email, vAlign: 'center' },
48
+ {
49
+ rowSpan: 1,
50
+ content: moment.utc(user.created_time).format(constants_1.ListTimeFormat),
51
+ vAlign: 'center',
52
+ },
53
+ ]);
54
+ });
55
+ loggingProvider_1.logger.info(table.toString());
56
+ break;
57
+ }
58
+ }
@@ -0,0 +1,108 @@
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 mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
7
+ const util_1 = require("../../commandUtil/util");
8
+ const constants_1 = require("../../constants");
9
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
10
+ const chalk_1 = __importDefault(require("chalk"));
11
+ const moment_1 = __importDefault(require("moment"));
12
+ const inquirer_1 = __importDefault(require("inquirer"));
13
+ const mablApi_1 = require("../../../mablApi");
14
+ const ora = require("ora");
15
+ exports.command = 'copy';
16
+ exports.describe = 'copy data from one workspace to another';
17
+ exports.builder = (yargs) => {
18
+ yargs
19
+ .option(constants_1.CommandArgFrom, {
20
+ describe: 'The workspace from which to copy',
21
+ required: true,
22
+ nargs: 1,
23
+ })
24
+ .option(constants_1.CommandArgTo, {
25
+ describe: 'The workspace the data will be copied into',
26
+ required: true,
27
+ nargs: 1,
28
+ })
29
+ .option(constants_1.CommandArgIncludeDefaults, {
30
+ describe: 'Include default tests when copying',
31
+ default: false,
32
+ type: 'boolean',
33
+ })
34
+ .option(constants_1.CommandArgIncludedTests, {
35
+ describe: 'List of test ids to include with the copy. If empty, all tests will be copied.',
36
+ default: [],
37
+ type: 'array',
38
+ })
39
+ .option(constants_1.CommandArgExcludedTests, {
40
+ describe: 'List of test ids to exclude from the copy. If a test is in both the include and exclude list, it will be excluded.',
41
+ default: [],
42
+ type: 'array',
43
+ });
44
+ };
45
+ exports.handler = (0, util_1.failWrapper)(copyWorkspace);
46
+ function getTimestamp() {
47
+ return (0, moment_1.default)().format('HH:mm:ss');
48
+ }
49
+ function hasOwnerRoleInWorkspace(user, workspaceId) {
50
+ var _a;
51
+ const hasOwnerRole = (_a = user.roles) === null || _a === void 0 ? void 0 : _a.some((role) => role.organization_id === workspaceId && role.role === mablApi_1.UserRoleEnum.Owner);
52
+ if (!hasOwnerRole) {
53
+ loggingProvider_1.logger.warn(chalk_1.default.yellow(`You must be an owner in both workspaces to copy. You do not have owner permissions in workspace: ${workspaceId}`));
54
+ }
55
+ return !!hasOwnerRole;
56
+ }
57
+ async function copyWorkspace(parsed) {
58
+ const spinner = ora({
59
+ prefixText: ' ',
60
+ text: 'Copying workspace assets...',
61
+ });
62
+ try {
63
+ const sourceWorkspaceId = parsed.from;
64
+ const destinationWorkspaceId = parsed.to;
65
+ const includeDefaults = parsed.includeDefaults;
66
+ const includedTests = parsed.includedTests;
67
+ const excludedTests = parsed.excludedTests;
68
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
69
+ const [sourceWorkspace, destinationWorkspace] = await Promise.all([
70
+ apiClient.getWorkspace(sourceWorkspaceId),
71
+ apiClient.getWorkspace(destinationWorkspaceId),
72
+ ]);
73
+ const user = await apiClient.getSelf();
74
+ if (!hasOwnerRoleInWorkspace(user, sourceWorkspaceId) ||
75
+ !hasOwnerRoleInWorkspace(user, destinationWorkspaceId)) {
76
+ return Promise.reject(new Error('You must be owner of both the source and destination workspace to copy a workspace.'));
77
+ }
78
+ loggingProvider_1.logger.info(chalk_1.default.yellow(`[${getTimestamp()}] In case of failure, please DO NOT re-run this command, as it would create duplicate items in the destination. The operation may take several minutes, or longer for especially large workspaces. Please contact mabl support if you encounter any issues.`));
79
+ loggingProvider_1.logger.info(chalk_1.default.yellow(`[${getTimestamp()}] Note: currently the copy includes tests, flows, datatables, file uploads, javascript snippets. Unsupported items include: plans, applications, environments, coverage, and run history.`));
80
+ const excludedTestsConfirmationDetail = !includeDefaults || (excludedTests === null || excludedTests === void 0 ? void 0 : excludedTests.length)
81
+ ? ' excluding default tests and all tests specified with --exclude-tests '
82
+ : '';
83
+ const response = await inquirer_1.default.prompt([
84
+ {
85
+ type: 'confirm',
86
+ name: 'do_continue',
87
+ message: `Are you sure you want to copy ALL tests${excludedTestsConfirmationDetail} from Workspace [${sourceWorkspaceId}](${sourceWorkspace.name}) to Workspace [${destinationWorkspaceId}](${destinationWorkspace.name})? Once the copy begins, it cannot be cancelled.`,
88
+ default: false,
89
+ },
90
+ ]);
91
+ if (!response.do_continue) {
92
+ return 'Skipped';
93
+ }
94
+ loggingProvider_1.logger.info(chalk_1.default.yellow(`[${getTimestamp()}] The copy process will complete even if this command is interrupted.`));
95
+ spinner.start();
96
+ await apiClient.copyWorkspace(sourceWorkspaceId, destinationWorkspaceId, includeDefaults, includedTests, excludedTests);
97
+ spinner.succeed('Done copying assets');
98
+ loggingProvider_1.logger.info(chalk_1.default.green(`[${getTimestamp()}] Workspace copy successful`));
99
+ return 'Success';
100
+ }
101
+ catch (error) {
102
+ if (spinner.isSpinning) {
103
+ spinner.fail('Error copying workspace assets');
104
+ loggingProvider_1.logger.info(chalk_1.default.red(`[${getTimestamp()}] Workspace copy failed`));
105
+ }
106
+ throw error;
107
+ }
108
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
4
+ const describe_1 = require("../../commandUtil/describe");
5
+ const util_1 = require("../../commandUtil/util");
6
+ exports.command = 'describe <id>';
7
+ exports.describe = (0, util_1.getDescribeDescriptions)('workspace');
8
+ exports.builder = (0, describe_1.getDescribeBuilderOptions)();
9
+ exports.handler = (0, util_1.failWrapper)(getWorkspace);
10
+ async function getWorkspace(parsed) {
11
+ try {
12
+ const workspaceId = parsed.id;
13
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
14
+ const workspace = await apiClient.getWorkspace(workspaceId);
15
+ (0, describe_1.outputEntity)(workspace, parsed.output);
16
+ return workspace.id;
17
+ }
18
+ catch (error) {
19
+ throw new Error(`Error getting workspace: ${error}`);
20
+ }
21
+ }
@@ -0,0 +1,67 @@
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 mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
8
+ const cli_table3_1 = __importDefault(require("cli-table3"));
9
+ const moment = require("moment");
10
+ const util_1 = require("../../commandUtil/util");
11
+ const interfaces_1 = require("../../commandUtil/interfaces");
12
+ const constants_1 = require("../../constants");
13
+ const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
14
+ exports.command = 'list';
15
+ exports.describe = 'List your workspaces';
16
+ exports.builder = (yargs) => {
17
+ yargs
18
+ .option(constants_1.CommandArgLimitOutput, {
19
+ alias: constants_1.CommandArgAliases.LimitOutput,
20
+ describe: 'The number of workspaces to return',
21
+ default: interfaces_1.DEFAULT_LISTING_RESULT_LIMIT,
22
+ nargs: 1,
23
+ })
24
+ .option(constants_1.CommandArgOutput, {
25
+ alias: constants_1.CommandArgAliases.OutputType,
26
+ choices: constants_1.DefaultOutputFormatChoices,
27
+ describe: 'Specify result output format',
28
+ nargs: 1,
29
+ });
30
+ };
31
+ exports.handler = (0, util_1.failWrapper)(listWorkspaces);
32
+ async function listWorkspaces(parsed) {
33
+ const output = parsed.output;
34
+ const limit = parsed.limit;
35
+ const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
36
+ const workspaces = await apiClient.getWorkspaces(limit);
37
+ printWorkspaces(workspaces, output);
38
+ return workspaces.length;
39
+ }
40
+ function printWorkspaces(workspaces, output) {
41
+ switch (output) {
42
+ case 'json':
43
+ loggingProvider_1.logger.info(JSON.stringify(workspaces, null, 2));
44
+ break;
45
+ case 'yaml':
46
+ loggingProvider_1.logger.info((0, js_yaml_1.dump)(workspaces));
47
+ break;
48
+ default:
49
+ const table = new cli_table3_1.default({
50
+ head: ['ID', 'Name', 'Created time'],
51
+ wordWrap: true,
52
+ });
53
+ workspaces.forEach((workspace) => {
54
+ table.push([
55
+ { rowSpan: 1, content: workspace.id, vAlign: 'center' },
56
+ { rowSpan: 1, content: workspace.name, vAlign: 'center' },
57
+ {
58
+ rowSpan: 1,
59
+ content: moment.utc(workspace.created_time).format(constants_1.ListTimeFormat),
60
+ vAlign: 'center',
61
+ },
62
+ ]);
63
+ });
64
+ loggingProvider_1.logger.info(table.toString());
65
+ break;
66
+ }
67
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.command = 'workspaces <command>';
4
+ exports.describe = 'Manage your workspaces';
5
+ exports.builder = (yargs) => yargs.commandDir('workspace_cmds').demandCommand();
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidEnvironmentVariableName = void 0;
4
+ function isValidEnvironmentVariableName(name) {
5
+ return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name);
6
+ }
7
+ exports.isValidEnvironmentVariableName = isValidEnvironmentVariableName;