@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
package/Globals.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Globals = void 0;
|
|
27
|
+
const os = __importStar(require("os"));
|
|
28
|
+
class Globals {
|
|
29
|
+
static getFindOverallTimeoutMs() {
|
|
30
|
+
return Globals.findOverallTimeoutMs;
|
|
31
|
+
}
|
|
32
|
+
static setFindOverallTimeoutMs(timeout) {
|
|
33
|
+
Globals.findOverallTimeoutMs = timeout;
|
|
34
|
+
}
|
|
35
|
+
static getPlaywrightInteractionWarningMs() {
|
|
36
|
+
return Globals.playwrightInteractionWarningMs;
|
|
37
|
+
}
|
|
38
|
+
static setPlaywrightInteractionWarningMs(timeout) {
|
|
39
|
+
Globals.playwrightInteractionWarningMs = timeout;
|
|
40
|
+
}
|
|
41
|
+
static getSslCaDir() {
|
|
42
|
+
return Globals.sslCaDir;
|
|
43
|
+
}
|
|
44
|
+
static getTestMaxAgeMs() {
|
|
45
|
+
return Globals.testMaxAgeMs;
|
|
46
|
+
}
|
|
47
|
+
static setTestMaxAgeMs(age) {
|
|
48
|
+
Globals.testMaxAgeMs = age;
|
|
49
|
+
}
|
|
50
|
+
static getUploadDirectory() {
|
|
51
|
+
return Globals.uploadDirectory;
|
|
52
|
+
}
|
|
53
|
+
static setUploadDirectory(dir) {
|
|
54
|
+
Globals.uploadDirectory = dir;
|
|
55
|
+
}
|
|
56
|
+
static getUploadDirectoryPrefix() {
|
|
57
|
+
return Globals.uploadDirectoryPrefix;
|
|
58
|
+
}
|
|
59
|
+
static setUploadDirectoryPrefix(prefix) {
|
|
60
|
+
Globals.uploadDirectoryPrefix = prefix;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.Globals = Globals;
|
|
64
|
+
Globals.findOverallTimeoutMs = 18.5 * 60 * 1000;
|
|
65
|
+
Globals.playwrightInteractionWarningMs = 30 * 1000;
|
|
66
|
+
Globals.sslCaDir = '/usr/local/share/http-proxy-certs';
|
|
67
|
+
Globals.testMaxAgeMs = 1000 * 60 * 60 * 24;
|
|
68
|
+
Globals.uploadDirectory = os.tmpdir();
|
|
69
|
+
Globals.uploadDirectoryPrefix = `mablTestRunUploads-`;
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
LICENSE AGREEMENT
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
PLEASE READ THE TERMS OF THIS LICENSE AGREEMENT (“AGREEMENT”) CAREFULLY AS BY INSTALLING, ACCESSING AND/OR USING THE TOOL (AS DEFINED BELOW), YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT YOU, OR THE COMPANY YOU REPRESENT, (“YOU” OR “LICENSEE”) ARE ENTERING INTO A LEGAL AGREEMENT WITH mabl Inc. (“mabl”), AND UNDERSTAND AND AGREE TO COMPLY WITH, AND BE LEGALLY BOUND BY, THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU ARE ENTERING INTO THIS AGREEMENT ON BEHALF OF AN ENTITY, YOU REPRESENT AND WARRANT THAT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THAT ENTITY TO THIS AGREEMENT. TO THE EXTENT PERMITTED UNDER APPLICABLE LAW, YOU HEREBY WAIVE ANY FORMALITIES UNDER ANY APPLICABLE LAW OR REGULATION IN ANY JURISDICTION REQUIRING AN EXCHANGE OF ORIGINAL (NON-ELECTRONIC) SIGNATURES FOR THE EXECUTION OF A VALID AND ENFORCEABLE CONTRACT.
|
|
5
|
+
BACKGROUND
|
|
6
|
+
mabl has developed a software tool, and mabl wishes to license the tool in object code form (the “Tool”) to Licensee, and Licensee wishes to license the Tool from mabl to develop an interface for its products to mabl’s products. mabl is willing to license the Tool to Licensee subject to the terms and conditions of this Agreement.
|
|
7
|
+
|
|
8
|
+
For the purposes of this Agreement, the term “Tool” shall include all (i) new versions, updates, revisions, enhancements, and other derivative works of the Tool; and (ii) all related documentation including user guides and technical manuals (“Documentation”), made available or delivered by mabl to Licensee, if any.
|
|
9
|
+
Therefore, the parties agree as follows:
|
|
10
|
+
1. No Fee.
|
|
11
|
+
There is no fee to Licensee for the license granted under this Agreement.
|
|
12
|
+
2. Ownership, Grant of License.
|
|
13
|
+
(a) Ownership. mabl is and shall remain the exclusive owner or licensee of the Tool and all copies thereof, and of all patent, copyright, trademark, trade secret, and other intellectual property rights therein. Licensee shall not acquire any rights to the Tool other than those specified in this Agreement
|
|
14
|
+
(b) Grant of License. Subject to the terms of this Agreement, mabl hereby grants to Licensee a non-exclusive, non-transferable, revocable, and royalty-free, license (without the right to sublicense) to use the Tool only for the limited purpose of developing an interface for Licensee’s products to interoperate with mabl’s products.
|
|
15
|
+
(c) Reservation of Rights, Use Restrictions. Other than the rights explicitly granted in this Agreement, Licensee shall have no other rights, express or implied, in the Tool. Without limiting the foregoing, Licensee shall not (i) modify, adapt or create derivative works of the Tool, (ii) distribute, sell, transfer, rent, lease, or loan the Tool to any third party, (iii) reverse engineer, decompile, or disassemble the Tool or otherwise take any action to reduce the Tool’s code to human-perceivable form or determine the Tool’s source code, (iv) copy or allow copies of the Tool to be made, (v) remove, alter or obscure any proprietary notice or identification, including copyright, trademark, patent or other notices, contained in or displayed on or via the Tool, and (vi) use the Tool to violate any applicable laws, rules or regulations.
|
|
16
|
+
(d) Copying. Notwithstanding any terms to the contrary in this Agreement, Licensee may make one (1) copy of the Tool for backup or archival purposes.
|
|
17
|
+
(e) Nondisclosure. Licensee shall not disclose, publish, or disseminate to any third party any non-public information or trade secrets regarding, or related to, the Tool or mabl disclosed by mabl to Licensee under this Agreement (collectively, “Confidential Information”). Licensee will take all necessary precautions to prevent any unauthorized use, disclosure, publication, or dissemination of Confidential information. Licensee shall use Confidential Information only for the purpose for which it was disclosed and shall not otherwise use or exploit the Confidential Information and/or Tool for its own benefit or the benefit of another without the prior written consent of mabl. Licensee shall allow access to the Confidential Information only to those employees and representatives who have the need to access it for the limited purpose set forth herein, and shall take appropriate action by written agreement with its employees and representatives to satisfy its obligations hereunder.
|
|
18
|
+
|
|
19
|
+
(f) Equitable Relief. Licensee acknowledges that a violation of this Section 2 would cause irreparable harm to mabl. Accordingly, Licensee agrees that mabl shall, without limiting its other rights or remedies, have the right to seek and obtain immediate injunctive relief to enforce Licensee’s obligations under this Agreement without posting bond or offering proof of damages.
|
|
20
|
+
3. Disclaimer of Warranty. THE TOOL IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND. mabl HEREBY DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, WITH REGARD TO THE TOOL, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, TITLE OR FITNESS FOR A PARTICULAR PURPOSE. LICENSEE SHALL BEAR ALL RISKS IN UTILIZING THE TOOL AS PROVIDED HEREUNDER.
|
|
21
|
+
4. Limitation of Liability. IN NO EVENT SHALL mabl HAVE ANY OBLIGATION OR LIABILITY TO LICENSEE OR ANY THIRD PARTY FOR DAMAGES, LOSSES, COSTS OR EXPENSES OF ANY TYPE OR NATURE, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING OUT OF OR RELATING TO THIS AGREEMENT OR THE TOOL, OR IN CONNECTION WITH USE OF THE TOOL. WITHOUT LIMITING THE FOREGOING, IN NO EVENT SHALL MABL BE LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, DIRECT OR CONSEQUENTIAL DAMAGES, INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF DATA OR INABILITY TO USE THE TOOL, EVEN IF MABL WAS AWARE OF OR WAS NOTIFIED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
22
|
+
5. Maintenance. mabl shall have no obligation to maintain or support the Tool.
|
|
23
|
+
6. Term and Termination.
|
|
24
|
+
(a) Term. The initial term of this Agreement shall be for a period of one (1) year from the date entered into by Licensee’s installation, access or use of the Tool, subject to earlier termination as provided for in this Section. Thereafter, this Agreement shall automatically renew for successive one (1) year renewal terms unless earlier terminated by a party.
|
|
25
|
+
(b) Termination. mabl may immediately terminate this Agreement and the license to the Tool at any time for any or no reason, and without notice. Licensee may terminate this Agreement at any time by removing the Tool from their system and destroying all copies of the Tool and Documentation. Licensee’s unauthorized copying of the Tool or Documentation or disclosure of Confidential Information, or failure to otherwise comply with this Agreement will result in automatic immediate termination of this Agreement and the license to the Tool, and will make available to mabl legal remedies.
|
|
26
|
+
(c) Effect of Termination. Following termination of this Agreement for any reason, the license granted hereunder will immediately terminate, and Licensee will(i) promptly cease use of the Tool and/or Documentation, and (ii) remove the Tool from all hard drives, networks and other storage media and destroy all copies of the Tool, Documentation and/or Confidential Information in Licensee’s possession or under Licensee’s control.
|
|
27
|
+
(d) Survival. The terms of Sections 2(a), 2(c), 2(e), 2(f), and 3-7 shall survive any termination of this Agreement.
|
|
28
|
+
7. General.
|
|
29
|
+
This Agreement constitutes the entire agreement between the parties and supersedes all prior statements and undertakings with respect to the subject matter. All modifications to this Agreement shall be in writing and signed by an authorized representative of each party. The headings in this Agreement are for convenience only and shall not be used in the interpreting this Agreement. Any failure by either party to enforce strict performance by the other of any provision herein shall not constitute a waiver of the right to subsequently enforce such provision or any other provision of this Agreement. Licensee may not assign its rights or delegate its obligations hereunder, either in whole or in part, whether by operation of law or otherwise, without the prior written consent of mabl. The rights and liabilities of the parties under this Agreement will bind and inure to the benefit of the parties' respective successors and permitted assigns. This Agreement shall be governed by and construed in accordance with the laws of the Commonwealth of Massachusetts, excluding its conflict of law principles.
|
package/README.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# mabl Playwright Tools
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
Leverage the power of the mabl cloud from within their own Playwright tests. By using mabl playwright tools, developers can easily introduce advanced test functionality such as email, database, generative AI testing, and more.
|
|
6
|
+
|
|
7
|
+
### Email testing
|
|
8
|
+
|
|
9
|
+
Mabl playwright tools gives developers the ability to create and use temporary emails as well as long-lived emails for use within their Playwright tests. With these abilities, developers are able to create full end-to-end functional tests that validate sign-up and login functionality without the overhead of managing their own email servers and accounts.
|
|
10
|
+
|
|
11
|
+
### Generative AI testing
|
|
12
|
+
|
|
13
|
+
With the generative AI testing functionality of mabl playwright tools, developers can easily leverage the power of AI to do more complex validations of their test environments without complex test code. Using the tools, developers can implement complex assertions in their tests that validate images, analyze text (translations, tone, sorting, etc), validate chatbot interactions, and a whole lot more.
|
|
14
|
+
|
|
15
|
+
### Multi-factor authentication and credentials testing
|
|
16
|
+
|
|
17
|
+
Mabl playwright tools allows developers to create functional end-to-end tests that rely on securely stored and managed passwords in the mabl cloud. With these tools, developers have a central place to manage credentials securely outside their codebase and leverage more sophisticated login flows that require generating two-factor authentication codes to complete a login. This functionality also works alongside the email testing tools for cases where login flows require opening emails to extract MFA codes or follow login links.
|
|
18
|
+
|
|
19
|
+
### Database testing
|
|
20
|
+
|
|
21
|
+
Mabl’s database connectivity tool gives developers secure access to test databases connected to the mabl cloud, allowing them to manage test environment DB state as well as validate it all without having to install database drivers and manage test environment networking. Developers can write setup and teardown code from within their Playwright tests that ensure the database state is correct for executing tests. They can also assert during their tests that the correct state has been updated as expected, offering more depth to the validations their Playwright tests are capable of.
|
|
22
|
+
|
|
23
|
+
### PDF Testing
|
|
24
|
+
|
|
25
|
+
Mabl playwright tools allows developers to load PDF documents downloaded during test execution into a Playwright tab as testable HTML. This allows for Playwright tests to not only validate the PDF downloaded but also validate the contents of the document are what is expected.
|
|
26
|
+
|
|
27
|
+
## Quickstart
|
|
28
|
+
|
|
29
|
+
### Before you begin
|
|
30
|
+
|
|
31
|
+
- Sign up or log in to your mabl workspace
|
|
32
|
+
- Create an API key to use in your test suite
|
|
33
|
+
- Navigate to Settings > APIs and click “Create API key”
|
|
34
|
+
- Select “Command Line Interface” as the key option, give it a name, and click “Save”
|
|
35
|
+
|
|
36
|
+
### Prerequisites
|
|
37
|
+
|
|
38
|
+
To leverage mabl playwright tools, you will need a developer environment with:
|
|
39
|
+
- NodeJS >= 18.0.0
|
|
40
|
+
- Playwright test suite
|
|
41
|
+
|
|
42
|
+
### Installing mabl playwright tools
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
npm install @mablhq/playwright-tools
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Using the mabl tools
|
|
49
|
+
|
|
50
|
+
You can set up mabl playwright tools inside your Playwright Test Fixtures for use across the entire test suite by importing and calling the `createMablFixtures` function inside the Playwright `extend` function.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import {test as base} from '@playwright/test';
|
|
54
|
+
|
|
55
|
+
// Import the initialization function for mabl playwright tools
|
|
56
|
+
import {createMablFixtures, MablFixtures} from '@mablhq/playwright-tools';
|
|
57
|
+
|
|
58
|
+
// For TypeScript you can include the MablFixtures typing when extending
|
|
59
|
+
export const test = base.extend<MablFixtures>({
|
|
60
|
+
|
|
61
|
+
// existing fixture configuration can remain in place
|
|
62
|
+
|
|
63
|
+
// this function will generate all the mabl Fixtures and configure them to use the supplied API key
|
|
64
|
+
...createMablFixtures({
|
|
65
|
+
apiKey: process.env.MABL_PLAYWRIGHT_TESTS_KEY,
|
|
66
|
+
test: base,
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export {expect} from '@playwright/test';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
With the fixtures configured, you will now have access to the mabl object inside your test cases, which allows you to access any of the mabl tools.
|
|
74
|
+
|
|
75
|
+
## Examples
|
|
76
|
+
|
|
77
|
+
### Email testing
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import {SandboxPage} from '../utils/SandboxPage';
|
|
81
|
+
import {expect, test} from '../utils/fixtures';
|
|
82
|
+
|
|
83
|
+
test('Validate emails can be received using mabl sandbox app', async ({
|
|
84
|
+
page,
|
|
85
|
+
mabl,
|
|
86
|
+
}) => {
|
|
87
|
+
await page.goto('https://sandbox.mabl.com');
|
|
88
|
+
const sandbox = new SandboxPage(page);
|
|
89
|
+
sandbox.maybeWaitForReady();
|
|
90
|
+
const mailboxPage = await sandbox.goToMailboxPage();
|
|
91
|
+
// Create a temporary mailbox for the test case using the mabl tools
|
|
92
|
+
const emailAddress = await mabl.createMailBoxAddress();
|
|
93
|
+
const subject = 'Test email';
|
|
94
|
+
const body = 'This is a test email';
|
|
95
|
+
// This uses the email as a destination address inside the test case
|
|
96
|
+
await mailboxPage.fillOutAndSendEmail(emailAddress, subject, body);
|
|
97
|
+
|
|
98
|
+
// Leverage the mabl Tooset to wait for an email to appear in the temporary mailbox generated earlier in the test.
|
|
99
|
+
const mablEmail = await mabl.waitForEmail(emailAddress, page, {subject});
|
|
100
|
+
// Open the email in the supplied Playwright Page
|
|
101
|
+
await mablEmail.open();
|
|
102
|
+
|
|
103
|
+
// The mabl tools returns a MablMailboxEmail object that allows for easy access to all the received email attributes for faster validation
|
|
104
|
+
expect(await mablEmail.getToAddress()).toBe(emailAddress);
|
|
105
|
+
expect(await mablEmail.getSubject()).toBe(subject);
|
|
106
|
+
expect(await mablEmail.getBodyText()).toBe(body);
|
|
107
|
+
expect(await mablEmail.getFromAddress()).toBe('test_mailer@m.mablmail.com');
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Generative AI testing
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import {expect, test} from '../utils/fixtures';
|
|
115
|
+
|
|
116
|
+
test('Evaluate a GenAI assertion to validate the state of a page', async ({
|
|
117
|
+
page,
|
|
118
|
+
mabl,
|
|
119
|
+
}) => {
|
|
120
|
+
await page.goto('https://www.mabl.com');
|
|
121
|
+
// Create a prompt to supply to the Gen AI tool
|
|
122
|
+
const prompt =
|
|
123
|
+
'Please validate that the web page you are looking at is a marketing page for a company named mabl which does automated UI testing. Also validate that there are no broken images on the page';
|
|
124
|
+
|
|
125
|
+
// Supply the Playwright Page to the evaluate function so mabl can extract a screenshot and other information to use with the prompt
|
|
126
|
+
const result = await mabl.evaluateGenAiAssertion(page, prompt);
|
|
127
|
+
|
|
128
|
+
// The result returned includes both a success (true/false) attribute as well as an explanation for the evaluation
|
|
129
|
+
console.log(`GEN AI EXPLANATION: [${result.explanation}]`);
|
|
130
|
+
expect(result.success).toBe(true);
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Database testing
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import {expect, test} from '../utils/fixtures';
|
|
138
|
+
|
|
139
|
+
// Database connection ID from your mabl workspace
|
|
140
|
+
const MABL_DATABASE_CONNECTION = 'grm9yi7lFN36WMjCQ4K2jg-dc';
|
|
141
|
+
|
|
142
|
+
test('Evaluate a mabl database query', async ({page, mabl}) => {
|
|
143
|
+
const dbQuery = 'SELECT * from pets LIMIT 15';
|
|
144
|
+
const result = await mabl.executeQuery(MABL_DATABASE_CONNECTION, dbQuery, []);
|
|
145
|
+
expect(result.metadata?.status).toBe('success');
|
|
146
|
+
expect(result.columns?.length).toEqual(5);
|
|
147
|
+
expect(result.rows?.length).toEqual(15);
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### PDF testing
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
test('Validate PDFs downloaded from the app', async ({
|
|
155
|
+
browser,
|
|
156
|
+
page,
|
|
157
|
+
mabl,
|
|
158
|
+
}) => {
|
|
159
|
+
await page.goto('https://sandbox.mabl.com');
|
|
160
|
+
await page.locator("a:has-text('downloads and pdfs')");
|
|
161
|
+
|
|
162
|
+
// get ready for the download
|
|
163
|
+
const downloadPromise = page.waitForEvent('download');
|
|
164
|
+
|
|
165
|
+
// click to download PDF
|
|
166
|
+
await page.locator("a:has-text('download pdf')").click();
|
|
167
|
+
|
|
168
|
+
// wait for download to complete
|
|
169
|
+
const download = await downloadPromise;
|
|
170
|
+
const pdfPath = await download.path();
|
|
171
|
+
|
|
172
|
+
// create a Page for the downloaded PDF to open in
|
|
173
|
+
const pageForPdf = await browser.newPage();
|
|
174
|
+
|
|
175
|
+
// use the mabl tools to open the file in a new Page
|
|
176
|
+
await mabl.openPdfFile(pdfPath, pageForPdf);
|
|
177
|
+
|
|
178
|
+
// validate the contents of the PDF
|
|
179
|
+
const element = pageForPdf.locator('text=Journey run export');
|
|
180
|
+
expect(await element.isVisible()).toBeTruthy();
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Multi-factor Authentication and credentials testing
|
|
185
|
+
|
|
186
|
+
You will need the IDs for any credentials you’d like to use in your tests. These can be found in the mabl app by going to Configuration > Credentials and clicking on the credential you’d like to use. The View mabl CLI IDs utility can be found in the upper left of the credentials details UI.
|
|
187
|
+
|
|
188
|
+
You can also use the mabl CLI from your terminal to list the credentials and their IDs using the command $ mabl credentials list
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import {expect, test} from '../utils/fixtures';
|
|
192
|
+
import {SandboxPage} from '../utils/SandboxPage';
|
|
193
|
+
|
|
194
|
+
// This is the ID of the mabl credentials to use in a test
|
|
195
|
+
const MFA_CREDENTIALS_ID = 'L7HamCgVXVY4UbelLPTRzA-c';
|
|
196
|
+
|
|
197
|
+
test('Validate that we can get an MFA token from mabl', async ({
|
|
198
|
+
page,
|
|
199
|
+
mabl,
|
|
200
|
+
}) => {
|
|
201
|
+
await page.goto('https://sandbox.mabl.com');
|
|
202
|
+
const mfaToken = await mabl.getMfaCode(MFA_CREDENTIALS_ID);
|
|
203
|
+
// now use the MFA token inside your test
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
test('Validate that we can get and use credentials from mabl', async ({
|
|
207
|
+
page,
|
|
208
|
+
mabl,
|
|
209
|
+
}) => {
|
|
210
|
+
await page.goto('https://sandbox.mabl.com');
|
|
211
|
+
const sandbox = new SandboxPage(page);
|
|
212
|
+
sandbox.maybeWaitForReady();
|
|
213
|
+
const loginPage = await sandbox.goToLoginPage();
|
|
214
|
+
|
|
215
|
+
// fetches the latest version of the credentials from mabl
|
|
216
|
+
const creds = await mabl.getCredentials(MFA_CREDENTIALS_ID);
|
|
217
|
+
await loginPage.fillOutAndSubmitLoginForm(creds.username, creds.password);
|
|
218
|
+
});
|
|
219
|
+
```
|
package/api/ApiError.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
class ApiError extends Error {
|
|
5
|
+
constructor(message, statusCode, cause) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.statusCode = statusCode;
|
|
8
|
+
this.cause = cause;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ApiError = ApiError;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BitBucketApiClient = exports.CODE_INSIGHTS_PORT = exports.CODE_INSIGHTS_PROXY = exports.CUSTOM_CODE_INSIGHTS_PIPE_PROXY = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const ApiError_1 = require("../ApiError");
|
|
9
|
+
const API_VERSION = '2.0';
|
|
10
|
+
exports.CUSTOM_CODE_INSIGHTS_PIPE_PROXY = 'host.docker.internal';
|
|
11
|
+
exports.CODE_INSIGHTS_PROXY = 'localhost';
|
|
12
|
+
exports.CODE_INSIGHTS_PORT = 29418;
|
|
13
|
+
class BitBucketApiClient {
|
|
14
|
+
constructor(username, token, isCustomPipe, noProxy) {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: {
|
|
17
|
+
Accept: 'application/json',
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
if (noProxy) {
|
|
22
|
+
config.auth = {
|
|
23
|
+
username,
|
|
24
|
+
password: token,
|
|
25
|
+
};
|
|
26
|
+
this.baseUrl = `https://api.bitbucket.org/${API_VERSION}`;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (!isCustomPipe) {
|
|
30
|
+
config.proxy = {
|
|
31
|
+
host: exports.CODE_INSIGHTS_PROXY,
|
|
32
|
+
port: 29418,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
config.proxy = {
|
|
37
|
+
host: exports.CUSTOM_CODE_INSIGHTS_PIPE_PROXY,
|
|
38
|
+
port: 29418,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
this.baseUrl = `http://api.bitbucket.org/${API_VERSION}`;
|
|
42
|
+
}
|
|
43
|
+
config.validateStatus = () => true;
|
|
44
|
+
this.apiClient = axios_1.default.create(config);
|
|
45
|
+
}
|
|
46
|
+
createUrl(path) {
|
|
47
|
+
return `${this.baseUrl}${path}`;
|
|
48
|
+
}
|
|
49
|
+
checkResponseStatusCode(response) {
|
|
50
|
+
const statusCode = response.status;
|
|
51
|
+
if (!statusCode || statusCode >= 400) {
|
|
52
|
+
throw new ApiError_1.ApiError(`[${statusCode} - ${response.statusText}]`, statusCode);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async makeGetRequest(path, config) {
|
|
56
|
+
const response = await this.apiClient.get(this.createUrl(path), config);
|
|
57
|
+
this.checkResponseStatusCode(response);
|
|
58
|
+
return response.data;
|
|
59
|
+
}
|
|
60
|
+
async makePutRequest(path, requestBody, config) {
|
|
61
|
+
const response = await this.apiClient.put(this.createUrl(path), JSON.stringify(requestBody), config);
|
|
62
|
+
this.checkResponseStatusCode(response);
|
|
63
|
+
return response.data;
|
|
64
|
+
}
|
|
65
|
+
putCodeReport(codeReport, workspace, repoSlug, node) {
|
|
66
|
+
return this.makePutRequest(`/repositories/${workspace}/${repoSlug}/commit/${node}/reports/${codeReport.external_id}`, codeReport);
|
|
67
|
+
}
|
|
68
|
+
getCodeReport(externalId, workspace, repoSlug, node) {
|
|
69
|
+
return this.makeGetRequest(`/repositories/${workspace}/${repoSlug}/commit/${node}/reports/${externalId}`);
|
|
70
|
+
}
|
|
71
|
+
getCodeReports(workspace, repoSlug, node) {
|
|
72
|
+
return this.makeGetRequest(`/repositories/${workspace}/${repoSlug}/commit/${node}/reports`);
|
|
73
|
+
}
|
|
74
|
+
putCodeAnnotation(codeAnnotation, workspace, repoSlug, node, codeReportExternalId) {
|
|
75
|
+
return this.makePutRequest(`/repositories/${workspace}/${repoSlug}/commit/${node}/reports/${codeReportExternalId}/annotations/${codeAnnotation.external_id}`, codeAnnotation);
|
|
76
|
+
}
|
|
77
|
+
getPullRequest(pullRequestId, workspace, repoSlug) {
|
|
78
|
+
return this.makeGetRequest(`/repositories/${workspace}/${repoSlug}/pullrequests/${pullRequestId}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.BitBucketApiClient = BitBucketApiClient;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeInsightsAnnotationType = void 0;
|
|
4
|
+
var CodeInsightsAnnotationType;
|
|
5
|
+
(function (CodeInsightsAnnotationType) {
|
|
6
|
+
CodeInsightsAnnotationType["BUG"] = "BUG";
|
|
7
|
+
CodeInsightsAnnotationType["CODE_SMELL"] = "CODE_SMELL";
|
|
8
|
+
CodeInsightsAnnotationType["VULNERABILITY"] = "VULNERABILITY";
|
|
9
|
+
})(CodeInsightsAnnotationType || (exports.CodeInsightsAnnotationType = CodeInsightsAnnotationType = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeInsightsResult = exports.CodeReportType = void 0;
|
|
4
|
+
var CodeReportType;
|
|
5
|
+
(function (CodeReportType) {
|
|
6
|
+
CodeReportType["BUG"] = "BUG";
|
|
7
|
+
CodeReportType["COVERAGE"] = "COVERAGE";
|
|
8
|
+
CodeReportType["SECURITY"] = "SECURITY";
|
|
9
|
+
CodeReportType["TEST"] = "TEST";
|
|
10
|
+
})(CodeReportType || (exports.CodeReportType = CodeReportType = {}));
|
|
11
|
+
var CodeInsightsResult;
|
|
12
|
+
(function (CodeInsightsResult) {
|
|
13
|
+
CodeInsightsResult["FAILED"] = "FAILED";
|
|
14
|
+
CodeInsightsResult["PASSED"] = "PASSED";
|
|
15
|
+
})(CodeInsightsResult || (exports.CodeInsightsResult = CodeInsightsResult = {}));
|