@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.
- package/Globals.js +69 -0
- package/LICENSE.txt +29 -0
- package/README.md +219 -0
- package/api/ApiError.js +11 -0
- package/api/atlassian/bitBucketApiClient.js +81 -0
- package/api/atlassian/entities/CodeAnnotation.js +9 -0
- package/api/atlassian/entities/CodeReport.js +15 -0
- package/api/atlassian/entities/PullRequest.js +2 -0
- package/api/basicApiClient.js +293 -0
- package/api/entities/Browser.js +11 -0
- package/api/entities/Email.js +14 -0
- package/api/entities/FindStrategy.js +10 -0
- package/api/entities/Label.js +2 -0
- package/api/entities/VersionedObject.js +2 -0
- package/api/entities/Workspace.js +2 -0
- package/api/featureSet.js +44 -0
- package/api/mablApiClient.js +1070 -0
- package/api/mablApiClientFactory.js +79 -0
- package/api/types.js +10 -0
- package/auth/AuthClient.js +38 -0
- package/auth/OktaClient.js +97 -0
- package/browserEngines/browserEngine.js +41 -0
- package/browserEngines/browserEngines.js +14 -0
- package/browserEngines/chromiumBrowserEngine.js +177 -0
- package/browserEngines/firefoxBrowserEngine.js +134 -0
- package/browserEngines/unsupportedBrowserEngine.js +29 -0
- package/browserEngines/webkitBrowerEngine.js +50 -0
- package/browserLauncher/browser.js +2 -0
- package/browserLauncher/browserEvent.js +11 -0
- package/browserLauncher/browserLauncher.js +17 -0
- package/browserLauncher/browserLauncherEventEmitter.js +2 -0
- package/browserLauncher/browserLauncherFactory.js +30 -0
- package/browserLauncher/elementHandle.js +30 -0
- package/browserLauncher/errors.js +26 -0
- package/browserLauncher/frame.js +17 -0
- package/browserLauncher/frameBase.js +10 -0
- package/browserLauncher/httpRequest.js +2 -0
- package/browserLauncher/httpResponse.js +2 -0
- package/browserLauncher/jsHandle.js +2 -0
- package/browserLauncher/page.js +2 -0
- package/browserLauncher/pageEvent.js +17 -0
- package/browserLauncher/playwrightBrowserLauncher/browserDelegate.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumBrowserDelegate.js +61 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +129 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +24 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +145 -0
- package/browserLauncher/playwrightBrowserLauncher/elementHandleDelegate.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxBrowserDelegate.js +50 -0
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxElementHandleDelegate.js +11 -0
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +36 -0
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxPageDelegate.js +15 -0
- package/browserLauncher/playwrightBrowserLauncher/frameDelegate.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/internals.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractBrowserDelegate.js +15 -0
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +73 -0
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractFrameDelegate.js +13 -0
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +81 -0
- package/browserLauncher/playwrightBrowserLauncher/pageDelegate.js +2 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightApiResponse.js +18 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +259 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +97 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +319 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +265 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +76 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpResponse.js +26 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +377 -0
- package/browserLauncher/playwrightBrowserLauncher/simplePlaywrightLogger.js +36 -0
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitBrowserDelegate.js +50 -0
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +16 -0
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +19 -0
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitPageDelegate.js +15 -0
- package/browserLauncher/playwrightBrowserLauncher/wrappers.js +25 -0
- package/browserLauncher/types.js +28 -0
- package/browserLauncher/utils.js +9 -0
- package/cli.js +66 -0
- package/commands/applications/applications.js +5 -0
- package/commands/applications/applications_cmds/describe.js +21 -0
- package/commands/applications/applications_cmds/list.js +56 -0
- package/commands/auth/auth.js +5 -0
- package/commands/auth/auth_cmds/activate-key.js +38 -0
- package/commands/auth/auth_cmds/clear.js +10 -0
- package/commands/auth/auth_cmds/info.js +10 -0
- package/commands/auth/auth_cmds/login.js +10 -0
- package/commands/branches/branches.js +5 -0
- package/commands/branches/branches_cmds/create.js +56 -0
- package/commands/branches/branches_cmds/describe.js +50 -0
- package/commands/branches/branches_cmds/list.js +84 -0
- package/commands/branches/branches_cmds/merge.js +56 -0
- package/commands/browserTypes.js +20 -0
- package/commands/commandUtil/awaitCompletion.js +67 -0
- package/commands/commandUtil/branches.js +44 -0
- package/commands/commandUtil/codeInsights.js +181 -0
- package/commands/commandUtil/describe.js +32 -0
- package/commands/commandUtil/fileUtil.js +50 -0
- package/commands/commandUtil/interfaces.js +4 -0
- package/commands/commandUtil/list.js +70 -0
- package/commands/commandUtil/util.js +127 -0
- package/commands/commandUtil/versionUtil.js +33 -0
- package/commands/config/config.js +5 -0
- package/commands/config/config_cmds/configKeys.js +28 -0
- package/commands/config/config_cmds/delete.js +29 -0
- package/commands/config/config_cmds/get.js +52 -0
- package/commands/config/config_cmds/install.js +119 -0
- package/commands/config/config_cmds/list.js +39 -0
- package/commands/config/config_cmds/set.js +80 -0
- package/commands/constants.js +160 -0
- package/commands/credentials/credentials.js +5 -0
- package/commands/credentials/credentials_cmds/list.js +66 -0
- package/commands/datatables/datatables.js +5 -0
- package/commands/datatables/datatables_cmds/create.js +61 -0
- package/commands/datatables/datatables_cmds/describe.js +17 -0
- package/commands/datatables/datatables_cmds/export.js +86 -0
- package/commands/datatables/datatables_cmds/list.js +18 -0
- package/commands/datatables/datatables_cmds/scenarios.js +35 -0
- package/commands/datatables/datatables_cmds/update.js +120 -0
- package/commands/datatables/utils.js +145 -0
- package/commands/deploy/deploy.js +5 -0
- package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +100 -0
- package/commands/deploy/deploy_cmds/create.js +342 -0
- package/commands/deploy/deploy_cmds/describe.js +54 -0
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +117 -0
- package/commands/deploy/deploy_cmds/list.js +74 -0
- package/commands/deploy/deploy_cmds/watch.js +44 -0
- package/commands/environments/environments.js +5 -0
- package/commands/environments/environments_cmds/build-files.js +5 -0
- package/commands/environments/environments_cmds/build-files_cmds/add.js +73 -0
- package/commands/environments/environments_cmds/build-files_cmds/list.js +54 -0
- package/commands/environments/environments_cmds/build-files_cmds/update.js +71 -0
- package/commands/environments/environments_cmds/create.js +153 -0
- package/commands/environments/environments_cmds/delete.js +32 -0
- package/commands/environments/environments_cmds/describe.js +28 -0
- package/commands/environments/environments_cmds/list.js +56 -0
- package/commands/environments/environments_cmds/update.js +46 -0
- package/commands/environments/environments_cmds/urls.js +5 -0
- package/commands/environments/environments_cmds/urls_cmds/add.js +91 -0
- package/commands/environments/environments_cmds/urls_cmds/list.js +49 -0
- package/commands/flows/flows.js +5 -0
- package/commands/flows/flows_cmds/export.js +78 -0
- package/commands/flows/flows_cmds/list.js +64 -0
- package/commands/internal/internal.js +6 -0
- package/commands/link-agents/link-agents.js +5 -0
- package/commands/link-agents/link-agents_cmds/delete.js +38 -0
- package/commands/link-agents/link-agents_cmds/list.js +131 -0
- package/commands/link-agents/link-agents_cmds/terminate.js +31 -0
- package/commands/mobile-build-files/mobile-build-files.js +5 -0
- package/commands/mobile-build-files/mobile-build-files_cmds/delete.js +31 -0
- package/commands/mobile-build-files/mobile-build-files_cmds/download.js +50 -0
- package/commands/mobile-build-files/mobile-build-files_cmds/list.js +72 -0
- package/commands/mobile-build-files/mobile-build-files_cmds/upload.js +101 -0
- package/commands/plans/plans.js +5 -0
- package/commands/plans/plans_cmds/describe.js +23 -0
- package/commands/plans/plans_cmds/list.js +63 -0
- package/commands/test-runs/test-runs.js +5 -0
- package/commands/test-runs/test-runs_cmds/export.js +62 -0
- package/commands/tests/mobileEmulationUtil.js +46 -0
- package/commands/tests/tests.js +5 -0
- package/commands/tests/testsUtil.js +538 -0
- package/commands/tests/tests_cmds/create.js +130 -0
- package/commands/tests/tests_cmds/edit.js +111 -0
- package/commands/tests/tests_cmds/export.js +145 -0
- package/commands/tests/tests_cmds/import.js +5 -0
- package/commands/tests/tests_cmds/import_cmds/import_playwright.js +439 -0
- package/commands/tests/tests_cmds/import_cmds/import_selenium.js +295 -0
- package/commands/tests/tests_cmds/list.js +94 -0
- package/commands/tests/tests_cmds/run-cloud.js +314 -0
- package/commands/tests/tests_cmds/run-mobile.js +260 -0
- package/commands/tests/tests_cmds/run.js +314 -0
- package/commands/tests/tests_cmds/runUtils.js +60 -0
- package/commands/tests/tests_cmds/trainerUtil.js +12 -0
- package/commands/users/users.js +5 -0
- package/commands/users/users_cmds/list.js +58 -0
- package/commands/workspaces/workspace_cmds/copy.js +108 -0
- package/commands/workspaces/workspace_cmds/describe.js +21 -0
- package/commands/workspaces/workspace_cmds/list.js +67 -0
- package/commands/workspaces/workspaces.js +5 -0
- package/core/entityValidation/environmentsValidation.js +7 -0
- package/core/entityValidation/stepValidation.js +15 -0
- package/core/execution/ApiTestUtils.js +1060 -0
- package/core/execution/MailboxConstants.js +4 -0
- package/core/execution/PostmanUtils.js +53 -0
- package/core/execution/RunConfig.js +2 -0
- package/core/execution/TestResult.js +15 -0
- package/core/execution/VariableUtils.js +154 -0
- package/core/execution/VariablesSummary.js +2 -0
- package/core/execution/basic-types.js +2 -0
- package/core/execution/newman-types.js +42 -0
- package/core/messaging/actions/MobileTrainingActions.js +17 -0
- package/core/messaging/actions/pdfActions.js +27 -0
- package/core/messaging/actions/runnerActions.js +18 -0
- package/core/messaging/actions/trainingSessionActions.js +38 -0
- package/core/messaging/logLineMessaging.js +50 -0
- package/core/messaging/messaging.js +130 -0
- package/core/messaging/pageMessaging.js +9 -0
- package/core/trainer/openUtils.js +47 -0
- package/core/trainer/trainingSessions-types.js +35 -0
- package/core/trainer/trainingSessions.js +151 -0
- package/core/util.js +52 -0
- package/coreWebVitals/index.js +77 -0
- package/domUtil/index.js +1 -0
- package/env/defaultEnv.js +17 -0
- package/env/dev.js +17 -0
- package/env/env.js +76 -0
- package/env/local.js +17 -0
- package/env/prod.js +17 -0
- package/execution/index.js +8 -0
- package/execution/index.js.LICENSE.txt +254 -0
- package/execution/runAppiumServer.js +145 -0
- package/functions/apiTest/utils.js +47 -0
- package/functions/types.js +2 -0
- package/functions/utils.js +12 -0
- package/http/MablHttpAgent.js +73 -0
- package/http/RequestFilteringHttpAgent.js +119 -0
- package/http/RequestSecurityError.js +13 -0
- package/http/axiosProxyConfig.js +101 -0
- package/http/httpUtil.js +73 -0
- package/http/requestInterceptor.js +206 -0
- package/index.d.ts +241 -0
- package/index.js +14 -0
- package/mablApi/index.js +1 -0
- package/mablscript/MablAction.js +102 -0
- package/mablscript/MablStep.js +191 -0
- package/mablscript/MablStepV2.js +73 -0
- package/mablscript/MablSymbol.js +35 -0
- package/mablscript/actions/AwaitDownloadAction.js +14 -0
- package/mablscript/actions/AwaitPDFDownloadAction.js +19 -0
- package/mablscript/actions/ConditionAction.js +123 -0
- package/mablscript/actions/CountAction.js +16 -0
- package/mablscript/actions/ExtractAction.js +71 -0
- package/mablscript/actions/FindAction.js +301 -0
- package/mablscript/actions/GenerateEmailAddressAction.js +14 -0
- package/mablscript/actions/GenerateRandomStringAction.js +20 -0
- package/mablscript/actions/GetUrlAction.js +22 -0
- package/mablscript/actions/GetVariableValue.js +31 -0
- package/mablscript/actions/GetViewportAction.js +17 -0
- package/mablscript/actions/JavaScriptAction.js +219 -0
- package/mablscript/diffing/diffingUtil.js +229 -0
- package/mablscript/importer.js +576 -0
- package/mablscript/mobile/steps/CreateVariableMobileStep.js +53 -0
- package/mablscript/mobile/steps/EnterTextStep.js +45 -0
- package/mablscript/mobile/steps/HideKeyboardStep.js +20 -0
- package/mablscript/mobile/steps/InstallAppStep.js +22 -0
- package/mablscript/mobile/steps/NavigateBackStep.js +20 -0
- package/mablscript/mobile/steps/NavigateHomeStep.js +21 -0
- package/mablscript/mobile/steps/OpenAppStep.js +22 -0
- package/mablscript/mobile/steps/OpenLinkStep.js +19 -0
- package/mablscript/mobile/steps/PrepareSessionStep.js +19 -0
- package/mablscript/mobile/steps/PushFileStep.js +27 -0
- package/mablscript/mobile/steps/ScrollStep.js +87 -0
- package/mablscript/mobile/steps/SetOrientationStep.js +20 -0
- package/mablscript/mobile/steps/TapStep.js +37 -0
- package/mablscript/mobile/steps/UninstallAppStep.js +22 -0
- package/mablscript/mobile/steps/actions/MobileFindAction.js +23 -0
- package/mablscript/mobile/steps/stepUtil.js +113 -0
- package/mablscript/mobile/tests/StepTestsUtil.js +20 -0
- package/mablscript/mobile/tests/TestMobileFindDescriptors.js +282 -0
- package/mablscript/mobile/tests/steps/CreateVariableMobileStep.mobiletest.js +298 -0
- package/mablscript/mobile/tests/steps/EnterTextStep.mobiletest.js +79 -0
- package/mablscript/mobile/tests/steps/GeneralHumanization.mobiletest.js +304 -0
- package/mablscript/mobile/tests/steps/HideKeyboardStep.mobiletest.js +27 -0
- package/mablscript/mobile/tests/steps/InstallAppStep.mobiletest.js +20 -0
- package/mablscript/mobile/tests/steps/NavigateBackStep.mobiletest.js +27 -0
- package/mablscript/mobile/tests/steps/NavigateHomeStep.mobiletest.js +27 -0
- package/mablscript/mobile/tests/steps/OpenLinkStep.mobiletest.js +20 -0
- package/mablscript/mobile/tests/steps/PushFileStep.mobiletest.js +55 -0
- package/mablscript/mobile/tests/steps/ScrollStep.mobiletest.js +386 -0
- package/mablscript/mobile/tests/steps/SetOrientationStep.mobiletest.js +32 -0
- package/mablscript/mobile/tests/steps/TapStep.mobiletest.js +57 -0
- package/mablscript/mobile/tests/steps/UninstallAppStep.mobiletest.js +20 -0
- package/mablscript/steps/AbstractAssertionsAndVariablesStep.js +52 -0
- package/mablscript/steps/AccessibilityCheck.js +108 -0
- package/mablscript/steps/ActionsUtils.js +18 -0
- package/mablscript/steps/AssertStep.js +318 -0
- package/mablscript/steps/AssertStepOld.js +159 -0
- package/mablscript/steps/AwaitTabStep.js +69 -0
- package/mablscript/steps/AwaitUploadsStep.js +26 -0
- package/mablscript/steps/ClearCookiesStep.js +26 -0
- package/mablscript/steps/ClickAndHoldStep.js +76 -0
- package/mablscript/steps/ClickStep.js +58 -0
- package/mablscript/steps/CookieUtils.js +54 -0
- package/mablscript/steps/CreateVariableStep.js +236 -0
- package/mablscript/steps/DatabaseQueryStep.js +28 -0
- package/mablscript/steps/DoubleClickStep.js +64 -0
- package/mablscript/steps/DownloadStep.js +96 -0
- package/mablscript/steps/EchoStep.js +34 -0
- package/mablscript/steps/ElseIfConditionStep.js +32 -0
- package/mablscript/steps/ElseStep.js +27 -0
- package/mablscript/steps/EndStep.js +27 -0
- package/mablscript/steps/EnterAuthCodeStep.js +59 -0
- package/mablscript/steps/EnterTextStep.js +96 -0
- package/mablscript/steps/EvaluateFlowStep.js +51 -0
- package/mablscript/steps/EvaluateJavaScriptStep.js +50 -0
- package/mablscript/steps/HoverStep.js +63 -0
- package/mablscript/steps/IfConditionStep.js +191 -0
- package/mablscript/steps/NavigateStep.js +30 -0
- package/mablscript/steps/OpenEmailStep.js +46 -0
- package/mablscript/steps/ReleaseStep.js +76 -0
- package/mablscript/steps/RemoveCookieStep.js +36 -0
- package/mablscript/steps/RightClickStep.js +58 -0
- package/mablscript/steps/SelectStep.js +82 -0
- package/mablscript/steps/SendHttpRequestStep.js +48 -0
- package/mablscript/steps/SendKeyStep.js +84 -0
- package/mablscript/steps/SetCookieStep.js +70 -0
- package/mablscript/steps/SetFilesStep.js +71 -0
- package/mablscript/steps/SetViewportStep.js +38 -0
- package/mablscript/steps/SwitchContextStep.js +122 -0
- package/mablscript/steps/SyntheticStep.js +20 -0
- package/mablscript/steps/VisitUrlStep.js +68 -0
- package/mablscript/steps/WaitStep.js +37 -0
- package/mablscript/steps/WaitUntilStep.js +46 -0
- package/mablscript/types/AccessibilityCheckStepDescriptor.js +2 -0
- package/mablscript/types/AccessibilityCheckTypes.js +9 -0
- package/mablscript/types/AssertionsAndVariablesStepDescriptor.js +2 -0
- package/mablscript/types/AwaitTabDescriptor.js +2 -0
- package/mablscript/types/AwaitUploadStepDescriptor.js +2 -0
- package/mablscript/types/ClearCookiesStepDescriptor.js +2 -0
- package/mablscript/types/ClickAndHoldStepDescriptor.js +2 -0
- package/mablscript/types/ClickStepDescriptor.js +2 -0
- package/mablscript/types/ConditionDescriptor.js +133 -0
- package/mablscript/types/CountDescriptor.js +2 -0
- package/mablscript/types/CreateVariableStepDescriptor.js +12 -0
- package/mablscript/types/DownloadStepDescriptor.js +2 -0
- package/mablscript/types/EchoStepDescriptor.js +2 -0
- package/mablscript/types/EnterTextStepDescriptor.js +2 -0
- package/mablscript/types/EvaluateFlowStepDescriptor.js +2 -0
- package/mablscript/types/EvaluateJavaScriptStepDescriptor.js +2 -0
- package/mablscript/types/ExtractDescriptor.js +21 -0
- package/mablscript/types/GetCurrentLocationDescriptor.js +12 -0
- package/mablscript/types/GetVariableDescriptor.js +16 -0
- package/mablscript/types/GetViewportDescriptor.js +12 -0
- package/mablscript/types/HoverStepDescriptor.js +2 -0
- package/mablscript/types/NavigateStepDescriptor.js +7 -0
- package/mablscript/types/OpenEmailStepDescriptor.js +2 -0
- package/mablscript/types/OperatingSystemDescriptor.js +45 -0
- package/mablscript/types/ReleaseStepDescriptor.js +7 -0
- package/mablscript/types/RemoveCookieStepDescriptor.js +2 -0
- package/mablscript/types/SelectStepDescriptor.js +2 -0
- package/mablscript/types/SendHttpRequestTypes.js +2 -0
- package/mablscript/types/SendKeyStepDescriptor.js +30 -0
- package/mablscript/types/SetCookieStepDescriptor.js +2 -0
- package/mablscript/types/SetFilesStepDescriptor.js +2 -0
- package/mablscript/types/SetViewportStepDescriptor.js +2 -0
- package/mablscript/types/SnippetsDescriptor.js +36 -0
- package/mablscript/types/StepDescriptor.js +2 -0
- package/mablscript/types/SwitchContextStepDescriptor.js +15 -0
- package/mablscript/types/VariableNamespace.js +17 -0
- package/mablscript/types/VisitUrlStepDescriptor.js +2 -0
- package/mablscript/types/WaitStepDescriptor.js +2 -0
- package/mablscript/types/WaitUntilStepDescriptor.js +2 -0
- package/mablscript/types/mobile/CreateVariableMobileStepDescriptor.js +9 -0
- package/mablscript/types/mobile/EnterTextStepDescriptor.js +2 -0
- package/mablscript/types/mobile/HideKeyboardStepDescriptor.js +2 -0
- package/mablscript/types/mobile/InstallAppStepDescriptor.js +2 -0
- package/mablscript/types/mobile/NavigateBackStepDescriptor.js +2 -0
- package/mablscript/types/mobile/NavigateHomeStepDescriptor.js +2 -0
- package/mablscript/types/mobile/OpenAppStepDescriptor.js +2 -0
- package/mablscript/types/mobile/OpenLinkStepDescriptor.js +2 -0
- package/mablscript/types/mobile/PrepareSessionStepDescriptor.js +2 -0
- package/mablscript/types/mobile/PushFileDescriptor.js +2 -0
- package/mablscript/types/mobile/ScrollStepDescriptor.js +32 -0
- package/mablscript/types/mobile/SetOrientationStepDescriptor.js +8 -0
- package/mablscript/types/mobile/StepWithMobileFindDescriptor.js +8 -0
- package/mablscript/types/mobile/TapStepDescriptor.js +8 -0
- package/mablscript/types/mobile/UninstallAppStepDescriptor.js +2 -0
- package/mablscriptFind/index.js +2 -0
- package/mablscriptFind/index.js.LICENSE.txt +25 -0
- package/middleware.js +42 -0
- package/mobile/index.js +2 -0
- package/mobile/types.js +8 -0
- package/observers/ObserverBase.js +11 -0
- package/observers/mockObserver.js +47 -0
- package/package.json +107 -0
- package/popupDismissal/candidate.js +2 -0
- package/popupDismissal/index.js +255 -0
- package/providers/authenticationProvider.js +254 -0
- package/providers/cliConfigProvider.js +271 -0
- package/providers/exportRequestProvider.js +196 -0
- package/providers/logging/loggingProvider.js +90 -0
- package/providers/scmContextInterfaces.js +14 -0
- package/providers/scmContextProvider.js +335 -0
- package/providers/scmContextProviderV2.js +122 -0
- package/providers/types.js +9 -0
- package/proxy/index.js +2 -0
- package/proxy/index.js.LICENSE.txt +12 -0
- package/proxy/lib/xpath.js +1 -0
- package/reporters/__tests__/resources/sampleData.js +162 -0
- package/reporters/mochAwesome/interfaces.js +2 -0
- package/reporters/mochAwesome/mochAwesomeReporter.js +227 -0
- package/reporters/reporter.js +46 -0
- package/resources/actionabilityCheck.js +160 -0
- package/resources/coreWebVitals.js +1 -0
- package/resources/mablFind.js +2 -0
- package/resources/media/mabl_test_audio.wav +0 -0
- package/resources/media/mabl_test_pattern.y4m +3 -0
- package/resources/pdf-viewer/EmbeddedPdfHandler.js +1 -0
- package/resources/pdf-viewer/embeddedPdfDetection.js +225 -0
- package/resources/pdf-viewer/index.html +1 -0
- package/resources/pdf-viewer/index.js +2 -0
- package/resources/pdf-viewer/libEmbeddedPdfHandler.js +279 -0
- package/resources/pdf-viewer/libmablPdfViewer.js +21909 -0
- package/resources/pdf-viewer/mabl_attention_move.gif +0 -0
- package/resources/pdf-viewer/mabl_error_artwork_Unplugged.gif +0 -0
- package/resources/pdf-viewer/pdf.worker.9251738a897f697389be.js +2 -0
- package/resources/pdf-viewer/pdf.worker.9e2021092643447a5b9f.js +81 -0
- package/resources/popupDismissal.js +1 -0
- package/resources/webdriver.js +19 -0
- package/socketTunnel/index.js +2 -0
- package/socketTunnel/index.js.LICENSE.txt +68 -0
- package/upload/index.js +2 -0
- package/upload/index.js.LICENSE.txt +27 -0
- package/util/CloudStorageWriter.js +45 -0
- package/util/FileCache.js +180 -0
- package/util/IdentifierUtil.js +57 -0
- package/util/InternalMetricsTrackingSingleton.js +36 -0
- package/util/Lazy.js +90 -0
- package/util/MobileAppFileCache.js +103 -0
- package/util/RichPromise.js +53 -0
- package/util/TestOutputWriter.js +104 -0
- package/util/actionabilityUtil.js +165 -0
- package/util/analytics-events.js +14 -0
- package/util/analytics.js +176 -0
- package/util/asyncUtil.js +61 -0
- package/util/browserTestUtils.js +17 -0
- package/util/clickUtil.js +68 -0
- package/util/downloadUtil.js +87 -0
- package/util/encodingUtil.js +50 -0
- package/util/fileUploadUtil.js +146 -0
- package/util/javaScriptStepMigration.js +115 -0
- package/util/jestUtil.js +21 -0
- package/util/logUtils.js +131 -0
- package/util/markdownUtil.js +125 -0
- package/util/postInstallMessage.js +14 -0
- package/util/pureUtil.js +175 -0
- package/util/resourceUtil.js +90 -0
- package/util/timeUtil.js +31 -0
- package/utilities.js +7 -0
- package/webdriver/index.js +44 -0
|
@@ -0,0 +1,314 @@
|
|
|
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 mablApi_1 = require("../../../mablApi");
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const util_1 = require("../../commandUtil/util");
|
|
10
|
+
const branches_1 = require("../../commandUtil/branches");
|
|
11
|
+
const env_1 = require("../../../env/env");
|
|
12
|
+
const pluralize_1 = __importDefault(require("pluralize"));
|
|
13
|
+
const testsUtil_1 = require("../testsUtil");
|
|
14
|
+
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
15
|
+
const inquirer = require('inquirer');
|
|
16
|
+
const chalk = require('chalk');
|
|
17
|
+
const CommandArgTestId = constants_1.CommandArgId;
|
|
18
|
+
const TestLaunchCountLimit = 100;
|
|
19
|
+
exports.command = 'run-cloud';
|
|
20
|
+
exports.describe = 'Run test(s) in the mabl cloud';
|
|
21
|
+
exports.builder = (yargs) => {
|
|
22
|
+
yargs
|
|
23
|
+
.example('$0 tests run-cloud --id <id>', 'run test by id')
|
|
24
|
+
.example('$0 tests run-cloud --labels <label1> <label2>', 'run tests by test label')
|
|
25
|
+
.option(CommandArgTestId, {
|
|
26
|
+
describe: 'The id of the test to run',
|
|
27
|
+
type: 'string',
|
|
28
|
+
conflicts: [constants_1.CommandArgLabelsInclude, constants_1.CommandArgLabelsExclude],
|
|
29
|
+
})
|
|
30
|
+
.option(constants_1.CommandArgDeploymentId, {
|
|
31
|
+
alias: constants_1.CommandArgAliases.DeploymentId,
|
|
32
|
+
describe: 'Deployment to run the mabl tests against',
|
|
33
|
+
nargs: 1,
|
|
34
|
+
type: 'string',
|
|
35
|
+
})
|
|
36
|
+
.option(constants_1.CommandArgUrl, {
|
|
37
|
+
alias: constants_1.CommandArgAliases.Url,
|
|
38
|
+
describe: `Alias for ${constants_1.CommandArgUrlApp}`,
|
|
39
|
+
nargs: 1,
|
|
40
|
+
type: 'string',
|
|
41
|
+
})
|
|
42
|
+
.option(constants_1.CommandArgUrlApp, {
|
|
43
|
+
describe: 'Application/web URL to run the mabl test against',
|
|
44
|
+
nargs: 1,
|
|
45
|
+
type: 'string',
|
|
46
|
+
})
|
|
47
|
+
.option(constants_1.CommandArgUrlApi, {
|
|
48
|
+
describe: 'API URL to run the mabl test against',
|
|
49
|
+
nargs: 1,
|
|
50
|
+
type: 'string',
|
|
51
|
+
})
|
|
52
|
+
.option(constants_1.CommandArgBasicAuthCredentials, {
|
|
53
|
+
alias: constants_1.CommandArgAliases.BasicAuthCredentials,
|
|
54
|
+
describe: 'Basic Authentication credentials to run the test with',
|
|
55
|
+
nargs: 1,
|
|
56
|
+
type: 'string',
|
|
57
|
+
})
|
|
58
|
+
.option(constants_1.CommandArgBrowsers, {
|
|
59
|
+
alias: constants_1.CommandArgAliases.Browsers,
|
|
60
|
+
describe: 'Space delimited browsers to test against (e.g. "chrome edge firefox")',
|
|
61
|
+
type: 'array',
|
|
62
|
+
default: constants_1.DefaultBrowserType,
|
|
63
|
+
choices: constants_1.BrowserTypeSelections,
|
|
64
|
+
demand: 'Choose at least one browser to run on',
|
|
65
|
+
})
|
|
66
|
+
.option(constants_1.CommandArgApiKey, {
|
|
67
|
+
alias: constants_1.CommandArgAliases.ApiKey,
|
|
68
|
+
describe: 'API key (found in the mabl web app)',
|
|
69
|
+
nargs: 1,
|
|
70
|
+
type: 'string',
|
|
71
|
+
})
|
|
72
|
+
.option(constants_1.CommandArgMablBranch, {
|
|
73
|
+
describe: 'Mabl branch to run test against',
|
|
74
|
+
nargs: 1,
|
|
75
|
+
type: 'string',
|
|
76
|
+
})
|
|
77
|
+
.option(constants_1.CommandArgMablBranchChangesOnly, {
|
|
78
|
+
describe: 'Only execute tests changed on specified branch',
|
|
79
|
+
type: 'boolean',
|
|
80
|
+
default: false,
|
|
81
|
+
})
|
|
82
|
+
.implies(constants_1.CommandArgMablBranchChangesOnly, constants_1.CommandArgMablBranch)
|
|
83
|
+
.option(constants_1.CommandArgRevision, {
|
|
84
|
+
alias: constants_1.CommandArgAliases.Revision,
|
|
85
|
+
describe: 'Code revision hash (application under test)',
|
|
86
|
+
nargs: 1,
|
|
87
|
+
type: 'string',
|
|
88
|
+
})
|
|
89
|
+
.option(constants_1.CommandArgLabelsInclude, {
|
|
90
|
+
describe: 'Space delimited test labels. Run tests that match any label.',
|
|
91
|
+
type: 'array',
|
|
92
|
+
conflicts: [CommandArgTestId],
|
|
93
|
+
})
|
|
94
|
+
.option(constants_1.CommandArgLabelsExclude, {
|
|
95
|
+
describe: 'Space delimited test labels. Exclude tests that match any label.',
|
|
96
|
+
type: 'array',
|
|
97
|
+
conflicts: [CommandArgTestId],
|
|
98
|
+
})
|
|
99
|
+
.option(constants_1.CommandArgWorkspaceId, {
|
|
100
|
+
alias: constants_1.CommandArgAliases.WorkspaceId,
|
|
101
|
+
describe: 'Workspace to run against',
|
|
102
|
+
nargs: 1,
|
|
103
|
+
type: 'string',
|
|
104
|
+
})
|
|
105
|
+
.option(constants_1.CommandArgApplicationId, {
|
|
106
|
+
alias: constants_1.CommandArgAliases.ApplicationId,
|
|
107
|
+
describe: `Mabl application to run under. Specify to ensure the test runs with the right URLs. Consider also using the ${constants_1.CommandArgEnvironmentId} flag.`,
|
|
108
|
+
nargs: 1,
|
|
109
|
+
type: 'string',
|
|
110
|
+
})
|
|
111
|
+
.option(constants_1.CommandArgEnvironmentId, {
|
|
112
|
+
alias: constants_1.CommandArgAliases.EnvironmentId,
|
|
113
|
+
describe: `Mabl environment to run under. Specify to ensure the test runs with environment variables and the latest find information. Consider also using the ${constants_1.CommandArgApplicationId} flag.`,
|
|
114
|
+
nargs: 1,
|
|
115
|
+
type: 'string',
|
|
116
|
+
})
|
|
117
|
+
.option(constants_1.CommandArgCredentials, {
|
|
118
|
+
alias: constants_1.CommandArgAliases.Credentials,
|
|
119
|
+
describe: 'Credentials ID to run the test with',
|
|
120
|
+
nargs: 1,
|
|
121
|
+
type: 'string',
|
|
122
|
+
})
|
|
123
|
+
.option(constants_1.CommandArgLocale, {
|
|
124
|
+
describe: 'Locale to run the test in, e.g. en-US',
|
|
125
|
+
nargs: 1,
|
|
126
|
+
type: 'string',
|
|
127
|
+
})
|
|
128
|
+
.option(constants_1.CommandArgTimezoneID, {
|
|
129
|
+
describe: 'Identifier of the timezone to run the test in, e.g. America/Buenos_Aires',
|
|
130
|
+
nargs: 1,
|
|
131
|
+
type: 'string',
|
|
132
|
+
})
|
|
133
|
+
.option(constants_1.CommandArgPrompt, {
|
|
134
|
+
describe: 'Prompt to confirm execution selections',
|
|
135
|
+
type: 'boolean',
|
|
136
|
+
default: true,
|
|
137
|
+
})
|
|
138
|
+
.option(constants_1.CommandArgNoPrompt, {
|
|
139
|
+
describe: 'Do not prompt to confirm execution selections',
|
|
140
|
+
alias: constants_1.CommandArgAliases.NoPrompt,
|
|
141
|
+
})
|
|
142
|
+
.check((argv) => (0, testsUtil_1.validateRunCommandWithLabels)(argv[constants_1.CommandArgId], argv[constants_1.CommandArgLabelsInclude], argv[constants_1.CommandArgLabelsExclude]));
|
|
143
|
+
};
|
|
144
|
+
exports.handler = (0, util_1.failWrapper)(runInCloud);
|
|
145
|
+
async function runInCloud(parsed) {
|
|
146
|
+
var _a;
|
|
147
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClientFromOptionalApiKey(parsed['api-key']);
|
|
148
|
+
const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
|
|
149
|
+
const prompt = parsed.prompt && !parsed[constants_1.CommandArgNoPrompt];
|
|
150
|
+
const branchName = parsed['mabl-branch'] || constants_1.DefaultBranchName;
|
|
151
|
+
const branchChangesOnly = parsed['branch-changes-only'];
|
|
152
|
+
const maybeTestId = parsed.id;
|
|
153
|
+
const labelsInclude = parsed.labels || [];
|
|
154
|
+
const labelsExclude = parsed['exclude-labels'] || [];
|
|
155
|
+
const maybeDeploymentId = parsed['deployment-id'];
|
|
156
|
+
const maybeUrlApp = (_a = parsed['app-url']) !== null && _a !== void 0 ? _a : parsed.url;
|
|
157
|
+
const maybeUrlApi = parsed['api-url'];
|
|
158
|
+
const browsers = parsed.browsers;
|
|
159
|
+
const credentialsId = parsed['credentials-id'];
|
|
160
|
+
const applicationId = parsed[constants_1.CommandArgApplicationId];
|
|
161
|
+
const environmentId = parsed[constants_1.CommandArgEnvironmentId];
|
|
162
|
+
const basicAuthCredentialsId = parsed[constants_1.CommandArgBasicAuthCredentials];
|
|
163
|
+
const parsedLocale = parsed[constants_1.CommandArgLocale];
|
|
164
|
+
const parsedTimezone = parsed[constants_1.CommandArgTimezoneID];
|
|
165
|
+
const localizationOptions = parsedLocale || parsedTimezone
|
|
166
|
+
? {
|
|
167
|
+
locale: parsedLocale,
|
|
168
|
+
timezone_identifier: parsedTimezone,
|
|
169
|
+
}
|
|
170
|
+
: undefined;
|
|
171
|
+
let tests = [];
|
|
172
|
+
if (maybeTestId) {
|
|
173
|
+
const journey = await apiClient.getJourney(maybeTestId, branchName);
|
|
174
|
+
tests.push(journey);
|
|
175
|
+
}
|
|
176
|
+
else if (labelsInclude.length > 0 || labelsExclude.length > 0) {
|
|
177
|
+
loggingProvider_1.logger.info('Determining test(s) to run...');
|
|
178
|
+
tests = await getJourneysForLabels(workspaceId, branchName, branchChangesOnly, labelsInclude, labelsExclude, TestLaunchCountLimit, prompt, apiClient);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
throw new Error(`Inputs error: neither test id or labels provided.`);
|
|
182
|
+
}
|
|
183
|
+
const testCount = tests.length;
|
|
184
|
+
if (testCount === 0) {
|
|
185
|
+
loggingProvider_1.logger.info(chalk.yellow('No tests selected. Quitting.'));
|
|
186
|
+
return 'no-tests-to-run';
|
|
187
|
+
}
|
|
188
|
+
loggingProvider_1.logger.info('\n');
|
|
189
|
+
(0, branches_1.printBranchRunningInfo)(branchName);
|
|
190
|
+
loggingProvider_1.logger.info(`Executing ${(0, pluralize_1.default)('test', testCount, true)} in the mabl cloud...`);
|
|
191
|
+
loggingProvider_1.logger.info(chalk.cyan(`Workspace: `, chalk.magenta(workspaceId)));
|
|
192
|
+
if (applicationId) {
|
|
193
|
+
loggingProvider_1.logger.info(chalk.cyan(`Application: `, chalk.magenta(applicationId)));
|
|
194
|
+
}
|
|
195
|
+
if (environmentId) {
|
|
196
|
+
loggingProvider_1.logger.info(chalk.cyan(`Environment: `, chalk.magenta(environmentId)));
|
|
197
|
+
}
|
|
198
|
+
loggingProvider_1.logger.info(chalk.white('---'));
|
|
199
|
+
const resultUrls = [];
|
|
200
|
+
for (const test of tests) {
|
|
201
|
+
const testRuns = await executeRunCloudTest(test, browsers, branchName, apiClient, maybeDeploymentId, maybeUrlApp, maybeUrlApi, credentialsId, applicationId, environmentId, basicAuthCredentialsId, localizationOptions);
|
|
202
|
+
testRuns.forEach((testRun) => resultUrls.push(`${env_1.BASE_APP_URL}/workspaces/${testRun.organization_id}/test/journey-runs/${testRun.id}`));
|
|
203
|
+
loggingProvider_1.logger.info(chalk.white('---'));
|
|
204
|
+
}
|
|
205
|
+
let outputUrl;
|
|
206
|
+
if (resultUrls.length === 1) {
|
|
207
|
+
outputUrl = resultUrls[0];
|
|
208
|
+
loggingProvider_1.logger.info(`See mabl test output page for results [${chalk.magenta(outputUrl)}]`);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
let filter = '';
|
|
212
|
+
if (labelsInclude.length === 1) {
|
|
213
|
+
filter = `?labels=${labelsInclude[0]}`;
|
|
214
|
+
}
|
|
215
|
+
outputUrl = `${env_1.BASE_APP_URL}/workspaces/${workspaceId}/output${filter}`;
|
|
216
|
+
loggingProvider_1.logger.info(`See mabl results page to view tests [${chalk.magenta(outputUrl)}]`);
|
|
217
|
+
}
|
|
218
|
+
return outputUrl;
|
|
219
|
+
}
|
|
220
|
+
async function executeRunCloudTest(test, browsers, branchName, apiClient, maybeDeploymentId, appUrl, apiUrl, credentialsId, applicationId, environmentId, basicAuthCredentialsId, localizationOptions) {
|
|
221
|
+
var _a;
|
|
222
|
+
const effectiveAppUrl = appUrl !== null && appUrl !== void 0 ? appUrl : (test.test_type === undefined || test.test_type === mablApi_1.TestTypeEnum.Browser
|
|
223
|
+
? test === null || test === void 0 ? void 0 : test.url
|
|
224
|
+
: undefined);
|
|
225
|
+
const effectiveApiUrl = apiUrl !== null && apiUrl !== void 0 ? apiUrl : (test.test_type && test.test_type !== mablApi_1.TestTypeEnum.Browser
|
|
226
|
+
? test === null || test === void 0 ? void 0 : test.api_url
|
|
227
|
+
: undefined);
|
|
228
|
+
const workspaceId = test.organization_id;
|
|
229
|
+
const testId = test.invariant_id;
|
|
230
|
+
let deploymentIds;
|
|
231
|
+
if (!effectiveAppUrl && !effectiveApiUrl && !maybeDeploymentId) {
|
|
232
|
+
const urlCmdLineArg = test.test_type === mablApi_1.TestTypeEnum.Browser
|
|
233
|
+
? `--${constants_1.CommandArgUrl}, --${constants_1.CommandArgUrlApp}`
|
|
234
|
+
: `--${constants_1.CommandArgUrlApi}`;
|
|
235
|
+
throw new Error(`There is no default URL for test [${testId}]. Please specify ${urlCmdLineArg} or --${constants_1.CommandArgDeploymentId}`);
|
|
236
|
+
}
|
|
237
|
+
loggingProvider_1.logger.info(chalk.cyan(`Running test: `, chalk.magenta(`${test.name} - ${testId} - on branch - ${branchName}`)));
|
|
238
|
+
if (effectiveAppUrl) {
|
|
239
|
+
loggingProvider_1.logger.info(chalk.cyan(`App/web URL: `, chalk.magenta(effectiveAppUrl)));
|
|
240
|
+
}
|
|
241
|
+
if (effectiveApiUrl) {
|
|
242
|
+
loggingProvider_1.logger.info(chalk.cyan(`API URL: `, chalk.magenta(effectiveApiUrl)));
|
|
243
|
+
}
|
|
244
|
+
if (applicationId || environmentId) {
|
|
245
|
+
const deploymentsResult = await apiClient.queryDeploymentEntities(workspaceId);
|
|
246
|
+
const foundDeployments = deploymentsResult.deployments
|
|
247
|
+
? deploymentsResult.deployments.filter((deployment) => (!applicationId || deployment.application_id === applicationId) &&
|
|
248
|
+
(!environmentId || deployment.environment_id === environmentId))
|
|
249
|
+
: [];
|
|
250
|
+
if (!foundDeployments.length) {
|
|
251
|
+
throw new Error('No configuration was found for the applicationId/environmentId specified');
|
|
252
|
+
}
|
|
253
|
+
deploymentIds = foundDeployments.map((deployment) => deployment.id);
|
|
254
|
+
}
|
|
255
|
+
const planRun = await apiClient.postPlanRun(workspaceId, testId, branchName, browsers, effectiveAppUrl, effectiveApiUrl, maybeDeploymentId, credentialsId, deploymentIds, basicAuthCredentialsId, localizationOptions);
|
|
256
|
+
const testRunsQueryResult = await apiClient.getTestRunsForPlan(planRun.id);
|
|
257
|
+
return (_a = testRunsQueryResult.test_script_executions) !== null && _a !== void 0 ? _a : [];
|
|
258
|
+
}
|
|
259
|
+
async function getJourneysForLabels(workspaceId, branchName, branchChangesOnly, labelsInclude, labelsExclude, limit, prompt, apiClient) {
|
|
260
|
+
var _a;
|
|
261
|
+
const journeys = await apiClient.getJourneys({
|
|
262
|
+
limit,
|
|
263
|
+
organization_id: workspaceId,
|
|
264
|
+
include_labels: labelsInclude,
|
|
265
|
+
exclude_labels: labelsExclude,
|
|
266
|
+
branch: branchName,
|
|
267
|
+
branch_changes_only: branchChangesOnly,
|
|
268
|
+
});
|
|
269
|
+
switch (journeys.length) {
|
|
270
|
+
case 0:
|
|
271
|
+
throw new Error(`No tests matched the labels include [${labelsInclude.join(',')}] exclude [${labelsExclude.join(',')}]`);
|
|
272
|
+
case TestLaunchCountLimit:
|
|
273
|
+
loggingProvider_1.logger.info(chalk.yellow(`WARNING: Maximum test search limit of ${TestLaunchCountLimit} test matches hit.`));
|
|
274
|
+
loggingProvider_1.logger.info(chalk.yellow(`The ${TestLaunchCountLimit} most recently created tests will be considered.`));
|
|
275
|
+
}
|
|
276
|
+
if (!prompt) {
|
|
277
|
+
return journeys;
|
|
278
|
+
}
|
|
279
|
+
const journeyChoices = journeys.map((journey, index) => ({
|
|
280
|
+
name: `${index})\t${journey.id}\t${journey.name}`,
|
|
281
|
+
value: journey.id,
|
|
282
|
+
checked: true,
|
|
283
|
+
}));
|
|
284
|
+
const testsToRun = await inquirer.prompt([
|
|
285
|
+
{
|
|
286
|
+
type: 'checkbox',
|
|
287
|
+
name: 'test_selection',
|
|
288
|
+
message: `Run these [${journeys.length}] tests?`,
|
|
289
|
+
pageSize: 20,
|
|
290
|
+
choices: journeyChoices,
|
|
291
|
+
default: journeyChoices.map((choice) => choice.value),
|
|
292
|
+
},
|
|
293
|
+
]);
|
|
294
|
+
const selectedJourneys = (_a = journeys.filter((journey) => { var _a; return (_a = testsToRun === null || testsToRun === void 0 ? void 0 : testsToRun.test_selection) === null || _a === void 0 ? void 0 : _a.includes(journey.id); })) !== null && _a !== void 0 ? _a : [];
|
|
295
|
+
if (selectedJourneys.length === 0) {
|
|
296
|
+
return [];
|
|
297
|
+
}
|
|
298
|
+
const response = await inquirer.prompt([
|
|
299
|
+
{
|
|
300
|
+
type: 'list',
|
|
301
|
+
name: 'do_continue',
|
|
302
|
+
message: `Run [${selectedJourneys.length}] tests?`,
|
|
303
|
+
choices: [
|
|
304
|
+
{ name: 'Yes', value: true },
|
|
305
|
+
{ name: 'No', value: false },
|
|
306
|
+
],
|
|
307
|
+
default: 'Yes',
|
|
308
|
+
},
|
|
309
|
+
]);
|
|
310
|
+
if (response === null || response === void 0 ? void 0 : response.do_continue) {
|
|
311
|
+
return selectedJourneys;
|
|
312
|
+
}
|
|
313
|
+
return [];
|
|
314
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const path_1 = require("path");
|
|
27
|
+
const defaultEnv_1 = require("../../../env/defaultEnv");
|
|
28
|
+
const execution_1 = require("../../../execution");
|
|
29
|
+
const mablApi_1 = require("../../../mablApi");
|
|
30
|
+
const loggingProvider_1 = require("../../../providers/logging/loggingProvider");
|
|
31
|
+
const util_1 = require("../../commandUtil/util");
|
|
32
|
+
const constants_1 = require("../../constants");
|
|
33
|
+
const testsUtil_1 = require("../testsUtil");
|
|
34
|
+
const runUtils_1 = require("./runUtils");
|
|
35
|
+
const MobileAppFileCache_1 = require("../../../util/MobileAppFileCache");
|
|
36
|
+
const fs = __importStar(require("fs"));
|
|
37
|
+
const resourceUtil_1 = require("../../../util/resourceUtil");
|
|
38
|
+
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
39
|
+
const chalk = require('chalk');
|
|
40
|
+
const execution = require('../../../execution/index');
|
|
41
|
+
exports.command = `run-mobile`;
|
|
42
|
+
exports.describe = 'Run a mobile test locally';
|
|
43
|
+
exports.builder = (yargs) => {
|
|
44
|
+
yargs
|
|
45
|
+
.example('$0 tests run-mobile --id <id> --app-file <path> --platform <platform>', 'run mobile test locally by id')
|
|
46
|
+
.option(constants_1.CommandArgId, {
|
|
47
|
+
describe: 'The id of the test to run',
|
|
48
|
+
type: 'string',
|
|
49
|
+
})
|
|
50
|
+
.option(constants_1.CommandArgMobileBuildFilePath, {
|
|
51
|
+
alias: 'app-file',
|
|
52
|
+
describe: 'The path to the mobile application binary',
|
|
53
|
+
type: 'string',
|
|
54
|
+
})
|
|
55
|
+
.option(constants_1.CommandArgMobileBuildFileId, {
|
|
56
|
+
describe: 'The ID of a previously uploaded mobile app file',
|
|
57
|
+
type: 'string',
|
|
58
|
+
})
|
|
59
|
+
.option(constants_1.CommandArgMobilePlatform, {
|
|
60
|
+
describe: 'The mobile platform',
|
|
61
|
+
defaultDescription: 'inferred from app binary extension',
|
|
62
|
+
type: 'string',
|
|
63
|
+
choices: [mablApi_1.MobilePlatformEnum.Android, mablApi_1.MobilePlatformEnum.Ios],
|
|
64
|
+
})
|
|
65
|
+
.option(constants_1.CommandArgWorkspaceId, {
|
|
66
|
+
alias: constants_1.CommandArgAliases.WorkspaceId,
|
|
67
|
+
describe: 'Workspace to run against',
|
|
68
|
+
nargs: 1,
|
|
69
|
+
type: 'string',
|
|
70
|
+
})
|
|
71
|
+
.option(constants_1.CommandArgReporter, {
|
|
72
|
+
describe: 'Output test run information for specified reporter',
|
|
73
|
+
hidden: true,
|
|
74
|
+
type: 'string',
|
|
75
|
+
choices: [constants_1.ReporterOptions.Mochawesome],
|
|
76
|
+
})
|
|
77
|
+
.option(constants_1.CommandArgTestRunId, {
|
|
78
|
+
describe: 'The id of the test run to pull config from',
|
|
79
|
+
type: 'string',
|
|
80
|
+
})
|
|
81
|
+
.option(constants_1.CommandArgReporterOptions, {
|
|
82
|
+
describe: 'Reporter options as comma separated key/values pairs. e.g. "reportDir=path/to,json=true"',
|
|
83
|
+
hidden: true,
|
|
84
|
+
type: 'string',
|
|
85
|
+
})
|
|
86
|
+
.option(constants_1.CommandArgMobileDeviceName, {
|
|
87
|
+
describe: 'Full name of the device to use for the test',
|
|
88
|
+
hidden: false,
|
|
89
|
+
type: 'string',
|
|
90
|
+
})
|
|
91
|
+
.option(constants_1.CommandArgMablBranch, {
|
|
92
|
+
describe: 'Mabl branch to run test against',
|
|
93
|
+
nargs: 1,
|
|
94
|
+
type: 'string',
|
|
95
|
+
})
|
|
96
|
+
.option(constants_1.CommandArgMablBranchChangesOnly, {
|
|
97
|
+
describe: 'Only execute tests changed on specified mabl branch',
|
|
98
|
+
type: 'boolean',
|
|
99
|
+
default: false,
|
|
100
|
+
})
|
|
101
|
+
.implies(constants_1.CommandArgMablBranchChangesOnly, constants_1.CommandArgMablBranch)
|
|
102
|
+
.option(constants_1.CommandArgLabelsInclude, {
|
|
103
|
+
describe: 'Space delimited test labels. Run tests that match any label.',
|
|
104
|
+
type: 'array',
|
|
105
|
+
conflicts: [constants_1.CommandArgId],
|
|
106
|
+
})
|
|
107
|
+
.option(constants_1.CommandArgLabelsExclude, {
|
|
108
|
+
describe: 'Space delimited test labels. Exclude tests that match any label.',
|
|
109
|
+
type: 'array',
|
|
110
|
+
conflicts: [constants_1.CommandArgId],
|
|
111
|
+
})
|
|
112
|
+
.option(constants_1.CommandArgRecordVideoPath, {
|
|
113
|
+
hidden: true,
|
|
114
|
+
describe: 'The path of a directory to save a video recording of the test to',
|
|
115
|
+
type: 'string',
|
|
116
|
+
})
|
|
117
|
+
.implies(constants_1.CommandArgReporterOptions, constants_1.CommandArgReporter)
|
|
118
|
+
.middleware(inferMobilePlatform)
|
|
119
|
+
.check((argv) => {
|
|
120
|
+
(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, undefined);
|
|
121
|
+
validateMobileCommand(argv[constants_1.CommandArgMobileBuildFilePath], argv[constants_1.CommandArgMobileBuildFileId]);
|
|
122
|
+
return true;
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
const exitCodeOnError = 1;
|
|
126
|
+
exports.handler = (0, util_1.failWrapper)(run, exitCodeOnError);
|
|
127
|
+
function validateMobileCommand(appFile, appFileId) {
|
|
128
|
+
if (appFile && appFileId) {
|
|
129
|
+
throw new Error(`Only one of { --${constants_1.CommandArgMobileBuildFilePath}, --${constants_1.CommandArgMobileBuildFileId} } may be specified`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function run(parsed) {
|
|
133
|
+
const commandStartTime = Date.now();
|
|
134
|
+
let workspaceId;
|
|
135
|
+
try {
|
|
136
|
+
workspaceId = await (0, util_1.getWorkspaceId)(parsed);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
}
|
|
140
|
+
const parentDirOfNodeModulesDir = (0, resourceUtil_1.findNodeModulesDirectories)()[0];
|
|
141
|
+
const mobileToolsInstalled = fs.existsSync((0, path_1.resolve)(parentDirOfNodeModulesDir, 'node_modules/appium-uiautomator2-driver'));
|
|
142
|
+
if (!mobileToolsInstalled) {
|
|
143
|
+
loggingProvider_1.logger.error(`[ERROR] Missing the mobile tools for running tests, run ${chalk.magenta('mabl config install mobile-tools')} to install them`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
let platformName;
|
|
147
|
+
if (parsed[constants_1.CommandArgTestRunId]) {
|
|
148
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
149
|
+
const testRun = await apiClient.getJourneyRun(parsed[constants_1.CommandArgTestRunId]);
|
|
150
|
+
platformName = (0, runUtils_1.getPlatformFromTestRun)(testRun);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
platformName = (0, execution_1.parsePlatformName)(parsed[constants_1.CommandArgMobilePlatform]);
|
|
154
|
+
}
|
|
155
|
+
await validateSystemRequirements(platformName, parsed[constants_1.CommandArgMobileDeviceName]);
|
|
156
|
+
const testRunnerConfig = {
|
|
157
|
+
_cliCreated: true,
|
|
158
|
+
branchName: parsed[constants_1.CommandArgMablBranch],
|
|
159
|
+
branchChangesOnly: parsed[constants_1.CommandArgMablBranchChangesOnly],
|
|
160
|
+
filterHttpRequests: false,
|
|
161
|
+
labelsExclude: parsed[constants_1.CommandArgLabelsExclude],
|
|
162
|
+
labelsInclude: parsed[constants_1.CommandArgLabelsInclude],
|
|
163
|
+
runId: parsed[constants_1.CommandArgTestRunId],
|
|
164
|
+
testId: parsed.id,
|
|
165
|
+
workspaceId,
|
|
166
|
+
mobileConfig: {
|
|
167
|
+
mobileAppFileId: parsed[constants_1.CommandArgMobileBuildFileId],
|
|
168
|
+
path: parsed[constants_1.CommandArgMobileBuildFilePath],
|
|
169
|
+
platformName,
|
|
170
|
+
avdName: parsed[constants_1.CommandArgMobileDeviceName],
|
|
171
|
+
recordVideoPath: parsed[constants_1.CommandArgRecordVideoPath],
|
|
172
|
+
udid: parsed[constants_1.CommandArgMobileDeviceName],
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
loggingProvider_1.logger.info('Warming up test runner...');
|
|
176
|
+
const mablTestsRunner = await execution.createMobileTestsRunner(testRunnerConfig);
|
|
177
|
+
const results = await mablTestsRunner.run();
|
|
178
|
+
if ((mablTestsRunner === null || mablTestsRunner === void 0 ? void 0 : mablTestsRunner.mablTestRunners) !== undefined) {
|
|
179
|
+
mablTestsRunner.mablTestRunners
|
|
180
|
+
.filter((tr) => tr instanceof execution_1.MablTestRunner)
|
|
181
|
+
.forEach((tr) => {
|
|
182
|
+
const testContext = tr.testContext;
|
|
183
|
+
(0, testsUtil_1.cleanupTestResources)(testContext);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
await (0, runUtils_1.logTestResults)(results, parsed, commandStartTime, generateRunCommandTemplate(parsed, results));
|
|
187
|
+
if (!results.success && !testRunnerConfig.keepBrowserOpen) {
|
|
188
|
+
process.exit(1);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function generateRunCommandTemplate(parsed, testResults) {
|
|
192
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
193
|
+
const testResult = testResults.testResults[0];
|
|
194
|
+
let templateCommand = `${defaultEnv_1.SCRIPT_NAME} ${parsed._.join(' ')} \\\n`;
|
|
195
|
+
if ((_a = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _a === void 0 ? void 0 : _a.environmentId) {
|
|
196
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgEnvironmentId} ${(_b = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _b === void 0 ? void 0 : _b.environmentId} \\\n`;
|
|
197
|
+
}
|
|
198
|
+
if ((_c = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _c === void 0 ? void 0 : _c.credentialsId) {
|
|
199
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgCredentials} ${(_d = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _d === void 0 ? void 0 : _d.credentialsId} \\\n`;
|
|
200
|
+
}
|
|
201
|
+
if ((_e = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _e === void 0 ? void 0 : _e.url) {
|
|
202
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgUrl} ${(_f = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _f === void 0 ? void 0 : _f.url} \\\n`;
|
|
203
|
+
}
|
|
204
|
+
if ((_g = testResult === null || testResult === void 0 ? void 0 : testResult.rerunConfig) === null || _g === void 0 ? void 0 : _g.branch) {
|
|
205
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgMablBranch} ${testResult.rerunConfig.branch} \\\n`;
|
|
206
|
+
}
|
|
207
|
+
const testIdVal = parsed.id ? parsed.id : '<TEST-ID>';
|
|
208
|
+
templateCommand = `${templateCommand} --${constants_1.CommandArgId} ${testIdVal}`;
|
|
209
|
+
return templateCommand;
|
|
210
|
+
}
|
|
211
|
+
async function validateSystemRequirements(platform, deviceName) {
|
|
212
|
+
let requirements;
|
|
213
|
+
if (platform === mablApi_1.MobilePlatformEnum.Ios) {
|
|
214
|
+
requirements = await (0, execution_1.systemIsSimulatorReady)(deviceName);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
requirements = await (0, execution_1.systemIsEmulatorReady)(deviceName);
|
|
218
|
+
}
|
|
219
|
+
if (!requirements.requirementsMet) {
|
|
220
|
+
const errorMessages = [];
|
|
221
|
+
Object.values(requirements.checks).forEach((requirement) => {
|
|
222
|
+
if (!requirement.requirementsMet && requirement.informationalText) {
|
|
223
|
+
errorMessages.push(requirement.informationalText);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
loggingProvider_1.logger.error('Failed while checking system requirements for testing mobile code. Errors: ');
|
|
227
|
+
for (const errorMessage of errorMessages) {
|
|
228
|
+
loggingProvider_1.logger.error(` * ${errorMessage}`);
|
|
229
|
+
}
|
|
230
|
+
process.exit(exitCodeOnError);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
async function inferMobilePlatform(argv) {
|
|
234
|
+
if (!argv[constants_1.CommandArgMobilePlatform] && argv[constants_1.CommandArgMobileBuildFileId]) {
|
|
235
|
+
if (argv[constants_1.CommandArgMobileBuildFileId]) {
|
|
236
|
+
try {
|
|
237
|
+
const { platform } = await new MobileAppFileCache_1.MobileAppFileCache().getMobileAppFileImmutableFields(argv[constants_1.CommandArgMobileBuildFileId]);
|
|
238
|
+
if (platform) {
|
|
239
|
+
argv[constants_1.CommandArgMobilePlatform] = platform.toString().toLowerCase();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
loggingProvider_1.logger.warn(chalk.yellow(`Warning: Unable to fetch mobile app file ${argv[constants_1.CommandArgMobileBuildFilePath]}: ${error}`));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const extension = (0, path_1.extname)(argv[constants_1.CommandArgMobileBuildFilePath]).toLowerCase();
|
|
248
|
+
switch (extension) {
|
|
249
|
+
case '.apk':
|
|
250
|
+
argv[constants_1.CommandArgMobilePlatform] = mablApi_1.MobilePlatformEnum.Android;
|
|
251
|
+
break;
|
|
252
|
+
case '.ipa':
|
|
253
|
+
case '.app':
|
|
254
|
+
argv[constants_1.CommandArgMobilePlatform] = mablApi_1.MobilePlatformEnum.Ios;
|
|
255
|
+
break;
|
|
256
|
+
default:
|
|
257
|
+
loggingProvider_1.logger.warn(chalk.yellow(`Warning: Unable to infer the mobile platform from the file extension: '${extension}' Please provide a --platform command line argument.`));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|