@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,439 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.processTracesPath = exports.processSingleTraceFile = void 0;
|
|
30
|
+
const env_1 = require("../../../../env/env");
|
|
31
|
+
const pluralize_1 = __importDefault(require("pluralize"));
|
|
32
|
+
const inquirer = __importStar(require("inquirer"));
|
|
33
|
+
const mablApiClientFactory_1 = require("../../../../api/mablApiClientFactory");
|
|
34
|
+
const util_1 = require("../../../commandUtil/util");
|
|
35
|
+
const mablApi_1 = require("../../../../mablApi");
|
|
36
|
+
const pureUtil_1 = require("../../../../util/pureUtil");
|
|
37
|
+
const constants_1 = require("../../../constants");
|
|
38
|
+
const loggingProvider_1 = require("../../../../providers/logging/loggingProvider");
|
|
39
|
+
const chromiumBrowserEngine_1 = require("../../../../browserEngines/chromiumBrowserEngine");
|
|
40
|
+
const RichPromise_1 = __importDefault(require("../../../../util/RichPromise"));
|
|
41
|
+
const { spawn } = require('child_process');
|
|
42
|
+
const fs_1 = __importDefault(require("fs"));
|
|
43
|
+
const path_1 = __importDefault(require("path"));
|
|
44
|
+
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
45
|
+
const execution_1 = require("../../../../execution");
|
|
46
|
+
const projectInfoTestFile = `
|
|
47
|
+
import { test } from "@playwright/test";
|
|
48
|
+
test("mablImportInfo", async ({baseURL, trace}) => {
|
|
49
|
+
console.log('@mabl project info',
|
|
50
|
+
JSON.stringify({
|
|
51
|
+
baseURL: baseURL,
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
`;
|
|
56
|
+
var PostImportActions;
|
|
57
|
+
(function (PostImportActions) {
|
|
58
|
+
PostImportActions["Discard"] = "Discard the test";
|
|
59
|
+
PostImportActions["Run"] = "Run the test locally";
|
|
60
|
+
PostImportActions["Save"] = "Save the test";
|
|
61
|
+
PostImportActions["View"] = "View the test description";
|
|
62
|
+
})(PostImportActions || (PostImportActions = {}));
|
|
63
|
+
exports.command = 'playwright';
|
|
64
|
+
exports.describe =
|
|
65
|
+
'[LABS]: Import an existing Playwright test.\nThis functionality is in an experimental stage.';
|
|
66
|
+
exports.builder = (yargs) => {
|
|
67
|
+
yargs
|
|
68
|
+
.option(constants_1.CommandArgAuto, {
|
|
69
|
+
default: false,
|
|
70
|
+
describe: 'Automatically save imported test when complete',
|
|
71
|
+
requiresArg: false,
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
})
|
|
74
|
+
.option(constants_1.CommandArgWorkspaceId, {
|
|
75
|
+
alias: constants_1.CommandArgAliases.WorkspaceId,
|
|
76
|
+
describe: 'Workspace into which tests should be imported',
|
|
77
|
+
nargs: 1,
|
|
78
|
+
requiresArg: true,
|
|
79
|
+
type: 'string',
|
|
80
|
+
})
|
|
81
|
+
.option(constants_1.CommandArgPath, {
|
|
82
|
+
describe: 'Project location. Current directory is default',
|
|
83
|
+
nargs: 1,
|
|
84
|
+
type: 'string',
|
|
85
|
+
})
|
|
86
|
+
.option(constants_1.CommandArgProject, {
|
|
87
|
+
describe: 'Playwright project to run. This project must have tracing enabled.',
|
|
88
|
+
nargs: 1,
|
|
89
|
+
type: 'string',
|
|
90
|
+
})
|
|
91
|
+
.option(constants_1.CommandArgGrep, {
|
|
92
|
+
describe: 'Grep argument to pass to Playwright to filter tests',
|
|
93
|
+
nargs: 1,
|
|
94
|
+
type: 'string',
|
|
95
|
+
})
|
|
96
|
+
.option(constants_1.CommandArgExtraArguments, {
|
|
97
|
+
describe: 'Extra arguments to pass to playwright',
|
|
98
|
+
nargs: 1,
|
|
99
|
+
type: 'string',
|
|
100
|
+
})
|
|
101
|
+
.option(constants_1.CommandArgTestPath, {
|
|
102
|
+
describe: 'Path where the tests are located',
|
|
103
|
+
type: 'string',
|
|
104
|
+
default: 'tests',
|
|
105
|
+
})
|
|
106
|
+
.option(constants_1.CommandArgTraceFile, {
|
|
107
|
+
describe: 'Path of a single playwright trace file to import',
|
|
108
|
+
type: 'string',
|
|
109
|
+
})
|
|
110
|
+
.option(constants_1.CommandArgTracesPath, {
|
|
111
|
+
describe: 'Path of the directory containing playwright trace files to import',
|
|
112
|
+
type: 'string',
|
|
113
|
+
})
|
|
114
|
+
.check((argv) => {
|
|
115
|
+
if (!argv[constants_1.CommandArgTraceFile] &&
|
|
116
|
+
!argv[constants_1.CommandArgTracesPath] &&
|
|
117
|
+
!argv[constants_1.CommandArgPath]) {
|
|
118
|
+
throw new Error(`Please pass in one of --${constants_1.CommandArgTraceFile}, --${constants_1.CommandArgTracesPath}, or ${constants_1.CommandArgPath}`);
|
|
119
|
+
}
|
|
120
|
+
if (argv[constants_1.CommandArgTraceFile] && argv[constants_1.CommandArgTracesPath]) {
|
|
121
|
+
throw new Error(`Only one of --${constants_1.CommandArgTraceFile} or --${constants_1.CommandArgTracesPath} can be provided`);
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
exports.handler = (0, util_1.failWrapper)(processCommand);
|
|
127
|
+
async function processCommand(parsed) {
|
|
128
|
+
const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
|
|
129
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
130
|
+
const importedTests = await importTests(parsed);
|
|
131
|
+
if (!importedTests.length) {
|
|
132
|
+
return Promise.reject(new Error(`No tests were imported.`));
|
|
133
|
+
}
|
|
134
|
+
if (importedTests.length > 1) {
|
|
135
|
+
loggingProvider_1.logger.info(`Imported ${importedTests.length} tests.\n`);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
loggingProvider_1.logger.info(`Imported ${(0, pluralize_1.default)('step', importedTests[0].steps.length, true)}.\n`);
|
|
139
|
+
}
|
|
140
|
+
return handlePostImportActions(workspaceId, apiClient, importedTests, parsed[constants_1.CommandArgAuto]);
|
|
141
|
+
}
|
|
142
|
+
async function importTests(args) {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
const cwd = (_a = args[constants_1.CommandArgPath]) !== null && _a !== void 0 ? _a : process.cwd();
|
|
145
|
+
const tracesPath = (_b = args[constants_1.CommandArgTracesPath]) !== null && _b !== void 0 ? _b : path_1.default.join(cwd, 'test-results');
|
|
146
|
+
const playwrightProject = args[constants_1.CommandArgProject]
|
|
147
|
+
? await getProjectInfo(args)
|
|
148
|
+
: { baseUrl: '' };
|
|
149
|
+
if (!args[constants_1.CommandArgTraceFile] && !args[constants_1.CommandArgTracesPath]) {
|
|
150
|
+
await runPlaywrightProject(args, tracesPath, cwd);
|
|
151
|
+
}
|
|
152
|
+
let importedTests = [];
|
|
153
|
+
const converter = new execution_1.PlaywrightToMablStepConverter();
|
|
154
|
+
if (args[constants_1.CommandArgTraceFile]) {
|
|
155
|
+
importedTests = processSingleTraceFile(args[constants_1.CommandArgTraceFile], playwrightProject, converter);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
importedTests = processTracesPath(tracesPath, playwrightProject, converter);
|
|
159
|
+
}
|
|
160
|
+
converter.printMissingApis(loggingProvider_1.logger);
|
|
161
|
+
return importedTests;
|
|
162
|
+
}
|
|
163
|
+
async function handlePostImportActions(workspaceId, apiClient, importedTests, autoSave) {
|
|
164
|
+
let nextAction;
|
|
165
|
+
do {
|
|
166
|
+
nextAction = await getNextAction(autoSave);
|
|
167
|
+
loggingProvider_1.logger.logNewLine();
|
|
168
|
+
switch (nextAction) {
|
|
169
|
+
case PostImportActions.Save:
|
|
170
|
+
return saveTests(workspaceId, apiClient, importedTests).then(() => {
|
|
171
|
+
loggingProvider_1.logger.info('Import complete.');
|
|
172
|
+
});
|
|
173
|
+
case PostImportActions.View:
|
|
174
|
+
displayTestDescriptions(importedTests);
|
|
175
|
+
break;
|
|
176
|
+
case PostImportActions.Run:
|
|
177
|
+
await runTests(workspaceId, apiClient, importedTests);
|
|
178
|
+
break;
|
|
179
|
+
case PostImportActions.Discard:
|
|
180
|
+
loggingProvider_1.logger.info('Exiting without saving.');
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
loggingProvider_1.logger.logNewLine();
|
|
184
|
+
} while ([PostImportActions.View, PostImportActions.Run].includes(nextAction));
|
|
185
|
+
}
|
|
186
|
+
async function getNextAction(autoSave) {
|
|
187
|
+
if (autoSave) {
|
|
188
|
+
return PostImportActions.Save;
|
|
189
|
+
}
|
|
190
|
+
const answer = await inquirer.prompt([
|
|
191
|
+
{
|
|
192
|
+
type: 'list',
|
|
193
|
+
name: 'action',
|
|
194
|
+
hint: false,
|
|
195
|
+
message: 'What do you want to do next?',
|
|
196
|
+
choices: Object.values(PostImportActions),
|
|
197
|
+
},
|
|
198
|
+
]);
|
|
199
|
+
return answer.action;
|
|
200
|
+
}
|
|
201
|
+
function saveTests(workspaceId, apiClient, importedTests) {
|
|
202
|
+
loggingProvider_1.logger.info(`Saving ${(0, pluralize_1.default)('test', importedTests.length, true)}...`);
|
|
203
|
+
const savePromises = importedTests.map((test) => apiClient
|
|
204
|
+
.createFlow(stepsToFlow(workspaceId, test.steps))
|
|
205
|
+
.then((flow) => apiClient.createJourney(flowToJourney(test.testName, flow)))
|
|
206
|
+
.then((journey) => {
|
|
207
|
+
loggingProvider_1.logger.info(`Saved test ${journey.invariant_id} : ${env_1.BASE_APP_URL}/workspaces/${journey.organization_id}/train/tests/${journey.invariant_id}/current`);
|
|
208
|
+
return journey;
|
|
209
|
+
}));
|
|
210
|
+
return Promise.all(savePromises);
|
|
211
|
+
}
|
|
212
|
+
function displayTestDescriptions(importedTests) {
|
|
213
|
+
importedTests.forEach((test, index) => {
|
|
214
|
+
if (importedTests.length > 1) {
|
|
215
|
+
loggingProvider_1.logger.info(`Test ${index + 1} of ${importedTests.length}: '${test.testName}'`);
|
|
216
|
+
}
|
|
217
|
+
loggingProvider_1.logger.info(test.steps.map((step) => step.description).join('\n'));
|
|
218
|
+
loggingProvider_1.logger.logNewLine();
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
async function runTests(workspaceId, apiClient, importedTests) {
|
|
222
|
+
var _a, _b, _c;
|
|
223
|
+
const tests = importedTests.map((test) => ({
|
|
224
|
+
test,
|
|
225
|
+
flow: stepsToFlow(workspaceId, test.steps),
|
|
226
|
+
}));
|
|
227
|
+
const firstUrl = (_b = (_a = tests.find((test) => test.flow.url)) === null || _a === void 0 ? void 0 : _a.flow) === null || _b === void 0 ? void 0 : _b.url;
|
|
228
|
+
const browserPath = await new chromiumBrowserEngine_1.ChromiumBrowserEngine().findBrowserExecutable();
|
|
229
|
+
for (let testIndex = 0; testIndex < tests.length; testIndex++) {
|
|
230
|
+
const testToRun = tests[testIndex];
|
|
231
|
+
loggingProvider_1.logger.info(`Running test '${testToRun.test.testName}' ${testIndex + 1} of ${tests.length}.`);
|
|
232
|
+
const journey = {
|
|
233
|
+
organization_id: workspaceId,
|
|
234
|
+
name: testToRun.test.testName,
|
|
235
|
+
flows: [],
|
|
236
|
+
url: (_c = testToRun.flow.url) !== null && _c !== void 0 ? _c : firstUrl,
|
|
237
|
+
};
|
|
238
|
+
const testRunner = await createTestRunner(apiClient, journey, testToRun.flow, journey.url, workspaceId, browserPath);
|
|
239
|
+
const results = await testRunner.run();
|
|
240
|
+
loggingProvider_1.logger.info(`Test result: ${results.status}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function stepsToFlow(workspaceId, steps) {
|
|
244
|
+
const prototype = {
|
|
245
|
+
import_source_id: mablApi_1.Flow.ImportSourceIdEnum.SeleniumNodeProxy,
|
|
246
|
+
import_source_version: (0, pureUtil_1.getCliVersion)(),
|
|
247
|
+
flow_type: mablApi_1.Flow.FlowTypeEnum.Mablscript,
|
|
248
|
+
organization_id: workspaceId,
|
|
249
|
+
reusable: false,
|
|
250
|
+
selectors: steps
|
|
251
|
+
.map((step) => step.selector)
|
|
252
|
+
.map((selector) => selector === null || selector === void 0 ? void 0 : selector.toMablscriptSelector())
|
|
253
|
+
.filter((selector) => selector)
|
|
254
|
+
.map((selector) => selector),
|
|
255
|
+
script: steps.map((step) => step.mablscript).join('\n'),
|
|
256
|
+
script_description: steps.map((step) => step.description).join('\n'),
|
|
257
|
+
url: steps.map((step) => step.url).find((url) => url),
|
|
258
|
+
};
|
|
259
|
+
return prototype;
|
|
260
|
+
}
|
|
261
|
+
function flowToJourney(name, flow) {
|
|
262
|
+
const prototype = {
|
|
263
|
+
organization_id: flow.organization_id,
|
|
264
|
+
name,
|
|
265
|
+
flows: [flow.id],
|
|
266
|
+
url: flow.url,
|
|
267
|
+
};
|
|
268
|
+
return prototype;
|
|
269
|
+
}
|
|
270
|
+
async function createTestRunner(apiClient, test, flow, url, workspaceId, browserPath) {
|
|
271
|
+
const runner = new execution_1.BrowserTestRunner({
|
|
272
|
+
testRunConfig: {
|
|
273
|
+
_cliCreated: true,
|
|
274
|
+
imported: true,
|
|
275
|
+
filterHttpRequests: false,
|
|
276
|
+
url,
|
|
277
|
+
workspaceId,
|
|
278
|
+
},
|
|
279
|
+
mablApiClient: apiClient,
|
|
280
|
+
});
|
|
281
|
+
await runner.initializeTestRunner(test, [flow], 'master', apiClient, false, browserPath, { url });
|
|
282
|
+
return runner;
|
|
283
|
+
}
|
|
284
|
+
function processSingleTraceFile(traceFile, playwrightProject, converter) {
|
|
285
|
+
const importedTests = [];
|
|
286
|
+
if (!fs_1.default.existsSync(traceFile)) {
|
|
287
|
+
throw new Error(`Trace file not found: ${traceFile}`);
|
|
288
|
+
}
|
|
289
|
+
const importedTest = processTestResult(traceFile, playwrightProject, converter);
|
|
290
|
+
if (importedTest) {
|
|
291
|
+
importedTests.push(importedTest);
|
|
292
|
+
}
|
|
293
|
+
return importedTests;
|
|
294
|
+
}
|
|
295
|
+
exports.processSingleTraceFile = processSingleTraceFile;
|
|
296
|
+
function processTracesPath(tracesPath, playwrightProject, converter) {
|
|
297
|
+
const importedTests = [];
|
|
298
|
+
const testResults = fs_1.default.readdirSync(tracesPath);
|
|
299
|
+
console.log(`Found ${testResults.length} test results`);
|
|
300
|
+
for (const testResult of testResults) {
|
|
301
|
+
const testResultPath = path_1.default.join(tracesPath, testResult);
|
|
302
|
+
const tracePath = path_1.default.join(testResultPath, 'trace.zip');
|
|
303
|
+
const importedTest = processTestResult(tracePath, playwrightProject, converter);
|
|
304
|
+
if (importedTest) {
|
|
305
|
+
importedTests.push(importedTest);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return importedTests;
|
|
309
|
+
}
|
|
310
|
+
exports.processTracesPath = processTracesPath;
|
|
311
|
+
function processTestResult(traceZip, playwrightProject, converter) {
|
|
312
|
+
const testResultPath = path_1.default.dirname(traceZip);
|
|
313
|
+
if (!fs_1.default.existsSync(traceZip)) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const zip = new adm_zip_1.default(traceZip);
|
|
317
|
+
const zipEntries = zip.getEntries();
|
|
318
|
+
const lines = [];
|
|
319
|
+
const traceInfoFiles = zipEntries.filter((entry) => entry.entryName.endsWith('-trace.trace'));
|
|
320
|
+
traceInfoFiles.sort((a, b) => {
|
|
321
|
+
const aNum = parseInt(a.entryName.split('-')[0]);
|
|
322
|
+
const bNum = parseInt(b.entryName.split('-')[0]);
|
|
323
|
+
return aNum - bNum;
|
|
324
|
+
});
|
|
325
|
+
for (const entry of traceInfoFiles) {
|
|
326
|
+
const entryContent = entry.getData().toString('utf8');
|
|
327
|
+
fs_1.default.writeFileSync(path_1.default.join(testResultPath, entry.entryName), entryContent);
|
|
328
|
+
lines.push(...entryContent.split('\n'));
|
|
329
|
+
}
|
|
330
|
+
const traceLines = lines
|
|
331
|
+
.filter((line) => line.trim() !== '')
|
|
332
|
+
.map((line) => {
|
|
333
|
+
try {
|
|
334
|
+
return JSON.parse(line);
|
|
335
|
+
}
|
|
336
|
+
catch (e) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
})
|
|
340
|
+
.filter((line) => line !== undefined);
|
|
341
|
+
const testName = getTestNameFromTraceInfo(traceLines);
|
|
342
|
+
const steps = converter.getStepsFromTraceInfo(traceLines, playwrightProject.baseUrl);
|
|
343
|
+
return { testName, steps };
|
|
344
|
+
}
|
|
345
|
+
function getTestNameFromTraceInfo(traceLines) {
|
|
346
|
+
var _a;
|
|
347
|
+
const contextOptionsLine = traceLines.find((trace) => trace.type === 'context-options');
|
|
348
|
+
return (_a = contextOptionsLine === null || contextOptionsLine === void 0 ? void 0 : contextOptionsLine.title) !== null && _a !== void 0 ? _a : '';
|
|
349
|
+
}
|
|
350
|
+
async function getProjectInfo(args) {
|
|
351
|
+
var _a, _b, _c;
|
|
352
|
+
const consoleLines = [];
|
|
353
|
+
const commandArgs = [
|
|
354
|
+
'playwright',
|
|
355
|
+
'test',
|
|
356
|
+
'--project',
|
|
357
|
+
args[constants_1.CommandArgProject],
|
|
358
|
+
'--grep',
|
|
359
|
+
'mablImportInfo',
|
|
360
|
+
];
|
|
361
|
+
const testFile = path_1.default.join((_a = args[constants_1.CommandArgPath]) !== null && _a !== void 0 ? _a : process.cwd(), (_b = args[constants_1.CommandArgTestPath]) !== null && _b !== void 0 ? _b : 'tests', 'mablImportInfo.spec.ts');
|
|
362
|
+
fs_1.default.writeFileSync(testFile, projectInfoTestFile);
|
|
363
|
+
const options = {
|
|
364
|
+
cwd: (_c = args[constants_1.CommandArgPath]) !== null && _c !== void 0 ? _c : process.cwd(),
|
|
365
|
+
env: {
|
|
366
|
+
...process.env,
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
const processClosedPromise = new RichPromise_1.default();
|
|
370
|
+
const playwrightProcess = spawn('npx', commandArgs, options);
|
|
371
|
+
playwrightProcess.stdout.on('data', (data) => {
|
|
372
|
+
consoleLines.push(data.toString());
|
|
373
|
+
if (data.toString().includes('@mabl project info') &&
|
|
374
|
+
processClosedPromise.isPending()) {
|
|
375
|
+
try {
|
|
376
|
+
const info = JSON.parse(data.toString().split('@mabl project info')[1]);
|
|
377
|
+
processClosedPromise.resolve(info);
|
|
378
|
+
}
|
|
379
|
+
catch {
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
playwrightProcess.on('close', (code) => {
|
|
384
|
+
if (code !== 0) {
|
|
385
|
+
processClosedPromise.reject(new Error(`Playwright process exited with code ${code}`));
|
|
386
|
+
console.log(consoleLines.join('\n'));
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
processClosedPromise.resolve();
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
const projectInfo = await processClosedPromise;
|
|
393
|
+
fs_1.default.unlinkSync(testFile);
|
|
394
|
+
return projectInfo !== null && projectInfo !== void 0 ? projectInfo : { baseUrl: '' };
|
|
395
|
+
}
|
|
396
|
+
async function runPlaywrightProject(args, tracesPath, cwd) {
|
|
397
|
+
const processClosedPromise = new RichPromise_1.default();
|
|
398
|
+
const commandArgs = ['playwright', 'test', '--trace', 'on'];
|
|
399
|
+
if (args[constants_1.CommandArgProject]) {
|
|
400
|
+
commandArgs.push('--project', args[constants_1.CommandArgProject]);
|
|
401
|
+
}
|
|
402
|
+
if (args.grep) {
|
|
403
|
+
commandArgs.push('--grep', args.grep);
|
|
404
|
+
}
|
|
405
|
+
if (args[constants_1.CommandArgExtraArguments]) {
|
|
406
|
+
commandArgs.push(args[constants_1.CommandArgExtraArguments]);
|
|
407
|
+
}
|
|
408
|
+
const options = {
|
|
409
|
+
cwd,
|
|
410
|
+
env: {
|
|
411
|
+
...process.env,
|
|
412
|
+
},
|
|
413
|
+
};
|
|
414
|
+
loggingProvider_1.logger.info('Checking playwright project...');
|
|
415
|
+
const playwrightProjectFile = path_1.default.join(options.cwd, 'playwright.config.ts');
|
|
416
|
+
if (!fs_1.default.existsSync(playwrightProjectFile)) {
|
|
417
|
+
throw new Error('No playwright project found. Please ensure you are in the root directory of a playwright project.');
|
|
418
|
+
}
|
|
419
|
+
loggingProvider_1.logger.info('Deleting existing traces...');
|
|
420
|
+
if (fs_1.default.existsSync(tracesPath)) {
|
|
421
|
+
fs_1.default.rmSync(tracesPath, { recursive: true });
|
|
422
|
+
}
|
|
423
|
+
loggingProvider_1.logger.info('Importing tests from Playwright...');
|
|
424
|
+
loggingProvider_1.logger.info('This may take a few minutes.');
|
|
425
|
+
const playwrightProcess = spawn('npx', commandArgs, options);
|
|
426
|
+
playwrightProcess.stdout.on('data', (data) => {
|
|
427
|
+
loggingProvider_1.logger.info(data.toString());
|
|
428
|
+
});
|
|
429
|
+
playwrightProcess.on('close', (code) => {
|
|
430
|
+
if (code !== 0) {
|
|
431
|
+
processClosedPromise.reject(new Error(`Playwright process exited with code ${code}`));
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
processClosedPromise.resolve();
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
await processClosedPromise;
|
|
438
|
+
loggingProvider_1.logger.info('Test import complete. Processing output');
|
|
439
|
+
}
|