@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,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExportRequestProvider = void 0;
|
|
4
|
+
const mablApi_1 = require("../mablApi");
|
|
5
|
+
const loggingProvider_1 = require("./logging/loggingProvider");
|
|
6
|
+
const basicApiClient_1 = require("../api/basicApiClient");
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const ora = require('ora');
|
|
9
|
+
const chalk = require('chalk');
|
|
10
|
+
class ExportRequestProvider {
|
|
11
|
+
constructor(apiClient, targetEntityId, targetEntityType, targetContentTypes, outputFilepath) {
|
|
12
|
+
this.pollingTimeoutMilliseconds = 10 * 60 * 1000;
|
|
13
|
+
this.pollingIntervalMilliseconds = 1000;
|
|
14
|
+
this.exportStartEpochMilliseconds = 0;
|
|
15
|
+
this.continuationStatuses = [
|
|
16
|
+
mablApi_1.ExportRequest.StatusEnum.Queued,
|
|
17
|
+
mablApi_1.ExportRequest.StatusEnum.Running,
|
|
18
|
+
];
|
|
19
|
+
this.apiClient = apiClient;
|
|
20
|
+
this.targetEntityId = targetEntityId;
|
|
21
|
+
this.targetEntityType = targetEntityType;
|
|
22
|
+
this.contentTypes = targetContentTypes;
|
|
23
|
+
this.outputFilepath = outputFilepath;
|
|
24
|
+
}
|
|
25
|
+
isExportIncomplete() {
|
|
26
|
+
var _a;
|
|
27
|
+
if ((_a = this.latestRequest) === null || _a === void 0 ? void 0 : _a.status) {
|
|
28
|
+
return this.continuationStatuses.includes(this.latestRequest.status);
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
isExportCompleted() {
|
|
33
|
+
return !this.isExportIncomplete();
|
|
34
|
+
}
|
|
35
|
+
static mapStatusToColor(status) {
|
|
36
|
+
switch (status) {
|
|
37
|
+
case mablApi_1.ExportRequest.StatusEnum.Queued:
|
|
38
|
+
return 'gray';
|
|
39
|
+
case mablApi_1.ExportRequest.StatusEnum.Running:
|
|
40
|
+
return 'yellow';
|
|
41
|
+
case mablApi_1.ExportRequest.StatusEnum.Completed:
|
|
42
|
+
return 'green';
|
|
43
|
+
case mablApi_1.ExportRequest.StatusEnum.Failed:
|
|
44
|
+
case mablApi_1.ExportRequest.StatusEnum.Terminated:
|
|
45
|
+
return 'red';
|
|
46
|
+
default:
|
|
47
|
+
return 'orange';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async pollForStatusUpdate(lastRequestId) {
|
|
51
|
+
const newLatestRequest = await this.apiClient.getExportRequest(lastRequestId);
|
|
52
|
+
this.latestRequest = newLatestRequest;
|
|
53
|
+
const statusColor = ExportRequestProvider.mapStatusToColor(newLatestRequest.status);
|
|
54
|
+
const updatedMessage = `Processing export [${chalk.magenta.bold(lastRequestId)}] status: [${chalk
|
|
55
|
+
.keyword(statusColor)
|
|
56
|
+
.bold(newLatestRequest.status.toString())}]`;
|
|
57
|
+
updateSpinnerText(updatedMessage, this.exportStatusSpinner);
|
|
58
|
+
return this.latestRequest;
|
|
59
|
+
}
|
|
60
|
+
async awaitCompletion() {
|
|
61
|
+
var _a;
|
|
62
|
+
if (!((_a = this.latestRequest) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
63
|
+
throw new Error('CreateExportRequest is undefined');
|
|
64
|
+
}
|
|
65
|
+
await this.pollForStatusUpdate(this.latestRequest.id);
|
|
66
|
+
const notTimedOut = Date.now() - this.exportStartEpochMilliseconds <
|
|
67
|
+
this.pollingTimeoutMilliseconds;
|
|
68
|
+
if (notTimedOut && this.isExportIncomplete()) {
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
setTimeout(() => this.awaitCompletion()
|
|
71
|
+
.then(() => resolve())
|
|
72
|
+
.catch((error) => reject(error)), this.pollingIntervalMilliseconds);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async processExport() {
|
|
77
|
+
try {
|
|
78
|
+
const testRun = await this.apiClient.getTestRun(this.targetEntityId);
|
|
79
|
+
if (testRun.test_type === mablApi_1.TestTypeEnum.Api) {
|
|
80
|
+
loggingProvider_1.logger.error(chalk.red(`Test run export not supported for API test runs: ${this.targetEntityId}`));
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
loggingProvider_1.logger.info(`Export ${this.targetEntityType} [${chalk.magenta.bold(this.targetEntityId)}]`);
|
|
84
|
+
this.createExportSpinner = ora({
|
|
85
|
+
prefixText: ' ',
|
|
86
|
+
text: 'Creating export request',
|
|
87
|
+
}).start();
|
|
88
|
+
const targetContent = this
|
|
89
|
+
.contentTypes;
|
|
90
|
+
this.latestRequest = await this.apiClient.createExportRequest(this.targetEntityId, targetContent);
|
|
91
|
+
const updateMessage = `Creating export request [${chalk.magenta.bold(this.latestRequest.id)}]. Types to export: ${chalk.magenta.bold(this.contentTypes.join(','))}`;
|
|
92
|
+
updateSpinnerSuccess(this.createExportSpinner, updateMessage);
|
|
93
|
+
this.exportStartEpochMilliseconds = Date.now();
|
|
94
|
+
this.latestRequest = await this.apiClient.getExportRequest(this.latestRequest.id);
|
|
95
|
+
this.exportStatusSpinner = ora({
|
|
96
|
+
prefixText: ' ',
|
|
97
|
+
text: 'Processing export',
|
|
98
|
+
}).start();
|
|
99
|
+
await this.awaitCompletion();
|
|
100
|
+
if (!this.isExportCompleted()) {
|
|
101
|
+
loggingProvider_1.logger.error(chalk.red(`Export request [${this.latestRequest
|
|
102
|
+
.id}] timed out. Please try again.`));
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
switch (this.latestRequest.status) {
|
|
106
|
+
case mablApi_1.ExportRequest.StatusEnum.Failed:
|
|
107
|
+
case mablApi_1.ExportRequest.StatusEnum.Terminated:
|
|
108
|
+
updateSpinnerFail(this.createExportSpinner);
|
|
109
|
+
loggingProvider_1.logger.error(chalk.red(`Export request [${this.latestRequest.id}] ${this.latestRequest.status
|
|
110
|
+
.toString()
|
|
111
|
+
.toUpperCase()}. Please try again.`));
|
|
112
|
+
process.exit(1);
|
|
113
|
+
break;
|
|
114
|
+
case mablApi_1.ExportRequest.StatusEnum.Completed:
|
|
115
|
+
default:
|
|
116
|
+
updateSpinnerSuccess(this.exportStatusSpinner);
|
|
117
|
+
}
|
|
118
|
+
const downloadUrl = this.latestRequest.output_signed_url;
|
|
119
|
+
if (!downloadUrl) {
|
|
120
|
+
throw new Error(`No download url provided for ExportRequest [${this.latestRequest.id}]`);
|
|
121
|
+
}
|
|
122
|
+
const outputFilename = this.outputFilepath || getDownloadFilename(downloadUrl);
|
|
123
|
+
this.exportDownloadSpinner = ora({
|
|
124
|
+
prefixText: ' ',
|
|
125
|
+
text: `Downloading export artifact to [${chalk.magenta.bold(outputFilename)}]`,
|
|
126
|
+
}).start();
|
|
127
|
+
const client = await basicApiClient_1.BasicApiClient.create();
|
|
128
|
+
const responseData = await client.makeGetRequest(downloadUrl, undefined, {
|
|
129
|
+
headers: {
|
|
130
|
+
Accept: 'application/zip',
|
|
131
|
+
},
|
|
132
|
+
responseType: 'stream',
|
|
133
|
+
});
|
|
134
|
+
const writer = fs.createWriteStream(outputFilename);
|
|
135
|
+
await new Promise((resolve, reject) => {
|
|
136
|
+
try {
|
|
137
|
+
responseData.pipe(writer);
|
|
138
|
+
writer.on('error', (err) => {
|
|
139
|
+
writer.close();
|
|
140
|
+
reject(err);
|
|
141
|
+
});
|
|
142
|
+
writer.on('finish', () => {
|
|
143
|
+
writer.close();
|
|
144
|
+
resolve();
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
catch (exception) {
|
|
148
|
+
reject(exception);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
updateSpinnerSuccessStop(this.exportDownloadSpinner);
|
|
152
|
+
return outputFilename;
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
[
|
|
156
|
+
this.createExportSpinner,
|
|
157
|
+
this.exportStatusSpinner,
|
|
158
|
+
this.exportDownloadSpinner,
|
|
159
|
+
]
|
|
160
|
+
.forEach((spinner) => {
|
|
161
|
+
if (spinner === null || spinner === void 0 ? void 0 : spinner.isSpinning) {
|
|
162
|
+
spinner.fail();
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
exports.ExportRequestProvider = ExportRequestProvider;
|
|
169
|
+
const filenameExtractorRegex = /\/([^\/]+)\?/;
|
|
170
|
+
function getDownloadFilename(downloadUrl) {
|
|
171
|
+
const urlParts = downloadUrl.match(filenameExtractorRegex);
|
|
172
|
+
if (urlParts && urlParts.length >= 2) {
|
|
173
|
+
return urlParts[1];
|
|
174
|
+
}
|
|
175
|
+
throw new Error('Output URL undefined');
|
|
176
|
+
}
|
|
177
|
+
function updateSpinnerSuccess(spinner, message) {
|
|
178
|
+
if (spinner) {
|
|
179
|
+
spinner.succeed(message);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function updateSpinnerSuccessStop(spinner, message) {
|
|
183
|
+
if (spinner) {
|
|
184
|
+
spinner.stop().succeed(message);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function updateSpinnerFail(spinner, message) {
|
|
188
|
+
if (spinner) {
|
|
189
|
+
spinner.fail(message);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function updateSpinnerText(message, spinner) {
|
|
193
|
+
if (spinner) {
|
|
194
|
+
spinner.text = message;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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.logger = exports.LogLevel = void 0;
|
|
30
|
+
const winston = __importStar(require("winston"));
|
|
31
|
+
const winston_transport_1 = __importDefault(require("winston-transport"));
|
|
32
|
+
const defaultEnv_1 = require("../../env/defaultEnv");
|
|
33
|
+
const { MESSAGE } = require('triple-beam');
|
|
34
|
+
const stripAnsi = require('strip-ansi');
|
|
35
|
+
var LogLevel;
|
|
36
|
+
(function (LogLevel) {
|
|
37
|
+
LogLevel["Debug"] = "debug";
|
|
38
|
+
LogLevel["Error"] = "error";
|
|
39
|
+
LogLevel["Info"] = "info";
|
|
40
|
+
LogLevel["Warn"] = "warn";
|
|
41
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
42
|
+
class CliTransport extends winston_transport_1.default {
|
|
43
|
+
constructor(opts) {
|
|
44
|
+
super(opts);
|
|
45
|
+
}
|
|
46
|
+
log(info, callback) {
|
|
47
|
+
this.emit('logged', info);
|
|
48
|
+
switch (info.level) {
|
|
49
|
+
case LogLevel.Error:
|
|
50
|
+
console.error(info[MESSAGE]);
|
|
51
|
+
break;
|
|
52
|
+
case LogLevel.Warn:
|
|
53
|
+
console.warn(info[MESSAGE]);
|
|
54
|
+
break;
|
|
55
|
+
case LogLevel.Info:
|
|
56
|
+
case LogLevel.Debug:
|
|
57
|
+
console.log(info[MESSAGE]);
|
|
58
|
+
break;
|
|
59
|
+
default:
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
callback();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.logger = winston.createLogger({
|
|
66
|
+
level: defaultEnv_1.CONSOLE_LOGGING_LEVEL,
|
|
67
|
+
format: winston.format.printf((info) => `${stripAnsi(info.message)}`),
|
|
68
|
+
defaultMeta: { service: 'mabl-cli' },
|
|
69
|
+
transports: [
|
|
70
|
+
new CliTransport({
|
|
71
|
+
format: winston.format.printf((info) => { var _a; return `${(_a = info.message) !== null && _a !== void 0 ? _a : info[MESSAGE]}`; }),
|
|
72
|
+
}),
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
exports.logger.constructor.prototype.logNewLine = (level = LogLevel.Info) => {
|
|
76
|
+
const emptyNewLine = '';
|
|
77
|
+
switch (level) {
|
|
78
|
+
case LogLevel.Error:
|
|
79
|
+
exports.logger.error(emptyNewLine);
|
|
80
|
+
break;
|
|
81
|
+
case LogLevel.Warn:
|
|
82
|
+
exports.logger.warn(emptyNewLine);
|
|
83
|
+
break;
|
|
84
|
+
case LogLevel.Debug:
|
|
85
|
+
case LogLevel.Info:
|
|
86
|
+
default:
|
|
87
|
+
exports.logger.info(emptyNewLine);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildTypes = void 0;
|
|
4
|
+
var BuildTypes;
|
|
5
|
+
(function (BuildTypes) {
|
|
6
|
+
BuildTypes["AzureDevOps"] = "azure_devops";
|
|
7
|
+
BuildTypes["BitbucketPipe"] = "bitbucket_pipe";
|
|
8
|
+
BuildTypes["CircleCi"] = "circle_ci";
|
|
9
|
+
BuildTypes["CloudBuild"] = "cloudbuild";
|
|
10
|
+
BuildTypes["Codeship"] = "codeship";
|
|
11
|
+
BuildTypes["GithubAction"] = "github_action";
|
|
12
|
+
BuildTypes["Jenkins"] = "jenkins";
|
|
13
|
+
BuildTypes["Travis"] = "travis";
|
|
14
|
+
})(BuildTypes || (exports.BuildTypes = BuildTypes = {}));
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScmContextProvider = void 0;
|
|
4
|
+
const scmContextInterfaces_1 = require("./scmContextInterfaces");
|
|
5
|
+
const loggingProvider_1 = require("./logging/loggingProvider");
|
|
6
|
+
const getRepoInfo = require('git-repo-info');
|
|
7
|
+
const { exec } = require('child_process');
|
|
8
|
+
function processBuildEnv(envVariables, mapper) {
|
|
9
|
+
const results = {};
|
|
10
|
+
envVariables.forEach((value, key) => {
|
|
11
|
+
mapper(key, value, results);
|
|
12
|
+
});
|
|
13
|
+
if (results.isCorrectType) {
|
|
14
|
+
return results;
|
|
15
|
+
}
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
class ScmContextProvider {
|
|
19
|
+
constructor(processRef) {
|
|
20
|
+
this.envVariables = this.extractEnvVariables(processRef);
|
|
21
|
+
}
|
|
22
|
+
async extractScmAndBuildInfo() {
|
|
23
|
+
try {
|
|
24
|
+
return this.innerExtractScmAndBuildInfo();
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
loggingProvider_1.logger.error('Error collecting build information. Using defaults.');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async innerExtractScmAndBuildInfo() {
|
|
32
|
+
const maybeBuildInfo = this.attemptExtractBuildInfo();
|
|
33
|
+
let scmIfo = await this.attemptGitChildProcessCall();
|
|
34
|
+
if (!scmIfo) {
|
|
35
|
+
scmIfo = this.attemptGitSoftInterrogation();
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
buildInfo: maybeBuildInfo,
|
|
39
|
+
scmInfo: scmIfo,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
attemptExtractBuildInfo() {
|
|
43
|
+
const processors = [
|
|
44
|
+
() => this.getForCircleCi(),
|
|
45
|
+
() => this.getForCloudBuild(),
|
|
46
|
+
() => this.getForCodeship(),
|
|
47
|
+
() => this.getForJenkins(),
|
|
48
|
+
() => this.getForTravis(),
|
|
49
|
+
];
|
|
50
|
+
let buildResultHolder;
|
|
51
|
+
processors.some((processor) => {
|
|
52
|
+
buildResultHolder = processor();
|
|
53
|
+
return buildResultHolder;
|
|
54
|
+
});
|
|
55
|
+
return buildResultHolder;
|
|
56
|
+
}
|
|
57
|
+
extractEnvVariables(processRef) {
|
|
58
|
+
const result = new Map();
|
|
59
|
+
Object.entries(processRef).forEach(([key, value]) => {
|
|
60
|
+
if (value && value !== '') {
|
|
61
|
+
result.set(key, value);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
getForCloudBuild() {
|
|
67
|
+
function mapper(key, value, results) {
|
|
68
|
+
switch (key) {
|
|
69
|
+
case '_HEAD_BRANCH':
|
|
70
|
+
results.pullRequestHeadBranch = value;
|
|
71
|
+
break;
|
|
72
|
+
case '_BASE_BRANCH':
|
|
73
|
+
results.pullRequestBaseBranch = value;
|
|
74
|
+
break;
|
|
75
|
+
case '_HEAD_REPO_URL':
|
|
76
|
+
results.pullRequestHeadRepo = value;
|
|
77
|
+
break;
|
|
78
|
+
case '_PR_NUMBER':
|
|
79
|
+
results.pullRequestId = value;
|
|
80
|
+
break;
|
|
81
|
+
case 'PROJECT_ID':
|
|
82
|
+
results.projectId = value;
|
|
83
|
+
break;
|
|
84
|
+
case 'BUILD_ID':
|
|
85
|
+
results.buildId = value;
|
|
86
|
+
break;
|
|
87
|
+
case 'COMMIT_SHA':
|
|
88
|
+
results.commitSha = value;
|
|
89
|
+
break;
|
|
90
|
+
case 'SHORT_SHA':
|
|
91
|
+
results.shortSha = value;
|
|
92
|
+
results.isCorrectType = true;
|
|
93
|
+
results.buildType = scmContextInterfaces_1.BuildTypes.CloudBuild;
|
|
94
|
+
break;
|
|
95
|
+
case 'REPO_NAME':
|
|
96
|
+
results.repoName = value;
|
|
97
|
+
break;
|
|
98
|
+
case 'BRANCH_NAME':
|
|
99
|
+
results.branchName = value;
|
|
100
|
+
break;
|
|
101
|
+
case 'TAG_NAME':
|
|
102
|
+
results.tagName = value;
|
|
103
|
+
break;
|
|
104
|
+
case 'REVISION_ID':
|
|
105
|
+
results.revisionId = value;
|
|
106
|
+
break;
|
|
107
|
+
default:
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return processBuildEnv(this.envVariables, mapper);
|
|
111
|
+
}
|
|
112
|
+
getForCircleCi() {
|
|
113
|
+
function mapper(key, value, results) {
|
|
114
|
+
switch (key) {
|
|
115
|
+
case 'CIRCLE_PR_NUMBER':
|
|
116
|
+
results.pullRequestId = value;
|
|
117
|
+
break;
|
|
118
|
+
case 'CIRCLE_PR_USERNAME':
|
|
119
|
+
results.pullRequestUsername = value;
|
|
120
|
+
break;
|
|
121
|
+
case 'CIRCLE_WORKFLOW_ID':
|
|
122
|
+
results.workflowId = value;
|
|
123
|
+
break;
|
|
124
|
+
case 'CIRCLECI':
|
|
125
|
+
results.isCorrectType = value === 'true';
|
|
126
|
+
results.buildType = scmContextInterfaces_1.BuildTypes.CircleCi;
|
|
127
|
+
break;
|
|
128
|
+
case 'CIRCLE_SHA1':
|
|
129
|
+
results.commitSha = value;
|
|
130
|
+
results.revisionId = value;
|
|
131
|
+
break;
|
|
132
|
+
case 'CIRCLE_USERNAME':
|
|
133
|
+
results.commitSha = value;
|
|
134
|
+
break;
|
|
135
|
+
case 'CIRCLE_TAG':
|
|
136
|
+
results.tagName = value;
|
|
137
|
+
break;
|
|
138
|
+
case 'CIRCLE_PR_REPONAME':
|
|
139
|
+
results.pullRequestRepo = value;
|
|
140
|
+
break;
|
|
141
|
+
case 'CIRCLE_PROJECT_REPONAME':
|
|
142
|
+
results.repoName = value;
|
|
143
|
+
break;
|
|
144
|
+
case 'CIRCLE_PROJECT_USERNAME':
|
|
145
|
+
results.projectUsername = value;
|
|
146
|
+
break;
|
|
147
|
+
case 'CIRCLE_REPOSITORY_URL':
|
|
148
|
+
results.repoUrl = value;
|
|
149
|
+
break;
|
|
150
|
+
case 'CIRCLE_BRANCH':
|
|
151
|
+
results.branchName = value;
|
|
152
|
+
break;
|
|
153
|
+
case 'CIRCLE_BUILD_NUM':
|
|
154
|
+
results.buildId = value;
|
|
155
|
+
break;
|
|
156
|
+
case 'CIRCLE_BUILD_URL':
|
|
157
|
+
results.buildUrl = value;
|
|
158
|
+
break;
|
|
159
|
+
case 'CIRCLE_JOB':
|
|
160
|
+
results.jobName = value;
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return processBuildEnv(this.envVariables, mapper);
|
|
166
|
+
}
|
|
167
|
+
getForTravis() {
|
|
168
|
+
function mapper(key, value, results) {
|
|
169
|
+
switch (key) {
|
|
170
|
+
case 'TRAVIS_PULL_REQUEST':
|
|
171
|
+
if (value !== 'false') {
|
|
172
|
+
results.pullRequestId = value;
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
175
|
+
case 'TRAVIS_PULL_REQUEST_BRANCH':
|
|
176
|
+
results.pullRequestBranch = value;
|
|
177
|
+
break;
|
|
178
|
+
case 'TRAVIS_REPO_SLUG':
|
|
179
|
+
const parts = value.split('/');
|
|
180
|
+
if (parts.length === 2) {
|
|
181
|
+
results.repoOwner = parts[0];
|
|
182
|
+
results.repoName = parts[1];
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
case 'TRAVIS':
|
|
186
|
+
results.isCorrectType = value === 'true';
|
|
187
|
+
results.buildType = scmContextInterfaces_1.BuildTypes.Travis;
|
|
188
|
+
break;
|
|
189
|
+
case 'TRAVIS_COMMIT':
|
|
190
|
+
results.commitSha = value;
|
|
191
|
+
results.revisionId = value;
|
|
192
|
+
break;
|
|
193
|
+
case 'TRAVIS_TAG':
|
|
194
|
+
results.tagName = value;
|
|
195
|
+
break;
|
|
196
|
+
case 'TRAVIS_BRANCH':
|
|
197
|
+
results.branchName = value;
|
|
198
|
+
break;
|
|
199
|
+
case 'TRAVIS_BUILD_NUMBER':
|
|
200
|
+
results.buildId = value;
|
|
201
|
+
break;
|
|
202
|
+
case 'TRAVIS_BUILD_WEB_URL':
|
|
203
|
+
results.buildUrl = value;
|
|
204
|
+
break;
|
|
205
|
+
case 'TRAVIS_JOB_NAME':
|
|
206
|
+
results.jobName = value;
|
|
207
|
+
break;
|
|
208
|
+
default:
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return processBuildEnv(this.envVariables, mapper);
|
|
212
|
+
}
|
|
213
|
+
getForCodeship() {
|
|
214
|
+
function mapper(key, value, results) {
|
|
215
|
+
switch (key) {
|
|
216
|
+
case 'CI_PR_NUMBER':
|
|
217
|
+
results.pullRequestId = value;
|
|
218
|
+
break;
|
|
219
|
+
case 'CI_PULL_REQUEST':
|
|
220
|
+
results.pullRequestUrl = value;
|
|
221
|
+
break;
|
|
222
|
+
case 'CI_REPO_NAME':
|
|
223
|
+
results.repoName = value;
|
|
224
|
+
break;
|
|
225
|
+
case 'CI_NAME':
|
|
226
|
+
results.isCorrectType = value === 'codeship';
|
|
227
|
+
results.buildType = scmContextInterfaces_1.BuildTypes.Codeship;
|
|
228
|
+
break;
|
|
229
|
+
case 'CI_COMMIT_ID':
|
|
230
|
+
results.commitSha = value;
|
|
231
|
+
results.revisionId = value;
|
|
232
|
+
break;
|
|
233
|
+
case 'CI_BRANCH':
|
|
234
|
+
results.branchName = value;
|
|
235
|
+
break;
|
|
236
|
+
case 'CI_BUILD_ID':
|
|
237
|
+
results.buildId = value;
|
|
238
|
+
break;
|
|
239
|
+
default:
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return processBuildEnv(this.envVariables, mapper);
|
|
243
|
+
}
|
|
244
|
+
getForJenkins() {
|
|
245
|
+
function mapper(key, value, results) {
|
|
246
|
+
switch (key) {
|
|
247
|
+
case 'GIT_URL':
|
|
248
|
+
results.repoUrl = value;
|
|
249
|
+
break;
|
|
250
|
+
case 'GIT_COMMIT':
|
|
251
|
+
results.commitSha = value;
|
|
252
|
+
results.revisionId = value;
|
|
253
|
+
break;
|
|
254
|
+
case 'SVN_REVISION':
|
|
255
|
+
results.revisionId = value;
|
|
256
|
+
break;
|
|
257
|
+
case 'GIT_BRANCH':
|
|
258
|
+
case 'CVS_BRANCH':
|
|
259
|
+
results.branchName = value;
|
|
260
|
+
break;
|
|
261
|
+
case 'BUILD_URL':
|
|
262
|
+
results.buildUrl = value;
|
|
263
|
+
break;
|
|
264
|
+
case 'JOB_NAME':
|
|
265
|
+
results.jobName = value;
|
|
266
|
+
break;
|
|
267
|
+
case 'BUILD_TAG':
|
|
268
|
+
results.isCorrectType = value.startsWith('jenkins');
|
|
269
|
+
results.jobTag = value;
|
|
270
|
+
results.buildType = scmContextInterfaces_1.BuildTypes.Jenkins;
|
|
271
|
+
break;
|
|
272
|
+
case 'BUILD_NUMBER':
|
|
273
|
+
results.buildId = value;
|
|
274
|
+
break;
|
|
275
|
+
default:
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return processBuildEnv(this.envVariables, mapper);
|
|
279
|
+
}
|
|
280
|
+
attemptGitSoftInterrogation() {
|
|
281
|
+
const gitInfo = getRepoInfo();
|
|
282
|
+
if (gitInfo) {
|
|
283
|
+
return {
|
|
284
|
+
commitSha: gitInfo.sha,
|
|
285
|
+
revisionId: gitInfo.sha,
|
|
286
|
+
branchName: gitInfo.branch,
|
|
287
|
+
tagName: gitInfo.tag,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
async attemptGitChildProcessCall() {
|
|
293
|
+
const repoUrlMatcher = /^origin\s+(\S+)\s+\(fetch\)/;
|
|
294
|
+
const repoBranchMatcher = /^(\S{1,256})/;
|
|
295
|
+
const repoShaMatch = /^([a-f0-9]{40})+/;
|
|
296
|
+
const showRepoRemoteCommand = 'git remote -v';
|
|
297
|
+
const showRepoBranchCommand = 'git rev-parse --abbrev-ref HEAD';
|
|
298
|
+
const showRepoShaCommand = 'git rev-parse HEAD';
|
|
299
|
+
const maybeRepoUrl = await this.executeGetRepoUrl(showRepoRemoteCommand, repoUrlMatcher);
|
|
300
|
+
if (!maybeRepoUrl) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
const maybeRepoBranch = await this.executeGetRepoUrl(showRepoBranchCommand, repoBranchMatcher);
|
|
304
|
+
if (!maybeRepoBranch) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
const maybeRepoSha = await this.executeGetRepoUrl(showRepoShaCommand, repoShaMatch);
|
|
308
|
+
if (!maybeRepoSha) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
branchName: maybeRepoBranch,
|
|
313
|
+
repoUrl: maybeRepoUrl,
|
|
314
|
+
revisionId: maybeRepoSha,
|
|
315
|
+
commitSha: maybeRepoSha,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
executeGetRepoUrl(command, matcher) {
|
|
319
|
+
return new Promise((resolve, reject) => {
|
|
320
|
+
exec(command, (error, stdout) => {
|
|
321
|
+
if (error) {
|
|
322
|
+
return reject(error);
|
|
323
|
+
}
|
|
324
|
+
if (matcher.test(stdout)) {
|
|
325
|
+
const matchParts = stdout.match(matcher);
|
|
326
|
+
if (matchParts && matchParts.length >= 1) {
|
|
327
|
+
return resolve(matchParts[1]);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
resolve(undefined);
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
exports.ScmContextProvider = ScmContextProvider;
|