@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,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.proxyUrlToPortConfig = exports.axiosProxyConfig = exports.currentProxyConfig = exports.setTestExecutionProxyUrl = void 0;
4
+ const cliConfigProvider_1 = require("../providers/cliConfigProvider");
5
+ const hpagent_1 = require("hpagent");
6
+ const httpUtil_1 = require("./httpUtil");
7
+ const https_1 = require("https");
8
+ let testExecutionProxyUrl;
9
+ function setTestExecutionProxyUrl(url) {
10
+ testExecutionProxyUrl = url;
11
+ }
12
+ exports.setTestExecutionProxyUrl = setTestExecutionProxyUrl;
13
+ async function currentProxyConfig(mode = 'mabl') {
14
+ const httpConfig = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http;
15
+ return axiosProxyConfig(mode === 'test' ? httpConfig === null || httpConfig === void 0 ? void 0 : httpConfig.test : httpConfig === null || httpConfig === void 0 ? void 0 : httpConfig.mabl);
16
+ }
17
+ exports.currentProxyConfig = currentProxyConfig;
18
+ function axiosProxyConfig(httpConfig) {
19
+ var _a;
20
+ const config = {
21
+ headers: {
22
+ [httpUtil_1.USER_AGENT_HEADER]: httpUtil_1.USER_AGENT,
23
+ },
24
+ };
25
+ let { proxyType, sslVerify } = httpConfig;
26
+ if (testExecutionProxyUrl) {
27
+ sslVerify = false;
28
+ proxyType = 'current';
29
+ }
30
+ if (!sslVerify) {
31
+ config.httpsAgent = new https_1.Agent({
32
+ rejectUnauthorized: false,
33
+ });
34
+ }
35
+ if (testExecutionProxyUrl || ((_a = httpConfig.proxyHost) === null || _a === void 0 ? void 0 : _a.href)) {
36
+ config.proxy = proxyUrlToPortConfig((testExecutionProxyUrl !== null && testExecutionProxyUrl !== void 0 ? testExecutionProxyUrl : httpConfig.proxyHost));
37
+ }
38
+ return maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, proxyType);
39
+ }
40
+ exports.axiosProxyConfig = axiosProxyConfig;
41
+ function escapeRegexDots(input) {
42
+ return input.replace('.', '\\.');
43
+ }
44
+ function proxyUrlToPortConfig(proxyUrl) {
45
+ const defaultPort = proxyUrl.protocol === 'https:' ? 443 : 80;
46
+ const maybePortNumberMatch = proxyUrl.port;
47
+ const portNumber = maybePortNumberMatch
48
+ ? parseInt(maybePortNumberMatch)
49
+ : defaultPort;
50
+ let hostname = proxyUrl.hostname +
51
+ (proxyUrl.search ? proxyUrl.pathname + proxyUrl.search : proxyUrl.pathname);
52
+ hostname = hostname.replace(new RegExp(`${escapeRegexDots(proxyUrl.hostname)}/$`), proxyUrl.hostname);
53
+ const config = {
54
+ host: hostname,
55
+ port: portNumber,
56
+ protocol: proxyUrl.protocol,
57
+ };
58
+ if (proxyUrl.username || proxyUrl.password) {
59
+ config.auth = {
60
+ username: proxyUrl.username,
61
+ password: proxyUrl.password,
62
+ };
63
+ }
64
+ return config;
65
+ }
66
+ exports.proxyUrlToPortConfig = proxyUrlToPortConfig;
67
+ function maybeGetModifiedAxiosConfigForHttpProxy(config, sslVerify, _proxyType) {
68
+ var _a, _b;
69
+ if (config.proxy &&
70
+ (((_a = config.proxy) === null || _a === void 0 ? void 0 : _a.protocol) === 'http:' || ((_b = config.proxy) === null || _b === void 0 ? void 0 : _b.protocol) === 'http')) {
71
+ const newConfig = {
72
+ ...config,
73
+ };
74
+ newConfig.proxy = false;
75
+ const authConfig = config.proxy.auth;
76
+ let proxyString = 'http://';
77
+ if (authConfig) {
78
+ proxyString += `${authConfig.username}:${authConfig.password}@`;
79
+ }
80
+ proxyString += `${config.proxy.host}:${config.proxy.port}`;
81
+ const rejectUnauthorized = sslVerify === true;
82
+ const httpAgentConfig = {
83
+ keepAlive: true,
84
+ keepAliveMsecs: 1000,
85
+ maxSockets: 256,
86
+ maxFreeSockets: 256,
87
+ proxy: proxyString,
88
+ proxyRequestOptions: {
89
+ rejectUnauthorized,
90
+ },
91
+ };
92
+ const httpsAgentConfig = {
93
+ ...httpAgentConfig,
94
+ rejectUnauthorized,
95
+ };
96
+ newConfig.httpsAgent = new hpagent_1.HttpsProxyAgent(httpsAgentConfig);
97
+ newConfig.httpAgent = new hpagent_1.HttpProxyAgent(httpAgentConfig);
98
+ return newConfig;
99
+ }
100
+ return config;
101
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.postProcessHeaders = exports.getHttpAgent = exports.GENERAL_API_STEP_EXECUTION_ERROR_CODE = exports.EXECUTION_ENGINE_SSL_VERIFY = exports.USER_AGENT_HEADER = exports.USER_AGENT = void 0;
4
+ const agent_base_1 = require("agent-base");
5
+ const socks_proxy_agent_1 = require("socks-proxy-agent");
6
+ const pureUtil_1 = require("../util/pureUtil");
7
+ const MablHttpAgent_1 = require("./MablHttpAgent");
8
+ const RequestFilteringHttpAgent_1 = require("./RequestFilteringHttpAgent");
9
+ exports.USER_AGENT = `${(0, pureUtil_1.getCliName)()}@${(0, pureUtil_1.getCliVersion)()}`;
10
+ exports.USER_AGENT_HEADER = 'User-Agent';
11
+ exports.EXECUTION_ENGINE_SSL_VERIFY = false;
12
+ exports.GENERAL_API_STEP_EXECUTION_ERROR_CODE = '-1';
13
+ function getHttpAgent(shouldFilterHttpRequests, linkServers, proxyConfig) {
14
+ const linkAgent = maybeGetSocksAgent(linkServers);
15
+ if (linkAgent) {
16
+ return MablHttpAgent_1.MablHttpAgent.createNewInstance({
17
+ httpAgent: linkAgent,
18
+ httpsAgent: linkAgent,
19
+ });
20
+ }
21
+ else if (shouldFilterHttpRequests) {
22
+ return RequestFilteringHttpAgent_1.RequestFilteringHttpAgent.createNewInstance();
23
+ }
24
+ return MablHttpAgent_1.MablHttpAgent.createNewInstance({ proxyConfig });
25
+ }
26
+ exports.getHttpAgent = getHttpAgent;
27
+ function maybeGetSocksAgent(linkServers) {
28
+ if (!(linkServers === null || linkServers === void 0 ? void 0 : linkServers.length)) {
29
+ return;
30
+ }
31
+ const agentOptions = linkServers.map((linkServer) => ({
32
+ host: linkServer.forwarding_host,
33
+ port: linkServer.forwarding_port,
34
+ userId: linkServer.workspace_id,
35
+ password: linkServer.label,
36
+ tls: {
37
+ rejectUnauthorized: false,
38
+ },
39
+ }));
40
+ if (agentOptions.length === 1) {
41
+ return new socks_proxy_agent_1.SocksProxyAgent(agentOptions[0]);
42
+ }
43
+ return new MultiSocksProxyAgent(agentOptions);
44
+ }
45
+ class MultiSocksProxyAgent extends agent_base_1.Agent {
46
+ constructor(options) {
47
+ super();
48
+ this.agents = options.map((proxy) => new socks_proxy_agent_1.SocksProxyAgent(proxy));
49
+ }
50
+ async callback(req, opts) {
51
+ return this.selectAgent().callback(req, opts);
52
+ }
53
+ selectAgent() {
54
+ return this.agents[Math.floor(Math.random() * this.agents.length)];
55
+ }
56
+ destroy() {
57
+ this.agents.forEach((agent) => agent.destroy());
58
+ }
59
+ }
60
+ function postProcessHeaders(response) {
61
+ var _a, _b, _c;
62
+ const parsed = {};
63
+ const rawHeaders = (_b = (_a = response.request) === null || _a === void 0 ? void 0 : _a.res) === null || _b === void 0 ? void 0 : _b.rawHeaders;
64
+ if (rawHeaders) {
65
+ for (let i = 0; i + 1 < rawHeaders.length; i += 2) {
66
+ const headerName = rawHeaders[i].toLowerCase();
67
+ const headerValue = rawHeaders[i + 1];
68
+ parsed[headerName] = ((_c = parsed[headerName]) !== null && _c !== void 0 ? _c : []).concat(headerValue);
69
+ }
70
+ }
71
+ return parsed;
72
+ }
73
+ exports.postProcessHeaders = postProcessHeaders;
@@ -0,0 +1,206 @@
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.RequestInterceptor = exports.headerStringToProtocol = exports.headerStringToHeaders = exports.MAX_SERIALIZED_BODY_SIZE_BYTES = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const loggingProvider_1 = require("../providers/logging/loggingProvider");
9
+ const uuid_1 = require("uuid");
10
+ const httpUtil_1 = require("./httpUtil");
11
+ const pureUtil_1 = require("../util/pureUtil");
12
+ exports.MAX_SERIALIZED_BODY_SIZE_BYTES = 1024 * 1024;
13
+ const HEADER_EXTRACT_REGEXP = /^(?<rawKey>[^:]+)(:)(?<value>.*)$/;
14
+ function headerStringToHeaders(rawHeader) {
15
+ const headers = {};
16
+ if (!rawHeader) {
17
+ return headers;
18
+ }
19
+ rawHeader
20
+ .split(/\r?\n/)
21
+ .filter((value) => value !== '')
22
+ .filter((value) => HEADER_EXTRACT_REGEXP.test(value))
23
+ .map((value) => value.match(HEADER_EXTRACT_REGEXP).groups)
24
+ .forEach(({ rawKey, value }) => {
25
+ var _a;
26
+ const normalizedHeader = rawKey.toLowerCase().trim();
27
+ const values = (_a = headers[normalizedHeader]) !== null && _a !== void 0 ? _a : [];
28
+ if (value === null || value === void 0 ? void 0 : value.trim()) {
29
+ values.push(value.trim());
30
+ }
31
+ headers[normalizedHeader] = values;
32
+ });
33
+ return headers;
34
+ }
35
+ exports.headerStringToHeaders = headerStringToHeaders;
36
+ function headerStringToProtocol(rawHeader) {
37
+ var _a, _b, _c;
38
+ if (!rawHeader) {
39
+ return;
40
+ }
41
+ const firstRowTrimmed = (_b = (_a = rawHeader.split(/\r?\n/, 2)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.trim();
42
+ return (_c = firstRowTrimmed === null || firstRowTrimmed === void 0 ? void 0 : firstRowTrimmed.match(/\s(\S+)$/)) === null || _c === void 0 ? void 0 : _c[1];
43
+ }
44
+ exports.headerStringToProtocol = headerStringToProtocol;
45
+ function headerRecordToHeaderMultiMap(input) {
46
+ const result = {};
47
+ Object.entries(input).forEach(([key, value]) => {
48
+ result[key] = [value];
49
+ });
50
+ return result;
51
+ }
52
+ function handleRawResponseBody(body) {
53
+ body = body !== null && body !== void 0 ? body : '';
54
+ switch (typeof body) {
55
+ case 'number':
56
+ return { body: body.toString(), responseSize: 8 };
57
+ case 'boolean':
58
+ return { body: body.toString(), responseSize: 4 };
59
+ case 'string':
60
+ return {
61
+ body: body.substring(0, exports.MAX_SERIALIZED_BODY_SIZE_BYTES),
62
+ responseSize: body.length,
63
+ };
64
+ case 'object':
65
+ const serializedBody = JSON.stringify(body);
66
+ if (serializedBody.length <= exports.MAX_SERIALIZED_BODY_SIZE_BYTES) {
67
+ return { body, responseSize: serializedBody.length };
68
+ }
69
+ return {
70
+ body: serializedBody.substring(0, exports.MAX_SERIALIZED_BODY_SIZE_BYTES),
71
+ responseSize: serializedBody.length,
72
+ };
73
+ default:
74
+ throw new Error(`Unhandled request intercept body type: [${typeof body}]`);
75
+ }
76
+ }
77
+ function getContentLength(headers) {
78
+ const contentLengthAsString = (0, pureUtil_1.getCaseInsensitiveProperty)(headers, 'content-length');
79
+ return contentLengthAsString ? Number(contentLengthAsString) : undefined;
80
+ }
81
+ class RequestInterceptor {
82
+ constructor() {
83
+ this.interceptedRequests = [];
84
+ this.handleRequest = this.handleRequest.bind(this);
85
+ this.handleResponse = this.handleResponse.bind(this);
86
+ this.handleError = this.handleError.bind(this);
87
+ }
88
+ get interceptedRequestBuffer() {
89
+ return [...this.interceptedRequests];
90
+ }
91
+ clearInterceptBuffer() {
92
+ this.interceptedRequests = [];
93
+ }
94
+ registerInterceptors(axiosInstance) {
95
+ this.requestInterceptorId = axiosInstance.interceptors.request.use(this.handleRequest, this.handleError);
96
+ this.responseInterceptorId = axios_1.default.interceptors.response.use(this.handleResponse, this.handleError);
97
+ }
98
+ ejectInterceptors(axiosInstance) {
99
+ try {
100
+ if (this.requestInterceptorId !== undefined) {
101
+ axiosInstance.interceptors.request.eject(this.requestInterceptorId);
102
+ }
103
+ }
104
+ catch (e) {
105
+ loggingProvider_1.logger.warn(`Unable to eject request interceptor ${this.requestInterceptorId}`);
106
+ }
107
+ try {
108
+ if (this.responseInterceptorId !== undefined) {
109
+ axiosInstance.interceptors.response.eject(this.responseInterceptorId);
110
+ }
111
+ }
112
+ catch (e) {
113
+ loggingProvider_1.logger.warn(`Unable to eject request interceptor ${this.responseInterceptorId}`);
114
+ }
115
+ }
116
+ handleRequest(config) {
117
+ var _a, _b, _c;
118
+ try {
119
+ const requestId = (0, uuid_1.v4)();
120
+ config.mablRequestId = requestId;
121
+ const requestResponseChain = {
122
+ requestId,
123
+ request: {
124
+ headers: (_a = config.headers) !== null && _a !== void 0 ? _a : {},
125
+ url: (_b = config === null || config === void 0 ? void 0 : config.url) !== null && _b !== void 0 ? _b : '<Unknown URL>',
126
+ method: (_c = config.method) === null || _c === void 0 ? void 0 : _c.toUpperCase(),
127
+ request_sent_time: Date.now(),
128
+ },
129
+ };
130
+ if (typeof config.data === 'string') {
131
+ requestResponseChain.request.body = config.data.substring(0, exports.MAX_SERIALIZED_BODY_SIZE_BYTES);
132
+ }
133
+ this.interceptedRequests.push(requestResponseChain);
134
+ }
135
+ catch (e) {
136
+ loggingProvider_1.logger.warn('Error in the response interceptor', e);
137
+ }
138
+ return config;
139
+ }
140
+ handleResponse(response) {
141
+ try {
142
+ const responseReceivedTime = Date.now();
143
+ const chainEntry = this.getOrCreateEntry(response.config);
144
+ const request = response.request;
145
+ if (request) {
146
+ chainEntry.request.headers = headerStringToHeaders(request._header);
147
+ chainEntry.request.protocol = (request === null || request === void 0 ? void 0 : request._header)
148
+ ? headerStringToProtocol(request._header)
149
+ : '<Unknown protocol>';
150
+ }
151
+ const { body, responseSize } = handleRawResponseBody(response.data);
152
+ const contentLength = getContentLength(response.headers);
153
+ chainEntry.response = {
154
+ headers: headerRecordToHeaderMultiMap(response.headers),
155
+ status: response.status,
156
+ response_received_time: responseReceivedTime,
157
+ response_size: contentLength !== null && contentLength !== void 0 ? contentLength : responseSize,
158
+ body,
159
+ };
160
+ }
161
+ catch (e) {
162
+ loggingProvider_1.logger.warn('Error in the response interceptor', e);
163
+ }
164
+ return response;
165
+ }
166
+ handleError(error) {
167
+ var _a;
168
+ try {
169
+ const config = error.config;
170
+ let chainEntry;
171
+ if (config) {
172
+ chainEntry = this.getOrCreateEntry(config);
173
+ }
174
+ else if (this.interceptedRequests.length) {
175
+ chainEntry =
176
+ this.interceptedRequests[this.interceptedRequests.length - 1];
177
+ }
178
+ if (chainEntry) {
179
+ chainEntry.error = {
180
+ code: (_a = error.code) !== null && _a !== void 0 ? _a : httpUtil_1.GENERAL_API_STEP_EXECUTION_ERROR_CODE,
181
+ message: error.message,
182
+ error_received_time: Date.now(),
183
+ };
184
+ }
185
+ if (error.response) {
186
+ this.handleResponse(error.response);
187
+ }
188
+ }
189
+ catch (e) {
190
+ loggingProvider_1.logger.warn('Error in the error interceptor', e);
191
+ }
192
+ return Promise.reject(error);
193
+ }
194
+ getOrCreateEntry(config) {
195
+ const existingEntry = this.findEntry(config);
196
+ if (existingEntry) {
197
+ return existingEntry;
198
+ }
199
+ this.handleRequest(config);
200
+ return this.findEntry(config);
201
+ }
202
+ findEntry(config) {
203
+ return this.interceptedRequests.find((chain) => chain.requestId === config.mablRequestId);
204
+ }
205
+ }
206
+ exports.RequestInterceptor = RequestInterceptor;
package/index.d.ts ADDED
@@ -0,0 +1,241 @@
1
+ import {BrowserContext, Locator, Page, Frame} from 'playwright-core';
2
+ import {TestType} from '@playwright/test';
3
+
4
+ declare module '@mablhq/playwright-tools' {
5
+ export enum TestResultStatus {
6
+ passed = 'passed',
7
+ skipped = 'skipped',
8
+ failed = 'failed',
9
+ }
10
+ export interface TestResult {
11
+ status: TestResultStatus;
12
+ errorMessage?: string;
13
+ testName: string;
14
+ startTime: number;
15
+ endTime: number;
16
+ }
17
+ export interface TestResults {
18
+ numFailedTests: number;
19
+ numPassedTests: number;
20
+ numSkippedTests: number;
21
+ numTotalTests: number;
22
+ testResults: TestResult[];
23
+ startTime: number;
24
+ endTime: number;
25
+ totalTimeSeconds: number;
26
+ success: boolean;
27
+ }
28
+ export enum RunnerType {
29
+ Playwright = 'playwright',
30
+ }
31
+ export interface HttpHeadersType {
32
+ [key: string]: string;
33
+ }
34
+ export interface HttpConfig {
35
+ proxyHost?: URL;
36
+ sslVerify: boolean;
37
+ proxyType?: string;
38
+ }
39
+ export interface TestRunConfig {
40
+ authToken?: string;
41
+ basicAuthCredentialsId?: string;
42
+ branchName?: string;
43
+ branchChangesOnly?: boolean;
44
+ credentialsId?: string;
45
+ dataTableVariables?: Scenario;
46
+ environmentId?: string;
47
+ /**
48
+ * An object containing additional HTTP headers to be sent with every request.
49
+ */
50
+ extraHttpHeaders?: HttpHeadersType;
51
+ filterHttpRequests: boolean;
52
+ fromPlanId?: string;
53
+ headless?: boolean;
54
+ height?: number;
55
+ highlights?: boolean;
56
+ interactionSpeed?: string;
57
+ keepBrowserOpen?: boolean;
58
+ labelsExclude?: string[];
59
+ labelsInclude?: string[];
60
+ mobileConfig?: MobileConfig;
61
+ proxy?: HttpConfig;
62
+ testId?: string;
63
+ runId?: string;
64
+ url?: string;
65
+ width?: number;
66
+ workspaceId?: string;
67
+ runnerType?: RunnerType;
68
+ }
69
+
70
+ export interface Scenario {
71
+ variables?: Array<Variable>;
72
+ }
73
+ export interface Variable {
74
+ name?: string;
75
+ value?: string;
76
+ }
77
+
78
+ export interface MablApiClient {}
79
+ export class BrowserTestsRunner {
80
+ run(): Promise<TestResults>;
81
+ }
82
+ export function createBrowserTestsRunner(
83
+ testRunConfig: TestRunConfig,
84
+ apiClient?: MablApiClient,
85
+ ): Promise<BrowserTestsRunner>;
86
+ export class MobileTestsRunner {
87
+ run(): Promise<TestResults>;
88
+ }
89
+ export function createMobileTestsRunner(
90
+ testRunConfig: TestRunConfig,
91
+ apiClient?: MablApiClient,
92
+ ): Promise<MobileTestsRunner>;
93
+ export function getRunnerVersion(): string;
94
+ }
95
+
96
+ export interface TrainingSessionOptions {
97
+ authToken?: string;
98
+ applicationId?: string;
99
+ autoBranch?: boolean;
100
+ branchName?: string;
101
+ credentialsId?: string;
102
+ deploymentId?: string;
103
+ environmentId?: string;
104
+ height: number;
105
+ url?: string;
106
+ width: number;
107
+ }
108
+ export interface CreateTestTrainingSessionOptions
109
+ extends TrainingSessionOptions {
110
+ autoLogin?: boolean;
111
+ dataTableIds?: string[];
112
+ labels?: string[];
113
+ newPlanName?: string;
114
+ planId?: string;
115
+ testDescription?: string;
116
+ testName: string;
117
+ url: string;
118
+ workspaceId: string;
119
+ }
120
+ export interface EditTrainingSessionOptions extends TrainingSessionOptions {
121
+ testId?: string;
122
+ testRunId?: string;
123
+ }
124
+ export declare function trainNewTest(
125
+ trainingSessionOptions: CreateTestTrainingSessionOptions,
126
+ ): Promise<void>;
127
+ export declare function editTest(
128
+ trainingSessionOptions: EditTrainingSessionOptions,
129
+ ): Promise<void>;
130
+
131
+ export interface MobileConfig {
132
+ appiumAddress?: string;
133
+ appiumHome?: string;
134
+ appiumPort?: string;
135
+ avdName?: string;
136
+ isRealDevice?: boolean;
137
+ mobileAppFileId?: string;
138
+ path?: string;
139
+ platformName: MobilePlatformEnum;
140
+ udid?: string;
141
+ }
142
+
143
+ export declare enum MobilePlatformEnum {
144
+ Android = 'android',
145
+ Ios = 'ios',
146
+ }
147
+
148
+ // Playwright external tool types
149
+
150
+ export interface MablToolsetOptions {
151
+ apiKey: string;
152
+ browserContext?: BrowserContext;
153
+ workspaceId?: string;
154
+ test: TestType<any, any>;
155
+ }
156
+
157
+ export interface GenAiAssertionResponse {
158
+ success: boolean;
159
+ explanation?: string;
160
+ }
161
+ export interface DatabaseQueryParameter {
162
+ id?: string;
163
+ type: 'String' | 'Number' | 'Boolean';
164
+ value: string;
165
+ }
166
+
167
+ export interface DatabaseQueryResultSet {
168
+ workspace_id?: string;
169
+ database_query_execution_id?: string;
170
+ metadata?: {
171
+ status?: 'success' | 'failed' | 'error';
172
+ duration?: number;
173
+ message?: string;
174
+ error_message?: string;
175
+ row_count?: number;
176
+ column_count?: number;
177
+ rows_affected?: number;
178
+ additional_properties?: object;
179
+ };
180
+ columns?: any[];
181
+ rows?: Array<{
182
+ [key: string]: any;
183
+ }>;
184
+ }
185
+
186
+ export interface MablToolset {
187
+ constructor(options: MablToolsetOptions);
188
+ evaluateGenAiAssertion(
189
+ // TODO this is any because it needs to align with the @playwright/test package's Page and we don't have that as a dependency of the CLI right now
190
+ page: any,
191
+ prompt: string,
192
+ locator?: Locator,
193
+ ): Promise<GenAiAssertionResponse>;
194
+ initializeContext(browserContext: BrowserContext): Promise<void>;
195
+ createMailBoxAddress(): Promise<string>;
196
+ waitForEmail(
197
+ emailAddress: string,
198
+ page: Page | Frame,
199
+ emailFindOptions?: EmailFindOptions,
200
+ ): Promise<MablMailboxEmail>;
201
+ openEmailUrl(page: any, emailUrl: string): Promise<MablMailboxEmail>;
202
+ getCredentials(credentialsId: string): Promise<UsernamePasswordCredential>;
203
+ getMfaCode(credentialsId: string): Promise<string>;
204
+ executeQuery(
205
+ dbConnectionId: string,
206
+ query: string,
207
+ queryParameters?: DatabaseQueryParameter[],
208
+ environmentId?: string,
209
+ timeoutMillis?: number,
210
+ ): Promise<DatabaseQueryResultSet>;
211
+ openPdfFile(filePath: string, page: Page): Promise<void>;
212
+ }
213
+
214
+ export interface MablFixtures {
215
+ mabl: MablToolset;
216
+ }
217
+
218
+ export declare function createMablFixtures(options?: MablToolsetOptions): {
219
+ mabl: ({context}: any, use: (arg0: MablToolset) => any) => Promise<void>;
220
+ };
221
+
222
+ export interface EmailFindOptions {
223
+ subject?: string;
224
+ from?: string;
225
+ body?: string;
226
+ timeoutMillis?: number;
227
+ }
228
+
229
+ export interface UsernamePasswordCredential {
230
+ username: string;
231
+ password: string;
232
+ }
233
+
234
+ export interface MablMailboxEmail {
235
+ open(): Promise<void>;
236
+ getToAddress(): Promise<string | null>;
237
+ getFromAddress(): Promise<string | null>;
238
+ getSubject(): Promise<string | null>;
239
+ getBodyText(): Promise<string | null>;
240
+ getBodyLocator(): Locator;
241
+ }
package/index.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMablFixtures = exports.getRunnerVersion = exports.createRunConfig = exports.createMobileTestsRunner = exports.createBrowserTestsRunner = exports.MobileTestsRunner = exports.BrowserTestsRunner = exports.editTest = exports.trainNewTest = void 0;
4
+ var trainingSessions_1 = require("./core/trainer/trainingSessions");
5
+ Object.defineProperty(exports, "trainNewTest", { enumerable: true, get: function () { return trainingSessions_1.trainNewTest; } });
6
+ Object.defineProperty(exports, "editTest", { enumerable: true, get: function () { return trainingSessions_1.editTest; } });
7
+ var index_1 = require("./execution/index");
8
+ Object.defineProperty(exports, "BrowserTestsRunner", { enumerable: true, get: function () { return index_1.BrowserTestsRunner; } });
9
+ Object.defineProperty(exports, "MobileTestsRunner", { enumerable: true, get: function () { return index_1.MobileTestsRunner; } });
10
+ Object.defineProperty(exports, "createBrowserTestsRunner", { enumerable: true, get: function () { return index_1.createBrowserTestsRunner; } });
11
+ Object.defineProperty(exports, "createMobileTestsRunner", { enumerable: true, get: function () { return index_1.createMobileTestsRunner; } });
12
+ Object.defineProperty(exports, "createRunConfig", { enumerable: true, get: function () { return index_1.createRunConfig; } });
13
+ Object.defineProperty(exports, "getRunnerVersion", { enumerable: true, get: function () { return index_1.getRunnerVersion; } });
14
+ Object.defineProperty(exports, "createMablFixtures", { enumerable: true, get: function () { return index_1.createMablFixtures; } });