@wopee-io/wopee.wdio 4.0.0
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/README.md +5 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getDocumentScrollHeight.d.ts +5 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getDocumentScrollHeight.d.ts.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getDocumentScrollHeight.js +48 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getDocumentScrollHeight.js.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getElementPositionTopDom.d.ts +9 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getElementPositionTopDom.d.ts.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getElementPositionTopDom.js +20 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getElementPositionTopDom.js.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getElementPositionTopWindow.d.ts +9 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getElementPositionTopWindow.d.ts.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getElementPositionTopWindow.js +22 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getElementPositionTopWindow.js.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getScreenDimensions.d.ts +8 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getScreenDimensions.d.ts.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getScreenDimensions.js +39 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/getScreenDimensions.js.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/screenDimensions.interfaces.d.ts +85 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/screenDimensions.interfaces.d.ts.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/screenDimensions.interfaces.js +2 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/screenDimensions.interfaces.js.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/scrollElementIntoView.d.ts +8 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/scrollElementIntoView.d.ts.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/scrollElementIntoView.js +35 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/scrollElementIntoView.js.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/scrollToPosition.d.ts +8 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/scrollToPosition.d.ts.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/scrollToPosition.js +27 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/clientSideScripts/scrollToPosition.js.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/desktopBrowserClientOperationAdapter.d.ts +13 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/desktopBrowserClientOperationAdapter.d.ts.map +1 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/desktopBrowserClientOperationAdapter.js +27 -0
- package/build/adapter/desktopBrowserClientOperationAdapter/desktopBrowserClientOperationAdapter.js.map +1 -0
- package/build/adapter/driven/localSaveScreenshot/default.d.ts +14 -0
- package/build/adapter/driven/localSaveScreenshot/default.d.ts.map +1 -0
- package/build/adapter/driven/localSaveScreenshot/default.js +20 -0
- package/build/adapter/driven/localSaveScreenshot/default.js.map +1 -0
- package/build/adapter/driven/localSaveScreenshot/localSaveScreenshot.d.ts +42 -0
- package/build/adapter/driven/localSaveScreenshot/localSaveScreenshot.d.ts.map +1 -0
- package/build/adapter/driven/localSaveScreenshot/localSaveScreenshot.interface.d.ts +43 -0
- package/build/adapter/driven/localSaveScreenshot/localSaveScreenshot.interface.d.ts.map +1 -0
- package/build/adapter/driven/localSaveScreenshot/localSaveScreenshot.interface.js +2 -0
- package/build/adapter/driven/localSaveScreenshot/localSaveScreenshot.interface.js.map +1 -0
- package/build/adapter/driven/localSaveScreenshot/localSaveScreenshot.js +76 -0
- package/build/adapter/driven/localSaveScreenshot/localSaveScreenshot.js.map +1 -0
- package/build/adapter/driven/wdioLoggerAdapter/wdioLoggerAdapter.d.ts +10 -0
- package/build/adapter/driven/wdioLoggerAdapter/wdioLoggerAdapter.d.ts.map +1 -0
- package/build/adapter/driven/wdioLoggerAdapter/wdioLoggerAdapter.js +20 -0
- package/build/adapter/driven/wdioLoggerAdapter/wdioLoggerAdapter.js.map +1 -0
- package/build/adapter/fullPageScreenshotAdapter/fullPageScreenshotAdapter.d.ts +31 -0
- package/build/adapter/fullPageScreenshotAdapter/fullPageScreenshotAdapter.d.ts.map +1 -0
- package/build/adapter/fullPageScreenshotAdapter/fullPageScreenshotAdapter.js +138 -0
- package/build/adapter/fullPageScreenshotAdapter/fullPageScreenshotAdapter.js.map +1 -0
- package/build/adapter/wdioConfigAdapter/wdioConfigAdapter.d.ts +10 -0
- package/build/adapter/wdioConfigAdapter/wdioConfigAdapter.d.ts.map +1 -0
- package/build/adapter/wdioConfigAdapter/wdioConfigAdapter.interface.d.ts +28 -0
- package/build/adapter/wdioConfigAdapter/wdioConfigAdapter.interface.d.ts.map +1 -0
- package/build/adapter/wdioConfigAdapter/wdioConfigAdapter.interface.js +12 -0
- package/build/adapter/wdioConfigAdapter/wdioConfigAdapter.interface.js.map +1 -0
- package/build/adapter/wdioConfigAdapter/wdioConfigAdapter.js +57 -0
- package/build/adapter/wdioConfigAdapter/wdioConfigAdapter.js.map +1 -0
- package/build/adapter/wdioLoggerAdapter/wdioLoggerAdapter.d.ts +10 -0
- package/build/adapter/wdioLoggerAdapter/wdioLoggerAdapter.d.ts.map +1 -0
- package/build/adapter/wdioLoggerAdapter/wdioLoggerAdapter.js +20 -0
- package/build/adapter/wdioLoggerAdapter/wdioLoggerAdapter.js.map +1 -0
- package/build/core/domain/valueObjects/elementPosition.interface.d.ts +7 -0
- package/build/core/domain/valueObjects/elementPosition.interface.d.ts.map +1 -0
- package/build/core/domain/valueObjects/elementPosition.interface.js +2 -0
- package/build/core/domain/valueObjects/elementPosition.interface.js.map +1 -0
- package/build/core/domain/valueObjects/index.d.ts +4 -0
- package/build/core/domain/valueObjects/index.d.ts.map +1 -0
- package/build/core/domain/valueObjects/index.js +2 -0
- package/build/core/domain/valueObjects/index.js.map +1 -0
- package/build/core/domain/valueObjects/track.interface.d.ts +22 -0
- package/build/core/domain/valueObjects/track.interface.d.ts.map +1 -0
- package/build/core/domain/valueObjects/track.interface.js +2 -0
- package/build/core/domain/valueObjects/track.interface.js.map +1 -0
- package/build/desktopBrowser/clientSideScript/screenDimensions.interfaces.d.ts +85 -0
- package/build/desktopBrowser/clientSideScript/screenDimensions.interfaces.d.ts.map +1 -0
- package/build/desktopBrowser/clientSideScript/screenDimensions.interfaces.js +2 -0
- package/build/desktopBrowser/clientSideScript/screenDimensions.interfaces.js.map +1 -0
- package/build/desktopBrowser/commands/element.interfaces.d.ts +11 -0
- package/build/desktopBrowser/commands/element.interfaces.d.ts.map +1 -0
- package/build/desktopBrowser/commands/element.interfaces.js +2 -0
- package/build/desktopBrowser/commands/element.interfaces.js.map +1 -0
- package/build/desktopBrowser/commands/fullPage.interfaces.d.ts +11 -0
- package/build/desktopBrowser/commands/fullPage.interfaces.d.ts.map +1 -0
- package/build/desktopBrowser/commands/fullPage.interfaces.js +2 -0
- package/build/desktopBrowser/commands/fullPage.interfaces.js.map +1 -0
- package/build/desktopBrowser/commands/screen.interfaces.d.ts +8 -0
- package/build/desktopBrowser/commands/screen.interfaces.d.ts.map +1 -0
- package/build/desktopBrowser/commands/screen.interfaces.js +2 -0
- package/build/desktopBrowser/commands/screen.interfaces.js.map +1 -0
- package/build/desktopBrowser/commands/trackElement.d.ts +7 -0
- package/build/desktopBrowser/commands/trackElement.d.ts.map +1 -0
- package/build/desktopBrowser/commands/trackElement.js +63 -0
- package/build/desktopBrowser/commands/trackElement.js.map +1 -0
- package/build/desktopBrowser/commands/trackFullPageScreen.d.ts +7 -0
- package/build/desktopBrowser/commands/trackFullPageScreen.d.ts.map +1 -0
- package/build/desktopBrowser/commands/trackFullPageScreen.js +49 -0
- package/build/desktopBrowser/commands/trackFullPageScreen.js.map +1 -0
- package/build/desktopBrowser/commands/trackImage.d.ts +6 -0
- package/build/desktopBrowser/commands/trackImage.d.ts.map +1 -0
- package/build/desktopBrowser/commands/trackImage.interface.d.ts +8 -0
- package/build/desktopBrowser/commands/trackImage.interface.d.ts.map +1 -0
- package/build/desktopBrowser/commands/trackImage.interface.js +2 -0
- package/build/desktopBrowser/commands/trackImage.interface.js.map +1 -0
- package/build/desktopBrowser/commands/trackImage.js +27 -0
- package/build/desktopBrowser/commands/trackImage.js.map +1 -0
- package/build/desktopBrowser/commands/trackScreen.d.ts +7 -0
- package/build/desktopBrowser/commands/trackScreen.d.ts.map +1 -0
- package/build/desktopBrowser/commands/trackScreen.js +52 -0
- package/build/desktopBrowser/commands/trackScreen.js.map +1 -0
- package/build/desktopBrowser/helpers/utils.d.ts +33 -0
- package/build/desktopBrowser/helpers/utils.d.ts.map +1 -0
- package/build/desktopBrowser/helpers/utils.js +77 -0
- package/build/desktopBrowser/helpers/utils.js.map +1 -0
- package/build/desktopBrowser/index.d.ts +8 -0
- package/build/desktopBrowser/index.d.ts.map +1 -0
- package/build/desktopBrowser/index.js +6 -0
- package/build/desktopBrowser/index.js.map +1 -0
- package/build/desktopBrowser/methods/elementPosition.d.ts +23 -0
- package/build/desktopBrowser/methods/elementPosition.d.ts.map +1 -0
- package/build/desktopBrowser/methods/elementPosition.js +26 -0
- package/build/desktopBrowser/methods/elementPosition.js.map +1 -0
- package/build/desktopBrowser/methods/images.d.ts +27 -0
- package/build/desktopBrowser/methods/images.d.ts.map +1 -0
- package/build/desktopBrowser/methods/images.interfaces.d.ts +31 -0
- package/build/desktopBrowser/methods/images.interfaces.d.ts.map +1 -0
- package/build/desktopBrowser/methods/images.interfaces.js +2 -0
- package/build/desktopBrowser/methods/images.interfaces.js.map +1 -0
- package/build/desktopBrowser/methods/images.js +109 -0
- package/build/desktopBrowser/methods/images.js.map +1 -0
- package/build/desktopBrowser/methods/instanceData.interfaces.d.ts +10 -0
- package/build/desktopBrowser/methods/instanceData.interfaces.d.ts.map +1 -0
- package/build/desktopBrowser/methods/instanceData.interfaces.js +2 -0
- package/build/desktopBrowser/methods/instanceData.interfaces.js.map +1 -0
- package/build/desktopBrowser/methods/methods.interface.d.ts +13 -0
- package/build/desktopBrowser/methods/methods.interface.d.ts.map +1 -0
- package/build/desktopBrowser/methods/methods.interface.js +2 -0
- package/build/desktopBrowser/methods/methods.interface.js.map +1 -0
- package/build/desktopBrowser/methods/rectangles.d.ts +23 -0
- package/build/desktopBrowser/methods/rectangles.d.ts.map +1 -0
- package/build/desktopBrowser/methods/rectangles.interfaces.d.ts +23 -0
- package/build/desktopBrowser/methods/rectangles.interfaces.d.ts.map +1 -0
- package/build/desktopBrowser/methods/rectangles.interfaces.js +2 -0
- package/build/desktopBrowser/methods/rectangles.interfaces.js.map +1 -0
- package/build/desktopBrowser/methods/rectangles.js +51 -0
- package/build/desktopBrowser/methods/rectangles.js.map +1 -0
- package/build/desktopBrowser/methods/screenshots.d.ts +29 -0
- package/build/desktopBrowser/methods/screenshots.d.ts.map +1 -0
- package/build/desktopBrowser/methods/screenshots.interfaces.d.ts +27 -0
- package/build/desktopBrowser/methods/screenshots.interfaces.d.ts.map +1 -0
- package/build/desktopBrowser/methods/screenshots.interfaces.js +2 -0
- package/build/desktopBrowser/methods/screenshots.interfaces.js.map +1 -0
- package/build/desktopBrowser/methods/screenshots.js +91 -0
- package/build/desktopBrowser/methods/screenshots.js.map +1 -0
- package/build/domain/model/afterScreenshotOptions.interface.d.ts +11 -0
- package/build/domain/model/afterScreenshotOptions.interface.d.ts.map +1 -0
- package/build/domain/model/afterScreenshotOptions.interface.js +2 -0
- package/build/domain/model/afterScreenshotOptions.interface.js.map +1 -0
- package/build/domain/model/beforeScreenshotOptions.interface.d.ts +7 -0
- package/build/domain/model/beforeScreenshotOptions.interface.d.ts.map +1 -0
- package/build/domain/model/beforeScreenshotOptions.interface.js +2 -0
- package/build/domain/model/beforeScreenshotOptions.interface.js.map +1 -0
- package/build/domain/model/config.interface.d.ts +19 -0
- package/build/domain/model/config.interface.d.ts.map +1 -0
- package/build/domain/model/config.interface.js +2 -0
- package/build/domain/model/config.interface.js.map +1 -0
- package/build/domain/model/constants.d.ts +9 -0
- package/build/domain/model/constants.d.ts.map +1 -0
- package/build/domain/model/constants.js +9 -0
- package/build/domain/model/constants.js.map +1 -0
- package/build/domain/model/croppingOptions.interface.d.ts +8 -0
- package/build/domain/model/croppingOptions.interface.d.ts.map +1 -0
- package/build/domain/model/croppingOptions.interface.js +12 -0
- package/build/domain/model/croppingOptions.interface.js.map +1 -0
- package/build/domain/model/instances.interface.d.ts +16 -0
- package/build/domain/model/instances.interface.d.ts.map +1 -0
- package/build/domain/model/instances.interface.js +2 -0
- package/build/domain/model/instances.interface.js.map +1 -0
- package/build/domain/model/instancesOptions.interface.d.ts +7 -0
- package/build/domain/model/instancesOptions.interface.d.ts.map +1 -0
- package/build/domain/model/instancesOptions.interface.js +10 -0
- package/build/domain/model/instancesOptions.interface.js.map +1 -0
- package/build/domain/model/methods.interface.d.ts +17 -0
- package/build/domain/model/methods.interface.d.ts.map +1 -0
- package/build/domain/model/methods.interface.js +2 -0
- package/build/domain/model/methods.interface.js.map +1 -0
- package/build/domain/model/permanentStorageResult.interface.d.ts +14 -0
- package/build/domain/model/permanentStorageResult.interface.d.ts.map +1 -0
- package/build/domain/model/permanentStorageResult.interface.js +2 -0
- package/build/domain/model/permanentStorageResult.interface.js.map +1 -0
- package/build/domain/model/saveBase64ImageOptions.interface.d.ts +54 -0
- package/build/domain/model/saveBase64ImageOptions.interface.d.ts.map +1 -0
- package/build/domain/model/saveBase64ImageOptions.interface.js +2 -0
- package/build/domain/model/saveBase64ImageOptions.interface.js.map +1 -0
- package/build/domain/model/screenshotOutput.interface.d.ts +16 -0
- package/build/domain/model/screenshotOutput.interface.d.ts.map +1 -0
- package/build/domain/model/screenshotOutput.interface.js +2 -0
- package/build/domain/model/screenshotOutput.interface.js.map +1 -0
- package/build/domain/model/screenshotSize.interface.d.ts +14 -0
- package/build/domain/model/screenshotSize.interface.d.ts.map +1 -0
- package/build/domain/model/screenshotSize.interface.js +2 -0
- package/build/domain/model/screenshotSize.interface.js.map +1 -0
- package/build/domain/model/screenshotValidationPayload.interface.d.ts +47 -0
- package/build/domain/model/screenshotValidationPayload.interface.d.ts.map +1 -0
- package/build/domain/model/screenshotValidationPayload.interface.js +2 -0
- package/build/domain/model/screenshotValidationPayload.interface.js.map +1 -0
- package/build/domain/model/screenshotValidationResult.interface.d.ts +23 -0
- package/build/domain/model/screenshotValidationResult.interface.d.ts.map +1 -0
- package/build/domain/model/screenshotValidationResult.interface.js +11 -0
- package/build/domain/model/screenshotValidationResult.interface.js.map +1 -0
- package/build/domain/model/service.interface.d.ts +33 -0
- package/build/domain/model/service.interface.d.ts.map +1 -0
- package/build/domain/model/service.interface.js +2 -0
- package/build/domain/model/service.interface.js.map +1 -0
- package/build/domain/model/trackImage.interface.d.ts +17 -0
- package/build/domain/model/trackImage.interface.d.ts.map +1 -0
- package/build/domain/model/trackImage.interface.js +2 -0
- package/build/domain/model/trackImage.interface.js.map +1 -0
- package/build/domain/service/afterScreenshot.d.ts +11 -0
- package/build/domain/service/afterScreenshot.d.ts.map +1 -0
- package/build/domain/service/afterScreenshot.js +15 -0
- package/build/domain/service/afterScreenshot.js.map +1 -0
- package/build/domain/service/beforeScreenshot.d.ts +12 -0
- package/build/domain/service/beforeScreenshot.d.ts.map +1 -0
- package/build/domain/service/beforeScreenshot.js +41 -0
- package/build/domain/service/beforeScreenshot.js.map +1 -0
- package/build/domain/service/webdriverService.d.ts +19 -0
- package/build/domain/service/webdriverService.d.ts.map +1 -0
- package/build/domain/service/webdriverService.js +98 -0
- package/build/domain/service/webdriverService.js.map +1 -0
- package/build/domain/service/wopeeService.d.ts +37 -0
- package/build/domain/service/wopeeService.d.ts.map +1 -0
- package/build/domain/service/wopeeService.js +83 -0
- package/build/domain/service/wopeeService.js.map +1 -0
- package/build/index.d.ts +59 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +4 -0
- package/build/index.js.map +1 -0
- package/build/port/clientSideOperationPort/clientSideOperationPort.d.ts +12 -0
- package/build/port/clientSideOperationPort/clientSideOperationPort.d.ts.map +1 -0
- package/build/port/clientSideOperationPort/clientSideOperationPort.js +3 -0
- package/build/port/clientSideOperationPort/clientSideOperationPort.js.map +1 -0
- package/build/port/driven/configDrivingPort/configDrivingPort.d.ts +9 -0
- package/build/port/driven/configDrivingPort/configDrivingPort.d.ts.map +1 -0
- package/build/port/driven/configDrivingPort/configDrivingPort.js +15 -0
- package/build/port/driven/configDrivingPort/configDrivingPort.js.map +1 -0
- package/build/port/driven/configDrivingPort/configDrivingPortDefaults.d.ts +6 -0
- package/build/port/driven/configDrivingPort/configDrivingPortDefaults.d.ts.map +1 -0
- package/build/port/driven/configDrivingPort/configDrivingPortDefaults.js +36 -0
- package/build/port/driven/configDrivingPort/configDrivingPortDefaults.js.map +1 -0
- package/build/port/driven/permanentStoragePort.d.ts +15 -0
- package/build/port/driven/permanentStoragePort.d.ts.map +1 -0
- package/build/port/driven/permanentStoragePort.js +6 -0
- package/build/port/driven/permanentStoragePort.js.map +1 -0
- package/build/port/driven/screenshotValidationPort.d.ts +28 -0
- package/build/port/driven/screenshotValidationPort.d.ts.map +1 -0
- package/build/port/driven/screenshotValidationPort.js +6 -0
- package/build/port/driven/screenshotValidationPort.js.map +1 -0
- package/build/types.d.ts +1 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/build/utils/versionMetadata.d.ts +10 -0
- package/build/utils/versionMetadata.d.ts.map +1 -0
- package/build/utils/versionMetadata.js +26 -0
- package/build/utils/versionMetadata.js.map +1 -0
- package/build/utils/wopeeError.d.ts +4 -0
- package/build/utils/wopeeError.d.ts.map +1 -0
- package/build/utils/wopeeError.js +8 -0
- package/build/utils/wopeeError.js.map +1 -0
- package/build/utils.d.ts +34 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +57 -0
- package/build/utils.js.map +1 -0
- package/docs/commands.md +37 -0
- package/docs/configuration.md +241 -0
- package/docs/mobile_native.md +31 -0
- package/node_modules/@autonomous-testing/sdk/.commitlintrc.json +3 -0
- package/node_modules/@autonomous-testing/sdk/.eslintignore +2 -0
- package/node_modules/@autonomous-testing/sdk/.eslintrc +21 -0
- package/node_modules/@autonomous-testing/sdk/.github/actions/npm_clean_install/action.yaml +35 -0
- package/node_modules/@autonomous-testing/sdk/.github/workflows/ci_cd.yaml +137 -0
- package/node_modules/@autonomous-testing/sdk/.prettierignore +3 -0
- package/node_modules/@autonomous-testing/sdk/.prettierrc +12 -0
- package/node_modules/@autonomous-testing/sdk/README.md +57 -0
- package/node_modules/@autonomous-testing/sdk/build/core/domain/index.d.ts +2 -0
- package/node_modules/@autonomous-testing/sdk/build/core/domain/index.js +18 -0
- package/node_modules/@autonomous-testing/sdk/build/core/domain/valueObjects/imageTrackingResult.interface.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/core/domain/valueObjects/imageTrackingResult.interface.js +3 -0
- package/node_modules/@autonomous-testing/sdk/build/core/domain/valueObjects/index.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/core/domain/valueObjects/index.js +3 -0
- package/node_modules/@autonomous-testing/sdk/build/core/domain/valueObjects/trackPayload.interface.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/core/domain/valueObjects/trackPayload.interface.js +3 -0
- package/node_modules/@autonomous-testing/sdk/build/core/index.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/core/index.js +19 -0
- package/node_modules/@autonomous-testing/sdk/build/core/ports/imageTracker.d.ts +6 -0
- package/node_modules/@autonomous-testing/sdk/build/core/ports/imageTracker.js +7 -0
- package/node_modules/@autonomous-testing/sdk/build/core/ports/index.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/core/ports/index.js +8 -0
- package/node_modules/@autonomous-testing/sdk/build/core/ports/logger.d.ts +7 -0
- package/node_modules/@autonomous-testing/sdk/build/core/ports/logger.js +7 -0
- package/node_modules/@autonomous-testing/sdk/build/index.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/index.js +20 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapter.d.ts +39 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapter.default.d.ts +16 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapter.default.js +31 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapter.interface.d.ts +93 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapter.interface.js +14 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapter.js +153 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapterQueries.d.ts +5 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapterQueries.js +102 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapterUtils.d.ts +9 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/apolloTrackAdapterUtils.js +26 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/index.d.ts +7 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/apolloTrackAdapter/index.js +8 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/consoleLogger/consoleLogger.d.ts +36 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/consoleLogger/consoleLogger.js +49 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/consoleLogger/index.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/consoleLogger/index.js +6 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/index.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/index.js +20 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/noLogger/index.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/noLogger/index.js +6 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/noLogger/noLogger.d.ts +31 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/adapters/noLogger/noLogger.js +34 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/index.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/index.js +19 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/apolloTrackAdapterService/apolloTrackAdapterService.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/apolloTrackAdapterService/apolloTrackAdapterService.interface.d.ts +51 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/apolloTrackAdapterService/apolloTrackAdapterService.interface.js +24 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/apolloTrackAdapterService/apolloTrackAdapterService.js +13 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/apolloTrackAdapterService/index.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/apolloTrackAdapterService/index.js +6 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/index.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/index.js +19 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/consoleLoggerOptions.interface.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/consoleLoggerOptions.interface.js +3 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/index.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/index.js +6 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/loggerOptions.interface.d.ts +8 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/loggerOptions.interface.js +3 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/loggerService.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/infrastructure/services/loggerService/loggerService.js +24 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/index.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/index.js +19 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/metadata/index.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/metadata/index.js +7 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/metadata/versionMetadata.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/metadata/versionMetadata.js +6 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/error.interface.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/error.interface.js +12 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/index.d.ts +4 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/index.js +21 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/zodHelper/index.d.ts +3 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/zodHelper/index.js +6 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/zodHelper/zodHelper.d.ts +14 -0
- package/node_modules/@autonomous-testing/sdk/build/shared/utils/zodHelper/zodHelper.js +39 -0
- package/node_modules/@autonomous-testing/sdk/package.json +53 -0
- package/node_modules/asynckit/LICENSE +21 -0
- package/node_modules/asynckit/README.md +233 -0
- package/node_modules/asynckit/bench.js +76 -0
- package/node_modules/asynckit/index.js +6 -0
- package/node_modules/asynckit/lib/abort.js +29 -0
- package/node_modules/asynckit/lib/async.js +34 -0
- package/node_modules/asynckit/lib/defer.js +26 -0
- package/node_modules/asynckit/lib/iterate.js +75 -0
- package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/node_modules/asynckit/lib/state.js +37 -0
- package/node_modules/asynckit/lib/streamify.js +141 -0
- package/node_modules/asynckit/lib/terminator.js +29 -0
- package/node_modules/asynckit/package.json +63 -0
- package/node_modules/asynckit/parallel.js +43 -0
- package/node_modules/asynckit/serial.js +17 -0
- package/node_modules/asynckit/serialOrdered.js +75 -0
- package/node_modules/asynckit/stream.js +21 -0
- package/node_modules/axios/CHANGELOG.md +952 -0
- package/node_modules/axios/LICENSE +7 -0
- package/node_modules/axios/MIGRATION_GUIDE.md +3 -0
- package/node_modules/axios/README.md +1695 -0
- package/node_modules/axios/SECURITY.md +6 -0
- package/node_modules/axios/dist/axios.js +4172 -0
- package/node_modules/axios/dist/axios.js.map +1 -0
- package/node_modules/axios/dist/axios.min.js +2 -0
- package/node_modules/axios/dist/axios.min.js.map +1 -0
- package/node_modules/axios/dist/browser/axios.cjs +3638 -0
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -0
- package/node_modules/axios/dist/esm/axios.js +3661 -0
- package/node_modules/axios/dist/esm/axios.js.map +1 -0
- package/node_modules/axios/dist/esm/axios.min.js +2 -0
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -0
- package/node_modules/axios/dist/node/axios.cjs +4705 -0
- package/node_modules/axios/dist/node/axios.cjs.map +1 -0
- package/node_modules/axios/index.d.cts +545 -0
- package/node_modules/axios/index.d.ts +562 -0
- package/node_modules/axios/index.js +43 -0
- package/node_modules/axios/lib/adapters/README.md +37 -0
- package/node_modules/axios/lib/adapters/adapters.js +79 -0
- package/node_modules/axios/lib/adapters/fetch.js +227 -0
- package/node_modules/axios/lib/adapters/http.js +685 -0
- package/node_modules/axios/lib/adapters/xhr.js +190 -0
- package/node_modules/axios/lib/axios.js +89 -0
- package/node_modules/axios/lib/cancel/CancelToken.js +121 -0
- package/node_modules/axios/lib/cancel/CanceledError.js +25 -0
- package/node_modules/axios/lib/cancel/isCancel.js +5 -0
- package/node_modules/axios/lib/core/Axios.js +228 -0
- package/node_modules/axios/lib/core/AxiosError.js +100 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +302 -0
- package/node_modules/axios/lib/core/InterceptorManager.js +71 -0
- package/node_modules/axios/lib/core/README.md +8 -0
- package/node_modules/axios/lib/core/buildFullPath.js +21 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +81 -0
- package/node_modules/axios/lib/core/mergeConfig.js +106 -0
- package/node_modules/axios/lib/core/settle.js +27 -0
- package/node_modules/axios/lib/core/transformData.js +28 -0
- package/node_modules/axios/lib/defaults/index.js +161 -0
- package/node_modules/axios/lib/defaults/transitional.js +7 -0
- package/node_modules/axios/lib/env/README.md +3 -0
- package/node_modules/axios/lib/env/classes/FormData.js +2 -0
- package/node_modules/axios/lib/env/data.js +1 -0
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +192 -0
- package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +58 -0
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +71 -0
- package/node_modules/axios/lib/helpers/README.md +7 -0
- package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +28 -0
- package/node_modules/axios/lib/helpers/bind.js +7 -0
- package/node_modules/axios/lib/helpers/buildURL.js +63 -0
- package/node_modules/axios/lib/helpers/callbackify.js +16 -0
- package/node_modules/axios/lib/helpers/combineURLs.js +15 -0
- package/node_modules/axios/lib/helpers/composeSignals.js +46 -0
- package/node_modules/axios/lib/helpers/cookies.js +42 -0
- package/node_modules/axios/lib/helpers/deprecatedMethod.js +26 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +95 -0
- package/node_modules/axios/lib/helpers/formDataToStream.js +111 -0
- package/node_modules/axios/lib/helpers/fromDataURI.js +53 -0
- package/node_modules/axios/lib/helpers/isAbsoluteURL.js +15 -0
- package/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +67 -0
- package/node_modules/axios/lib/helpers/null.js +2 -0
- package/node_modules/axios/lib/helpers/parseHeaders.js +55 -0
- package/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
- package/node_modules/axios/lib/helpers/progressEventReducer.js +32 -0
- package/node_modules/axios/lib/helpers/readBlob.js +15 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +57 -0
- package/node_modules/axios/lib/helpers/speedometer.js +55 -0
- package/node_modules/axios/lib/helpers/spread.js +28 -0
- package/node_modules/axios/lib/helpers/throttle.js +35 -0
- package/node_modules/axios/lib/helpers/toFormData.js +219 -0
- package/node_modules/axios/lib/helpers/toURLEncodedForm.js +18 -0
- package/node_modules/axios/lib/helpers/trackStream.js +55 -0
- package/node_modules/axios/lib/helpers/validator.js +91 -0
- package/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
- package/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
- package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
- package/node_modules/axios/lib/platform/browser/index.js +13 -0
- package/node_modules/axios/lib/platform/common/utils.js +50 -0
- package/node_modules/axios/lib/platform/index.js +7 -0
- package/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
- package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
- package/node_modules/axios/lib/platform/node/index.js +12 -0
- package/node_modules/axios/lib/utils.js +728 -0
- package/node_modules/axios/package.json +219 -0
- package/node_modules/combined-stream/License +19 -0
- package/node_modules/combined-stream/Readme.md +138 -0
- package/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/node_modules/combined-stream/package.json +25 -0
- package/node_modules/delayed-stream/.npmignore +1 -0
- package/node_modules/delayed-stream/License +19 -0
- package/node_modules/delayed-stream/Makefile +7 -0
- package/node_modules/delayed-stream/Readme.md +141 -0
- package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/node_modules/delayed-stream/package.json +27 -0
- package/node_modules/follow-redirects/LICENSE +18 -0
- package/node_modules/follow-redirects/README.md +155 -0
- package/node_modules/follow-redirects/debug.js +15 -0
- package/node_modules/follow-redirects/http.js +1 -0
- package/node_modules/follow-redirects/https.js +1 -0
- package/node_modules/follow-redirects/index.js +672 -0
- package/node_modules/follow-redirects/package.json +58 -0
- package/node_modules/form-data/License +19 -0
- package/node_modules/form-data/README.md.bak +358 -0
- package/node_modules/form-data/Readme.md +358 -0
- package/node_modules/form-data/index.d.ts +62 -0
- package/node_modules/form-data/lib/browser.js +2 -0
- package/node_modules/form-data/lib/form_data.js +501 -0
- package/node_modules/form-data/lib/populate.js +10 -0
- package/node_modules/form-data/package.json +68 -0
- package/node_modules/mime-db/HISTORY.md +507 -0
- package/node_modules/mime-db/LICENSE +23 -0
- package/node_modules/mime-db/README.md +100 -0
- package/node_modules/mime-db/db.json +8519 -0
- package/node_modules/mime-db/index.js +12 -0
- package/node_modules/mime-db/package.json +60 -0
- package/node_modules/mime-types/HISTORY.md +397 -0
- package/node_modules/mime-types/LICENSE +23 -0
- package/node_modules/mime-types/README.md +113 -0
- package/node_modules/mime-types/index.js +188 -0
- package/node_modules/mime-types/package.json +44 -0
- package/node_modules/proxy-from-env/.eslintrc +29 -0
- package/node_modules/proxy-from-env/.travis.yml +10 -0
- package/node_modules/proxy-from-env/LICENSE +20 -0
- package/node_modules/proxy-from-env/README.md +131 -0
- package/node_modules/proxy-from-env/index.js +108 -0
- package/node_modules/proxy-from-env/package.json +34 -0
- package/node_modules/proxy-from-env/test.js +483 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +2876 -0
- package/node_modules/zod/index.d.ts +2 -0
- package/node_modules/zod/lib/ZodError.d.ts +164 -0
- package/node_modules/zod/lib/ZodError.js +137 -0
- package/node_modules/zod/lib/__tests__/Mocker.d.ts +17 -0
- package/node_modules/zod/lib/__tests__/Mocker.js +57 -0
- package/node_modules/zod/lib/benchmarks/datetime.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/datetime.js +54 -0
- package/node_modules/zod/lib/benchmarks/discriminatedUnion.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/discriminatedUnion.js +79 -0
- package/node_modules/zod/lib/benchmarks/index.d.ts +1 -0
- package/node_modules/zod/lib/benchmarks/index.js +59 -0
- package/node_modules/zod/lib/benchmarks/ipv4.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/ipv4.js +54 -0
- package/node_modules/zod/lib/benchmarks/object.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/object.js +70 -0
- package/node_modules/zod/lib/benchmarks/primitives.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/primitives.js +170 -0
- package/node_modules/zod/lib/benchmarks/realworld.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/realworld.js +56 -0
- package/node_modules/zod/lib/benchmarks/string.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/string.js +55 -0
- package/node_modules/zod/lib/benchmarks/union.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/union.js +79 -0
- package/node_modules/zod/lib/errors.d.ts +5 -0
- package/node_modules/zod/lib/errors.js +17 -0
- package/node_modules/zod/lib/external.d.ts +6 -0
- package/node_modules/zod/lib/external.js +18 -0
- package/node_modules/zod/lib/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/lib/helpers/enumUtil.js +2 -0
- package/node_modules/zod/lib/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/lib/helpers/errorUtil.js +8 -0
- package/node_modules/zod/lib/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/lib/helpers/parseUtil.js +125 -0
- package/node_modules/zod/lib/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/lib/helpers/partialUtil.js +2 -0
- package/node_modules/zod/lib/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/lib/helpers/typeAliases.js +2 -0
- package/node_modules/zod/lib/helpers/util.d.ts +82 -0
- package/node_modules/zod/lib/helpers/util.js +142 -0
- package/node_modules/zod/lib/index.d.ts +4 -0
- package/node_modules/zod/lib/index.js +29 -0
- package/node_modules/zod/lib/index.mjs +4236 -0
- package/node_modules/zod/lib/index.umd.js +4351 -0
- package/node_modules/zod/lib/locales/en.d.ts +3 -0
- package/node_modules/zod/lib/locales/en.js +129 -0
- package/node_modules/zod/lib/types.d.ts +1127 -0
- package/node_modules/zod/lib/types.js +3677 -0
- package/node_modules/zod/package.json +119 -0
- package/package.json +79 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adjusts data values based on the device pixel ratio.
|
|
3
|
+
*
|
|
4
|
+
* @param {T} data - The data to be adjusted.
|
|
5
|
+
* @param {number} devicePixelRatio - The device pixel ratio to scale the data.
|
|
6
|
+
* @returns {T} - The adjusted data.
|
|
7
|
+
*/
|
|
8
|
+
export function calculateDprData(data, devicePixelRatio) {
|
|
9
|
+
// Loop through each property in the data object
|
|
10
|
+
for (const key in data) {
|
|
11
|
+
if (typeof data[key] === 'number') {
|
|
12
|
+
// Multiply numeric values by the device pixel ratio
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
data[key] *= devicePixelRatio;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Waits for a specified amount of time.
|
|
21
|
+
*
|
|
22
|
+
* @param milliseconds - The time to wait in milliseconds.
|
|
23
|
+
* @returns A Promise that resolves after the specified time.
|
|
24
|
+
*/
|
|
25
|
+
export async function waitFor(milliseconds) {
|
|
26
|
+
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves the size of a screenshot in pixels, adjusted for device pixel ratio.
|
|
30
|
+
*
|
|
31
|
+
* @param screenshot - The screenshot data in base64 format.
|
|
32
|
+
* @param devicePixelRatio - The device pixel ratio (default is 1).
|
|
33
|
+
* @returns An object containing the width and height of the screenshot.
|
|
34
|
+
*/
|
|
35
|
+
export function getScreenshotSize(screenshot, devicePixelRatio = 1) {
|
|
36
|
+
const buffer = Buffer.from(screenshot, 'base64');
|
|
37
|
+
const height = buffer.readUInt32BE(20) / devicePixelRatio;
|
|
38
|
+
const width = buffer.readUInt32BE(16) / devicePixelRatio;
|
|
39
|
+
return { width, height };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Retrieve various screen dimensions for mobile run.
|
|
43
|
+
*
|
|
44
|
+
* @returns {ScreenDimensions} - An object containing dimensions for body, HTML, and window properties.
|
|
45
|
+
*/
|
|
46
|
+
export async function getScreenDimensionsMobile(methods) {
|
|
47
|
+
const size = await methods.getWindowSize();
|
|
48
|
+
const { width, height } = size;
|
|
49
|
+
const bodyDimensions = {
|
|
50
|
+
scrollHeight: 0,
|
|
51
|
+
offsetHeight: 0,
|
|
52
|
+
};
|
|
53
|
+
const htmlDimensions = {
|
|
54
|
+
clientHeight: height,
|
|
55
|
+
clientWidth: width,
|
|
56
|
+
scrollHeight: 0,
|
|
57
|
+
scrollWidth: 0,
|
|
58
|
+
offsetHeight: 0,
|
|
59
|
+
};
|
|
60
|
+
const windowDimensions = {
|
|
61
|
+
innerWidth: width,
|
|
62
|
+
innerHeight: height,
|
|
63
|
+
outerHeight: height,
|
|
64
|
+
outerWidth: width,
|
|
65
|
+
devicePixelRatio: 1,
|
|
66
|
+
screenWidth: width,
|
|
67
|
+
screenHeight: height,
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
dimensions: {
|
|
71
|
+
body: bodyDimensions,
|
|
72
|
+
html: htmlDimensions,
|
|
73
|
+
window: windowDimensions,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/desktopBrowser/helpers/utils.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAI,IAAO,EAAE,gBAAwB;IACnE,gDAAgD;IAChD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YAClC,oDAAoD;YACpD,aAAa;YACb,IAAI,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC;QAChC,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,YAAoB;IAChD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkB,EAAE,gBAAgB,GAAG,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC;IAC1D,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,GAAG,gBAAgB,CAAC;IAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,OAAgB;IAC9D,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC;IAC3C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAE/B,MAAM,cAAc,GAAG;QACrB,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;KAChB,CAAC;IAEF,MAAM,cAAc,GAAG;QACrB,YAAY,EAAE,MAAM;QACpB,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;KAChB,CAAC;IAEF,MAAM,gBAAgB,GAAG;QACvB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,CAAC;QACnB,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,MAAM;KACrB,CAAC;IAEF,OAAO;QACL,UAAU,EAAE;YACV,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,gBAAgB;SACzB;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { Methods } from '../../domain/model/methods.interface.js';\nimport { ScreenshotSize } from '../../domain/model/screenshotSize.interface.js';\nimport { ScreenDimensions } from '../clientSideScript/screenDimensions.interfaces.js';\n\n/**\n * Adjusts data values based on the device pixel ratio.\n *\n * @param {T} data - The data to be adjusted.\n * @param {number} devicePixelRatio - The device pixel ratio to scale the data.\n * @returns {T} - The adjusted data.\n */\nexport function calculateDprData<T>(data: T, devicePixelRatio: number): T {\n // Loop through each property in the data object\n for (const key in data) {\n if (typeof data[key] === 'number') {\n // Multiply numeric values by the device pixel ratio\n // @ts-ignore\n data[key] *= devicePixelRatio;\n }\n }\n\n return data;\n}\n\n/**\n * Waits for a specified amount of time.\n *\n * @param milliseconds - The time to wait in milliseconds.\n * @returns A Promise that resolves after the specified time.\n */\nexport async function waitFor(milliseconds: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, milliseconds));\n}\n\n/**\n * Retrieves the size of a screenshot in pixels, adjusted for device pixel ratio.\n *\n * @param screenshot - The screenshot data in base64 format.\n * @param devicePixelRatio - The device pixel ratio (default is 1).\n * @returns An object containing the width and height of the screenshot.\n */\nexport function getScreenshotSize(screenshot: string, devicePixelRatio = 1): ScreenshotSize {\n const buffer = Buffer.from(screenshot, 'base64');\n const height = buffer.readUInt32BE(20) / devicePixelRatio;\n const width = buffer.readUInt32BE(16) / devicePixelRatio;\n\n return { width, height };\n}\n\n/**\n * Retrieve various screen dimensions for mobile run.\n *\n * @returns {ScreenDimensions} - An object containing dimensions for body, HTML, and window properties.\n */\nexport async function getScreenDimensionsMobile(methods: Methods): Promise<ScreenDimensions> {\n const size = await methods.getWindowSize();\n const { width, height } = size;\n\n const bodyDimensions = {\n scrollHeight: 0,\n offsetHeight: 0,\n };\n\n const htmlDimensions = {\n clientHeight: height,\n clientWidth: width,\n scrollHeight: 0,\n scrollWidth: 0,\n offsetHeight: 0,\n };\n\n const windowDimensions = {\n innerWidth: width,\n innerHeight: height,\n outerHeight: height,\n outerWidth: width,\n devicePixelRatio: 1,\n screenWidth: width,\n screenHeight: height,\n };\n\n return {\n dimensions: {\n body: bodyDimensions,\n html: htmlDimensions,\n window: windowDimensions,\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ScreenshotOutput } from '../domain/model/screenshotOutput.interface.js';
|
|
2
|
+
import trackElement from './commands/trackElement.js';
|
|
3
|
+
import trackFullPageScreen from './commands/trackFullPageScreen.js';
|
|
4
|
+
import trackImage from './commands/trackImage.js';
|
|
5
|
+
import trackScreen from './commands/trackScreen.js';
|
|
6
|
+
import { InstanceData } from './methods/instanceData.interfaces.js';
|
|
7
|
+
export { trackImage, ScreenshotOutput, trackScreen, trackElement, trackFullPageScreen, InstanceData };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/desktopBrowser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,mBAAmB,MAAM,mCAAmC,CAAC;AACpE,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import trackElement from './commands/trackElement.js';
|
|
2
|
+
import trackFullPageScreen from './commands/trackFullPageScreen.js';
|
|
3
|
+
import trackImage from './commands/trackImage.js';
|
|
4
|
+
import trackScreen from './commands/trackScreen.js';
|
|
5
|
+
export { trackImage, trackScreen, trackElement, trackFullPageScreen };
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/desktopBrowser/index.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,mBAAmB,MAAM,mCAAmC,CAAC;AACpE,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAoB,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAgB,CAAC","sourcesContent":["import { ScreenshotOutput } from '../domain/model/screenshotOutput.interface.js';\nimport trackElement from './commands/trackElement.js';\nimport trackFullPageScreen from './commands/trackFullPageScreen.js';\nimport trackImage from './commands/trackImage.js';\nimport trackScreen from './commands/trackScreen.js';\nimport { InstanceData } from './methods/instanceData.interfaces.js';\n\nexport { trackImage, ScreenshotOutput, trackScreen, trackElement, trackFullPageScreen, InstanceData };\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ElementPosition } from '../../core/domain/valueObjects/elementPosition.interface.js';
|
|
2
|
+
import { WopeeService } from '../../domain/service/wopeeService.js';
|
|
3
|
+
import { Executor } from './methods.interface.js';
|
|
4
|
+
/**
|
|
5
|
+
* Get the position of an element on a desktop browser.
|
|
6
|
+
*
|
|
7
|
+
* @param {Executor} executor - The function to execute JavaScript in the browser.
|
|
8
|
+
* @param {HTMLElement} element - The element for which the position is to be determined.
|
|
9
|
+
* @param {Object} options - Additional options for calculating the position.
|
|
10
|
+
* @param {number} options.innerHeight - The inner height of the screen.
|
|
11
|
+
* @param {number} options.screenshotHeight - The height of the screenshot.
|
|
12
|
+
*
|
|
13
|
+
* @returns {Promise<ElementPosition>} - A Promise that resolves to an object with position properties.
|
|
14
|
+
* @property {number} height - The height of the element.
|
|
15
|
+
* @property {number} width - The width of the element.
|
|
16
|
+
* @property {number} x - The X-coordinate of the element's top-left corner.
|
|
17
|
+
* @property {number} y - The Y-coordinate of the element's top-left corner.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getElementPositionDesktop(wopeeService: WopeeService, executor: Executor, element: WebdriverIO.Element, { innerHeight, screenshotHeight }: {
|
|
20
|
+
innerHeight: number;
|
|
21
|
+
screenshotHeight: number;
|
|
22
|
+
}): Promise<ElementPosition>;
|
|
23
|
+
//# sourceMappingURL=elementPosition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementPosition.d.ts","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/elementPosition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,WAAW,CAAC,OAAO,EAC5B,EAAE,WAAW,EAAE,gBAAgB,EAAE,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,GACnF,OAAO,CAAC,eAAe,CAAC,CAQ1B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the position of an element on a desktop browser.
|
|
3
|
+
*
|
|
4
|
+
* @param {Executor} executor - The function to execute JavaScript in the browser.
|
|
5
|
+
* @param {HTMLElement} element - The element for which the position is to be determined.
|
|
6
|
+
* @param {Object} options - Additional options for calculating the position.
|
|
7
|
+
* @param {number} options.innerHeight - The inner height of the screen.
|
|
8
|
+
* @param {number} options.screenshotHeight - The height of the screenshot.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<ElementPosition>} - A Promise that resolves to an object with position properties.
|
|
11
|
+
* @property {number} height - The height of the element.
|
|
12
|
+
* @property {number} width - The width of the element.
|
|
13
|
+
* @property {number} x - The X-coordinate of the element's top-left corner.
|
|
14
|
+
* @property {number} y - The Y-coordinate of the element's top-left corner.
|
|
15
|
+
*/
|
|
16
|
+
export async function getElementPositionDesktop(wopeeService, executor, element, { innerHeight, screenshotHeight }) {
|
|
17
|
+
if (screenshotHeight > innerHeight) {
|
|
18
|
+
// Calculate position using DOM method when screenshot height is greater than inner height.
|
|
19
|
+
return wopeeService.clientSideScript.getElementPositionTopDom(executor, element);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
// Calculate position using window method when screenshot height is not greater than inner height.
|
|
23
|
+
return wopeeService.clientSideScript.getElementPositionTopWindow(executor, element);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=elementPosition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementPosition.js","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/elementPosition.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,YAA0B,EAC1B,QAAkB,EAClB,OAA4B,EAC5B,EAAE,WAAW,EAAE,gBAAgB,EAAqD;IAEpF,IAAI,gBAAgB,GAAG,WAAW,EAAE,CAAC;QACnC,2FAA2F;QAC3F,OAAO,YAAY,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnF,CAAC;SAAM,CAAC;QACN,kGAAkG;QAClG,OAAO,YAAY,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;AACH,CAAC","sourcesContent":["import { ElementPosition } from '../../core/domain/valueObjects/elementPosition.interface.js';\nimport { WopeeService } from '../../domain/service/wopeeService.js';\nimport { Executor } from './methods.interface.js';\n\n/**\n * Get the position of an element on a desktop browser.\n *\n * @param {Executor} executor - The function to execute JavaScript in the browser.\n * @param {HTMLElement} element - The element for which the position is to be determined.\n * @param {Object} options - Additional options for calculating the position.\n * @param {number} options.innerHeight - The inner height of the screen.\n * @param {number} options.screenshotHeight - The height of the screenshot.\n *\n * @returns {Promise<ElementPosition>} - A Promise that resolves to an object with position properties.\n * @property {number} height - The height of the element.\n * @property {number} width - The width of the element.\n * @property {number} x - The X-coordinate of the element's top-left corner.\n * @property {number} y - The Y-coordinate of the element's top-left corner.\n */\nexport async function getElementPositionDesktop(\n wopeeService: WopeeService,\n executor: Executor,\n element: WebdriverIO.Element,\n { innerHeight, screenshotHeight }: { innerHeight: number; screenshotHeight: number },\n): Promise<ElementPosition> {\n if (screenshotHeight > innerHeight) {\n // Calculate position using DOM method when screenshot height is greater than inner height.\n return wopeeService.clientSideScript.getElementPositionTopDom(executor, element);\n } else {\n // Calculate position using window method when screenshot height is not greater than inner height.\n return wopeeService.clientSideScript.getElementPositionTopWindow(executor, element);\n }\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CroppedBase64Image, RotateBase64ImageOptions } from './images.interfaces.js';
|
|
2
|
+
import { FullPageScreenshotsData } from './screenshots.interfaces.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a cropped base64 image using Canvas.
|
|
5
|
+
*
|
|
6
|
+
* @param {CroppedBase64Image} params - Parameters for creating the cropped image.
|
|
7
|
+
* @returns {Promise<string>} - A Promise that resolves to the base64 representation of the cropped image.
|
|
8
|
+
*/
|
|
9
|
+
export declare function makeCroppedBase64Image({ base64Image, devicePixelRatio, isLandscape, rectangles, instanceData, croppingOptions, }: CroppedBase64Image): Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a full-page image from a series of screenshots and return it as a base64-encoded string.
|
|
12
|
+
* @param screenshotsData - Information about the screenshots and their placement.
|
|
13
|
+
* @param devicePixelRatio - The device's pixel ratio for rendering.
|
|
14
|
+
* @returns A base64-encoded string representing the full-page image.
|
|
15
|
+
*/
|
|
16
|
+
export declare function makeFullPageBase64Image(screenshotsData: FullPageScreenshotsData, { devicePixelRatio, isLandscape }: {
|
|
17
|
+
devicePixelRatio: number;
|
|
18
|
+
isLandscape: boolean;
|
|
19
|
+
}): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Rotate a base64 image by the specified number of degrees.
|
|
22
|
+
*
|
|
23
|
+
* @param {RotateBase64ImageOptions} options - Options for rotating the base64 image.
|
|
24
|
+
* @returns {Promise<string>} - A Promise that resolves to the base64 representation of the rotated image.
|
|
25
|
+
*/
|
|
26
|
+
export declare function rotateBase64Image({ base64Image, degrees, newHeight, newWidth, }: RotateBase64ImageOptions): Promise<string>;
|
|
27
|
+
//# sourceMappingURL=images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/images.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAGtE;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,eAAe,GAChB,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CA8CtC;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,eAAe,EAAE,uBAAuB,EACxC,EAAE,gBAAgB,EAAE,WAAW,EAAE,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,GACpF,OAAO,CAAC,MAAM,CAAC,CAiDjB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,WAAW,EACX,OAAO,EACP,SAAS,EACT,QAAQ,GACT,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB5C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CroppingOptions } from '../../domain/model/config.interface.js';
|
|
2
|
+
import { InstanceData } from './instanceData.interfaces.js';
|
|
3
|
+
import { RectanglesOutput } from './rectangles.interfaces.js';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a cropped image in base64 format with associated metadata.
|
|
6
|
+
*/
|
|
7
|
+
export interface CroppedBase64Image {
|
|
8
|
+
/** The base64 encoded image. */
|
|
9
|
+
base64Image: string;
|
|
10
|
+
/** The device pixel ratio. */
|
|
11
|
+
devicePixelRatio: number;
|
|
12
|
+
isLandscape: boolean;
|
|
13
|
+
/** Output rectangles information. */
|
|
14
|
+
rectangles: RectanglesOutput;
|
|
15
|
+
instanceData: InstanceData;
|
|
16
|
+
croppingOptions: CroppingOptions;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Represents options for rotating a base64 encoded image.
|
|
20
|
+
*/
|
|
21
|
+
export interface RotateBase64ImageOptions {
|
|
22
|
+
/** The base64 encoded image. */
|
|
23
|
+
base64Image: string;
|
|
24
|
+
/** The degrees to rotate the image by. */
|
|
25
|
+
degrees: number;
|
|
26
|
+
/** The new height of the rotated image. */
|
|
27
|
+
newHeight: number;
|
|
28
|
+
/** The new width of the rotated image. */
|
|
29
|
+
newWidth: number;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=images.interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.interfaces.d.ts","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/images.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,qCAAqC;IACrC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,eAAe,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.interfaces.js","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/images.interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { CroppingOptions } from '../../domain/model/config.interface.js';\nimport { InstanceData } from './instanceData.interfaces.js';\nimport { RectanglesOutput } from './rectangles.interfaces.js';\n\n/**\n * Represents a cropped image in base64 format with associated metadata.\n */\nexport interface CroppedBase64Image {\n /** The base64 encoded image. */\n base64Image: string;\n /** The device pixel ratio. */\n devicePixelRatio: number;\n isLandscape: boolean;\n /** Output rectangles information. */\n rectangles: RectanglesOutput;\n instanceData: InstanceData;\n croppingOptions: CroppingOptions;\n}\n\n/**\n * Represents options for rotating a base64 encoded image.\n */\nexport interface RotateBase64ImageOptions {\n /** The base64 encoded image. */\n base64Image: string;\n /** The degrees to rotate the image by. */\n degrees: number;\n /** The new height of the rotated image. */\n newHeight: number;\n /** The new width of the rotated image. */\n newWidth: number;\n}\n"]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { getScreenshotSize } from '../helpers/utils.js';
|
|
2
|
+
import { createCanvas, loadImage } from 'canvas';
|
|
3
|
+
/**
|
|
4
|
+
* Create a cropped base64 image using Canvas.
|
|
5
|
+
*
|
|
6
|
+
* @param {CroppedBase64Image} params - Parameters for creating the cropped image.
|
|
7
|
+
* @returns {Promise<string>} - A Promise that resolves to the base64 representation of the cropped image.
|
|
8
|
+
*/
|
|
9
|
+
export async function makeCroppedBase64Image({ base64Image, devicePixelRatio, isLandscape, rectangles, instanceData, croppingOptions, }) {
|
|
10
|
+
// Determine if the image is rotated
|
|
11
|
+
const { height: screenshotHeight, width: screenshotWidth } = getScreenshotSize(base64Image, devicePixelRatio);
|
|
12
|
+
const isRotated = isLandscape && screenshotHeight > screenshotWidth;
|
|
13
|
+
// Rotate the image if necessary
|
|
14
|
+
const newBase64Image = isRotated
|
|
15
|
+
? await rotateBase64Image({
|
|
16
|
+
base64Image,
|
|
17
|
+
degrees: -90,
|
|
18
|
+
newHeight: screenshotWidth,
|
|
19
|
+
newWidth: screenshotHeight,
|
|
20
|
+
})
|
|
21
|
+
: base64Image;
|
|
22
|
+
const { height, width } = rectangles;
|
|
23
|
+
let canvasWidth = null;
|
|
24
|
+
let canvasHeight = null;
|
|
25
|
+
if (instanceData.isMobile) {
|
|
26
|
+
canvasWidth = screenshotWidth;
|
|
27
|
+
canvasHeight = screenshotHeight;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
canvasHeight = height;
|
|
31
|
+
canvasWidth = width;
|
|
32
|
+
}
|
|
33
|
+
// Create a canvas and load the image
|
|
34
|
+
const canvas = createCanvas(canvasWidth, canvasHeight);
|
|
35
|
+
const image = await loadImage(`data:image/png;base64,${newBase64Image}`);
|
|
36
|
+
const ctx = canvas.getContext('2d');
|
|
37
|
+
const xCropLeft = croppingOptions.xCropLeft;
|
|
38
|
+
const xCropRight = croppingOptions.xCropRight;
|
|
39
|
+
const yCropTop = croppingOptions.yCropTop;
|
|
40
|
+
const yCropBottom = croppingOptions.yCropBottom;
|
|
41
|
+
const sourceXStart = xCropLeft;
|
|
42
|
+
const sourceYStart = yCropTop;
|
|
43
|
+
canvasHeight = canvasHeight - yCropTop - yCropBottom;
|
|
44
|
+
canvasWidth = canvasWidth - xCropLeft - xCropRight;
|
|
45
|
+
// Draw the cropped portion of the image onto the canvas
|
|
46
|
+
ctx.drawImage(image, sourceXStart, sourceYStart, canvasWidth, canvasHeight, 0, 0, canvasWidth, canvasHeight);
|
|
47
|
+
// Convert the canvas to a base64 data URL and return it
|
|
48
|
+
return canvas.toDataURL().replace(/^data:image\/png;base64,/, '');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create a full-page image from a series of screenshots and return it as a base64-encoded string.
|
|
52
|
+
* @param screenshotsData - Information about the screenshots and their placement.
|
|
53
|
+
* @param devicePixelRatio - The device's pixel ratio for rendering.
|
|
54
|
+
* @returns A base64-encoded string representing the full-page image.
|
|
55
|
+
*/
|
|
56
|
+
export async function makeFullPageBase64Image(screenshotsData, { devicePixelRatio, isLandscape }) {
|
|
57
|
+
// Calculate the canvas dimensions
|
|
58
|
+
const canvasWidth = screenshotsData.fullPageWidth;
|
|
59
|
+
const canvasHeight = screenshotsData.fullPageHeight;
|
|
60
|
+
// Create a canvas element and get its 2D rendering context
|
|
61
|
+
const canvas = createCanvas(canvasWidth, canvasHeight);
|
|
62
|
+
const ctx = canvas.getContext('2d');
|
|
63
|
+
// Iterate through the screenshots and render them onto the canvas
|
|
64
|
+
for (let i = 0; i < screenshotsData.data.length; i++) {
|
|
65
|
+
const screenshotData = screenshotsData.data[i];
|
|
66
|
+
const currentScreenshot = screenshotData.screenshot;
|
|
67
|
+
// Determine if the image needs to be rotated
|
|
68
|
+
const { height: screenshotHeight, width: screenshotWidth } = getScreenshotSize(currentScreenshot, devicePixelRatio);
|
|
69
|
+
const isRotated = isLandscape && screenshotHeight > screenshotWidth;
|
|
70
|
+
// Rotate the image if necessary
|
|
71
|
+
const newBase64Image = isRotated
|
|
72
|
+
? await rotateBase64Image({
|
|
73
|
+
base64Image: currentScreenshot,
|
|
74
|
+
degrees: -90,
|
|
75
|
+
newHeight: screenshotWidth,
|
|
76
|
+
newWidth: screenshotHeight,
|
|
77
|
+
})
|
|
78
|
+
: currentScreenshot;
|
|
79
|
+
// Load the rotated image
|
|
80
|
+
const image = await loadImage(`data:image/png;base64,${newBase64Image}`);
|
|
81
|
+
// Draw the image onto the canvas
|
|
82
|
+
ctx.drawImage(image, screenshotData.imageXPosition, screenshotData.imageYPosition, screenshotData.imageWidth, screenshotData.imageHeight, 0, screenshotData.canvasYPosition, screenshotData.imageWidth, screenshotData.imageHeight);
|
|
83
|
+
}
|
|
84
|
+
// Convert the canvas to a base64-encoded PNG
|
|
85
|
+
const base64Image = canvas.toDataURL().replace(/^data:image\/png;base64,/, '');
|
|
86
|
+
return base64Image;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Rotate a base64 image by the specified number of degrees.
|
|
90
|
+
*
|
|
91
|
+
* @param {RotateBase64ImageOptions} options - Options for rotating the base64 image.
|
|
92
|
+
* @returns {Promise<string>} - A Promise that resolves to the base64 representation of the rotated image.
|
|
93
|
+
*/
|
|
94
|
+
export async function rotateBase64Image({ base64Image, degrees, newHeight, newWidth, }) {
|
|
95
|
+
// Create a canvas and load the image
|
|
96
|
+
const canvas = createCanvas(newWidth, newHeight);
|
|
97
|
+
const ctx = canvas.getContext('2d');
|
|
98
|
+
const image = await loadImage(`data:image/png;base64,${base64Image}`);
|
|
99
|
+
// Set canvas dimensions based on rotation angle
|
|
100
|
+
canvas.width = degrees % 180 === 0 ? image.width : image.height;
|
|
101
|
+
canvas.height = degrees % 180 === 0 ? image.height : image.width;
|
|
102
|
+
// Translate and rotate the image on the canvas
|
|
103
|
+
ctx.translate(canvas.width / 2, canvas.height / 2);
|
|
104
|
+
ctx.rotate((degrees * Math.PI) / 180);
|
|
105
|
+
ctx.drawImage(image, image.width / -2, image.height / -2);
|
|
106
|
+
// Return the rotated image as base64
|
|
107
|
+
return canvas.toDataURL().replace(/^data:image\/png;base64,/, '');
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=images.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.js","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,EAC3C,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,eAAe,GACI;IACnB,oCAAoC;IACpC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IAC9G,MAAM,SAAS,GAAG,WAAW,IAAI,gBAAgB,GAAG,eAAe,CAAC;IAEpE,gCAAgC;IAChC,MAAM,cAAc,GAAG,SAAS;QAC9B,CAAC,CAAC,MAAM,iBAAiB,CAAC;YACtB,WAAW;YACX,OAAO,EAAE,CAAC,EAAE;YACZ,SAAS,EAAE,eAAe;YAC1B,QAAQ,EAAE,gBAAgB;SAC3B,CAAC;QACJ,CAAC,CAAC,WAAW,CAAC;IAEhB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;IACrC,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,YAAY,GAAG,IAAI,CAAC;IACxB,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC1B,WAAW,GAAG,eAAe,CAAC;QAC9B,YAAY,GAAG,gBAAgB,CAAC;IAClC,CAAC;SAAM,CAAC;QACN,YAAY,GAAG,MAAM,CAAC;QACtB,WAAW,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,qCAAqC;IACrC,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,yBAAyB,cAAc,EAAE,CAAC,CAAC;IACzE,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAEpC,MAAM,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC;IAC5C,MAAM,UAAU,GAAG,eAAe,CAAC,UAAU,CAAC;IAC9C,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;IAC1C,MAAM,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC;IAEhD,MAAM,YAAY,GAAG,SAAS,CAAC;IAC/B,MAAM,YAAY,GAAG,QAAQ,CAAC;IAC9B,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,WAAW,CAAC;IACrD,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;IAEnD,wDAAwD;IACxD,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;IAE7G,wDAAwD;IACxD,OAAO,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;AACpE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,eAAwC,EACxC,EAAE,gBAAgB,EAAE,WAAW,EAAsD;IAErF,kCAAkC;IAClC,MAAM,WAAW,GAAG,eAAe,CAAC,aAAa,CAAC;IAClD,MAAM,YAAY,GAAG,eAAe,CAAC,cAAc,CAAC;IAEpD,2DAA2D;IAC3D,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACvD,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAEpC,kEAAkE;IAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrD,MAAM,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/C,MAAM,iBAAiB,GAAG,cAAc,CAAC,UAAU,CAAC;QAEpD,6CAA6C;QAC7C,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;QACpH,MAAM,SAAS,GAAG,WAAW,IAAI,gBAAgB,GAAG,eAAe,CAAC;QAEpE,gCAAgC;QAChC,MAAM,cAAc,GAAG,SAAS;YAC9B,CAAC,CAAC,MAAM,iBAAiB,CAAC;gBACtB,WAAW,EAAE,iBAAiB;gBAC9B,OAAO,EAAE,CAAC,EAAE;gBACZ,SAAS,EAAE,eAAe;gBAC1B,QAAQ,EAAE,gBAAgB;aAC3B,CAAC;YACJ,CAAC,CAAC,iBAAiB,CAAC;QAEtB,yBAAyB;QACzB,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,yBAAyB,cAAc,EAAE,CAAC,CAAC;QAEzE,iCAAiC;QACjC,GAAG,CAAC,SAAS,CACX,KAAK,EACL,cAAc,CAAC,cAAc,EAC7B,cAAc,CAAC,cAAc,EAC7B,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,WAAW,EAC1B,CAAC,EACD,cAAc,CAAC,eAAe,EAC9B,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,WAAW,CAC3B,CAAC;IACJ,CAAC;IAED,6CAA6C;IAC7C,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;IAE/E,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,WAAW,EACX,OAAO,EACP,SAAS,EACT,QAAQ,GACiB;IACzB,qCAAqC;IACrC,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACjD,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC;IAEtE,gDAAgD;IAChD,MAAM,CAAC,KAAK,GAAG,OAAO,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IAChE,MAAM,CAAC,MAAM,GAAG,OAAO,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IAEjE,+CAA+C;IAC/C,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnD,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;IACtC,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAE1D,qCAAqC;IACrC,OAAO,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import { getScreenshotSize } from '../helpers/utils.js';\nimport { CroppedBase64Image, RotateBase64ImageOptions } from './images.interfaces.js';\nimport { FullPageScreenshotsData } from './screenshots.interfaces.js';\nimport { createCanvas, loadImage } from 'canvas';\n\n/**\n * Create a cropped base64 image using Canvas.\n *\n * @param {CroppedBase64Image} params - Parameters for creating the cropped image.\n * @returns {Promise<string>} - A Promise that resolves to the base64 representation of the cropped image.\n */\nexport async function makeCroppedBase64Image({\n base64Image,\n devicePixelRatio,\n isLandscape,\n rectangles,\n instanceData,\n croppingOptions,\n}: CroppedBase64Image): Promise<string> {\n // Determine if the image is rotated\n const { height: screenshotHeight, width: screenshotWidth } = getScreenshotSize(base64Image, devicePixelRatio);\n const isRotated = isLandscape && screenshotHeight > screenshotWidth;\n\n // Rotate the image if necessary\n const newBase64Image = isRotated\n ? await rotateBase64Image({\n base64Image,\n degrees: -90,\n newHeight: screenshotWidth,\n newWidth: screenshotHeight,\n })\n : base64Image;\n\n const { height, width } = rectangles;\n let canvasWidth = null;\n let canvasHeight = null;\n if (instanceData.isMobile) {\n canvasWidth = screenshotWidth;\n canvasHeight = screenshotHeight;\n } else {\n canvasHeight = height;\n canvasWidth = width;\n }\n\n // Create a canvas and load the image\n const canvas = createCanvas(canvasWidth, canvasHeight);\n const image = await loadImage(`data:image/png;base64,${newBase64Image}`);\n const ctx = canvas.getContext('2d');\n\n const xCropLeft = croppingOptions.xCropLeft;\n const xCropRight = croppingOptions.xCropRight;\n const yCropTop = croppingOptions.yCropTop;\n const yCropBottom = croppingOptions.yCropBottom;\n\n const sourceXStart = xCropLeft;\n const sourceYStart = yCropTop;\n canvasHeight = canvasHeight - yCropTop - yCropBottom;\n canvasWidth = canvasWidth - xCropLeft - xCropRight;\n\n // Draw the cropped portion of the image onto the canvas\n ctx.drawImage(image, sourceXStart, sourceYStart, canvasWidth, canvasHeight, 0, 0, canvasWidth, canvasHeight);\n\n // Convert the canvas to a base64 data URL and return it\n return canvas.toDataURL().replace(/^data:image\\/png;base64,/, '');\n}\n\n/**\n * Create a full-page image from a series of screenshots and return it as a base64-encoded string.\n * @param screenshotsData - Information about the screenshots and their placement.\n * @param devicePixelRatio - The device's pixel ratio for rendering.\n * @returns A base64-encoded string representing the full-page image.\n */\nexport async function makeFullPageBase64Image(\n screenshotsData: FullPageScreenshotsData,\n { devicePixelRatio, isLandscape }: { devicePixelRatio: number; isLandscape: boolean },\n): Promise<string> {\n // Calculate the canvas dimensions\n const canvasWidth = screenshotsData.fullPageWidth;\n const canvasHeight = screenshotsData.fullPageHeight;\n\n // Create a canvas element and get its 2D rendering context\n const canvas = createCanvas(canvasWidth, canvasHeight);\n const ctx = canvas.getContext('2d');\n\n // Iterate through the screenshots and render them onto the canvas\n for (let i = 0; i < screenshotsData.data.length; i++) {\n const screenshotData = screenshotsData.data[i];\n const currentScreenshot = screenshotData.screenshot;\n\n // Determine if the image needs to be rotated\n const { height: screenshotHeight, width: screenshotWidth } = getScreenshotSize(currentScreenshot, devicePixelRatio);\n const isRotated = isLandscape && screenshotHeight > screenshotWidth;\n\n // Rotate the image if necessary\n const newBase64Image = isRotated\n ? await rotateBase64Image({\n base64Image: currentScreenshot,\n degrees: -90,\n newHeight: screenshotWidth,\n newWidth: screenshotHeight,\n })\n : currentScreenshot;\n\n // Load the rotated image\n const image = await loadImage(`data:image/png;base64,${newBase64Image}`);\n\n // Draw the image onto the canvas\n ctx.drawImage(\n image,\n screenshotData.imageXPosition,\n screenshotData.imageYPosition,\n screenshotData.imageWidth,\n screenshotData.imageHeight,\n 0,\n screenshotData.canvasYPosition,\n screenshotData.imageWidth,\n screenshotData.imageHeight,\n );\n }\n\n // Convert the canvas to a base64-encoded PNG\n const base64Image = canvas.toDataURL().replace(/^data:image\\/png;base64,/, '');\n\n return base64Image;\n}\n\n/**\n * Rotate a base64 image by the specified number of degrees.\n *\n * @param {RotateBase64ImageOptions} options - Options for rotating the base64 image.\n * @returns {Promise<string>} - A Promise that resolves to the base64 representation of the rotated image.\n */\nexport async function rotateBase64Image({\n base64Image,\n degrees,\n newHeight,\n newWidth,\n}: RotateBase64ImageOptions): Promise<string> {\n // Create a canvas and load the image\n const canvas = createCanvas(newWidth, newHeight);\n const ctx = canvas.getContext('2d');\n const image = await loadImage(`data:image/png;base64,${base64Image}`);\n\n // Set canvas dimensions based on rotation angle\n canvas.width = degrees % 180 === 0 ? image.width : image.height;\n canvas.height = degrees % 180 === 0 ? image.height : image.width;\n\n // Translate and rotate the image on the canvas\n ctx.translate(canvas.width / 2, canvas.height / 2);\n ctx.rotate((degrees * Math.PI) / 180);\n ctx.drawImage(image, image.width / -2, image.height / -2);\n\n // Return the rotated image as base64\n return canvas.toDataURL().replace(/^data:image\\/png;base64,/, '');\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ScreenDimensions } from '../clientSideScript/screenDimensions.interfaces.js';
|
|
2
|
+
export interface InstanceData {
|
|
3
|
+
browserName: string;
|
|
4
|
+
browserVersion: string;
|
|
5
|
+
isMobile: boolean;
|
|
6
|
+
capabilities: WebdriverIO.Capabilities;
|
|
7
|
+
}
|
|
8
|
+
export interface EnrichedInstanceData extends ScreenDimensions, InstanceData {
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=instanceData.interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instanceData.interfaces.d.ts","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/instanceData.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAGtF,MAAM,WAAW,YAAY;IAE3B,WAAW,EAAE,MAAM,CAAC;IAEpB,cAAc,EAAE,MAAM,CAAC;IAEvB,QAAQ,EAAE,OAAO,CAAC;IAElB,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC;CACxC;AAGD,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB,EAAE,YAAY;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instanceData.interfaces.js","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/instanceData.interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { ScreenDimensions } from '../clientSideScript/screenDimensions.interfaces.js';\n\n// Represents the data associated with an instance.\nexport interface InstanceData {\n // The name of the browser used by the instance.\n browserName: string;\n // The version of the browser used by the instance.\n browserVersion: string;\n // Is mobile or not\n isMobile: boolean;\n // Browser capabilities\n capabilities: WebdriverIO.Capabilities;\n}\n\n// Represents enriched instance data combining screen dimensions and instance options.\nexport interface EnrichedInstanceData extends ScreenDimensions, InstanceData {}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A type representing a function that captures a screenshot.
|
|
3
|
+
* @returns A promise that resolves with the file path to the screenshot image.
|
|
4
|
+
*/
|
|
5
|
+
export type TakeScreenShot = () => Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* A type representing a function that executes JavaScript code.
|
|
8
|
+
* @param script - The JavaScript code or function to execute.
|
|
9
|
+
* @param var_args - Optional arguments to pass to the script.
|
|
10
|
+
* @returns A promise that resolves with the result of the execution.
|
|
11
|
+
*/
|
|
12
|
+
export type Executor = <T>(script: string | Function, ...args: any[]) => Promise<T>;
|
|
13
|
+
//# sourceMappingURL=methods.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.interface.d.ts","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/methods.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;AAEnD;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.interface.js","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/methods.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A type representing a function that captures a screenshot.\n * @returns A promise that resolves with the file path to the screenshot image.\n */\nexport type TakeScreenShot = () => Promise<string>;\n\n/**\n * A type representing a function that executes JavaScript code.\n * @param script - The JavaScript code or function to execute.\n * @param var_args - Optional arguments to pass to the script.\n * @returns A promise that resolves with the result of the execution.\n */\n// eslint-disable-next-line\nexport type Executor = <T>(script: string | Function, ...args: any[]) => Promise<T>;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WopeeService } from '../../domain/service/wopeeService.js';
|
|
2
|
+
import { Executor } from './methods.interface.js';
|
|
3
|
+
import { ElementRectanglesOptions, RectanglesOutput, ScreenRectanglesOptions } from './rectangles.interfaces.js';
|
|
4
|
+
/**
|
|
5
|
+
* Determine the rectangles occupied by an element on a page or screenshot.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} options - The options for determining element rectangles.
|
|
8
|
+
* @param {Function} options.executor - The executor function.
|
|
9
|
+
* @param {string} options.base64Image - The base64 encoded screenshot image.
|
|
10
|
+
* @param {Object} options.element - The element to determine rectangles for.
|
|
11
|
+
* @returns {Promise<Object>} A Promise that resolves to an object containing element rectangles.
|
|
12
|
+
* @throws {Error} If the element is not visible.
|
|
13
|
+
*/
|
|
14
|
+
export declare function determineElementRectangles(wopeeService: WopeeService, executor: Executor, base64Image: string, options: ElementRectanglesOptions, element: WebdriverIO.Element): Promise<RectanglesOutput>;
|
|
15
|
+
/**
|
|
16
|
+
* Calculate the optimal screen rectangles for capturing a screenshot.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} base64Image - The base64 encoded screenshot image.
|
|
19
|
+
* @param {ScreenRectanglesOptions} options - Options including devicePixelRatio, innerHeight, and innerWidth.
|
|
20
|
+
* @returns {RectanglesOutput} - An object containing the calculated rectangles.
|
|
21
|
+
*/
|
|
22
|
+
export declare function determineScreenRectangles(base64Image: string, options: ScreenRectanglesOptions): RectanglesOutput;
|
|
23
|
+
//# sourceMappingURL=rectangles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangles.d.ts","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/rectangles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAGpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAEjH;;;;;;;;;GASG;AACH,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,WAAW,CAAC,OAAO,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAoB3B;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CAqBjH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Executor } from './methods.interface.js';
|
|
2
|
+
export interface RectanglesOptions {
|
|
3
|
+
devicePixelRatio: number;
|
|
4
|
+
isLandscape: boolean;
|
|
5
|
+
innerHeight: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ScreenRectanglesOptions extends RectanglesOptions {
|
|
8
|
+
innerWidth: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ElementRectanglesOptions extends RectanglesOptions {
|
|
11
|
+
}
|
|
12
|
+
export interface RectanglesOutput {
|
|
13
|
+
height: number;
|
|
14
|
+
width: number;
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ElementRectangles {
|
|
19
|
+
executor: Executor;
|
|
20
|
+
base64Image: string;
|
|
21
|
+
element: HTMLElement;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=rectangles.interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangles.interfaces.d.ts","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/rectangles.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,MAAM,WAAW,iBAAiB;IAEhC,gBAAgB,EAAE,MAAM,CAAC;IAEzB,WAAW,EAAE,OAAO,CAAC;IAErB,WAAW,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAEhE,UAAU,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;CAAG;AAGtE,MAAM,WAAW,gBAAgB;IAE/B,MAAM,EAAE,MAAM,CAAC;IAEf,KAAK,EAAE,MAAM,CAAC;IAEd,CAAC,EAAE,MAAM,CAAC;IAEV,CAAC,EAAE,MAAM,CAAC;CACX;AAGD,MAAM,WAAW,iBAAiB;IAEhC,QAAQ,EAAE,QAAQ,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IAEpB,OAAO,EAAE,WAAW,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangles.interfaces.js","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/rectangles.interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { Executor } from './methods.interface.js';\n\n// Represents the options for calculating rectangles.\nexport interface RectanglesOptions {\n // The device pixel ratio of the screen/device.\n devicePixelRatio: number;\n // Signals if Landscape or Portrait.\n isLandscape: boolean;\n // The inner height of a screen.\n innerHeight: number;\n}\n\n// Represents additional options for calculating screen rectangles.\nexport interface ScreenRectanglesOptions extends RectanglesOptions {\n // The inner width of a screen.\n innerWidth: number;\n}\n\n// Represents additional options for calculating element rectangles.\nexport interface ElementRectanglesOptions extends RectanglesOptions {}\n\n// Represents the output rectangles.\nexport interface RectanglesOutput {\n // The height of the rectangle.\n height: number;\n // The width of the rectangle.\n width: number;\n // The X-coordinate of the rectangle.\n x: number;\n // The Y-coordinate of the rectangle.\n y: number;\n}\n\n// Represents the rectangles related to an element.\nexport interface ElementRectangles {\n // The executor responsible for the element.\n executor: Executor;\n // The base64 encoded image of the element.\n base64Image: string;\n // The element for which rectangles are calculated.\n element: HTMLElement;\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { calculateDprData, getScreenshotSize } from '../helpers/utils.js';
|
|
2
|
+
import { getElementPositionDesktop } from './elementPosition.js';
|
|
3
|
+
/**
|
|
4
|
+
* Determine the rectangles occupied by an element on a page or screenshot.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} options - The options for determining element rectangles.
|
|
7
|
+
* @param {Function} options.executor - The executor function.
|
|
8
|
+
* @param {string} options.base64Image - The base64 encoded screenshot image.
|
|
9
|
+
* @param {Object} options.element - The element to determine rectangles for.
|
|
10
|
+
* @returns {Promise<Object>} A Promise that resolves to an object containing element rectangles.
|
|
11
|
+
* @throws {Error} If the element is not visible.
|
|
12
|
+
*/
|
|
13
|
+
export async function determineElementRectangles(wopeeService, executor, base64Image, options, element) {
|
|
14
|
+
const { devicePixelRatio, innerHeight } = options;
|
|
15
|
+
const { height } = getScreenshotSize(base64Image, devicePixelRatio);
|
|
16
|
+
// Determine the element position on the screenshot
|
|
17
|
+
const elementPosition = await getElementPositionDesktop(wopeeService, executor, element, {
|
|
18
|
+
innerHeight,
|
|
19
|
+
screenshotHeight: height,
|
|
20
|
+
});
|
|
21
|
+
// Determine the rectangles based on the device pixel ratio
|
|
22
|
+
return calculateDprData({
|
|
23
|
+
height: elementPosition.height,
|
|
24
|
+
width: elementPosition.width,
|
|
25
|
+
x: elementPosition.x,
|
|
26
|
+
y: elementPosition.y,
|
|
27
|
+
}, devicePixelRatio);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Calculate the optimal screen rectangles for capturing a screenshot.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} base64Image - The base64 encoded screenshot image.
|
|
33
|
+
* @param {ScreenRectanglesOptions} options - Options including devicePixelRatio, innerHeight, and innerWidth.
|
|
34
|
+
* @returns {RectanglesOutput} - An object containing the calculated rectangles.
|
|
35
|
+
*/
|
|
36
|
+
export function determineScreenRectangles(base64Image, options) {
|
|
37
|
+
const { devicePixelRatio, isLandscape, innerHeight, innerWidth } = options;
|
|
38
|
+
const screenshotWidth = innerWidth;
|
|
39
|
+
const screenshotHeight = innerHeight;
|
|
40
|
+
// Check if the screenshot is rotated
|
|
41
|
+
const isRotated = isLandscape;
|
|
42
|
+
// Determine the screen rectangles
|
|
43
|
+
const screenRectangles = calculateDprData({
|
|
44
|
+
height: isRotated ? screenshotWidth : screenshotHeight,
|
|
45
|
+
width: isRotated ? screenshotHeight : screenshotWidth,
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0,
|
|
48
|
+
}, devicePixelRatio);
|
|
49
|
+
return screenRectangles;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=rectangles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangles.js","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/rectangles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAIjE;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,YAA0B,EAC1B,QAAkB,EAClB,WAAmB,EACnB,OAAiC,EACjC,OAA4B;IAE5B,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAClD,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;IAEpE,mDAAmD;IACnD,MAAM,eAAe,GAAG,MAAM,yBAAyB,CAAC,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE;QACvF,WAAW;QACX,gBAAgB,EAAE,MAAM;KACzB,CAAC,CAAC;IAEH,2DAA2D;IAC3D,OAAO,gBAAgB,CACrB;QACE,MAAM,EAAE,eAAe,CAAC,MAAM;QAC9B,KAAK,EAAE,eAAe,CAAC,KAAK;QAC5B,CAAC,EAAE,eAAe,CAAC,CAAC;QACpB,CAAC,EAAE,eAAe,CAAC,CAAC;KACrB,EACD,gBAAgB,CACjB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,WAAmB,EAAE,OAAgC;IAC7F,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE3E,MAAM,eAAe,GAAG,UAAU,CAAC;IACnC,MAAM,gBAAgB,GAAG,WAAW,CAAC;IAErC,qCAAqC;IACrC,MAAM,SAAS,GAAG,WAAW,CAAC;IAE9B,kCAAkC;IAClC,MAAM,gBAAgB,GAAG,gBAAgB,CACvC;QACE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB;QACtD,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe;QACrD,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;KACL,EACD,gBAAgB,CACjB,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["import { WopeeService } from '../../domain/service/wopeeService.js';\nimport { calculateDprData, getScreenshotSize } from '../helpers/utils.js';\nimport { getElementPositionDesktop } from './elementPosition.js';\nimport { Executor } from './methods.interface.js';\nimport { ElementRectanglesOptions, RectanglesOutput, ScreenRectanglesOptions } from './rectangles.interfaces.js';\n\n/**\n * Determine the rectangles occupied by an element on a page or screenshot.\n *\n * @param {Object} options - The options for determining element rectangles.\n * @param {Function} options.executor - The executor function.\n * @param {string} options.base64Image - The base64 encoded screenshot image.\n * @param {Object} options.element - The element to determine rectangles for.\n * @returns {Promise<Object>} A Promise that resolves to an object containing element rectangles.\n * @throws {Error} If the element is not visible.\n */\nexport async function determineElementRectangles(\n wopeeService: WopeeService,\n executor: Executor,\n base64Image: string,\n options: ElementRectanglesOptions,\n element: WebdriverIO.Element,\n): Promise<RectanglesOutput> {\n const { devicePixelRatio, innerHeight } = options;\n const { height } = getScreenshotSize(base64Image, devicePixelRatio);\n\n // Determine the element position on the screenshot\n const elementPosition = await getElementPositionDesktop(wopeeService, executor, element, {\n innerHeight,\n screenshotHeight: height,\n });\n\n // Determine the rectangles based on the device pixel ratio\n return calculateDprData(\n {\n height: elementPosition.height,\n width: elementPosition.width,\n x: elementPosition.x,\n y: elementPosition.y,\n },\n devicePixelRatio,\n );\n}\n\n/**\n * Calculate the optimal screen rectangles for capturing a screenshot.\n *\n * @param {string} base64Image - The base64 encoded screenshot image.\n * @param {ScreenRectanglesOptions} options - Options including devicePixelRatio, innerHeight, and innerWidth.\n * @returns {RectanglesOutput} - An object containing the calculated rectangles.\n */\nexport function determineScreenRectangles(base64Image: string, options: ScreenRectanglesOptions): RectanglesOutput {\n const { devicePixelRatio, isLandscape, innerHeight, innerWidth } = options;\n\n const screenshotWidth = innerWidth;\n const screenshotHeight = innerHeight;\n\n // Check if the screenshot is rotated\n const isRotated = isLandscape;\n\n // Determine the screen rectangles\n const screenRectangles = calculateDprData(\n {\n height: isRotated ? screenshotWidth : screenshotHeight,\n width: isRotated ? screenshotHeight : screenshotWidth,\n x: 0,\n y: 0,\n },\n devicePixelRatio,\n );\n\n return screenRectangles;\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { WopeeService } from '../../domain/service/wopeeService.js';
|
|
2
|
+
import { Executor, TakeScreenShot } from './methods.interface.js';
|
|
3
|
+
import { FullPageScreenshotDataOptions, FullPageScreenshotOptions, FullPageScreenshotsData } from './screenshots.interfaces.js';
|
|
4
|
+
/**
|
|
5
|
+
* Takes a full page screenshot.
|
|
6
|
+
*
|
|
7
|
+
* @param {TakeScreenShot} takeScreenshot - Function to capture a screenshot.
|
|
8
|
+
* @param {Executor} executor - Function to execute JavaScript in the browser.
|
|
9
|
+
* @param {FullPageScreenshotDataOptions} options - Screenshot data options.
|
|
10
|
+
* @returns {Promise<FullPageScreenshotsData>} - Promise with full page screenshots data.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getBase64FullPageScreenshotsData(wopeeService: WopeeService, takeScreenshot: TakeScreenShot, executor: Executor, options: FullPageScreenshotDataOptions): Promise<FullPageScreenshotsData>;
|
|
13
|
+
/**
|
|
14
|
+
* Takes a full page screenshot for desktop.
|
|
15
|
+
*
|
|
16
|
+
* @param {TakeScreenShot} takeScreenshot - Function to capture a screenshot.
|
|
17
|
+
* @param {Executor} executor - Function to execute JavaScript in the browser.
|
|
18
|
+
* @param {FullPageScreenshotOptions} options - Screenshot options.
|
|
19
|
+
* @returns {Promise<FullPageScreenshotsData>} - Promise with full page screenshots data.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getFullPageScreenshotsDataDesktop(wopeeService: WopeeService, takeScreenshot: TakeScreenShot, executor: Executor, options: FullPageScreenshotOptions): Promise<FullPageScreenshotsData>;
|
|
22
|
+
/**
|
|
23
|
+
* Takes a screenshot.
|
|
24
|
+
*
|
|
25
|
+
* @param {TakeScreenShot} takeScreenshot - Function to capture a screenshot.
|
|
26
|
+
* @returns {Promise<string>} - Promise with base64 encoded screenshot data.
|
|
27
|
+
*/
|
|
28
|
+
export declare function takeBase64Screenshot(takeScreenshot: TakeScreenShot): Promise<string>;
|
|
29
|
+
//# sourceMappingURL=screenshots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenshots.d.ts","sourceRoot":"","sources":["../../../lib/desktopBrowser/methods/screenshots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;GAOG;AACH,wBAAsB,gCAAgC,CACpD,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,uBAAuB,CAAC,CASlC;AAED;;;;;;;GAOG;AACH,wBAAsB,iCAAiC,CACrD,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,uBAAuB,CAAC,CAyElC;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1F"}
|