@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,79 @@
|
|
|
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.MablApiClientFactory = void 0;
|
|
7
|
+
const mablApiClient_1 = require("./mablApiClient");
|
|
8
|
+
const authenticationProvider_1 = require("../providers/authenticationProvider");
|
|
9
|
+
const cliConfigProvider_1 = require("../providers/cliConfigProvider");
|
|
10
|
+
const types_1 = require("./types");
|
|
11
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
+
class MablApiClientFactory {
|
|
13
|
+
static createApiClientFromOptionalApiKey(apiKey) {
|
|
14
|
+
if (apiKey) {
|
|
15
|
+
return MablApiClientFactory.createApiClient({
|
|
16
|
+
authType: types_1.AuthType.ApiKey,
|
|
17
|
+
token: apiKey,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return MablApiClientFactory.createApiClient();
|
|
21
|
+
}
|
|
22
|
+
static createApiClientFromApiKey(apiKey, apiUrl) {
|
|
23
|
+
return MablApiClientFactory.createApiClient({
|
|
24
|
+
apiUrl,
|
|
25
|
+
authType: types_1.AuthType.ApiKey,
|
|
26
|
+
token: apiKey,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
static createApiClientFromBearerToken(bearerToken) {
|
|
30
|
+
return MablApiClientFactory.createApiClient({
|
|
31
|
+
authType: types_1.AuthType.Bearer,
|
|
32
|
+
token: bearerToken,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
static async createApiClient(opts) {
|
|
36
|
+
const { mabl } = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http;
|
|
37
|
+
const optsFromCliHttpConfig = {
|
|
38
|
+
proxyUrl: mabl.proxyHost,
|
|
39
|
+
sslVerify: mabl.sslVerify,
|
|
40
|
+
proxyType: mabl.proxyType,
|
|
41
|
+
};
|
|
42
|
+
if (opts) {
|
|
43
|
+
return new mablApiClient_1.MablApiClient({
|
|
44
|
+
...optsFromCliHttpConfig,
|
|
45
|
+
...opts,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const authProvider = new authenticationProvider_1.AuthenticationProvider();
|
|
49
|
+
const authConfig = await authProvider.getAuthConfigWithAutoRenew();
|
|
50
|
+
if (authConfig === null || authConfig === void 0 ? void 0 : authConfig.accessToken) {
|
|
51
|
+
return new mablApiClient_1.MablApiClient({
|
|
52
|
+
...optsFromCliHttpConfig,
|
|
53
|
+
authType: authConfig.authType,
|
|
54
|
+
token: authConfig.accessToken,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
throw new Error('Please supply an API key or authenticate the mabl CLI tool');
|
|
58
|
+
}
|
|
59
|
+
static async createUserApiClient() {
|
|
60
|
+
if ((await authenticationProvider_1.AuthenticationProvider.getAuthType()) !== types_1.AuthType.Bearer) {
|
|
61
|
+
MablApiClientFactory.throwUserAuthTypeError();
|
|
62
|
+
}
|
|
63
|
+
return MablApiClientFactory.createApiClient();
|
|
64
|
+
}
|
|
65
|
+
static async createApiClientForAccessToken(accessToken) {
|
|
66
|
+
const httpConfig = (await cliConfigProvider_1.CliConfigProvider.getCliConfig()).http.mabl;
|
|
67
|
+
return new mablApiClient_1.MablApiClient({
|
|
68
|
+
authType: types_1.AuthType.Bearer,
|
|
69
|
+
token: accessToken,
|
|
70
|
+
proxyUrl: httpConfig.proxyHost,
|
|
71
|
+
sslVerify: httpConfig.sslVerify,
|
|
72
|
+
proxyType: httpConfig.proxyType,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
static throwUserAuthTypeError() {
|
|
76
|
+
throw new Error(chalk_1.default.red(`Auth with user credentials required. Please run ${chalk_1.default.magenta('mabl auth login')} to log in with your mabl account`));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.MablApiClientFactory = MablApiClientFactory;
|
package/api/types.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthType = void 0;
|
|
4
|
+
var AuthType;
|
|
5
|
+
(function (AuthType) {
|
|
6
|
+
AuthType[AuthType["Bearer"] = 0] = "Bearer";
|
|
7
|
+
AuthType[AuthType["ApiKey"] = 1] = "ApiKey";
|
|
8
|
+
AuthType[AuthType["None"] = 2] = "None";
|
|
9
|
+
AuthType[AuthType["Basic"] = 3] = "Basic";
|
|
10
|
+
})(AuthType || (exports.AuthType = AuthType = {}));
|
|
@@ -0,0 +1,38 @@
|
|
|
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.AuthClient = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const query_string_1 = __importDefault(require("query-string"));
|
|
9
|
+
const env_1 = require("../env/env");
|
|
10
|
+
class AuthClient {
|
|
11
|
+
constructor() { }
|
|
12
|
+
generateCodeChallenge() {
|
|
13
|
+
const codeVerifier = this.base64URLEncode(crypto_1.default.randomBytes(32));
|
|
14
|
+
const codeChallenge = this.base64URLEncode(this.sha256(codeVerifier));
|
|
15
|
+
return { codeChallenge, codeVerifier };
|
|
16
|
+
}
|
|
17
|
+
base64URLEncode(input) {
|
|
18
|
+
return Buffer.from(input)
|
|
19
|
+
.toString('base64')
|
|
20
|
+
.replace(/\+/g, '-')
|
|
21
|
+
.replace(/\//g, '_')
|
|
22
|
+
.replace(/=/g, '');
|
|
23
|
+
}
|
|
24
|
+
sha256(input) {
|
|
25
|
+
return crypto_1.default.createHash('sha256').update(input).digest();
|
|
26
|
+
}
|
|
27
|
+
buildAuthorizationUrl(codeChallenge, redirectUri, idpType) {
|
|
28
|
+
const loginQueryString = query_string_1.default.stringify({
|
|
29
|
+
codeChallenge,
|
|
30
|
+
redirectUri,
|
|
31
|
+
includeRefreshToken: true,
|
|
32
|
+
});
|
|
33
|
+
return idpType
|
|
34
|
+
? `${env_1.BASE_APP_URL}/authorize/social/${idpType.toLowerCase()}?${loginQueryString}`
|
|
35
|
+
: `${env_1.BASE_APP_URL}/authorize?${loginQueryString}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.AuthClient = AuthClient;
|
|
@@ -0,0 +1,97 @@
|
|
|
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.OktaClient = void 0;
|
|
7
|
+
const env_1 = require("../env/env");
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const authenticationProvider_1 = require("../providers/authenticationProvider");
|
|
10
|
+
const types_1 = require("../providers/types");
|
|
11
|
+
const types_2 = require("../api/types");
|
|
12
|
+
const AuthClient_1 = require("./AuthClient");
|
|
13
|
+
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
14
|
+
const queryString = require('query-string');
|
|
15
|
+
class OktaClient extends AuthClient_1.AuthClient {
|
|
16
|
+
constructor(httpClient) {
|
|
17
|
+
super();
|
|
18
|
+
this.httpClient = httpClient;
|
|
19
|
+
}
|
|
20
|
+
async validateAuthCode(code, codeVerifier, redirectUri) {
|
|
21
|
+
return this.getBearerAuthInfo(queryString.stringify({
|
|
22
|
+
grant_type: 'authorization_code',
|
|
23
|
+
client_id: env_1.OKTA_CLIENT_ID,
|
|
24
|
+
code_verifier: codeVerifier,
|
|
25
|
+
code,
|
|
26
|
+
redirect_uri: redirectUri,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
async getRefreshTokenExpiration(refreshToken) {
|
|
30
|
+
if (!refreshToken) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const url = `${env_1.OKTA_URL}/oauth2/v1/introspect`;
|
|
34
|
+
const requestOptions = {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
37
|
+
};
|
|
38
|
+
const data = queryString.stringify({
|
|
39
|
+
client_id: env_1.OKTA_CLIENT_ID,
|
|
40
|
+
token_type_hint: 'refresh_token',
|
|
41
|
+
token: refreshToken,
|
|
42
|
+
});
|
|
43
|
+
try {
|
|
44
|
+
const response = await this.httpClient.post(url, data, requestOptions);
|
|
45
|
+
return response.data.exp;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
loggingProvider_1.logger.info(`Couldn't get refresh token expiration. Will re-use previous lifetime.`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async getBearerAuthInfo(queryStringData) {
|
|
53
|
+
const url = `${env_1.OKTA_URL}/oauth2/default/v1/token`;
|
|
54
|
+
const requestOptions = {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
57
|
+
};
|
|
58
|
+
const response = await this.httpClient.post(url, queryStringData, requestOptions);
|
|
59
|
+
const authInfo = response.data;
|
|
60
|
+
const refreshTokenExpiresAt = await this.getRefreshTokenExpiration(authInfo.refresh_token);
|
|
61
|
+
authInfo.auth_provider = types_1.AuthProviderType.Okta;
|
|
62
|
+
authInfo.auth_type = types_2.AuthType.Bearer;
|
|
63
|
+
authInfo.refresh_token_expires_at = refreshTokenExpiresAt;
|
|
64
|
+
return authInfo;
|
|
65
|
+
}
|
|
66
|
+
exchangeRefreshTokenForAccessToken(refreshToken) {
|
|
67
|
+
var _a;
|
|
68
|
+
try {
|
|
69
|
+
return this.getBearerAuthInfo(queryString.stringify({
|
|
70
|
+
grant_type: 'refresh_token',
|
|
71
|
+
client_id: env_1.OKTA_CLIENT_ID,
|
|
72
|
+
refresh_token: refreshToken,
|
|
73
|
+
scope: 'openid profile email offline_access',
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (!axios_1.default.isAxiosError(error)) {
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
const data = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
81
|
+
if (!(0, authenticationProvider_1.isOidcError)(data)) {
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
return Promise.resolve({
|
|
85
|
+
auth_provider: types_1.AuthProviderType.Okta,
|
|
86
|
+
auth_type: types_2.AuthType.Bearer,
|
|
87
|
+
access_token: '',
|
|
88
|
+
id_token: '',
|
|
89
|
+
token_type: '',
|
|
90
|
+
expires_in: 0,
|
|
91
|
+
error: data.error,
|
|
92
|
+
error_description: data.error_description,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.OktaClient = OktaClient;
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
exports.getTempBrowserPrefDirectory = exports.BROWSER_PREFERENCES_DIRECTORY_SUFFIX = void 0;
|
|
27
|
+
const tmp = require('tmp-promise');
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
const env_1 = require("../env/env");
|
|
30
|
+
const fs = __importStar(require("fs-extra"));
|
|
31
|
+
exports.BROWSER_PREFERENCES_DIRECTORY_SUFFIX = 'MablBrowserPreferences';
|
|
32
|
+
function getTempBrowserPrefDirectory(browserName = 'chrome') {
|
|
33
|
+
const tempDir = tmp.dirSync({
|
|
34
|
+
mode: 0o777,
|
|
35
|
+
prefix: `${env_1.CONF_FILE_PROJECT_NAME}-`,
|
|
36
|
+
});
|
|
37
|
+
const preferencesPath = path.normalize(`${tempDir.name}/${browserName}${exports.BROWSER_PREFERENCES_DIRECTORY_SUFFIX}`);
|
|
38
|
+
fs.ensureDirSync(preferencesPath, 0o777);
|
|
39
|
+
return preferencesPath;
|
|
40
|
+
}
|
|
41
|
+
exports.getTempBrowserPrefDirectory = getTempBrowserPrefDirectory;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultBrowserEngine = exports.BrowserTypeToBrowserEngine = void 0;
|
|
4
|
+
const browserTypes_1 = require("../commands/browserTypes");
|
|
5
|
+
const chromiumBrowserEngine_1 = require("./chromiumBrowserEngine");
|
|
6
|
+
const firefoxBrowserEngine_1 = require("./firefoxBrowserEngine");
|
|
7
|
+
const webkitBrowerEngine_1 = require("./webkitBrowerEngine");
|
|
8
|
+
exports.BrowserTypeToBrowserEngine = {
|
|
9
|
+
[browserTypes_1.BrowserType.Chrome]: new chromiumBrowserEngine_1.ChromiumBrowserEngine(),
|
|
10
|
+
[browserTypes_1.BrowserType.Edge]: new chromiumBrowserEngine_1.ChromiumBrowserEngine(),
|
|
11
|
+
[browserTypes_1.BrowserType.Firefox]: new firefoxBrowserEngine_1.FirefoxBrowserEngine(),
|
|
12
|
+
[browserTypes_1.BrowserType.Webkit]: new webkitBrowerEngine_1.WebkitBrowserEngine(),
|
|
13
|
+
};
|
|
14
|
+
exports.DefaultBrowserEngine = exports.BrowserTypeToBrowserEngine[browserTypes_1.BrowserType.Chrome];
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ChromiumBrowserEngine = void 0;
|
|
30
|
+
const path_1 = __importDefault(require("path"));
|
|
31
|
+
const async_retry_1 = __importDefault(require("async-retry"));
|
|
32
|
+
const fs = __importStar(require("fs-extra"));
|
|
33
|
+
const mobileEmulationUtil_1 = require("../commands/tests/mobileEmulationUtil");
|
|
34
|
+
const resourceUtil_1 = require("../util/resourceUtil");
|
|
35
|
+
const browserEngine_1 = require("./browserEngine");
|
|
36
|
+
const cliConfigProvider_1 = require("../providers/cliConfigProvider");
|
|
37
|
+
const configKeys_1 = require("../commands/config/config_cmds/configKeys");
|
|
38
|
+
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
39
|
+
const chromeFinder = require('chrome-launcher/dist/chrome-finder');
|
|
40
|
+
const launchUtils = require('chrome-launcher/dist/utils');
|
|
41
|
+
const baseExecutionEngineLaunchArgs = [
|
|
42
|
+
'--unlimited-storage',
|
|
43
|
+
'--disable-dev-shm-usage',
|
|
44
|
+
'--enable-print-preview-register-promos',
|
|
45
|
+
'--kiosk-printing',
|
|
46
|
+
'--disable-infobars',
|
|
47
|
+
'--enable-logging',
|
|
48
|
+
'--v=0',
|
|
49
|
+
'--enable-features=NetworkService,NetworkServiceInProcess',
|
|
50
|
+
'--disable-component-update',
|
|
51
|
+
];
|
|
52
|
+
const ExecutionEngineFakeAudioFilePath = '/opt/media/mabl_test_audio.wav';
|
|
53
|
+
const ExecutionEngineFakeVideoFilePath = '/opt/media/mabl_test_pattern.y4m';
|
|
54
|
+
class ChromiumBrowserEngine {
|
|
55
|
+
name() {
|
|
56
|
+
return 'chromium';
|
|
57
|
+
}
|
|
58
|
+
getBrowserLaunchOptions(options) {
|
|
59
|
+
const commandLineArgs = [];
|
|
60
|
+
const ignoreCommandLineDefaultArgs = [];
|
|
61
|
+
const disableFeaturesFlags = [];
|
|
62
|
+
if (options.containerTesting) {
|
|
63
|
+
commandLineArgs.push('--no-sandbox');
|
|
64
|
+
}
|
|
65
|
+
if (options.disableIsolation) {
|
|
66
|
+
disableFeaturesFlags.push('IsolateOrigins');
|
|
67
|
+
disableFeaturesFlags.push('site-per-process');
|
|
68
|
+
}
|
|
69
|
+
if (disableFeaturesFlags.length) {
|
|
70
|
+
commandLineArgs.push(`--disable-features=${disableFeaturesFlags.join(',')}`);
|
|
71
|
+
}
|
|
72
|
+
if (options.autoOpenDevtoolsForTabs) {
|
|
73
|
+
commandLineArgs.push('--auto-open-devtools-for-tabs');
|
|
74
|
+
}
|
|
75
|
+
const fakeMicrophoneMedia = (0, resourceUtil_1.findResource)('media/mabl_test_audio.wav', options.resourcesDirectoryOverride);
|
|
76
|
+
const fakeWebcamMedia = (0, resourceUtil_1.findResource)('media/mabl_test_pattern.y4m', options.resourcesDirectoryOverride);
|
|
77
|
+
const defaultDeviceDescriptor = (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(options.emulationConfig);
|
|
78
|
+
this.addBasicLaunchArgs(commandLineArgs, options.browserWidth, options.browserHeight, fakeMicrophoneMedia, fakeWebcamMedia, options.ignoreCertificateErrors, defaultDeviceDescriptor);
|
|
79
|
+
if (options.enableExtensions) {
|
|
80
|
+
ignoreCommandLineDefaultArgs.push('--disable-extensions');
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
commandLineArgs,
|
|
84
|
+
defaultDeviceDescriptor,
|
|
85
|
+
ignoreCommandLineDefaultArgs,
|
|
86
|
+
permissions: ['geolocation', 'notifications'],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
getExecutionEngineBrowserLaunchOptions(options, proxyInfo) {
|
|
90
|
+
const commandLineArgs = [...baseExecutionEngineLaunchArgs];
|
|
91
|
+
if (proxyInfo.pacProxy) {
|
|
92
|
+
commandLineArgs.push(`--proxy-pac-url=${proxyInfo.pacProxy}`);
|
|
93
|
+
}
|
|
94
|
+
else if (proxyInfo.socksProxy) {
|
|
95
|
+
commandLineArgs.push(`--proxy-server=socks=${proxyInfo.socksProxy}`);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
throw new Error('no proxy provided for cloud run');
|
|
99
|
+
}
|
|
100
|
+
const defaultDeviceDescriptor = (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(options.emulationConfig);
|
|
101
|
+
this.addBasicLaunchArgs(commandLineArgs, options.browserWidth, options.browserHeight, ExecutionEngineFakeAudioFilePath, ExecutionEngineFakeVideoFilePath, true, defaultDeviceDescriptor);
|
|
102
|
+
loggingProvider_1.logger.debug(`launchArgs: ${JSON.stringify(commandLineArgs)}`);
|
|
103
|
+
return { commandLineArgs, defaultDeviceDescriptor };
|
|
104
|
+
}
|
|
105
|
+
addBasicLaunchArgs(launchArgs, browserWidth, browserHeight, fakeMicrophoneMediaPath, fakeWebcamMediaPath, ignoreCertificateErrors, deviceDescriptor) {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
launchArgs.push(`--window-size=${(_a = deviceDescriptor === null || deviceDescriptor === void 0 ? void 0 : deviceDescriptor.width) !== null && _a !== void 0 ? _a : browserWidth},${(_b = deviceDescriptor === null || deviceDescriptor === void 0 ? void 0 : deviceDescriptor.height) !== null && _b !== void 0 ? _b : browserHeight}`);
|
|
108
|
+
launchArgs.push('--use-fake-ui-for-media-stream');
|
|
109
|
+
launchArgs.push('--use-fake-device-for-media-stream');
|
|
110
|
+
launchArgs.push(`--use-file-for-fake-audio-capture=${fakeMicrophoneMediaPath}`);
|
|
111
|
+
launchArgs.push(`--use-file-for-fake-video-capture=${fakeWebcamMediaPath}`);
|
|
112
|
+
if (ignoreCertificateErrors) {
|
|
113
|
+
launchArgs.push('--ignore-certificate-errors');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
prepareBrowserPreferencesDirectory(windowPlacement) {
|
|
117
|
+
return (0, async_retry_1.default)(() => {
|
|
118
|
+
const tempBrowserPreferencesDirectory = (0, browserEngine_1.getTempBrowserPrefDirectory)();
|
|
119
|
+
fs.ensureDirSync(path_1.default.normalize(`${tempBrowserPreferencesDirectory}/Default`));
|
|
120
|
+
const prefFilePath = path_1.default.normalize(`${tempBrowserPreferencesDirectory}/Default/Preferences`);
|
|
121
|
+
fs.writeFileSync(prefFilePath, JSON.stringify(this.generateChromiumPreferencesFile(windowPlacement), null, 3));
|
|
122
|
+
fs.chmodSync(path_1.default.normalize(`${tempBrowserPreferencesDirectory}/Default`), 0o777);
|
|
123
|
+
fs.chmodSync(prefFilePath, 0o777);
|
|
124
|
+
return tempBrowserPreferencesDirectory;
|
|
125
|
+
}, {
|
|
126
|
+
retries: 5,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
generateChromiumPreferencesFile(windowPlacement, _proxyInfo) {
|
|
130
|
+
const preferences = {
|
|
131
|
+
download: {
|
|
132
|
+
open_pdf_in_system_reader: true,
|
|
133
|
+
prompt_for_download: false,
|
|
134
|
+
},
|
|
135
|
+
profile: {
|
|
136
|
+
avatar_index: 5,
|
|
137
|
+
name: 'mabl',
|
|
138
|
+
},
|
|
139
|
+
plugins: {
|
|
140
|
+
always_open_pdf_externally: true,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
if (windowPlacement) {
|
|
144
|
+
preferences.browser = {
|
|
145
|
+
window_placement: {
|
|
146
|
+
always_on_top: false,
|
|
147
|
+
...windowPlacement,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return preferences;
|
|
152
|
+
}
|
|
153
|
+
async findBrowserExecutable() {
|
|
154
|
+
const existingLocation = await cliConfigProvider_1.CliConfigProvider.getConfigProperty(configKeys_1.configKeys.browserPath);
|
|
155
|
+
if (typeof existingLocation === 'string' &&
|
|
156
|
+
existingLocation &&
|
|
157
|
+
fs.existsSync(existingLocation)) {
|
|
158
|
+
return existingLocation;
|
|
159
|
+
}
|
|
160
|
+
const chromePath = this.searchForChrome();
|
|
161
|
+
await cliConfigProvider_1.CliConfigProvider.setConfigProperty(configKeys_1.configKeys.browserPath, chromePath);
|
|
162
|
+
return chromePath;
|
|
163
|
+
}
|
|
164
|
+
searchForChrome() {
|
|
165
|
+
const chromes = chromeFinder[launchUtils.getPlatform()]();
|
|
166
|
+
return chromes.filter((chrome) => {
|
|
167
|
+
chrome = chrome.toLowerCase();
|
|
168
|
+
return !(chrome.includes('canary') ||
|
|
169
|
+
chrome.includes('dev') ||
|
|
170
|
+
chrome.includes('beta'));
|
|
171
|
+
})[0];
|
|
172
|
+
}
|
|
173
|
+
getProxySpec(_proxyInfo) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.ChromiumBrowserEngine = ChromiumBrowserEngine;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.FirefoxBrowserEngine = void 0;
|
|
30
|
+
const mobileEmulationUtil_1 = require("../commands/tests/mobileEmulationUtil");
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
32
|
+
const fs = __importStar(require("fs-extra"));
|
|
33
|
+
const browserEngine_1 = require("./browserEngine");
|
|
34
|
+
const async_retry_1 = __importDefault(require("async-retry"));
|
|
35
|
+
class FirefoxBrowserEngine {
|
|
36
|
+
name() {
|
|
37
|
+
return 'firefox';
|
|
38
|
+
}
|
|
39
|
+
getBrowserLaunchOptions(options) {
|
|
40
|
+
return {
|
|
41
|
+
commandLineArgs: [],
|
|
42
|
+
ignoreCommandLineDefaultArgs: [],
|
|
43
|
+
defaultDeviceDescriptor: (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(options.emulationConfig),
|
|
44
|
+
permissions: ['geolocation', 'notifications'],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
getExecutionEngineBrowserLaunchOptions(options, _proxyInfo) {
|
|
48
|
+
return {
|
|
49
|
+
commandLineArgs: [],
|
|
50
|
+
defaultDeviceDescriptor: (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(options.emulationConfig),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
prepareBrowserPreferencesDirectory(_windowPlacement, proxyInfo) {
|
|
54
|
+
const customPreferences = {};
|
|
55
|
+
if (proxyInfo === null || proxyInfo === void 0 ? void 0 : proxyInfo.pacProxy) {
|
|
56
|
+
customPreferences['network.proxy.autoconfig_url'] = proxyInfo.pacProxy;
|
|
57
|
+
customPreferences['network.proxy.type'] = 2;
|
|
58
|
+
}
|
|
59
|
+
else if (proxyInfo === null || proxyInfo === void 0 ? void 0 : proxyInfo.socksProxy) {
|
|
60
|
+
const socksUrl = new URL(proxyInfo.socksProxy);
|
|
61
|
+
customPreferences['network.proxy.socks'] = socksUrl.hostname;
|
|
62
|
+
customPreferences['network.proxy.socks_port'] = Number.parseInt(socksUrl.port);
|
|
63
|
+
customPreferences['network.proxy.socks_version'] = 5;
|
|
64
|
+
customPreferences['network.proxy.type'] = 1;
|
|
65
|
+
}
|
|
66
|
+
return (0, async_retry_1.default)(() => {
|
|
67
|
+
const preferenceFileName = 'user.js';
|
|
68
|
+
const tempBrowserPreferencesDirectory = (0, browserEngine_1.getTempBrowserPrefDirectory)(this.name());
|
|
69
|
+
const prefFilePath = path_1.default.normalize(`${tempBrowserPreferencesDirectory}/${preferenceFileName}`);
|
|
70
|
+
fs.writeFileSync(prefFilePath, this.generatePreferencesInfo(customPreferences));
|
|
71
|
+
return tempBrowserPreferencesDirectory;
|
|
72
|
+
}, {
|
|
73
|
+
retries: 5,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
findBrowserExecutable() {
|
|
77
|
+
return Promise.resolve('');
|
|
78
|
+
}
|
|
79
|
+
generatePreferencesInfo(customPrefs = {}) {
|
|
80
|
+
const lines = [];
|
|
81
|
+
const prefs = { ...this.getFirefoxUserPrefs(), ...customPrefs };
|
|
82
|
+
for (const [name, value] of Object.entries(prefs)) {
|
|
83
|
+
lines.push(`user_pref(${JSON.stringify(name)}, ${JSON.stringify(value)});`);
|
|
84
|
+
}
|
|
85
|
+
return lines.join('\n');
|
|
86
|
+
}
|
|
87
|
+
getFirefoxUserPrefs() {
|
|
88
|
+
return {
|
|
89
|
+
'xpinstall.signatures.required': false,
|
|
90
|
+
'browser.preferences.defaultPerformanceSettings.enabled': false,
|
|
91
|
+
'layers.acceleration.disabled': true,
|
|
92
|
+
'browser.cache.memory.enable': false,
|
|
93
|
+
'browser.cache.offline.enable': false,
|
|
94
|
+
'browser.cache.disk.capacity': 262144,
|
|
95
|
+
'browser.sessionhistory.max_entries': 1,
|
|
96
|
+
'browser.sessionhistory.max_total_viewers': 0,
|
|
97
|
+
'media.memory_caches_combined_limit_kb': 65536,
|
|
98
|
+
'media.memory_caches_combined_limit_pc_sysmem': 1,
|
|
99
|
+
'pdfjs.enabledCache.state': false,
|
|
100
|
+
'plugin.disable_full_page_plugin_for_types': 'application/pdf,application/vnd.adobe.xfdf,application/vnd.adobe.xdp+xml',
|
|
101
|
+
'browser.helperApps.alwaysAsk.force': true,
|
|
102
|
+
'browser.helperApps.neverAsk.saveToDisk': [
|
|
103
|
+
'application/csv',
|
|
104
|
+
'application/force-download',
|
|
105
|
+
'application/gzip',
|
|
106
|
+
'application/pdf',
|
|
107
|
+
'application/vnd.ms-excel',
|
|
108
|
+
'application/msword',
|
|
109
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
110
|
+
'application/x-7z-compressed',
|
|
111
|
+
'application/x-bzip',
|
|
112
|
+
'application/x-bzip2',
|
|
113
|
+
'application/x-gzip',
|
|
114
|
+
'application/zip',
|
|
115
|
+
'binary/octet-stream',
|
|
116
|
+
'application/octet-stream',
|
|
117
|
+
'image/png',
|
|
118
|
+
'image/jpeg',
|
|
119
|
+
'image/gif',
|
|
120
|
+
'text/csv',
|
|
121
|
+
'text/comma-separated-values',
|
|
122
|
+
'text/plain',
|
|
123
|
+
].join(','),
|
|
124
|
+
'media.navigator.permission.disabled': true,
|
|
125
|
+
'media.navigator.streams.fake': true,
|
|
126
|
+
'dom.webnotifications.enabled': true,
|
|
127
|
+
'network.proxy.socks_remote_dns': true,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
getProxySpec(_proxyInfo) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.FirefoxBrowserEngine = FirefoxBrowserEngine;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnsupportedBrowserEngine = void 0;
|
|
4
|
+
const mobileEmulationUtil_1 = require("../commands/tests/mobileEmulationUtil");
|
|
5
|
+
class UnsupportedBrowserEngine {
|
|
6
|
+
name() {
|
|
7
|
+
throw new Error('Unsupported browser engine');
|
|
8
|
+
}
|
|
9
|
+
getBrowserLaunchOptions(options) {
|
|
10
|
+
return {
|
|
11
|
+
commandLineArgs: [],
|
|
12
|
+
ignoreCommandLineDefaultArgs: [],
|
|
13
|
+
defaultDeviceDescriptor: (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(options.emulationConfig),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
getExecutionEngineBrowserLaunchOptions(_options, _proxyInfo) {
|
|
17
|
+
throw new Error('Unsupported browser engine');
|
|
18
|
+
}
|
|
19
|
+
prepareBrowserPreferencesDirectory(_windowPlacement) {
|
|
20
|
+
throw new Error('Unsupported browser engine');
|
|
21
|
+
}
|
|
22
|
+
findBrowserExecutable() {
|
|
23
|
+
throw new Error('Unsupported browser engine');
|
|
24
|
+
}
|
|
25
|
+
getProxySpec(_proxyInfo) {
|
|
26
|
+
throw new Error('Unsupported browser engine');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.UnsupportedBrowserEngine = UnsupportedBrowserEngine;
|
|
@@ -0,0 +1,50 @@
|
|
|
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.WebkitBrowserEngine = void 0;
|
|
7
|
+
const mobileEmulationUtil_1 = require("../commands/tests/mobileEmulationUtil");
|
|
8
|
+
const browserEngine_1 = require("./browserEngine");
|
|
9
|
+
const async_retry_1 = __importDefault(require("async-retry"));
|
|
10
|
+
class WebkitBrowserEngine {
|
|
11
|
+
name() {
|
|
12
|
+
return 'webkit';
|
|
13
|
+
}
|
|
14
|
+
getBrowserLaunchOptions(options) {
|
|
15
|
+
return {
|
|
16
|
+
commandLineArgs: [],
|
|
17
|
+
ignoreCommandLineDefaultArgs: [],
|
|
18
|
+
defaultDeviceDescriptor: (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(options.emulationConfig),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
getExecutionEngineBrowserLaunchOptions(options, _proxyInfo) {
|
|
22
|
+
return {
|
|
23
|
+
commandLineArgs: [],
|
|
24
|
+
defaultDeviceDescriptor: (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(options.emulationConfig),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
prepareBrowserPreferencesDirectory(_windowPlacement) {
|
|
28
|
+
return (0, async_retry_1.default)(() => {
|
|
29
|
+
const tempBrowserPreferencesDirectory = (0, browserEngine_1.getTempBrowserPrefDirectory)(this.name());
|
|
30
|
+
return tempBrowserPreferencesDirectory;
|
|
31
|
+
}, {
|
|
32
|
+
retries: 5,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
findBrowserExecutable() {
|
|
36
|
+
return Promise.resolve('');
|
|
37
|
+
}
|
|
38
|
+
getProxySpec(proxyInfo) {
|
|
39
|
+
const { httpProxy, socksProxy, excludeFromProxy } = proxyInfo;
|
|
40
|
+
const server = httpProxy !== null && httpProxy !== void 0 ? httpProxy : socksProxy;
|
|
41
|
+
if (!server) {
|
|
42
|
+
throw new Error('no proxy provided for cloud run');
|
|
43
|
+
}
|
|
44
|
+
const bypass = (excludeFromProxy === null || excludeFromProxy === void 0 ? void 0 : excludeFromProxy.length)
|
|
45
|
+
? excludeFromProxy.join(',')
|
|
46
|
+
: undefined;
|
|
47
|
+
return { server, bypass };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.WebkitBrowserEngine = WebkitBrowserEngine;
|