@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,25 @@
|
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Lodash <https://lodash.com/>
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
* Released under MIT license <https://lodash.com/license>
|
|
8
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
9
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @license Complex.js v2.1.1 12/05/2020
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) 2020, Robert Eisele (robert@xarg.org)
|
|
16
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
17
|
+
**/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @license Fraction.js v4.2.0 05/03/2022
|
|
21
|
+
* https://www.xarg.org/2014/03/rational-numbers-in-javascript/
|
|
22
|
+
*
|
|
23
|
+
* Copyright (c) 2021, Robert Eisele (robert@xarg.org)
|
|
24
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
25
|
+
**/
|
package/middleware.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
var _a;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CLI_MIDDLEWARE = void 0;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const versionUtil_1 = require("./commands/commandUtil/versionUtil");
|
|
10
|
+
const logLineMessaging_1 = require("./core/messaging/logLineMessaging");
|
|
11
|
+
const messaging_1 = require("./core/messaging/messaging");
|
|
12
|
+
const loggingProvider_1 = require("./providers/logging/loggingProvider");
|
|
13
|
+
const analytics_1 = require("./util/analytics");
|
|
14
|
+
const pureUtil_1 = require("./util/pureUtil");
|
|
15
|
+
const simple_update_notifier_1 = __importDefault(require("simple-update-notifier"));
|
|
16
|
+
const cliPackage = require('./package.json');
|
|
17
|
+
const UPDATE_CHECK_INTERVAL_MILLISECONDS = 24 * 60 * 60 * 1000;
|
|
18
|
+
const MIN_SUPPORTED_NODE_VERSION = (0, versionUtil_1.extractNodeVersionTuple)((_a = cliPackage === null || cliPackage === void 0 ? void 0 : cliPackage.engines) === null || _a === void 0 ? void 0 : _a.node);
|
|
19
|
+
exports.CLI_MIDDLEWARE = [
|
|
20
|
+
() => {
|
|
21
|
+
(0, logLineMessaging_1.registerConsoleLoggerForOutput)(messaging_1.mablEventEmitter);
|
|
22
|
+
},
|
|
23
|
+
warnOnUnsupportedNodeVersion,
|
|
24
|
+
async (argv) => (0, analytics_1.trackCliEvent)(argv._, (0, pureUtil_1.extractKeyCountsFromArgs)(argv)),
|
|
25
|
+
runUpdateCheck,
|
|
26
|
+
];
|
|
27
|
+
function warnOnUnsupportedNodeVersion() {
|
|
28
|
+
const nodeVersion = (0, versionUtil_1.extractNodeVersionTuple)(process.version);
|
|
29
|
+
if ((0, versionUtil_1.compareNodeVersions)(nodeVersion, MIN_SUPPORTED_NODE_VERSION) < 0) {
|
|
30
|
+
loggingProvider_1.logger.info(chalk_1.default.bgYellow.black(`WARNING: Unsupported Node.js detected (`) +
|
|
31
|
+
chalk_1.default.bgYellow.bold.white((0, versionUtil_1.nodeVersionToString)(nodeVersion)) +
|
|
32
|
+
chalk_1.default.bgYellow.black(`). \nmabl-cli functionality may be limited, please update to `) +
|
|
33
|
+
chalk_1.default.bgYellow.bold.white((0, versionUtil_1.nodeVersionToString)(MIN_SUPPORTED_NODE_VERSION)) +
|
|
34
|
+
chalk_1.default.bgYellow.black(' or later.\n'));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function runUpdateCheck() {
|
|
38
|
+
await (0, simple_update_notifier_1.default)({
|
|
39
|
+
pkg: cliPackage,
|
|
40
|
+
updateCheckInterval: UPDATE_CHECK_INTERVAL_MILLISECONDS,
|
|
41
|
+
});
|
|
42
|
+
}
|
package/mobile/index.js
ADDED
package/mobile/types.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileAutomationName = void 0;
|
|
4
|
+
var MobileAutomationName;
|
|
5
|
+
(function (MobileAutomationName) {
|
|
6
|
+
MobileAutomationName["UiAutomator2"] = "UiAutomator2";
|
|
7
|
+
MobileAutomationName["XCUITest"] = "XCUITest";
|
|
8
|
+
})(MobileAutomationName || (exports.MobileAutomationName = MobileAutomationName = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildObserverBaseOptions = exports.OBSERVER_TIMEOUT_MILLIS = void 0;
|
|
4
|
+
exports.OBSERVER_TIMEOUT_MILLIS = 300000;
|
|
5
|
+
function buildObserverBaseOptions(executionContext) {
|
|
6
|
+
return {
|
|
7
|
+
executionContext,
|
|
8
|
+
executionIndex: executionContext.executionIndexTracker.getExecutionIndex(),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.buildObserverBaseOptions = buildObserverBaseOptions;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FakeBrowserObserver = exports.noopPageLifecycleCallback = exports.noopObserveAfterFunction = exports.noopObserveDeferredFunction = void 0;
|
|
4
|
+
const noopObserveDeferredFunction = () => Promise.resolve();
|
|
5
|
+
exports.noopObserveDeferredFunction = noopObserveDeferredFunction;
|
|
6
|
+
const noopObserveAfterFunction = () => Promise.resolve();
|
|
7
|
+
exports.noopObserveAfterFunction = noopObserveAfterFunction;
|
|
8
|
+
exports.noopPageLifecycleCallback = {
|
|
9
|
+
onPageCreated: () => { },
|
|
10
|
+
onPageDestroyed: () => { },
|
|
11
|
+
};
|
|
12
|
+
class FakeBrowserObserver {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.observationType = 'test';
|
|
15
|
+
this._hitCount = 0;
|
|
16
|
+
this._sendObservationMessageHitCount = 0;
|
|
17
|
+
}
|
|
18
|
+
get sendObservationMessageHitCount() {
|
|
19
|
+
return this._sendObservationMessageHitCount;
|
|
20
|
+
}
|
|
21
|
+
get hitCount() {
|
|
22
|
+
return this._hitCount;
|
|
23
|
+
}
|
|
24
|
+
observeDeferred() {
|
|
25
|
+
this._hitCount += 1;
|
|
26
|
+
return Promise.resolve();
|
|
27
|
+
}
|
|
28
|
+
observeAfter() {
|
|
29
|
+
return Promise.resolve();
|
|
30
|
+
}
|
|
31
|
+
observeFlow() {
|
|
32
|
+
return Promise.resolve();
|
|
33
|
+
}
|
|
34
|
+
observeTest() {
|
|
35
|
+
return Promise.resolve();
|
|
36
|
+
}
|
|
37
|
+
onPageCreated(_page, _pageId) {
|
|
38
|
+
return Promise.resolve();
|
|
39
|
+
}
|
|
40
|
+
onPageDestroyed(_page, _pageId) {
|
|
41
|
+
return Promise.resolve();
|
|
42
|
+
}
|
|
43
|
+
sendObservationMessage() {
|
|
44
|
+
this._sendObservationMessageHitCount += 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.FakeBrowserObserver = FakeBrowserObserver;
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mablhq/playwright-tools",
|
|
3
|
+
"version": "2.49.1",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
+
"description": "The official mabl command line interface tool",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"bin": {},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"mabl",
|
|
11
|
+
"cli"
|
|
12
|
+
],
|
|
13
|
+
"author": "mabl",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"email": "support@mabl.com"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18.0.0"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@aws-crypto/crc32c": "5.1.0",
|
|
22
|
+
"@google-cloud/storage": "7.9.0",
|
|
23
|
+
"@mablhq/newman-reporter-mabl-console": "0.1.0",
|
|
24
|
+
"@plist/common": "1.1.0",
|
|
25
|
+
"@plist/parse": "1.1.0",
|
|
26
|
+
"@types/adm-zip": "0.5.5",
|
|
27
|
+
"@types/estree": "1.0.5",
|
|
28
|
+
"@types/lodash": "4.14.202",
|
|
29
|
+
"@xmldom/xmldom": "0.8.10",
|
|
30
|
+
"adm-zip": "0.5.10",
|
|
31
|
+
"agent-base": "6.0.2",
|
|
32
|
+
"analytics-node": "6.2.0",
|
|
33
|
+
"appium": "2.11.3",
|
|
34
|
+
"async-mutex": "0.3.1",
|
|
35
|
+
"async-retry": "1.3.3",
|
|
36
|
+
"axe-core": "4.8.3",
|
|
37
|
+
"axios": "0.27.2",
|
|
38
|
+
"axios-cookiejar-support": "1.0.1",
|
|
39
|
+
"cachedir": "2.4.0",
|
|
40
|
+
"cd": "0.3.3",
|
|
41
|
+
"chalk": "2.4.2",
|
|
42
|
+
"change-case": "4.1.1",
|
|
43
|
+
"chrome-launcher": "0.14.2",
|
|
44
|
+
"cli-table3": "0.6.1",
|
|
45
|
+
"conf": "10.2.0",
|
|
46
|
+
"csv-parser": "3.0.0",
|
|
47
|
+
"csv-stringify": "6.2.3",
|
|
48
|
+
"encodeurl": "1.0.2",
|
|
49
|
+
"env-paths": "2.2.0",
|
|
50
|
+
"escodegen": "2.0.0",
|
|
51
|
+
"esprima": "4.0.1",
|
|
52
|
+
"estraverse": "4.3.0",
|
|
53
|
+
"fast-json-stable-stringify": "2.1.0",
|
|
54
|
+
"fastest-levenshtein": "1.0.12",
|
|
55
|
+
"fs-extra": "8.1.0",
|
|
56
|
+
"git-repo-info": "2.1.1",
|
|
57
|
+
"glob": "7.1.6",
|
|
58
|
+
"hpagent": "1.2.0",
|
|
59
|
+
"http-mitm-proxy": "1.1.0",
|
|
60
|
+
"humanize-duration": "3.23.0",
|
|
61
|
+
"inquirer": "8.2.5",
|
|
62
|
+
"js-yaml": "4.1.0",
|
|
63
|
+
"jsesc": "3.0.2",
|
|
64
|
+
"jwt-decode": "2.2.0",
|
|
65
|
+
"lodash.get": "4.4.2",
|
|
66
|
+
"lodash.groupby": "4.6.0",
|
|
67
|
+
"markdown-table": "2.0.0",
|
|
68
|
+
"mime-types": "2.1.27",
|
|
69
|
+
"minimist": "1.2.8",
|
|
70
|
+
"mjpeg-consumer": "2.0.0",
|
|
71
|
+
"mochawesome-report-generator": "6.2.0",
|
|
72
|
+
"moment": "2.30.1",
|
|
73
|
+
"murmurhash": "1.0.0",
|
|
74
|
+
"newman": "6.0.0",
|
|
75
|
+
"open": "6.4.0",
|
|
76
|
+
"ora": "4.0.4",
|
|
77
|
+
"pixelmatch": "5.3.0",
|
|
78
|
+
"playwright": "^1.43.1",
|
|
79
|
+
"playwright-core": "^1.43.1",
|
|
80
|
+
"pluralize": "8.0.0",
|
|
81
|
+
"pngjs": "6.0.0",
|
|
82
|
+
"portfinder": "1.0.28",
|
|
83
|
+
"postman-collection": "4.1.4",
|
|
84
|
+
"query-string": "6.14.1",
|
|
85
|
+
"range_check": "2.0.4",
|
|
86
|
+
"retry": "0.13.1",
|
|
87
|
+
"sanitize-html": "2.3.3",
|
|
88
|
+
"serve-handler": "6.1.5",
|
|
89
|
+
"set-cookie-parser": "2.5.1",
|
|
90
|
+
"simple-update-notifier": "1.1.0",
|
|
91
|
+
"socks-proxy-agent": "6.1.1",
|
|
92
|
+
"stoppable": "1.1.0",
|
|
93
|
+
"strip-ansi": "6.0.0",
|
|
94
|
+
"tldts": "6.0.12",
|
|
95
|
+
"tmp-promise": "3.0.2",
|
|
96
|
+
"tough-cookie": "4.0.0",
|
|
97
|
+
"triple-beam": "1.3.0",
|
|
98
|
+
"uuid": "9.0.0",
|
|
99
|
+
"webdriverio": "8.39.1",
|
|
100
|
+
"winston": "3.13.0",
|
|
101
|
+
"winston-transport": "4.7.0",
|
|
102
|
+
"xpath": "0.0.32",
|
|
103
|
+
"y18n": "4.0.1",
|
|
104
|
+
"yargonaut": "1.1.4",
|
|
105
|
+
"yargs": "14.2.3"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.elementsInFrontCount = exports.detectAndDismissPopupCandidates = exports.getAllElementsAbove = exports.getOverlappingElements = exports.fireRightClickEvent = exports.fireClickEvent = exports.fireDoubleClickEvent = exports.elementsByHigherZIndex = void 0;
|
|
4
|
+
const DISMISSAL_WAIT_TIME_MS = 750;
|
|
5
|
+
const ZINDEX_AUTO = 'auto';
|
|
6
|
+
const MINIMUM_POPUP_DISPLAY_COVERAGE_PX = 0.95;
|
|
7
|
+
const CLOSE_VALUES = [
|
|
8
|
+
'close',
|
|
9
|
+
'dismiss',
|
|
10
|
+
'exit',
|
|
11
|
+
'not at this time',
|
|
12
|
+
'no thanks',
|
|
13
|
+
'no, thanks',
|
|
14
|
+
'i, agree',
|
|
15
|
+
'i agree',
|
|
16
|
+
];
|
|
17
|
+
const ATTRIBUTES_TO_CHECK = [
|
|
18
|
+
{ attributeName: 'className', matchFunction: matchOnAnyAppearance },
|
|
19
|
+
{ attributeName: 'name', matchFunction: matchOnAnyAppearance },
|
|
20
|
+
{ attributeName: 'id', matchFunction: matchOnAnyAppearance },
|
|
21
|
+
{ attributeName: 'href', matchFunction: matchOnAnyAppearance },
|
|
22
|
+
{ attributeName: 'innerText', matchFunction: matchWithWordBoundary },
|
|
23
|
+
];
|
|
24
|
+
function elementsByHigherZIndex(aboveIndex) {
|
|
25
|
+
return Array.from(document.querySelectorAll('body *')).reduce((obj, element) => {
|
|
26
|
+
const zIndex = parseFloat(globalThis.getComputedStyle(element).zIndex);
|
|
27
|
+
const aboveIndexNumber = typeof aboveIndex === 'number' ? aboveIndex : parseFloat(aboveIndex);
|
|
28
|
+
if (!Number.isNaN(zIndex) && zIndex >= aboveIndexNumber) {
|
|
29
|
+
if (obj.has(zIndex)) {
|
|
30
|
+
obj.get(zIndex).push(element);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
obj.set(zIndex, [element]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return obj;
|
|
37
|
+
}, new Map());
|
|
38
|
+
}
|
|
39
|
+
exports.elementsByHigherZIndex = elementsByHigherZIndex;
|
|
40
|
+
function getEffectiveZIndex(element) {
|
|
41
|
+
const isRootElement = (element) => element === undefined || element.tagName.toLowerCase() === 'html';
|
|
42
|
+
let current = element;
|
|
43
|
+
while (!isRootElement(current)) {
|
|
44
|
+
const zIndex = globalThis.getComputedStyle(current).zIndex;
|
|
45
|
+
if (zIndex && zIndex !== ZINDEX_AUTO) {
|
|
46
|
+
return parseInt(zIndex, 10);
|
|
47
|
+
}
|
|
48
|
+
current = (current === null || current === void 0 ? void 0 : current.parentElement) ? current.parentElement : undefined;
|
|
49
|
+
}
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
function getDescendantElements(childElement) {
|
|
53
|
+
let children = [childElement];
|
|
54
|
+
const childNodes = Array.from(childElement.children);
|
|
55
|
+
childNodes.forEach((el) => {
|
|
56
|
+
children = children.concat(getDescendantElements(el));
|
|
57
|
+
});
|
|
58
|
+
return children;
|
|
59
|
+
}
|
|
60
|
+
function matchOnAnyAppearance(attribute, matchVal) {
|
|
61
|
+
return attribute.toLowerCase().includes(matchVal);
|
|
62
|
+
}
|
|
63
|
+
function matchWithWordBoundary(attribute, matchVal) {
|
|
64
|
+
const regExp = new RegExp(`\\b${matchVal}\\b`);
|
|
65
|
+
return !!attribute.toLowerCase().match(regExp);
|
|
66
|
+
}
|
|
67
|
+
function checkElementAttributes(element) {
|
|
68
|
+
let matches = 0;
|
|
69
|
+
ATTRIBUTES_TO_CHECK.forEach((attr) => {
|
|
70
|
+
CLOSE_VALUES.forEach((closeVal) => {
|
|
71
|
+
if (element.getAttribute(attr.attributeName) &&
|
|
72
|
+
attr.matchFunction(element.getAttribute(attr.attributeName), closeVal)) {
|
|
73
|
+
matches += 1;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
return matches;
|
|
78
|
+
}
|
|
79
|
+
function checkElementDomCoverage(element) {
|
|
80
|
+
if (element.getBoundingClientRect) {
|
|
81
|
+
const bBox = element.getBoundingClientRect();
|
|
82
|
+
const yCoverage = bBox.width / globalThis.innerWidth;
|
|
83
|
+
const xCoverage = bBox.height / globalThis.innerHeight;
|
|
84
|
+
return (yCoverage > MINIMUM_POPUP_DISPLAY_COVERAGE_PX &&
|
|
85
|
+
xCoverage > MINIMUM_POPUP_DISPLAY_COVERAGE_PX);
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
function developCloseCandidates(candidates) {
|
|
90
|
+
const candidatesByZIndex = [];
|
|
91
|
+
candidates.forEach((candidate) => {
|
|
92
|
+
const domCovering = [];
|
|
93
|
+
const actionableElements = [];
|
|
94
|
+
candidate.elements.forEach((element) => {
|
|
95
|
+
var _a;
|
|
96
|
+
if (element === null || element === void 0 ? void 0 : element.offsetParent) {
|
|
97
|
+
if (['BUTTON', 'A', 'DIV'].includes((_a = element.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) &&
|
|
98
|
+
checkElementAttributes(element) &&
|
|
99
|
+
!actionableElements.includes(element)) {
|
|
100
|
+
actionableElements.push(element);
|
|
101
|
+
}
|
|
102
|
+
else if (checkElementDomCoverage(element)) {
|
|
103
|
+
domCovering.push(element);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
candidatesByZIndex.push({
|
|
108
|
+
zIndex: candidate.zIndex,
|
|
109
|
+
actionableElements,
|
|
110
|
+
domCovering,
|
|
111
|
+
dismissedStatus: false,
|
|
112
|
+
elementsInFront: 0,
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
return candidatesByZIndex;
|
|
116
|
+
}
|
|
117
|
+
function dispatchMouseEvent(targetElement, eventType, leftEdgeClick = false) {
|
|
118
|
+
const boundingBox = targetElement.getBoundingClientRect();
|
|
119
|
+
const halfHeight = boundingBox.height / 2;
|
|
120
|
+
const xDistance = leftEdgeClick ? 1 : boundingBox.width / 2;
|
|
121
|
+
const button = eventType === 'contextmenu' ? 2 : 0;
|
|
122
|
+
const mouseEvent = new MouseEvent(eventType, {
|
|
123
|
+
bubbles: true,
|
|
124
|
+
cancelable: true,
|
|
125
|
+
view: window,
|
|
126
|
+
detail: 0,
|
|
127
|
+
screenX: boundingBox.left + xDistance,
|
|
128
|
+
screenY: boundingBox.top + halfHeight,
|
|
129
|
+
clientX: targetElement.clientLeft + xDistance,
|
|
130
|
+
clientY: targetElement.clientTop + halfHeight,
|
|
131
|
+
ctrlKey: false,
|
|
132
|
+
altKey: false,
|
|
133
|
+
shiftKey: false,
|
|
134
|
+
metaKey: false,
|
|
135
|
+
button,
|
|
136
|
+
relatedTarget: undefined,
|
|
137
|
+
});
|
|
138
|
+
targetElement.dispatchEvent(mouseEvent);
|
|
139
|
+
}
|
|
140
|
+
function fireDoubleClickEvent(targetElement) {
|
|
141
|
+
fireClickEvent(targetElement, false);
|
|
142
|
+
fireClickEvent(targetElement, false);
|
|
143
|
+
dispatchMouseEvent(targetElement, 'dblclick');
|
|
144
|
+
}
|
|
145
|
+
exports.fireDoubleClickEvent = fireDoubleClickEvent;
|
|
146
|
+
function fireClickEvent(targetElement, leftEdgeClick = false) {
|
|
147
|
+
dispatchMouseEvent(targetElement, 'click', leftEdgeClick);
|
|
148
|
+
}
|
|
149
|
+
exports.fireClickEvent = fireClickEvent;
|
|
150
|
+
function fireRightClickEvent(targetElement, leftEdgeClick = false) {
|
|
151
|
+
dispatchMouseEvent(targetElement, 'contextmenu', leftEdgeClick);
|
|
152
|
+
}
|
|
153
|
+
exports.fireRightClickEvent = fireRightClickEvent;
|
|
154
|
+
function getCenterCoordinates(rect) {
|
|
155
|
+
return {
|
|
156
|
+
x: rect.left + rect.width / 2,
|
|
157
|
+
y: rect.top + rect.height / 2,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function getOverlappingElements(element) {
|
|
161
|
+
const { x, y } = getCenterCoordinates(element.getBoundingClientRect());
|
|
162
|
+
const elementsAtPoint = document.elementsFromPoint(x, y);
|
|
163
|
+
const targetIndex = elementsAtPoint.findIndex((iterElement) => iterElement === element);
|
|
164
|
+
return targetIndex ? elementsAtPoint.slice(0, targetIndex) : [];
|
|
165
|
+
}
|
|
166
|
+
exports.getOverlappingElements = getOverlappingElements;
|
|
167
|
+
function sleep(time) {
|
|
168
|
+
return new Promise((resolve) => setTimeout(resolve, time));
|
|
169
|
+
}
|
|
170
|
+
function getAllElementsAbove(targetElement, elements) {
|
|
171
|
+
if (elements.length === 0) {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
const targetZindex = getEffectiveZIndex(targetElement);
|
|
175
|
+
const zIndexAboveTarget = Math.min(...elements === null || elements === void 0 ? void 0 : elements.map((el) => getEffectiveZIndex(el)));
|
|
176
|
+
if (zIndexAboveTarget <= targetZindex) {
|
|
177
|
+
return [];
|
|
178
|
+
}
|
|
179
|
+
const higherElementsByZIndex = elementsByHigherZIndex(zIndexAboveTarget);
|
|
180
|
+
const allElementsByZIndex = Array.from(higherElementsByZIndex).map(([item, higherElements]) => {
|
|
181
|
+
const allElements = higherElements
|
|
182
|
+
.flatMap(getDescendantElements)
|
|
183
|
+
.reverse();
|
|
184
|
+
return { zIndex: item, elements: allElements };
|
|
185
|
+
});
|
|
186
|
+
allElementsByZIndex.sort((a, b) => b.zIndex - a.zIndex);
|
|
187
|
+
return allElementsByZIndex;
|
|
188
|
+
}
|
|
189
|
+
exports.getAllElementsAbove = getAllElementsAbove;
|
|
190
|
+
async function detectAndDismissPopupCandidates(element) {
|
|
191
|
+
try {
|
|
192
|
+
let higherElements = getOverlappingElements(element);
|
|
193
|
+
const elementsInFrontCount = higherElements.length;
|
|
194
|
+
if (elementsInFrontCount === 0) {
|
|
195
|
+
return {
|
|
196
|
+
elementsInFront: 0,
|
|
197
|
+
dismissedStatus: false,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const clickCandidates = async function (candidates, leftEdgeClick) {
|
|
201
|
+
for (const candidate of candidates) {
|
|
202
|
+
fireClickEvent(candidate, leftEdgeClick);
|
|
203
|
+
await sleep(DISMISSAL_WAIT_TIME_MS);
|
|
204
|
+
if (getOverlappingElements(element).length < elementsInFrontCount) {
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return false;
|
|
209
|
+
};
|
|
210
|
+
let allElements = getAllElementsAbove(element, higherElements);
|
|
211
|
+
const candidatesByZIndex = developCloseCandidates(allElements);
|
|
212
|
+
for (const candidate of candidatesByZIndex) {
|
|
213
|
+
let matched = await clickCandidates(candidate.domCovering, true);
|
|
214
|
+
if (!matched) {
|
|
215
|
+
matched = await clickCandidates(candidate.actionableElements, false);
|
|
216
|
+
}
|
|
217
|
+
if (matched) {
|
|
218
|
+
return {
|
|
219
|
+
dismissedStatus: true,
|
|
220
|
+
elementsInFront: 0,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
higherElements = getOverlappingElements(element);
|
|
225
|
+
allElements = getAllElementsAbove(element, higherElements);
|
|
226
|
+
const candidates = developCloseCandidates(allElements);
|
|
227
|
+
const result = candidates.length
|
|
228
|
+
? candidates[0]
|
|
229
|
+
: {
|
|
230
|
+
zIndex: 0,
|
|
231
|
+
elementsInFront: 0,
|
|
232
|
+
dismissedStatus: false,
|
|
233
|
+
domCovering: [],
|
|
234
|
+
actionableElements: [],
|
|
235
|
+
};
|
|
236
|
+
result.elementsInFront = higherElements.length;
|
|
237
|
+
result.dismissedStatus = false;
|
|
238
|
+
return {
|
|
239
|
+
dismissedStatus: result.dismissedStatus,
|
|
240
|
+
elementsInFront: result.elementsInFront,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
return {
|
|
245
|
+
elementsInFront: 0,
|
|
246
|
+
dismissedStatus: false,
|
|
247
|
+
error: error.toString(),
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
exports.detectAndDismissPopupCandidates = detectAndDismissPopupCandidates;
|
|
252
|
+
function elementsInFrontCount(element) {
|
|
253
|
+
return getOverlappingElements(element).length;
|
|
254
|
+
}
|
|
255
|
+
exports.elementsInFrontCount = elementsInFrontCount;
|