@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,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeEmail = exports.isEmailSelectorOrDescriptor = exports.normalize = exports.isElementSelector = exports.FindAction = exports.formattedFindTypeToMablscript = exports.findTypesToFormattedType = void 0;
|
|
4
|
+
const domUtil_1 = require("../../domUtil");
|
|
5
|
+
const mablscriptFind_1 = require("../../mablscriptFind");
|
|
6
|
+
const MablAction_1 = require("../MablAction");
|
|
7
|
+
exports.findTypesToFormattedType = {
|
|
8
|
+
find_all: 'FindAll',
|
|
9
|
+
find_any: 'FindFirst',
|
|
10
|
+
find_cookie: 'FindCookie',
|
|
11
|
+
find_first: 'FindFirst',
|
|
12
|
+
find_one: 'FindOne',
|
|
13
|
+
find_email: 'FindEmail',
|
|
14
|
+
find_tab: 'FindTab',
|
|
15
|
+
find_last: 'FindLast',
|
|
16
|
+
};
|
|
17
|
+
exports.formattedFindTypeToMablscript = {};
|
|
18
|
+
Object.entries(exports.findTypesToFormattedType).forEach(([findType, field]) => (exports.formattedFindTypeToMablscript[field] = findType));
|
|
19
|
+
class FindAction extends MablAction_1.MablAction {
|
|
20
|
+
constructor(name, args) {
|
|
21
|
+
super(name, name, args);
|
|
22
|
+
const actionName = this.getActionName();
|
|
23
|
+
if (!(0, domUtil_1.isFindType)(actionName)) {
|
|
24
|
+
throw new Error(`Unknown find type for action: ${actionName}`);
|
|
25
|
+
}
|
|
26
|
+
const findType = domUtil_1.FindType.fromString(actionName);
|
|
27
|
+
this.isValid = true;
|
|
28
|
+
switch (findType) {
|
|
29
|
+
case domUtil_1.FindType.FIND_ONE: {
|
|
30
|
+
const [selectors, options] = this.getActionArgs();
|
|
31
|
+
if (!isElementSelector(selectors)) {
|
|
32
|
+
this.isValid = false;
|
|
33
|
+
}
|
|
34
|
+
const [target, ancestor] = Array.isArray(selectors)
|
|
35
|
+
? [...selectors]
|
|
36
|
+
: [selectors];
|
|
37
|
+
const findTarget = normalize(target);
|
|
38
|
+
if (ancestor) {
|
|
39
|
+
findTarget.auxiliaryDescriptors = [normalize(ancestor)];
|
|
40
|
+
}
|
|
41
|
+
this.findDescriptor = {
|
|
42
|
+
findType,
|
|
43
|
+
findTarget,
|
|
44
|
+
};
|
|
45
|
+
if ((0, domUtil_1.isFindOptions)(options)) {
|
|
46
|
+
this.findDescriptor.findOptions = options;
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
51
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
52
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
53
|
+
case domUtil_1.FindType.FIND_ALL: {
|
|
54
|
+
const [primarySelector, foundElementSelectors, findOptions] = this.getActionArgs();
|
|
55
|
+
if (!(0, domUtil_1.isCssSelector)(primarySelector) &&
|
|
56
|
+
!(0, domUtil_1.isXPathSelector)(primarySelector)) {
|
|
57
|
+
this.isValid = false;
|
|
58
|
+
}
|
|
59
|
+
this.findDescriptor = {
|
|
60
|
+
findOptions,
|
|
61
|
+
findTarget: primarySelector,
|
|
62
|
+
findType,
|
|
63
|
+
foundElementSelectors,
|
|
64
|
+
primarySelectors: primarySelector,
|
|
65
|
+
};
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case domUtil_1.FindType.FIND_COOKIE: {
|
|
69
|
+
const [selectors] = this.getActionArgs();
|
|
70
|
+
if (!(0, domUtil_1.isCookieSelector)(selectors)) {
|
|
71
|
+
this.isValid = false;
|
|
72
|
+
}
|
|
73
|
+
this.findDescriptor = {
|
|
74
|
+
findType,
|
|
75
|
+
findTarget: selectors,
|
|
76
|
+
};
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
case domUtil_1.FindType.FIND_EMAIL:
|
|
80
|
+
const [selectors] = this.getActionArgs();
|
|
81
|
+
if (!isEmailSelectorOrDescriptor(selectors)) {
|
|
82
|
+
this.isValid = false;
|
|
83
|
+
}
|
|
84
|
+
const [target] = Array.isArray(selectors)
|
|
85
|
+
? [...selectors]
|
|
86
|
+
: [selectors];
|
|
87
|
+
const findTarget = normalizeEmail(target);
|
|
88
|
+
this.findDescriptor = {
|
|
89
|
+
findType,
|
|
90
|
+
findTarget,
|
|
91
|
+
};
|
|
92
|
+
break;
|
|
93
|
+
case domUtil_1.FindType.FIND_TAB: {
|
|
94
|
+
const [selectors] = this.getActionArgs();
|
|
95
|
+
if (selectors !== 'initial' && !(0, domUtil_1.isTabSelector)(selectors)) {
|
|
96
|
+
this.isValid = false;
|
|
97
|
+
}
|
|
98
|
+
this.findDescriptor = {
|
|
99
|
+
findType,
|
|
100
|
+
findTarget: selectors,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
Object.freeze(this.findDescriptor);
|
|
105
|
+
}
|
|
106
|
+
toDescriptor() {
|
|
107
|
+
return this.findDescriptor;
|
|
108
|
+
}
|
|
109
|
+
static findActionFromStepArgs(stepArgs, suppliedFindType) {
|
|
110
|
+
let findType;
|
|
111
|
+
if (stepArgs.selector) {
|
|
112
|
+
if (suppliedFindType) {
|
|
113
|
+
findType = suppliedFindType;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
findType = stepArgs.findType
|
|
117
|
+
? exports.formattedFindTypeToMablscript[stepArgs.findType]
|
|
118
|
+
: exports.formattedFindTypeToMablscript.FindOne;
|
|
119
|
+
}
|
|
120
|
+
if (!stepArgs.selectorAncestors) {
|
|
121
|
+
return new FindAction(findType, [
|
|
122
|
+
stepArgs.selector,
|
|
123
|
+
stepArgs.findOptions,
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
const ancestors = stepArgs.selectorAncestors || [];
|
|
127
|
+
return new FindAction(findType, [
|
|
128
|
+
[stepArgs.selector, ...ancestors],
|
|
129
|
+
stepArgs.findOptions,
|
|
130
|
+
]);
|
|
131
|
+
}
|
|
132
|
+
throw new Error('No selector found in yaml');
|
|
133
|
+
}
|
|
134
|
+
toYaml() {
|
|
135
|
+
var _a;
|
|
136
|
+
const result = {};
|
|
137
|
+
const find = this.toDescriptor();
|
|
138
|
+
switch (find.findType) {
|
|
139
|
+
case domUtil_1.FindType.FIND_FIRST:
|
|
140
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
141
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
142
|
+
case domUtil_1.FindType.FIND_ALL:
|
|
143
|
+
result.find_type = find.findType;
|
|
144
|
+
result.selector = find.findTarget;
|
|
145
|
+
break;
|
|
146
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
147
|
+
result.selector = find.findTarget.selector;
|
|
148
|
+
if ((_a = find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
149
|
+
result.selectorAncestors = find.findTarget.auxiliaryDescriptors.map((descriptor) => descriptor.selector);
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
default:
|
|
153
|
+
throw new Error(`Unexpected find type ${find.findType}`);
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
toMablscript() {
|
|
158
|
+
return this.generateFindMablscript();
|
|
159
|
+
}
|
|
160
|
+
generateFindMablscript() {
|
|
161
|
+
var _a;
|
|
162
|
+
let action = this.findDescriptor.findType;
|
|
163
|
+
let args = '';
|
|
164
|
+
switch (this.findDescriptor.findType) {
|
|
165
|
+
case domUtil_1.FindType.FIND_ONE:
|
|
166
|
+
const find = this.findDescriptor;
|
|
167
|
+
const selectors = ((_a = find.findTarget.auxiliaryDescriptors) === null || _a === void 0 ? void 0 : _a.length)
|
|
168
|
+
? '[' +
|
|
169
|
+
[find.findTarget, ...find.findTarget.auxiliaryDescriptors]
|
|
170
|
+
.map(mablscriptFind_1.buildFindDescriptorString)
|
|
171
|
+
.filter(Boolean)
|
|
172
|
+
.join(', ') +
|
|
173
|
+
']'
|
|
174
|
+
: (0, mablscriptFind_1.buildFindDescriptorString)(find.findTarget);
|
|
175
|
+
const options = buildFindOptionsString(find.findOptions);
|
|
176
|
+
args = [selectors, options].filter(Boolean).join(', ');
|
|
177
|
+
break;
|
|
178
|
+
case domUtil_1.FindType.FIND_LAST:
|
|
179
|
+
case domUtil_1.FindType.FIND_ANY:
|
|
180
|
+
case domUtil_1.FindType.FIND_ALL:
|
|
181
|
+
case domUtil_1.FindType.FIND_FIRST: {
|
|
182
|
+
const find = this.findDescriptor;
|
|
183
|
+
const selector = (0, mablscriptFind_1.buildElementSelectorString)(find.findTarget);
|
|
184
|
+
let foundElementSelectors;
|
|
185
|
+
if (find.foundElementSelectors) {
|
|
186
|
+
if (Array.isArray(find.foundElementSelectors)) {
|
|
187
|
+
foundElementSelectors = find.foundElementSelectors
|
|
188
|
+
.map((selector) => (0, mablscriptFind_1.buildFindDescriptorString)({ selector }))
|
|
189
|
+
.join(', ');
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
foundElementSelectors = (0, mablscriptFind_1.buildFindDescriptorString)({
|
|
193
|
+
selector: find.foundElementSelectors,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
foundElementSelectors = '{selector_type: "element"}';
|
|
199
|
+
}
|
|
200
|
+
const options = buildFindOptionsString(find.findOptions);
|
|
201
|
+
args = [selector, foundElementSelectors, options]
|
|
202
|
+
.filter(Boolean)
|
|
203
|
+
.join(', ');
|
|
204
|
+
if (find.findType === domUtil_1.FindType.FIND_ANY) {
|
|
205
|
+
action = domUtil_1.FindType.FIND_FIRST;
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
case domUtil_1.FindType.FIND_COOKIE:
|
|
210
|
+
args = (0, mablscriptFind_1.buildCookieSelectorString)(this.findDescriptor.findTarget);
|
|
211
|
+
break;
|
|
212
|
+
case domUtil_1.FindType.FIND_EMAIL: {
|
|
213
|
+
args = (0, domUtil_1.buildFindEmailDescriptorString)(this.findDescriptor.findTarget);
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
case domUtil_1.FindType.FIND_TAB:
|
|
217
|
+
args = (0, mablscriptFind_1.buildTabSelectorString)(this.findDescriptor.findTarget);
|
|
218
|
+
break;
|
|
219
|
+
default:
|
|
220
|
+
throw new Error(`Error generating mablscript: Unexpected find type in ${JSON.stringify(this.findDescriptor)}`);
|
|
221
|
+
}
|
|
222
|
+
return `${action}(${args})`;
|
|
223
|
+
}
|
|
224
|
+
isValidDescriptor() {
|
|
225
|
+
return this.isValid;
|
|
226
|
+
}
|
|
227
|
+
getInputVariables() {
|
|
228
|
+
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.findDescriptor);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
exports.FindAction = FindAction;
|
|
232
|
+
FindAction.mablScriptStepNames = [
|
|
233
|
+
'find_all',
|
|
234
|
+
'find_one',
|
|
235
|
+
'find_first',
|
|
236
|
+
'find_last',
|
|
237
|
+
'find_any',
|
|
238
|
+
'find_cookie',
|
|
239
|
+
'find_email',
|
|
240
|
+
'find_tab',
|
|
241
|
+
];
|
|
242
|
+
FindAction.yamlMablScriptNames = [
|
|
243
|
+
'FindAll',
|
|
244
|
+
'FindOne',
|
|
245
|
+
'FindFirst',
|
|
246
|
+
'FindLast',
|
|
247
|
+
'FindAny',
|
|
248
|
+
'FindCookie',
|
|
249
|
+
'FindEmail',
|
|
250
|
+
'FindTab',
|
|
251
|
+
];
|
|
252
|
+
function buildFindOptionsString(findOptions) {
|
|
253
|
+
if (!findOptions) {
|
|
254
|
+
return undefined;
|
|
255
|
+
}
|
|
256
|
+
return JSON.stringify(findOptions);
|
|
257
|
+
}
|
|
258
|
+
function isElementSelector(maybeSelectors) {
|
|
259
|
+
const [target, ancestor] = Array.isArray(maybeSelectors)
|
|
260
|
+
? [...maybeSelectors]
|
|
261
|
+
: [maybeSelectors];
|
|
262
|
+
const validTarget = (0, domUtil_1.isStandardSelector)(target) || (0, domUtil_1.isNormalizedFindDescriptor)(target);
|
|
263
|
+
const validAncestor = !ancestor ||
|
|
264
|
+
(0, domUtil_1.isStandardSelector)(ancestor) ||
|
|
265
|
+
(0, domUtil_1.isNormalizedFindDescriptor)(ancestor);
|
|
266
|
+
return !!(validTarget && validAncestor);
|
|
267
|
+
}
|
|
268
|
+
exports.isElementSelector = isElementSelector;
|
|
269
|
+
function normalize(maybeFindDescriptor) {
|
|
270
|
+
if ((0, domUtil_1.isNormalizedFindDescriptor)(maybeFindDescriptor)) {
|
|
271
|
+
return { ...maybeFindDescriptor };
|
|
272
|
+
}
|
|
273
|
+
return { selector: maybeFindDescriptor };
|
|
274
|
+
}
|
|
275
|
+
exports.normalize = normalize;
|
|
276
|
+
function isEmailSelectorOrDescriptor(selectorOrDescriptor) {
|
|
277
|
+
const [target] = Array.isArray(selectorOrDescriptor)
|
|
278
|
+
? [...selectorOrDescriptor]
|
|
279
|
+
: [selectorOrDescriptor];
|
|
280
|
+
return (0, domUtil_1.isEmailSelector)(target) || (0, domUtil_1.isNormalizedFindEmailDescriptor)(target);
|
|
281
|
+
}
|
|
282
|
+
exports.isEmailSelectorOrDescriptor = isEmailSelectorOrDescriptor;
|
|
283
|
+
function normalizeEmail(selectorOrDescriptor) {
|
|
284
|
+
if ((0, domUtil_1.isNormalizedFindEmailDescriptor)(selectorOrDescriptor)) {
|
|
285
|
+
return { ...selectorOrDescriptor };
|
|
286
|
+
}
|
|
287
|
+
if ((0, domUtil_1.isEmailSelector)(selectorOrDescriptor)) {
|
|
288
|
+
if (selectorOrDescriptor.subject_exact) {
|
|
289
|
+
const { subject_exact: subjectExact, ...restOfObject } = selectorOrDescriptor;
|
|
290
|
+
return {
|
|
291
|
+
selector: {
|
|
292
|
+
subject: subjectExact,
|
|
293
|
+
...restOfObject,
|
|
294
|
+
},
|
|
295
|
+
type: 'email',
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return { selector: selectorOrDescriptor, type: 'email' };
|
|
300
|
+
}
|
|
301
|
+
exports.normalizeEmail = normalizeEmail;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateEmailAddressAction = void 0;
|
|
4
|
+
const MablAction_1 = require("../MablAction");
|
|
5
|
+
class GenerateEmailAddressAction extends MablAction_1.MablAction {
|
|
6
|
+
constructor(name, args) {
|
|
7
|
+
super(name, 'generate_email_address', args);
|
|
8
|
+
}
|
|
9
|
+
toMablscript() {
|
|
10
|
+
return 'generate_email_address()';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.GenerateEmailAddressAction = GenerateEmailAddressAction;
|
|
14
|
+
GenerateEmailAddressAction.mablScriptStepNames = ['generate_email_address'];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateRandomStringAction = void 0;
|
|
4
|
+
const MablAction_1 = require("../MablAction");
|
|
5
|
+
const domUtil_1 = require("../../domUtil");
|
|
6
|
+
class GenerateRandomStringAction extends MablAction_1.MablAction {
|
|
7
|
+
constructor(name, args) {
|
|
8
|
+
super(name, 'generate_random_string', args);
|
|
9
|
+
this.generateString = this.getActionArgs()[0];
|
|
10
|
+
}
|
|
11
|
+
toMablscript() {
|
|
12
|
+
return `generate_random_string(\"${(0, domUtil_1.escapeMablscriptString)(this.generateString)}\")`;
|
|
13
|
+
}
|
|
14
|
+
getInputVariables() {
|
|
15
|
+
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.generateString);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.GenerateRandomStringAction = GenerateRandomStringAction;
|
|
19
|
+
GenerateRandomStringAction.mablScriptStepNames = ['generate_random_string'];
|
|
20
|
+
GenerateRandomStringAction.yamlMablScriptNames = ['GenerateRandomString'];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetUrlAction = void 0;
|
|
4
|
+
const MablAction_1 = require("../MablAction");
|
|
5
|
+
const GetCurrentLocationDescriptor_1 = require("../types/GetCurrentLocationDescriptor");
|
|
6
|
+
class GetUrlAction extends MablAction_1.MablAction {
|
|
7
|
+
constructor(name, args) {
|
|
8
|
+
super(name, 'get_current_location', args);
|
|
9
|
+
}
|
|
10
|
+
toMablscript() {
|
|
11
|
+
return `get_current_location()`;
|
|
12
|
+
}
|
|
13
|
+
toDescriptor() {
|
|
14
|
+
return (0, GetCurrentLocationDescriptor_1.newGetCurrentLocationDescriptor)();
|
|
15
|
+
}
|
|
16
|
+
generateFindMablscript() {
|
|
17
|
+
return 'get_current_location()';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.GetUrlAction = GetUrlAction;
|
|
21
|
+
GetUrlAction.mablScriptStepNames = ['get_current_location'];
|
|
22
|
+
GetUrlAction.yamlMablScriptNames = ['GetUrl'];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetVariableValue = void 0;
|
|
4
|
+
const MablAction_1 = require("../MablAction");
|
|
5
|
+
const MablSymbol_1 = require("../MablSymbol");
|
|
6
|
+
const GetVariableDescriptor_1 = require("../types/GetVariableDescriptor");
|
|
7
|
+
class GetVariableValue extends MablAction_1.MablAction {
|
|
8
|
+
constructor(name, args) {
|
|
9
|
+
super(name, 'get_variable_value', args);
|
|
10
|
+
const arg = this.getActionArgs()[0];
|
|
11
|
+
if (typeof arg !== 'string') {
|
|
12
|
+
throw new Error('Expected string argument');
|
|
13
|
+
}
|
|
14
|
+
this.variable = MablSymbol_1.MablSymbol.fromString(arg);
|
|
15
|
+
}
|
|
16
|
+
toMablscript() {
|
|
17
|
+
return `get_variable_value(${this.subVariable(this.variable.toString())})`;
|
|
18
|
+
}
|
|
19
|
+
toDescriptor() {
|
|
20
|
+
return (0, GetVariableDescriptor_1.newGetVariableDescriptor)(this.variable);
|
|
21
|
+
}
|
|
22
|
+
generateFindMablscript() {
|
|
23
|
+
return `get_variable_value(${this.variable.name})`;
|
|
24
|
+
}
|
|
25
|
+
getInputVariables() {
|
|
26
|
+
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.variable);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.GetVariableValue = GetVariableValue;
|
|
30
|
+
GetVariableValue.mablScriptStepNames = ['get_variable_value'];
|
|
31
|
+
GetVariableValue.yamlMablScriptNames = ['GetVariableValueAs'];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetViewportAction = void 0;
|
|
4
|
+
const MablAction_1 = require("../MablAction");
|
|
5
|
+
const GetViewportDescriptor_1 = require("../types/GetViewportDescriptor");
|
|
6
|
+
class GetViewportAction extends MablAction_1.MablAction {
|
|
7
|
+
constructor() {
|
|
8
|
+
super('get_viewport', 'get_viewport', []);
|
|
9
|
+
}
|
|
10
|
+
toDescriptor() {
|
|
11
|
+
return (0, GetViewportDescriptor_1.newGetViewportDescriptor)();
|
|
12
|
+
}
|
|
13
|
+
generateFindMablscript() {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.GetViewportAction = GetViewportAction;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isJavaScriptActionDescriptor = exports.JavaScriptAction = void 0;
|
|
4
|
+
const domUtil_1 = require("../../domUtil");
|
|
5
|
+
const MablAction_1 = require("../MablAction");
|
|
6
|
+
const SnippetsDescriptor_1 = require("../types/SnippetsDescriptor");
|
|
7
|
+
const MABLSCRIPT_NAME = 'evaluate_js';
|
|
8
|
+
function isLegacySnippetReference(value) {
|
|
9
|
+
return typeof value === 'object' && !!value.id && !('invariant_id' in value);
|
|
10
|
+
}
|
|
11
|
+
function isReusableSnippetReference(value) {
|
|
12
|
+
return typeof value === 'object' && !!value.id && !!value.invariant_id;
|
|
13
|
+
}
|
|
14
|
+
function isInlineSnippetReference(value) {
|
|
15
|
+
return (typeof value === 'object' &&
|
|
16
|
+
typeof value.body === 'string' &&
|
|
17
|
+
Array.isArray(value.parameters) &&
|
|
18
|
+
!('id' in value) &&
|
|
19
|
+
!('invariant_id' in value));
|
|
20
|
+
}
|
|
21
|
+
function isSnippetOptions(value) {
|
|
22
|
+
return value && 'parameter_overrides' in value;
|
|
23
|
+
}
|
|
24
|
+
class JavaScriptAction extends MablAction_1.MablAction {
|
|
25
|
+
constructor(name, args) {
|
|
26
|
+
super(name, MABLSCRIPT_NAME, args);
|
|
27
|
+
if (args.length < 1 || args.length > 2) {
|
|
28
|
+
throw new Error('EvaluateJS action expects 1 or 2 arguments');
|
|
29
|
+
}
|
|
30
|
+
const scriptOrSnippetReference = args[0];
|
|
31
|
+
if (!scriptOrSnippetReference ||
|
|
32
|
+
!(typeof scriptOrSnippetReference === 'string' ||
|
|
33
|
+
typeof scriptOrSnippetReference === 'object')) {
|
|
34
|
+
throw new Error('EvaluateJS action expects the first argument to be a string or object');
|
|
35
|
+
}
|
|
36
|
+
if (typeof scriptOrSnippetReference === 'string') {
|
|
37
|
+
this.javaScript = {
|
|
38
|
+
encodedJS: scriptOrSnippetReference,
|
|
39
|
+
actionCode: MABLSCRIPT_NAME,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
else if (isLegacySnippetReference(scriptOrSnippetReference)) {
|
|
43
|
+
const { id } = scriptOrSnippetReference;
|
|
44
|
+
this.javaScript = {
|
|
45
|
+
snippetInvariantId: id,
|
|
46
|
+
actionCode: MABLSCRIPT_NAME,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
else if (isReusableSnippetReference(scriptOrSnippetReference)) {
|
|
50
|
+
const { id, invariant_id } = scriptOrSnippetReference;
|
|
51
|
+
this.javaScript = {
|
|
52
|
+
snippetId: id,
|
|
53
|
+
snippetInvariantId: invariant_id,
|
|
54
|
+
parameterOverrides: [],
|
|
55
|
+
actionCode: MABLSCRIPT_NAME,
|
|
56
|
+
};
|
|
57
|
+
const snippetOptions = args[1];
|
|
58
|
+
if (isSnippetOptions(snippetOptions)) {
|
|
59
|
+
this.javaScript.parameterOverrides = snippetOptions.parameter_overrides;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (isInlineSnippetReference(scriptOrSnippetReference)) {
|
|
63
|
+
this.javaScript = {
|
|
64
|
+
inlineSnippet: scriptOrSnippetReference,
|
|
65
|
+
parameterOverrides: [],
|
|
66
|
+
actionCode: MABLSCRIPT_NAME,
|
|
67
|
+
};
|
|
68
|
+
const snippetOptions = args[1];
|
|
69
|
+
if (isSnippetOptions(snippetOptions)) {
|
|
70
|
+
this.javaScript.parameterOverrides = snippetOptions.parameter_overrides;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw new Error(`Invalid argument for EvaluateJS action: ${JSON.stringify(scriptOrSnippetReference)}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
toDescriptor() {
|
|
78
|
+
return { javaScript: this.javaScript, actionCode: this.actionCode };
|
|
79
|
+
}
|
|
80
|
+
static fromDescriptor(descriptor) {
|
|
81
|
+
const { javaScript } = descriptor;
|
|
82
|
+
if ((0, SnippetsDescriptor_1.isReusableSnippetDescriptor)(javaScript)) {
|
|
83
|
+
return new JavaScriptAction(JavaScriptAction.mablscriptName, [
|
|
84
|
+
{
|
|
85
|
+
id: javaScript.snippetId,
|
|
86
|
+
invariant_id: javaScript.snippetInvariantId,
|
|
87
|
+
},
|
|
88
|
+
{ parameter_overrides: javaScript.parameterOverrides },
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
else if ((0, SnippetsDescriptor_1.isInlineSnippetDescriptor)(javaScript)) {
|
|
92
|
+
return new JavaScriptAction(JavaScriptAction.mablscriptName, [
|
|
93
|
+
javaScript.inlineSnippet,
|
|
94
|
+
{ parameter_overrides: javaScript.parameterOverrides },
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
else if ((0, SnippetsDescriptor_1.isLegacyReusableSnippetDescriptor)(javaScript)) {
|
|
98
|
+
return new JavaScriptAction(JavaScriptAction.mablscriptName, [
|
|
99
|
+
{
|
|
100
|
+
id: javaScript.snippetInvariantId,
|
|
101
|
+
},
|
|
102
|
+
]);
|
|
103
|
+
}
|
|
104
|
+
else if ((0, SnippetsDescriptor_1.isLegacyInlineJavaScriptDescriptor)(javaScript)) {
|
|
105
|
+
return new JavaScriptAction(JavaScriptAction.mablscriptName, [
|
|
106
|
+
javaScript.encodedJS,
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
throw new Error(`Invalid javascript action descriptor: ${JSON.stringify(descriptor)}`);
|
|
110
|
+
}
|
|
111
|
+
toYaml() {
|
|
112
|
+
return JavaScriptAction.toYamlFromJavaScriptDescriptor(this.javaScript);
|
|
113
|
+
}
|
|
114
|
+
static toYamlFromJavaScriptDescriptor(javaScript) {
|
|
115
|
+
const actionYaml = {};
|
|
116
|
+
if ((0, SnippetsDescriptor_1.isReusableSnippetDescriptor)(javaScript)) {
|
|
117
|
+
actionYaml.snippetId = javaScript.snippetId;
|
|
118
|
+
actionYaml.snippetInvariantId = javaScript.snippetInvariantId;
|
|
119
|
+
actionYaml.parameterOverrides = javaScript.parameterOverrides;
|
|
120
|
+
}
|
|
121
|
+
else if ((0, SnippetsDescriptor_1.isInlineSnippetDescriptor)(javaScript)) {
|
|
122
|
+
actionYaml.snippet = { ...actionYaml, ...javaScript.inlineSnippet };
|
|
123
|
+
actionYaml.parameterOverrides = javaScript.parameterOverrides;
|
|
124
|
+
}
|
|
125
|
+
else if ((0, SnippetsDescriptor_1.isLegacyReusableSnippetDescriptor)(javaScript)) {
|
|
126
|
+
actionYaml.snippetId = javaScript.snippetInvariantId;
|
|
127
|
+
}
|
|
128
|
+
else if ((0, SnippetsDescriptor_1.isLegacyInlineJavaScriptDescriptor)(javaScript)) {
|
|
129
|
+
actionYaml.code = javaScript.encodedJS;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
throw new Error(`Cannot export action to yaml: ${JSON.stringify(javaScript)}`);
|
|
133
|
+
}
|
|
134
|
+
return actionYaml;
|
|
135
|
+
}
|
|
136
|
+
static fromYaml(formatted) {
|
|
137
|
+
let snippetOptions;
|
|
138
|
+
if (formatted.parameterOverrides) {
|
|
139
|
+
snippetOptions = {
|
|
140
|
+
parameter_overrides: formatted.parameterOverrides,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const args = [];
|
|
144
|
+
if (formatted.code) {
|
|
145
|
+
args.push(formatted.code);
|
|
146
|
+
}
|
|
147
|
+
else if (formatted.body) {
|
|
148
|
+
delete formatted.parameterOverrides;
|
|
149
|
+
args.push(formatted);
|
|
150
|
+
}
|
|
151
|
+
else if (formatted.snippet) {
|
|
152
|
+
args.push(formatted.snippet);
|
|
153
|
+
}
|
|
154
|
+
else if (formatted.snippetInvariantId && formatted.snippetId) {
|
|
155
|
+
args.push({
|
|
156
|
+
id: formatted.snippetId,
|
|
157
|
+
invariant_id: formatted.snippetInvariantId,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else if (formatted.snippetId) {
|
|
161
|
+
args.push({
|
|
162
|
+
id: formatted.snippetId,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
throw new Error(`Cannot import action from yaml: ${JSON.stringify(formatted)}`);
|
|
167
|
+
}
|
|
168
|
+
if (snippetOptions) {
|
|
169
|
+
args.push(snippetOptions);
|
|
170
|
+
}
|
|
171
|
+
return new JavaScriptAction(MABLSCRIPT_NAME, args);
|
|
172
|
+
}
|
|
173
|
+
toMablscript() {
|
|
174
|
+
if ((0, SnippetsDescriptor_1.isReusableSnippetDescriptor)(this.javaScript)) {
|
|
175
|
+
const snippetReference = (0, domUtil_1.buildStepArgumentString)({
|
|
176
|
+
params: {
|
|
177
|
+
id: this.javaScript.snippetId,
|
|
178
|
+
invariant_id: this.javaScript.snippetInvariantId,
|
|
179
|
+
snippet_type: 'javascript',
|
|
180
|
+
},
|
|
181
|
+
legacy: true,
|
|
182
|
+
});
|
|
183
|
+
const snippetOptions = `, {parameter_overrides: ${(0, domUtil_1.buildStepArgumentString)({ params: this.javaScript.parameterOverrides, legacy: true })}}`;
|
|
184
|
+
return `evaluate_js(${snippetReference}${snippetOptions})`;
|
|
185
|
+
}
|
|
186
|
+
if ((0, SnippetsDescriptor_1.isInlineSnippetDescriptor)(this.javaScript)) {
|
|
187
|
+
const snippetReference = (0, domUtil_1.buildStepArgumentString)({
|
|
188
|
+
params: { ...this.javaScript.inlineSnippet, snippet_type: 'javascript' },
|
|
189
|
+
legacy: true,
|
|
190
|
+
});
|
|
191
|
+
const snippetOptions = `, {parameter_overrides: ${(0, domUtil_1.buildStepArgumentString)({
|
|
192
|
+
params: this.javaScript.parameterOverrides,
|
|
193
|
+
legacy: true,
|
|
194
|
+
})}}`;
|
|
195
|
+
return `evaluate_js(${snippetReference}${snippetOptions})`;
|
|
196
|
+
}
|
|
197
|
+
if ((0, SnippetsDescriptor_1.isLegacyReusableSnippetDescriptor)(this.javaScript)) {
|
|
198
|
+
return `evaluate_js({id: "${this.javaScript.snippetInvariantId}", snippet_type: "javascript"})`;
|
|
199
|
+
}
|
|
200
|
+
if ((0, SnippetsDescriptor_1.isLegacyInlineJavaScriptDescriptor)(this.javaScript)) {
|
|
201
|
+
return `evaluate_js("${this.javaScript.encodedJS}")`;
|
|
202
|
+
}
|
|
203
|
+
throw new Error(`Cannot export action to mablscript: ${JSON.stringify(this.javaScript)}`);
|
|
204
|
+
}
|
|
205
|
+
getInputVariables() {
|
|
206
|
+
if ((0, SnippetsDescriptor_1.isInlineSnippetDescriptor)(this.javaScript) ||
|
|
207
|
+
(0, SnippetsDescriptor_1.isReusableSnippetDescriptor)(this.javaScript)) {
|
|
208
|
+
return MablAction_1.MablAction.findUniqueVariableReferencesInValue(this.javaScript.parameterOverrides.map((override) => override.value));
|
|
209
|
+
}
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
exports.JavaScriptAction = JavaScriptAction;
|
|
214
|
+
JavaScriptAction.mablscriptName = MABLSCRIPT_NAME;
|
|
215
|
+
JavaScriptAction.mablScriptStepNames = [MABLSCRIPT_NAME];
|
|
216
|
+
function isJavaScriptActionDescriptor(value) {
|
|
217
|
+
return value.javaScript !== undefined;
|
|
218
|
+
}
|
|
219
|
+
exports.isJavaScriptActionDescriptor = isJavaScriptActionDescriptor;
|