@wdio/image-comparison-core 1.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/CHANGELOG.md +82 -0
- package/LICENSE +21 -0
- package/README.md +12 -0
- package/assets/ios/ipadair4th.ipadair5th-bottom.png +0 -0
- package/assets/ios/ipadair4th.ipadair5th-top.png +0 -0
- package/assets/ios/ipadmini6th-bottom.png +0 -0
- package/assets/ios/ipadmini6th-top.png +0 -0
- package/assets/ios/ipadpro11-bottom.png +0 -0
- package/assets/ios/ipadpro11-top.png +0 -0
- package/assets/ios/ipadpro129-bottom.png +0 -0
- package/assets/ios/ipadpro129-top.png +0 -0
- package/assets/ios/iphone11promax-bottom.png +0 -0
- package/assets/ios/iphone11promax-top.png +0 -0
- package/assets/ios/iphone12.iphone12pro-top.png +0 -0
- package/assets/ios/iphone12.iphone12pro.iphone13.iphone13pro.iphone14-bottom.png +0 -0
- package/assets/ios/iphone12mini-top.png +0 -0
- package/assets/ios/iphone12mini.iphone13mini-bottom.png +0 -0
- package/assets/ios/iphone12promax-top.png +0 -0
- package/assets/ios/iphone12promax.iphone13promax.iphone14plus-bottom.png +0 -0
- package/assets/ios/iphone13.iphone13pro.iphone14-top.png +0 -0
- package/assets/ios/iphone13mini-top.png +0 -0
- package/assets/ios/iphone13promax.iphone14plus-top.png +0 -0
- package/assets/ios/iphone14pro-bottom.png +0 -0
- package/assets/ios/iphone14pro-top.png +0 -0
- package/assets/ios/iphone14promax-bottom.png +0 -0
- package/assets/ios/iphone14promax-top.png +0 -0
- package/assets/ios/iphone15-bottom.png +0 -0
- package/assets/ios/iphone15-top.png +0 -0
- package/assets/ios/iphonex.iphonexs.iphone11pro-bottom.png +0 -0
- package/assets/ios/iphonex.iphonexs.iphone11pro-top.png +0 -0
- package/assets/ios/iphonexr.iphone11-bottom.png +0 -0
- package/assets/ios/iphonexr.iphone11-top.png +0 -0
- package/assets/ios/iphonexsmax-bottom.png +0 -0
- package/assets/ios/iphonexsmax-top.png +0 -0
- package/dist/base.d.ts +18 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/base.interfaces.d.ts +200 -0
- package/dist/base.interfaces.d.ts.map +1 -0
- package/dist/base.interfaces.js +1 -0
- package/dist/base.js +58 -0
- package/dist/base.test.d.ts +2 -0
- package/dist/base.test.d.ts.map +1 -0
- package/dist/base.test.js +45 -0
- package/dist/clientSideScripts/checkMetaTag.d.ts +2 -0
- package/dist/clientSideScripts/checkMetaTag.d.ts.map +1 -0
- package/dist/clientSideScripts/checkMetaTag.js +9 -0
- package/dist/clientSideScripts/checkMetaTag.test.d.ts +2 -0
- package/dist/clientSideScripts/checkMetaTag.test.d.ts.map +1 -0
- package/dist/clientSideScripts/checkMetaTag.test.js +25 -0
- package/dist/clientSideScripts/customCss.interfaces.d.ts +8 -0
- package/dist/clientSideScripts/customCss.interfaces.d.ts.map +1 -0
- package/dist/clientSideScripts/customCss.interfaces.js +1 -0
- package/dist/clientSideScripts/drawTabbableOnCanvas.d.ts +8 -0
- package/dist/clientSideScripts/drawTabbableOnCanvas.d.ts.map +1 -0
- package/dist/clientSideScripts/drawTabbableOnCanvas.interfaces.d.ts +4 -0
- package/dist/clientSideScripts/drawTabbableOnCanvas.interfaces.d.ts.map +1 -0
- package/dist/clientSideScripts/drawTabbableOnCanvas.interfaces.js +1 -0
- package/dist/clientSideScripts/drawTabbableOnCanvas.js +275 -0
- package/dist/clientSideScripts/drawTabbableOnCanvas.test.d.ts +2 -0
- package/dist/clientSideScripts/drawTabbableOnCanvas.test.d.ts.map +1 -0
- package/dist/clientSideScripts/drawTabbableOnCanvas.test.js +251 -0
- package/dist/clientSideScripts/elementPosition.interfaces.d.ts +3 -0
- package/dist/clientSideScripts/elementPosition.interfaces.d.ts.map +1 -0
- package/dist/clientSideScripts/elementPosition.interfaces.js +1 -0
- package/dist/clientSideScripts/getBoundingClientRect.d.ts +6 -0
- package/dist/clientSideScripts/getBoundingClientRect.d.ts.map +1 -0
- package/dist/clientSideScripts/getBoundingClientRect.js +12 -0
- package/dist/clientSideScripts/getBoundingClientRect.test.d.ts +2 -0
- package/dist/clientSideScripts/getBoundingClientRect.test.d.ts.map +1 -0
- package/dist/clientSideScripts/getBoundingClientRect.test.js +28 -0
- package/dist/clientSideScripts/getDocumentScrollHeight.d.ts +5 -0
- package/dist/clientSideScripts/getDocumentScrollHeight.d.ts.map +1 -0
- package/dist/clientSideScripts/getDocumentScrollHeight.js +48 -0
- package/dist/clientSideScripts/getDocumentScrollHeight.test.d.ts +2 -0
- package/dist/clientSideScripts/getDocumentScrollHeight.test.d.ts.map +1 -0
- package/dist/clientSideScripts/getDocumentScrollHeight.test.js +30 -0
- package/dist/clientSideScripts/getElementPositionTopDom.d.ts +6 -0
- package/dist/clientSideScripts/getElementPositionTopDom.d.ts.map +1 -0
- package/dist/clientSideScripts/getElementPositionTopDom.js +11 -0
- package/dist/clientSideScripts/getElementPositionTopDom.test.d.ts +2 -0
- package/dist/clientSideScripts/getElementPositionTopDom.test.d.ts.map +1 -0
- package/dist/clientSideScripts/getElementPositionTopDom.test.js +11 -0
- package/dist/clientSideScripts/getElementPositionTopScreenNativeMobile.d.ts +14 -0
- package/dist/clientSideScripts/getElementPositionTopScreenNativeMobile.d.ts.map +1 -0
- package/dist/clientSideScripts/getElementPositionTopScreenNativeMobile.js +19 -0
- package/dist/clientSideScripts/getElementPositionTopScreenNativeMobile.test.d.ts +2 -0
- package/dist/clientSideScripts/getElementPositionTopScreenNativeMobile.test.d.ts.map +1 -0
- package/dist/clientSideScripts/getElementPositionTopScreenNativeMobile.test.js +52 -0
- package/dist/clientSideScripts/getMobileWebviewClickAndDimensions.d.ts +6 -0
- package/dist/clientSideScripts/getMobileWebviewClickAndDimensions.d.ts.map +1 -0
- package/dist/clientSideScripts/getMobileWebviewClickAndDimensions.js +17 -0
- package/dist/clientSideScripts/getMobileWebviewClickAndDimensions.test.d.ts +2 -0
- package/dist/clientSideScripts/getMobileWebviewClickAndDimensions.test.d.ts.map +1 -0
- package/dist/clientSideScripts/getMobileWebviewClickAndDimensions.test.js +47 -0
- package/dist/clientSideScripts/getScreenDimensions.d.ts +6 -0
- package/dist/clientSideScripts/getScreenDimensions.d.ts.map +1 -0
- package/dist/clientSideScripts/getScreenDimensions.js +104 -0
- package/dist/clientSideScripts/getScreenDimensions.test.d.ts +2 -0
- package/dist/clientSideScripts/getScreenDimensions.test.d.ts.map +1 -0
- package/dist/clientSideScripts/getScreenDimensions.test.js +161 -0
- package/dist/clientSideScripts/hideRemoveElements.d.ts +8 -0
- package/dist/clientSideScripts/hideRemoveElements.d.ts.map +1 -0
- package/dist/clientSideScripts/hideRemoveElements.js +60 -0
- package/dist/clientSideScripts/hideRemoveElements.test.d.ts +2 -0
- package/dist/clientSideScripts/hideRemoveElements.test.d.ts.map +1 -0
- package/dist/clientSideScripts/hideRemoveElements.test.js +199 -0
- package/dist/clientSideScripts/hideScrollbars.d.ts +9 -0
- package/dist/clientSideScripts/hideScrollbars.d.ts.map +1 -0
- package/dist/clientSideScripts/hideScrollbars.js +15 -0
- package/dist/clientSideScripts/hideScrollbars.test.d.ts +2 -0
- package/dist/clientSideScripts/hideScrollbars.test.d.ts.map +1 -0
- package/dist/clientSideScripts/hideScrollbars.test.js +12 -0
- package/dist/clientSideScripts/injectWebviewOverlay.d.ts +5 -0
- package/dist/clientSideScripts/injectWebviewOverlay.d.ts.map +1 -0
- package/dist/clientSideScripts/injectWebviewOverlay.js +35 -0
- package/dist/clientSideScripts/injectWebviewOverlay.test.d.ts +2 -0
- package/dist/clientSideScripts/injectWebviewOverlay.test.d.ts.map +1 -0
- package/dist/clientSideScripts/injectWebviewOverlay.test.js +74 -0
- package/dist/clientSideScripts/removeElementFromDom.d.ts +5 -0
- package/dist/clientSideScripts/removeElementFromDom.d.ts.map +1 -0
- package/dist/clientSideScripts/removeElementFromDom.js +9 -0
- package/dist/clientSideScripts/removeElementFromDom.test.d.ts +2 -0
- package/dist/clientSideScripts/removeElementFromDom.test.d.ts.map +1 -0
- package/dist/clientSideScripts/removeElementFromDom.test.js +43 -0
- package/dist/clientSideScripts/screenDimensions.interfaces.d.ts +96 -0
- package/dist/clientSideScripts/screenDimensions.interfaces.d.ts.map +1 -0
- package/dist/clientSideScripts/screenDimensions.interfaces.js +1 -0
- package/dist/clientSideScripts/scrollElementIntoView.d.ts +5 -0
- package/dist/clientSideScripts/scrollElementIntoView.d.ts.map +1 -0
- package/dist/clientSideScripts/scrollElementIntoView.js +31 -0
- package/dist/clientSideScripts/scrollElementIntoView.test.d.ts +2 -0
- package/dist/clientSideScripts/scrollElementIntoView.test.d.ts.map +1 -0
- package/dist/clientSideScripts/scrollElementIntoView.test.js +79 -0
- package/dist/clientSideScripts/scrollToPosition.d.ts +5 -0
- package/dist/clientSideScripts/scrollToPosition.d.ts.map +1 -0
- package/dist/clientSideScripts/scrollToPosition.js +25 -0
- package/dist/clientSideScripts/scrollToPosition.test.d.ts +2 -0
- package/dist/clientSideScripts/scrollToPosition.test.d.ts.map +1 -0
- package/dist/clientSideScripts/scrollToPosition.test.js +72 -0
- package/dist/clientSideScripts/setCustomCss.d.ts +6 -0
- package/dist/clientSideScripts/setCustomCss.d.ts.map +1 -0
- package/dist/clientSideScripts/setCustomCss.js +36 -0
- package/dist/clientSideScripts/setCustomCss.test.d.ts +2 -0
- package/dist/clientSideScripts/setCustomCss.test.d.ts.map +1 -0
- package/dist/clientSideScripts/setCustomCss.test.js +68 -0
- package/dist/clientSideScripts/statusAddressToolBarOffsets.interfaces.d.ts +11 -0
- package/dist/clientSideScripts/statusAddressToolBarOffsets.interfaces.d.ts.map +1 -0
- package/dist/clientSideScripts/statusAddressToolBarOffsets.interfaces.js +1 -0
- package/dist/clientSideScripts/toggleTextTransparency.d.ts +5 -0
- package/dist/clientSideScripts/toggleTextTransparency.d.ts.map +1 -0
- package/dist/clientSideScripts/toggleTextTransparency.js +16 -0
- package/dist/clientSideScripts/toggleTextTransparency.test.d.ts +2 -0
- package/dist/clientSideScripts/toggleTextTransparency.test.d.ts.map +1 -0
- package/dist/clientSideScripts/toggleTextTransparency.test.js +35 -0
- package/dist/clientSideScripts/waitForFonts.d.ts +8 -0
- package/dist/clientSideScripts/waitForFonts.d.ts.map +1 -0
- package/dist/clientSideScripts/waitForFonts.js +20 -0
- package/dist/clientSideScripts/waitForFonts.test.d.ts +2 -0
- package/dist/clientSideScripts/waitForFonts.test.d.ts.map +1 -0
- package/dist/clientSideScripts/waitForFonts.test.js +37 -0
- package/dist/commands/check.interfaces.d.ts +35 -0
- package/dist/commands/check.interfaces.d.ts.map +1 -0
- package/dist/commands/check.interfaces.js +1 -0
- package/dist/commands/checkAppElement.d.ts +7 -0
- package/dist/commands/checkAppElement.d.ts.map +1 -0
- package/dist/commands/checkAppElement.js +44 -0
- package/dist/commands/checkAppElement.test.d.ts +2 -0
- package/dist/commands/checkAppElement.test.d.ts.map +1 -0
- package/dist/commands/checkAppElement.test.js +241 -0
- package/dist/commands/checkAppScreen.d.ts +7 -0
- package/dist/commands/checkAppScreen.d.ts.map +1 -0
- package/dist/commands/checkAppScreen.js +73 -0
- package/dist/commands/checkAppScreen.test.d.ts +2 -0
- package/dist/commands/checkAppScreen.test.d.ts.map +1 -0
- package/dist/commands/checkAppScreen.test.js +295 -0
- package/dist/commands/checkElement.d.ts +7 -0
- package/dist/commands/checkElement.d.ts.map +1 -0
- package/dist/commands/checkElement.js +10 -0
- package/dist/commands/checkElement.test.d.ts +2 -0
- package/dist/commands/checkElement.test.d.ts.map +1 -0
- package/dist/commands/checkElement.test.js +66 -0
- package/dist/commands/checkFullPageScreen.d.ts +7 -0
- package/dist/commands/checkFullPageScreen.d.ts.map +1 -0
- package/dist/commands/checkFullPageScreen.js +56 -0
- package/dist/commands/checkFullPageScreen.test.d.ts +2 -0
- package/dist/commands/checkFullPageScreen.test.d.ts.map +1 -0
- package/dist/commands/checkFullPageScreen.test.js +259 -0
- package/dist/commands/checkScreen.d.ts +7 -0
- package/dist/commands/checkScreen.d.ts.map +1 -0
- package/dist/commands/checkScreen.js +10 -0
- package/dist/commands/checkScreen.test.d.ts +2 -0
- package/dist/commands/checkScreen.test.d.ts.map +1 -0
- package/dist/commands/checkScreen.test.js +62 -0
- package/dist/commands/checkTabbablePage.d.ts +7 -0
- package/dist/commands/checkTabbablePage.d.ts.map +1 -0
- package/dist/commands/checkTabbablePage.js +28 -0
- package/dist/commands/checkTabbablePage.test.d.ts +2 -0
- package/dist/commands/checkTabbablePage.test.d.ts.map +1 -0
- package/dist/commands/checkTabbablePage.test.js +200 -0
- package/dist/commands/checkWebElement.d.ts +7 -0
- package/dist/commands/checkWebElement.d.ts.map +1 -0
- package/dist/commands/checkWebElement.js +52 -0
- package/dist/commands/checkWebElement.test.d.ts +2 -0
- package/dist/commands/checkWebElement.test.d.ts.map +1 -0
- package/dist/commands/checkWebElement.test.js +278 -0
- package/dist/commands/checkWebScreen.d.ts +7 -0
- package/dist/commands/checkWebScreen.d.ts.map +1 -0
- package/dist/commands/checkWebScreen.js +50 -0
- package/dist/commands/checkWebScreen.test.d.ts +2 -0
- package/dist/commands/checkWebScreen.test.d.ts.map +1 -0
- package/dist/commands/checkWebScreen.test.js +227 -0
- package/dist/commands/element.interfaces.d.ts +27 -0
- package/dist/commands/element.interfaces.d.ts.map +1 -0
- package/dist/commands/element.interfaces.js +1 -0
- package/dist/commands/fullPage.interfaces.d.ts +38 -0
- package/dist/commands/fullPage.interfaces.d.ts.map +1 -0
- package/dist/commands/fullPage.interfaces.js +1 -0
- package/dist/commands/save.interfaces.d.ts +27 -0
- package/dist/commands/save.interfaces.d.ts.map +1 -0
- package/dist/commands/save.interfaces.js +1 -0
- package/dist/commands/saveAppElement.d.ts +7 -0
- package/dist/commands/saveAppElement.d.ts.map +1 -0
- package/dist/commands/saveAppElement.js +30 -0
- package/dist/commands/saveAppElement.test.d.ts +2 -0
- package/dist/commands/saveAppElement.test.d.ts.map +1 -0
- package/dist/commands/saveAppElement.test.js +199 -0
- package/dist/commands/saveAppScreen.d.ts +7 -0
- package/dist/commands/saveAppScreen.d.ts.map +1 -0
- package/dist/commands/saveAppScreen.js +43 -0
- package/dist/commands/saveAppScreen.test.d.ts +2 -0
- package/dist/commands/saveAppScreen.test.d.ts.map +1 -0
- package/dist/commands/saveAppScreen.test.js +221 -0
- package/dist/commands/saveElement.d.ts +7 -0
- package/dist/commands/saveElement.d.ts.map +1 -0
- package/dist/commands/saveElement.js +10 -0
- package/dist/commands/saveElement.test.d.ts +2 -0
- package/dist/commands/saveElement.test.d.ts.map +1 -0
- package/dist/commands/saveElement.test.js +62 -0
- package/dist/commands/saveFullPageScreen.d.ts +7 -0
- package/dist/commands/saveFullPageScreen.d.ts.map +1 -0
- package/dist/commands/saveFullPageScreen.js +60 -0
- package/dist/commands/saveFullPageScreen.test.d.ts +2 -0
- package/dist/commands/saveFullPageScreen.test.d.ts.map +1 -0
- package/dist/commands/saveFullPageScreen.test.js +293 -0
- package/dist/commands/saveScreen.d.ts +7 -0
- package/dist/commands/saveScreen.d.ts.map +1 -0
- package/dist/commands/saveScreen.js +10 -0
- package/dist/commands/saveScreen.test.d.ts +2 -0
- package/dist/commands/saveScreen.test.d.ts.map +1 -0
- package/dist/commands/saveScreen.test.js +47 -0
- package/dist/commands/saveTabbablePage.d.ts +7 -0
- package/dist/commands/saveTabbablePage.d.ts.map +1 -0
- package/dist/commands/saveTabbablePage.js +20 -0
- package/dist/commands/saveTabbablePage.test.d.ts +2 -0
- package/dist/commands/saveTabbablePage.test.d.ts.map +1 -0
- package/dist/commands/saveTabbablePage.test.js +74 -0
- package/dist/commands/saveWebElement.d.ts +7 -0
- package/dist/commands/saveWebElement.d.ts.map +1 -0
- package/dist/commands/saveWebElement.js +53 -0
- package/dist/commands/saveWebElement.test.d.ts +2 -0
- package/dist/commands/saveWebElement.test.d.ts.map +1 -0
- package/dist/commands/saveWebElement.test.js +253 -0
- package/dist/commands/saveWebScreen.d.ts +7 -0
- package/dist/commands/saveWebScreen.d.ts.map +1 -0
- package/dist/commands/saveWebScreen.js +48 -0
- package/dist/commands/saveWebScreen.test.d.ts +2 -0
- package/dist/commands/saveWebScreen.test.d.ts.map +1 -0
- package/dist/commands/saveWebScreen.test.js +222 -0
- package/dist/commands/screen.interfaces.d.ts +16 -0
- package/dist/commands/screen.interfaces.d.ts.map +1 -0
- package/dist/commands/screen.interfaces.js +1 -0
- package/dist/commands/tabbable.interfaces.d.ts +29 -0
- package/dist/commands/tabbable.interfaces.d.ts.map +1 -0
- package/dist/commands/tabbable.interfaces.js +1 -0
- package/dist/helpers/afterScreenshot.d.ts +7 -0
- package/dist/helpers/afterScreenshot.d.ts.map +1 -0
- package/dist/helpers/afterScreenshot.interfaces.d.ts +46 -0
- package/dist/helpers/afterScreenshot.interfaces.d.ts.map +1 -0
- package/dist/helpers/afterScreenshot.interfaces.js +1 -0
- package/dist/helpers/afterScreenshot.js +55 -0
- package/dist/helpers/afterScreenshot.test.d.ts +2 -0
- package/dist/helpers/afterScreenshot.test.d.ts.map +1 -0
- package/dist/helpers/afterScreenshot.test.js +241 -0
- package/dist/helpers/beforeScreenshot.d.ts +6 -0
- package/dist/helpers/beforeScreenshot.d.ts.map +1 -0
- package/dist/helpers/beforeScreenshot.interfaces.d.ts +15 -0
- package/dist/helpers/beforeScreenshot.interfaces.d.ts.map +1 -0
- package/dist/helpers/beforeScreenshot.interfaces.js +1 -0
- package/dist/helpers/beforeScreenshot.js +79 -0
- package/dist/helpers/beforeScreenshot.test.d.ts +2 -0
- package/dist/helpers/beforeScreenshot.test.d.ts.map +1 -0
- package/dist/helpers/beforeScreenshot.test.js +261 -0
- package/dist/helpers/compare.interfaces.d.ts +16 -0
- package/dist/helpers/compare.interfaces.d.ts.map +1 -0
- package/dist/helpers/compare.interfaces.js +1 -0
- package/dist/helpers/constants.d.ts +108 -0
- package/dist/helpers/constants.d.ts.map +1 -0
- package/dist/helpers/constants.interfaces.d.ts +30 -0
- package/dist/helpers/constants.interfaces.d.ts.map +1 -0
- package/dist/helpers/constants.interfaces.js +11 -0
- package/dist/helpers/constants.js +436 -0
- package/dist/helpers/options.d.ts +64 -0
- package/dist/helpers/options.d.ts.map +1 -0
- package/dist/helpers/options.interfaces.d.ts +363 -0
- package/dist/helpers/options.interfaces.d.ts.map +1 -0
- package/dist/helpers/options.interfaces.js +1 -0
- package/dist/helpers/options.js +184 -0
- package/dist/helpers/options.test.d.ts +2 -0
- package/dist/helpers/options.test.d.ts.map +1 -0
- package/dist/helpers/options.test.js +428 -0
- package/dist/helpers/utils.d.ts +134 -0
- package/dist/helpers/utils.d.ts.map +1 -0
- package/dist/helpers/utils.interfaces.d.ts +254 -0
- package/dist/helpers/utils.interfaces.d.ts.map +1 -0
- package/dist/helpers/utils.interfaces.js +1 -0
- package/dist/helpers/utils.js +566 -0
- package/dist/helpers/utils.test.d.ts +2 -0
- package/dist/helpers/utils.test.d.ts.map +1 -0
- package/dist/helpers/utils.test.js +900 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/methods/compareReport.interfaces.d.ts +109 -0
- package/dist/methods/compareReport.interfaces.d.ts.map +1 -0
- package/dist/methods/compareReport.interfaces.js +1 -0
- package/dist/methods/createCompareReport.d.ts +7 -0
- package/dist/methods/createCompareReport.d.ts.map +1 -0
- package/dist/methods/createCompareReport.js +61 -0
- package/dist/methods/createCompareReport.test.d.ts +2 -0
- package/dist/methods/createCompareReport.test.d.ts.map +1 -0
- package/dist/methods/createCompareReport.test.js +236 -0
- package/dist/methods/elementPosition.d.ts +18 -0
- package/dist/methods/elementPosition.d.ts.map +1 -0
- package/dist/methods/elementPosition.interfaces.d.ts +14 -0
- package/dist/methods/elementPosition.interfaces.d.ts.map +1 -0
- package/dist/methods/elementPosition.interfaces.js +1 -0
- package/dist/methods/elementPosition.js +34 -0
- package/dist/methods/images.d.ts +69 -0
- package/dist/methods/images.d.ts.map +1 -0
- package/dist/methods/images.executeImageCompare.test.d.ts +2 -0
- package/dist/methods/images.executeImageCompare.test.d.ts.map +1 -0
- package/dist/methods/images.executeImageCompare.test.js +770 -0
- package/dist/methods/images.interfaces.d.ts +214 -0
- package/dist/methods/images.interfaces.d.ts.map +1 -0
- package/dist/methods/images.interfaces.js +1 -0
- package/dist/methods/images.js +428 -0
- package/dist/methods/images.test.d.ts +2 -0
- package/dist/methods/images.test.d.ts.map +1 -0
- package/dist/methods/images.test.js +1465 -0
- package/dist/methods/instanceData.d.ts +6 -0
- package/dist/methods/instanceData.d.ts.map +1 -0
- package/dist/methods/instanceData.interfaces.d.ts +57 -0
- package/dist/methods/instanceData.interfaces.d.ts.map +1 -0
- package/dist/methods/instanceData.interfaces.js +1 -0
- package/dist/methods/instanceData.js +42 -0
- package/dist/methods/instanceData.test.d.ts +2 -0
- package/dist/methods/instanceData.test.d.ts.map +1 -0
- package/dist/methods/instanceData.test.js +224 -0
- package/dist/methods/processDiffPixels.d.ts +59 -0
- package/dist/methods/processDiffPixels.d.ts.map +1 -0
- package/dist/methods/processDiffPixels.js +242 -0
- package/dist/methods/processDiffPixels.test.d.ts +2 -0
- package/dist/methods/processDiffPixels.test.d.ts.map +1 -0
- package/dist/methods/processDiffPixels.test.js +122 -0
- package/dist/methods/rectangles.d.ts +51 -0
- package/dist/methods/rectangles.d.ts.map +1 -0
- package/dist/methods/rectangles.interfaces.d.ts +146 -0
- package/dist/methods/rectangles.interfaces.d.ts.map +1 -0
- package/dist/methods/rectangles.interfaces.js +1 -0
- package/dist/methods/rectangles.js +266 -0
- package/dist/methods/rectangles.test.d.ts +2 -0
- package/dist/methods/rectangles.test.d.ts.map +1 -0
- package/dist/methods/rectangles.test.js +853 -0
- package/dist/methods/screenshots.d.ts +37 -0
- package/dist/methods/screenshots.d.ts.map +1 -0
- package/dist/methods/screenshots.interfaces.d.ts +203 -0
- package/dist/methods/screenshots.interfaces.d.ts.map +1 -0
- package/dist/methods/screenshots.interfaces.js +1 -0
- package/dist/methods/screenshots.js +394 -0
- package/dist/methods/screenshots.test.d.ts +2 -0
- package/dist/methods/screenshots.test.d.ts.map +1 -0
- package/dist/methods/screenshots.test.js +656 -0
- package/dist/methods/takeElementScreenshots.d.ts +3 -0
- package/dist/methods/takeElementScreenshots.d.ts.map +1 -0
- package/dist/methods/takeElementScreenshots.js +104 -0
- package/dist/methods/takeElementScreenshots.test.d.ts +2 -0
- package/dist/methods/takeElementScreenshots.test.d.ts.map +1 -0
- package/dist/methods/takeElementScreenshots.test.js +314 -0
- package/dist/methods/takeFullPageScreenshots.d.ts +3 -0
- package/dist/methods/takeFullPageScreenshots.d.ts.map +1 -0
- package/dist/methods/takeFullPageScreenshots.js +56 -0
- package/dist/methods/takeFullPageScreenshots.test.d.ts +2 -0
- package/dist/methods/takeFullPageScreenshots.test.d.ts.map +1 -0
- package/dist/methods/takeFullPageScreenshots.test.js +72 -0
- package/dist/methods/takeWebScreenshots.d.ts +3 -0
- package/dist/methods/takeWebScreenshots.d.ts.map +1 -0
- package/dist/methods/takeWebScreenshots.js +41 -0
- package/dist/methods/takeWebScreenshots.test.d.ts +2 -0
- package/dist/methods/takeWebScreenshots.test.d.ts.map +1 -0
- package/dist/methods/takeWebScreenshots.test.js +149 -0
- package/dist/mocks/image.d.ts +4 -0
- package/dist/mocks/image.d.ts.map +1 -0
- package/dist/mocks/image.js +3 -0
- package/dist/mocks/mocks.d.ts +745 -0
- package/dist/mocks/mocks.d.ts.map +1 -0
- package/dist/mocks/mocks.js +392 -0
- package/dist/resemble/compare.interfaces.d.ts +136 -0
- package/dist/resemble/compare.interfaces.d.ts.map +1 -0
- package/dist/resemble/compare.interfaces.js +1 -0
- package/dist/resemble/compareImages.d.ts +3 -0
- package/dist/resemble/compareImages.d.ts.map +1 -0
- package/dist/resemble/compareImages.js +21 -0
- package/dist/resemble/resemble.jimp.cjs +981 -0
- package/dist/resemble/resemble.jimp.d.cts +46 -0
- package/dist/resemble/resemble.jimp.d.cts.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { processDiffPixels } from './processDiffPixels.js';
|
|
4
|
+
import logger from '@wdio/logger';
|
|
5
|
+
const log = logger('test');
|
|
6
|
+
vi.mock('@wdio/logger', () => import(join(process.cwd(), '__mocks__', '@wdio/logger')));
|
|
7
|
+
describe('processDiffPixels', () => {
|
|
8
|
+
let logInfoSpy;
|
|
9
|
+
let logErrorSpy;
|
|
10
|
+
const createMockPixels = (count, startX = 0, startY = 0) => {
|
|
11
|
+
const pixels = [];
|
|
12
|
+
for (let i = 0; i < count; i++) {
|
|
13
|
+
pixels.push({
|
|
14
|
+
x: startX + (i % 10),
|
|
15
|
+
y: startY + Math.floor(i / 10),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return pixels;
|
|
19
|
+
};
|
|
20
|
+
const createMockPixelsInBox = (box) => {
|
|
21
|
+
const pixels = [];
|
|
22
|
+
for (let x = box.left; x <= box.right; x++) {
|
|
23
|
+
for (let y = box.top; y <= box.bottom; y++) {
|
|
24
|
+
pixels.push({ x, y });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return pixels;
|
|
28
|
+
};
|
|
29
|
+
const normalizeTimingValues = (calls) => {
|
|
30
|
+
return calls.map(call => {
|
|
31
|
+
const message = call[0];
|
|
32
|
+
return [
|
|
33
|
+
message
|
|
34
|
+
.replace(/Union time: \d+ms/, 'Union time: XXXms')
|
|
35
|
+
.replace(/Grouping time: \d+ms/, 'Grouping time: XXXms')
|
|
36
|
+
.replace(/Total analysis time: \d+ms/, 'Total analysis time: XXXms')
|
|
37
|
+
.replace(/Post-processing time: \d+ms/, 'Post-processing time: XXXms')
|
|
38
|
+
];
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
logInfoSpy = vi.spyOn(log, 'info').mockImplementation(() => { });
|
|
43
|
+
logErrorSpy = vi.spyOn(log, 'error').mockImplementation(() => { });
|
|
44
|
+
});
|
|
45
|
+
afterEach(() => {
|
|
46
|
+
vi.clearAllMocks();
|
|
47
|
+
logInfoSpy.mockRestore();
|
|
48
|
+
logErrorSpy.mockRestore();
|
|
49
|
+
});
|
|
50
|
+
it('should handle empty pixel array', () => {
|
|
51
|
+
const result = processDiffPixels([], 5);
|
|
52
|
+
expect(result).toMatchSnapshot();
|
|
53
|
+
expect(normalizeTimingValues(logInfoSpy.mock.calls)).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
it('should process a single pixel', () => {
|
|
56
|
+
const pixels = createMockPixels(1);
|
|
57
|
+
const result = processDiffPixels(pixels, 5);
|
|
58
|
+
expect(result).toMatchSnapshot();
|
|
59
|
+
expect(normalizeTimingValues(logInfoSpy.mock.calls)).toMatchSnapshot();
|
|
60
|
+
});
|
|
61
|
+
it('should merge nearby pixels into a single bounding box', () => {
|
|
62
|
+
const pixels = createMockPixels(4, 0, 0); // Creates a 2x2 square
|
|
63
|
+
const result = processDiffPixels(pixels, 5);
|
|
64
|
+
expect(result).toMatchSnapshot();
|
|
65
|
+
expect(normalizeTimingValues(logInfoSpy.mock.calls)).toMatchSnapshot();
|
|
66
|
+
});
|
|
67
|
+
it('should create separate bounding boxes for distant pixels', () => {
|
|
68
|
+
const pixels = [
|
|
69
|
+
...createMockPixels(4, 0, 0), // First 2x2 square
|
|
70
|
+
...createMockPixels(4, 20, 20), // Second 2x2 square far away
|
|
71
|
+
];
|
|
72
|
+
const result = processDiffPixels(pixels, 5);
|
|
73
|
+
expect(result).toMatchSnapshot();
|
|
74
|
+
expect(normalizeTimingValues(logInfoSpy.mock.calls)).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
it('should handle a large number of pixels', () => {
|
|
77
|
+
const pixels = createMockPixels(1000);
|
|
78
|
+
const result = processDiffPixels(pixels, 5);
|
|
79
|
+
expect(result).toMatchSnapshot();
|
|
80
|
+
expect(normalizeTimingValues(logInfoSpy.mock.calls)).toMatchSnapshot();
|
|
81
|
+
});
|
|
82
|
+
it('should respect proximity parameter when merging boxes', () => {
|
|
83
|
+
const pixels = [
|
|
84
|
+
...createMockPixels(4, 0, 0), // First 2x2 square
|
|
85
|
+
...createMockPixels(4, 6, 6), // Second 2x2 square just outside proximity
|
|
86
|
+
];
|
|
87
|
+
const result = processDiffPixels(pixels, 5);
|
|
88
|
+
expect(result).toMatchSnapshot();
|
|
89
|
+
expect(normalizeTimingValues(logInfoSpy.mock.calls)).toMatchSnapshot();
|
|
90
|
+
});
|
|
91
|
+
it('should handle pixels in a complex pattern', () => {
|
|
92
|
+
const pixels = [
|
|
93
|
+
...createMockPixelsInBox({ left: 0, top: 0, right: 5, bottom: 5 }), // Square
|
|
94
|
+
...createMockPixelsInBox({ left: 10, top: 10, right: 15, bottom: 15 }), // Another square
|
|
95
|
+
...createMockPixelsInBox({ left: 20, top: 20, right: 25, bottom: 25 }), // Third square
|
|
96
|
+
];
|
|
97
|
+
const result = processDiffPixels(pixels, 5);
|
|
98
|
+
expect(result).toMatchSnapshot();
|
|
99
|
+
expect(normalizeTimingValues(logInfoSpy.mock.calls)).toMatchSnapshot();
|
|
100
|
+
});
|
|
101
|
+
it('should handle maximum diff percentage threshold', () => {
|
|
102
|
+
const pixels = createMockPixels(1000000);
|
|
103
|
+
const result = processDiffPixels(pixels, 5);
|
|
104
|
+
expect(result).toMatchSnapshot();
|
|
105
|
+
expect(logErrorSpy.mock.calls).toMatchSnapshot();
|
|
106
|
+
});
|
|
107
|
+
it('should handle maximum diff pixels threshold', () => {
|
|
108
|
+
const pixels = createMockPixels(6000000);
|
|
109
|
+
const result = processDiffPixels(pixels, 5);
|
|
110
|
+
expect(result).toMatchSnapshot();
|
|
111
|
+
expect(logErrorSpy.mock.calls).toMatchSnapshot();
|
|
112
|
+
});
|
|
113
|
+
it('should handle two adjacent pixels to trigger equal rank union', () => {
|
|
114
|
+
const pixels = [
|
|
115
|
+
{ x: 0, y: 0 },
|
|
116
|
+
{ x: 1, y: 0 }
|
|
117
|
+
];
|
|
118
|
+
const result = processDiffPixels(pixels, 5);
|
|
119
|
+
expect(result).toMatchSnapshot();
|
|
120
|
+
expect(normalizeTimingValues(logInfoSpy.mock.calls)).toMatchSnapshot();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { DetermineDeviceBlockOutsOptions, DeviceRectangles, ElementRectangles, PrepareIgnoreRectanglesOptions, PreparedIgnoreRectangles, RectanglesOutput, ScreenRectanglesOptions, SplitIgnores, StatusAddressToolBarRectangles, StatusAddressToolBarRectanglesOptions } from './rectangles.interfaces.js';
|
|
2
|
+
import type { ElementIgnore } from 'src/commands/element.interfaces.js';
|
|
3
|
+
/**
|
|
4
|
+
* Determine the element rectangles on the page / screenshot
|
|
5
|
+
*/
|
|
6
|
+
export declare function determineElementRectangles({ browserInstance, base64Image, options, element, }: ElementRectangles): Promise<RectanglesOutput>;
|
|
7
|
+
/**
|
|
8
|
+
* Determine the rectangles of the screen for the screenshot
|
|
9
|
+
*/
|
|
10
|
+
export declare function determineScreenRectangles(base64Image: string, options: ScreenRectanglesOptions): RectanglesOutput;
|
|
11
|
+
/**
|
|
12
|
+
* Determine the rectangles for the mobile devices
|
|
13
|
+
*/
|
|
14
|
+
export declare function determineStatusAddressToolBarRectangles({ deviceRectangles, options }: {
|
|
15
|
+
deviceRectangles: DeviceRectangles;
|
|
16
|
+
options: StatusAddressToolBarRectanglesOptions;
|
|
17
|
+
}): StatusAddressToolBarRectangles;
|
|
18
|
+
/**
|
|
19
|
+
* Validate that the element is a WebdriverIO element
|
|
20
|
+
*/
|
|
21
|
+
export declare function isWdioElement(x: unknown): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Validate that the object is a valid ignore region
|
|
24
|
+
*/
|
|
25
|
+
export declare function validateIgnoreRegion(x: unknown): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Format the error message
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatErrorMessage(item: unknown, message: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Split the ignores into elements and regions and throw an error if
|
|
32
|
+
* an element is not a valid WebdriverIO element/region
|
|
33
|
+
*/
|
|
34
|
+
export declare function splitIgnores(items: unknown[]): SplitIgnores;
|
|
35
|
+
/**
|
|
36
|
+
* Get the regions from the elements
|
|
37
|
+
*/
|
|
38
|
+
export declare function getRegionsFromElements(browserInstance: WebdriverIO.Browser, elements: WebdriverIO.Element[]): Promise<RectanglesOutput[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Translate ignores to regions
|
|
41
|
+
*/
|
|
42
|
+
export declare function determineIgnoreRegions(browserInstance: WebdriverIO.Browser, ignores: ElementIgnore[]): Promise<RectanglesOutput[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Determine the device block outs
|
|
45
|
+
*/
|
|
46
|
+
export declare function determineDeviceBlockOuts({ isAndroid, screenCompareOptions, instanceData }: DetermineDeviceBlockOutsOptions): Promise<RectanglesOutput[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Prepare all ignore rectangles for image comparison
|
|
49
|
+
*/
|
|
50
|
+
export declare function prepareIgnoreRectangles(options: PrepareIgnoreRectanglesOptions): PreparedIgnoreRectangles;
|
|
51
|
+
//# sourceMappingURL=rectangles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangles.d.ts","sourceRoot":"","sources":["../../src/methods/rectangles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,+BAA+B,EAC/B,gBAAgB,EAChB,iBAAiB,EACjB,8BAA8B,EAC9B,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,8BAA8B,EAC9B,qCAAqC,EACxC,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAEvE;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,EAC7C,eAAe,EACf,WAAW,EACX,OAAO,EACP,OAAO,GACV,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4C/C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CAoCjH;AAED;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAC;IAClF,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,OAAO,EAAE,qCAAqC,CAAC;CAClD,GAAG,8BAA8B,CAgDjC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,WASvC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,WAS9C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,UAG9D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAC,OAAO,EAAE,GAAG,YAAY,CA4B1D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,eAAe,EAAE,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAQ/I;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CACxC,eAAe,EAAE,WAAW,CAAC,OAAO,EACpC,OAAO,EAAE,aAAa,EAAE,GACzB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAY7B;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,EAAE,SAAS,EAAE,oBAAoB,EAAE,YAAY,EAAE,EAAE,+BAA+B,+BAwBhI;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,8BAA8B,GAAG,wBAAwB,CAwEzG"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { CheckScreenMethodOptions } from '../commands/screen.interfaces.js';
|
|
2
|
+
import type { BaseBoundingBox, BaseDimensions, BaseRectangle } from '../base.interfaces.js';
|
|
3
|
+
import type { InstanceData } from './instanceData.interfaces.js';
|
|
4
|
+
export interface RectanglesOptions {
|
|
5
|
+
/** The device pixel ratio of the screen / device */
|
|
6
|
+
devicePixelRatio: number;
|
|
7
|
+
/** If this is an Android native screenshot */
|
|
8
|
+
isAndroidNativeWebScreenshot: boolean;
|
|
9
|
+
/** The inner height of a screen */
|
|
10
|
+
innerHeight: number;
|
|
11
|
+
/** If this is an iOS device */
|
|
12
|
+
isIOS: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ElementRectanglesOptions extends RectanglesOptions {
|
|
15
|
+
/** The device rectangles */
|
|
16
|
+
deviceRectangles: DeviceRectangles;
|
|
17
|
+
/** If this is an Android device */
|
|
18
|
+
isAndroid: boolean;
|
|
19
|
+
/** If the screen is emulated */
|
|
20
|
+
isEmulated: boolean;
|
|
21
|
+
/** The initial devicePixelRatio of the instance */
|
|
22
|
+
initialDevicePixelRatio: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ScreenRectanglesOptions extends RectanglesOptions {
|
|
25
|
+
/** If the legacy screenshot method is enabled */
|
|
26
|
+
enableLegacyScreenshotMethod: boolean;
|
|
27
|
+
/** The inner width of the screen */
|
|
28
|
+
innerWidth: number;
|
|
29
|
+
/** If this is an Android ChromeDriver screenshot */
|
|
30
|
+
isAndroidChromeDriverScreenshot: boolean;
|
|
31
|
+
/** The initial devicePixelRatio of the instance */
|
|
32
|
+
initialDevicePixelRatio: number;
|
|
33
|
+
/** If the screen is emulated */
|
|
34
|
+
isEmulated: boolean;
|
|
35
|
+
/** If the screen is in landscape mode */
|
|
36
|
+
isLandscape: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface RectanglesOutput extends BaseRectangle {
|
|
39
|
+
}
|
|
40
|
+
export type DeviceRectangles = {
|
|
41
|
+
/** The bottom bar rectangle */
|
|
42
|
+
bottomBar: RectanglesOutput;
|
|
43
|
+
/** The home bar rectangle */
|
|
44
|
+
homeBar: RectanglesOutput;
|
|
45
|
+
/** The left side padding rectangle */
|
|
46
|
+
leftSidePadding: RectanglesOutput;
|
|
47
|
+
/** The right side padding rectangle */
|
|
48
|
+
rightSidePadding: RectanglesOutput;
|
|
49
|
+
/** The screen size dimensions */
|
|
50
|
+
screenSize: BaseDimensions;
|
|
51
|
+
/** The status bar and address bar rectangle */
|
|
52
|
+
statusBarAndAddressBar: RectanglesOutput;
|
|
53
|
+
/** The status bar rectangle */
|
|
54
|
+
statusBar: RectanglesOutput;
|
|
55
|
+
/** The viewport rectangle */
|
|
56
|
+
viewport: RectanglesOutput;
|
|
57
|
+
};
|
|
58
|
+
export interface StatusAddressToolBarRectanglesOptions {
|
|
59
|
+
/** If the side bar needs to be blocked out */
|
|
60
|
+
blockOutSideBar: boolean;
|
|
61
|
+
/** If the status and address bar needs to be blocked out */
|
|
62
|
+
blockOutStatusBar: boolean;
|
|
63
|
+
/** If the tool bar needs to be blocked out */
|
|
64
|
+
blockOutToolBar: boolean;
|
|
65
|
+
/** Determine if it's an Android device */
|
|
66
|
+
isAndroid: boolean;
|
|
67
|
+
/** The name of the platform */
|
|
68
|
+
isAndroidNativeWebScreenshot: boolean;
|
|
69
|
+
/** If the instance is a mobile phone */
|
|
70
|
+
isMobile: boolean;
|
|
71
|
+
/** If the comparison needs to be done for a viewport screenshot or not */
|
|
72
|
+
isViewPortScreenshot: boolean;
|
|
73
|
+
}
|
|
74
|
+
export type StatusAddressToolBarRectangles = Array<RectanglesOutput>;
|
|
75
|
+
export interface ElementRectangles {
|
|
76
|
+
/** The browser instance */
|
|
77
|
+
browserInstance: WebdriverIO.Browser;
|
|
78
|
+
/** The base64 encoded image */
|
|
79
|
+
base64Image: string;
|
|
80
|
+
/** The options for element rectangles */
|
|
81
|
+
options: ElementRectanglesOptions;
|
|
82
|
+
/** The element to be compared */
|
|
83
|
+
element: any;
|
|
84
|
+
}
|
|
85
|
+
export interface SplitIgnores {
|
|
86
|
+
/** The elements to be ignored */
|
|
87
|
+
elements: WebdriverIO.Element[];
|
|
88
|
+
/** The regions to be ignored */
|
|
89
|
+
regions: RectanglesOutput[];
|
|
90
|
+
}
|
|
91
|
+
export interface DetermineDeviceBlockOutsOptions {
|
|
92
|
+
isAndroid: boolean;
|
|
93
|
+
screenCompareOptions: CheckScreenMethodOptions;
|
|
94
|
+
instanceData: InstanceData;
|
|
95
|
+
}
|
|
96
|
+
export interface PrepareIgnoreRectanglesOptions {
|
|
97
|
+
/** The blockOut rectangles from imageCompareOptions */
|
|
98
|
+
blockOut: RectanglesOutput[];
|
|
99
|
+
/** The ignore regions */
|
|
100
|
+
ignoreRegions: RectanglesOutput[];
|
|
101
|
+
/** The device rectangles */
|
|
102
|
+
deviceRectangles: DeviceRectangles;
|
|
103
|
+
/** The device pixel ratio */
|
|
104
|
+
devicePixelRatio: number;
|
|
105
|
+
/** Whether this is mobile */
|
|
106
|
+
isMobile: boolean;
|
|
107
|
+
/** Whether this is native context */
|
|
108
|
+
isNativeContext: boolean;
|
|
109
|
+
/** Whether this is Android */
|
|
110
|
+
isAndroid: boolean;
|
|
111
|
+
/** Whether this is Android native web screenshot */
|
|
112
|
+
isAndroidNativeWebScreenshot: boolean;
|
|
113
|
+
/** Whether this is viewport screenshot */
|
|
114
|
+
isViewPortScreenshot: boolean;
|
|
115
|
+
/** Image compare options for status/address/toolbar blocking */
|
|
116
|
+
imageCompareOptions: {
|
|
117
|
+
blockOutSideBar?: boolean;
|
|
118
|
+
blockOutStatusBar?: boolean;
|
|
119
|
+
blockOutToolBar?: boolean;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export interface PreparedIgnoreRectangles {
|
|
123
|
+
/** The final ignored boxes ready for resemble comparison */
|
|
124
|
+
ignoredBoxes: any[];
|
|
125
|
+
/** Whether any ignore rectangles were found */
|
|
126
|
+
hasIgnoreRectangles: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface BoundingBox extends BaseBoundingBox {
|
|
129
|
+
}
|
|
130
|
+
export interface IgnoreBoxes extends BoundingBox {
|
|
131
|
+
}
|
|
132
|
+
export interface BoundingBoxes {
|
|
133
|
+
/** Areas where visual differences were detected */
|
|
134
|
+
diffBoundingBoxes: BoundingBox[];
|
|
135
|
+
/** Areas to exclude from comparison analysis */
|
|
136
|
+
ignoredBoxes: IgnoreBoxes[];
|
|
137
|
+
}
|
|
138
|
+
export interface ReportFileSizes {
|
|
139
|
+
/** Dimensions of the actual screenshot */
|
|
140
|
+
actual: BaseDimensions;
|
|
141
|
+
/** Dimensions of the baseline image */
|
|
142
|
+
baseline: BaseDimensions;
|
|
143
|
+
/** Dimensions of the diff image (if generated) */
|
|
144
|
+
diff?: BaseDimensions;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=rectangles.interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangles.interfaces.d.ts","sourceRoot":"","sources":["../../src/methods/rectangles.interfaces.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { calculateDprData, getBase64ScreenshotSize, isObject } from '../helpers/utils.js';
|
|
2
|
+
import { getElementPositionAndroid, getElementPositionDesktop, getElementWebviewPosition } from './elementPosition.js';
|
|
3
|
+
/**
|
|
4
|
+
* Determine the element rectangles on the page / screenshot
|
|
5
|
+
*/
|
|
6
|
+
export async function determineElementRectangles({ browserInstance, base64Image, options, element, }) {
|
|
7
|
+
// Determine screenshot data
|
|
8
|
+
const { devicePixelRatio, deviceRectangles, initialDevicePixelRatio, innerHeight, isAndroid, isAndroidNativeWebScreenshot, isEmulated, isIOS, } = options;
|
|
9
|
+
const internalDpr = isEmulated ? initialDevicePixelRatio : devicePixelRatio;
|
|
10
|
+
const { height } = getBase64ScreenshotSize(base64Image, internalDpr);
|
|
11
|
+
let elementPosition;
|
|
12
|
+
// Determine the element position on the screenshot
|
|
13
|
+
if (isIOS) {
|
|
14
|
+
elementPosition = await getElementWebviewPosition(browserInstance, element, { deviceRectangles });
|
|
15
|
+
}
|
|
16
|
+
else if (isAndroid) {
|
|
17
|
+
elementPosition = await getElementPositionAndroid(browserInstance, element, { deviceRectangles, isAndroidNativeWebScreenshot });
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
elementPosition = await getElementPositionDesktop(browserInstance, element, { innerHeight, screenshotHeight: height });
|
|
21
|
+
}
|
|
22
|
+
// Validate if the element is visible
|
|
23
|
+
if (elementPosition.height === 0 || elementPosition.width === 0) {
|
|
24
|
+
let selectorMessage = ' ';
|
|
25
|
+
if (element.selector) {
|
|
26
|
+
selectorMessage = `, with selector "$(${element.selector})",`;
|
|
27
|
+
}
|
|
28
|
+
const message = `The element${selectorMessage}is not visible. The dimensions are ${elementPosition.width}x${elementPosition.height}`;
|
|
29
|
+
throw new Error(message);
|
|
30
|
+
}
|
|
31
|
+
// Determine the rectangles based on the device pixel ratio
|
|
32
|
+
return calculateDprData({
|
|
33
|
+
height: elementPosition.height,
|
|
34
|
+
width: elementPosition.width,
|
|
35
|
+
x: elementPosition.x,
|
|
36
|
+
y: elementPosition.y,
|
|
37
|
+
}, internalDpr);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Determine the rectangles of the screen for the screenshot
|
|
41
|
+
*/
|
|
42
|
+
export function determineScreenRectangles(base64Image, options) {
|
|
43
|
+
// Determine screenshot data
|
|
44
|
+
const { devicePixelRatio, enableLegacyScreenshotMethod, initialDevicePixelRatio, innerHeight, innerWidth, isEmulated, isIOS, isAndroidChromeDriverScreenshot, isAndroidNativeWebScreenshot, isLandscape, } = options;
|
|
45
|
+
// For #967: When a screenshot of an emulated device is taken, but the browser was initially
|
|
46
|
+
// started as a "desktop" session, so not with emulated caps, we need to store the initial
|
|
47
|
+
// devicePixelRatio when we take a screenshot and enableLegacyScreenshotMethod is enabled
|
|
48
|
+
const internalDpr = isEmulated && enableLegacyScreenshotMethod ? initialDevicePixelRatio : devicePixelRatio;
|
|
49
|
+
const { height, width } = getBase64ScreenshotSize(base64Image, internalDpr);
|
|
50
|
+
// Determine the width
|
|
51
|
+
const screenshotWidth = isIOS || isAndroidChromeDriverScreenshot ? width : innerWidth;
|
|
52
|
+
const screenshotHeight = isIOS || isAndroidNativeWebScreenshot ? height : innerHeight;
|
|
53
|
+
const isRotated = isLandscape && height > width;
|
|
54
|
+
// Determine the rectangles
|
|
55
|
+
return calculateDprData({
|
|
56
|
+
height: isRotated ? screenshotWidth : screenshotHeight,
|
|
57
|
+
width: isRotated ? screenshotHeight : screenshotWidth,
|
|
58
|
+
x: 0,
|
|
59
|
+
y: 0,
|
|
60
|
+
}, internalDpr);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Determine the rectangles for the mobile devices
|
|
64
|
+
*/
|
|
65
|
+
export function determineStatusAddressToolBarRectangles({ deviceRectangles, options }) {
|
|
66
|
+
const { blockOutSideBar, blockOutStatusBar, blockOutToolBar, isAndroid, isAndroidNativeWebScreenshot, isMobile, isViewPortScreenshot, } = options;
|
|
67
|
+
const rectangles = [];
|
|
68
|
+
if (isViewPortScreenshot &&
|
|
69
|
+
isMobile &&
|
|
70
|
+
(isAndroid && isAndroidNativeWebScreenshot || !isAndroid)) {
|
|
71
|
+
const statusAddressBar = {
|
|
72
|
+
x: deviceRectangles.statusBarAndAddressBar.x, y: deviceRectangles.statusBarAndAddressBar.y,
|
|
73
|
+
width: deviceRectangles.statusBarAndAddressBar.width, height: deviceRectangles.statusBarAndAddressBar.height,
|
|
74
|
+
};
|
|
75
|
+
const toolBar = {
|
|
76
|
+
x: deviceRectangles.bottomBar.x, y: deviceRectangles.bottomBar.y,
|
|
77
|
+
width: deviceRectangles.bottomBar.width, height: deviceRectangles.bottomBar.height,
|
|
78
|
+
};
|
|
79
|
+
const leftSidePadding = {
|
|
80
|
+
x: deviceRectangles.leftSidePadding.x, y: deviceRectangles.leftSidePadding.y,
|
|
81
|
+
width: deviceRectangles.leftSidePadding.width, height: deviceRectangles.leftSidePadding.height,
|
|
82
|
+
};
|
|
83
|
+
const rightSidePadding = {
|
|
84
|
+
x: deviceRectangles.rightSidePadding.x, y: deviceRectangles.rightSidePadding.y,
|
|
85
|
+
width: deviceRectangles.rightSidePadding.width, height: deviceRectangles.rightSidePadding.height,
|
|
86
|
+
};
|
|
87
|
+
if (blockOutStatusBar) {
|
|
88
|
+
rectangles.push(statusAddressBar);
|
|
89
|
+
}
|
|
90
|
+
if (blockOutToolBar) {
|
|
91
|
+
rectangles.push(toolBar);
|
|
92
|
+
}
|
|
93
|
+
if (blockOutSideBar) {
|
|
94
|
+
rectangles.push(leftSidePadding, rightSidePadding);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return rectangles;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Validate that the element is a WebdriverIO element
|
|
101
|
+
*/
|
|
102
|
+
export function isWdioElement(x) {
|
|
103
|
+
if (!isObject(x)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
const region = x;
|
|
107
|
+
const keys = ['selector', 'elementId'];
|
|
108
|
+
return keys.every(key => typeof region[key] === 'string');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Validate that the object is a valid ignore region
|
|
112
|
+
*/
|
|
113
|
+
export function validateIgnoreRegion(x) {
|
|
114
|
+
if (!isObject(x)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const region = x;
|
|
118
|
+
const keys = ['height', 'width', 'x', 'y'];
|
|
119
|
+
return keys.every(key => typeof region[key] === 'number');
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Format the error message
|
|
123
|
+
*/
|
|
124
|
+
export function formatErrorMessage(item, message) {
|
|
125
|
+
const formattedItem = isObject(item) ? JSON.stringify(item) : item;
|
|
126
|
+
return `${formattedItem} ${message}`;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Split the ignores into elements and regions and throw an error if
|
|
130
|
+
* an element is not a valid WebdriverIO element/region
|
|
131
|
+
*/
|
|
132
|
+
export function splitIgnores(items) {
|
|
133
|
+
const elements = [];
|
|
134
|
+
const regions = [];
|
|
135
|
+
const errorMessages = [];
|
|
136
|
+
for (const item of items) {
|
|
137
|
+
if (Array.isArray(item)) {
|
|
138
|
+
for (const nestedItem of item) {
|
|
139
|
+
if (!isWdioElement(nestedItem)) {
|
|
140
|
+
errorMessages.push(formatErrorMessage(nestedItem, 'is not a valid WebdriverIO element'));
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
elements.push(nestedItem);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else if (isWdioElement(item)) {
|
|
148
|
+
elements.push(item);
|
|
149
|
+
}
|
|
150
|
+
else if (validateIgnoreRegion(item)) {
|
|
151
|
+
regions.push(item);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
errorMessages.push(formatErrorMessage(item, 'is not a valid WebdriverIO element or region'));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (errorMessages.length > 0) {
|
|
158
|
+
throw new Error('Invalid elements or regions: ' + errorMessages.join(', '));
|
|
159
|
+
}
|
|
160
|
+
return { elements, regions };
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get the regions from the elements
|
|
164
|
+
*/
|
|
165
|
+
export async function getRegionsFromElements(browserInstance, elements) {
|
|
166
|
+
const regions = [];
|
|
167
|
+
for (const element of elements) {
|
|
168
|
+
const region = await browserInstance.getElementRect(element.elementId);
|
|
169
|
+
regions.push(region);
|
|
170
|
+
}
|
|
171
|
+
return regions;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Translate ignores to regions
|
|
175
|
+
*/
|
|
176
|
+
export async function determineIgnoreRegions(browserInstance, ignores) {
|
|
177
|
+
const awaitedIgnores = await Promise.all(ignores);
|
|
178
|
+
const { elements, regions } = splitIgnores(awaitedIgnores);
|
|
179
|
+
const regionsFromElements = await getRegionsFromElements(browserInstance, elements);
|
|
180
|
+
return [...regions, ...regionsFromElements]
|
|
181
|
+
.map((region) => ({
|
|
182
|
+
x: Math.round(region.x),
|
|
183
|
+
y: Math.round(region.y),
|
|
184
|
+
width: Math.round(region.width),
|
|
185
|
+
height: Math.round(region.height),
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Determine the device block outs
|
|
190
|
+
*/
|
|
191
|
+
export async function determineDeviceBlockOuts({ isAndroid, screenCompareOptions, instanceData }) {
|
|
192
|
+
const rectangles = [];
|
|
193
|
+
const { blockOutStatusBar, blockOutToolBar } = screenCompareOptions;
|
|
194
|
+
const { deviceRectangles: { homeBar, statusBar } } = instanceData;
|
|
195
|
+
if (blockOutStatusBar) {
|
|
196
|
+
rectangles.push(statusBar);
|
|
197
|
+
}
|
|
198
|
+
if (isAndroid) {
|
|
199
|
+
//
|
|
200
|
+
}
|
|
201
|
+
else if (blockOutToolBar) {
|
|
202
|
+
rectangles.push(homeBar);
|
|
203
|
+
}
|
|
204
|
+
// @TODO: This is from the native-app-compare module, I can't really find the diffs between the two
|
|
205
|
+
// if (options.blockOutStatusBar) {
|
|
206
|
+
// rectangles.push(deviceInfo.rectangles.statusBar)
|
|
207
|
+
// }
|
|
208
|
+
// if (driver.isAndroid && options.blockOutNavigationBar) {
|
|
209
|
+
// rectangles.push(deviceInfo.rectangles.androidNavigationBar)
|
|
210
|
+
// }
|
|
211
|
+
return rectangles;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Prepare all ignore rectangles for image comparison
|
|
215
|
+
*/
|
|
216
|
+
export function prepareIgnoreRectangles(options) {
|
|
217
|
+
const { blockOut, ignoreRegions, deviceRectangles, devicePixelRatio, isMobile, isNativeContext, isAndroid, isAndroidNativeWebScreenshot, isViewPortScreenshot, imageCompareOptions } = options;
|
|
218
|
+
// Get blockOut rectangles
|
|
219
|
+
let webStatusAddressToolBarOptions = [];
|
|
220
|
+
// Handle mobile web status/address/toolbar rectangles
|
|
221
|
+
if (isMobile && !isNativeContext) {
|
|
222
|
+
const statusAddressToolBarOptions = {
|
|
223
|
+
blockOutSideBar: imageCompareOptions.blockOutSideBar,
|
|
224
|
+
blockOutStatusBar: imageCompareOptions.blockOutStatusBar,
|
|
225
|
+
blockOutToolBar: imageCompareOptions.blockOutToolBar,
|
|
226
|
+
isAndroid,
|
|
227
|
+
isAndroidNativeWebScreenshot,
|
|
228
|
+
isMobile,
|
|
229
|
+
isViewPortScreenshot,
|
|
230
|
+
};
|
|
231
|
+
webStatusAddressToolBarOptions.push(...(determineStatusAddressToolBarRectangles({ deviceRectangles, options: statusAddressToolBarOptions })) || []);
|
|
232
|
+
if (webStatusAddressToolBarOptions.length > 0) {
|
|
233
|
+
// There's an issue with the resemble lib when all the rectangles are 0,0,0,0, it will see this as a full
|
|
234
|
+
// blockout of the image and the comparison will succeed with 0 % difference
|
|
235
|
+
webStatusAddressToolBarOptions = webStatusAddressToolBarOptions
|
|
236
|
+
.filter((rectangle) => !(rectangle.x === 0 && rectangle.y === 0 && rectangle.width === 0 && rectangle.height === 0));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
// Combine all ignore regions
|
|
240
|
+
const ignoredBoxes = [
|
|
241
|
+
// These come from the method
|
|
242
|
+
...blockOut,
|
|
243
|
+
// @TODO: I'm defaulting ignore regions for devices
|
|
244
|
+
// Need to check if this is the right thing to do for web and mobile browser tests
|
|
245
|
+
...ignoreRegions,
|
|
246
|
+
// Only get info about the status bars when we are in the web context
|
|
247
|
+
...webStatusAddressToolBarOptions
|
|
248
|
+
]
|
|
249
|
+
.map(
|
|
250
|
+
// Make sure all the rectangles are equal to the dpr for the screenshot
|
|
251
|
+
(rectangles) => {
|
|
252
|
+
return calculateDprData({
|
|
253
|
+
// Adjust for the ResembleJS API
|
|
254
|
+
bottom: rectangles.y + rectangles.height,
|
|
255
|
+
right: rectangles.x + rectangles.width,
|
|
256
|
+
left: rectangles.x,
|
|
257
|
+
top: rectangles.y,
|
|
258
|
+
},
|
|
259
|
+
// For Android we don't need to do it times the pixel ratio, for all others we need to
|
|
260
|
+
isAndroid ? 1 : devicePixelRatio);
|
|
261
|
+
});
|
|
262
|
+
return {
|
|
263
|
+
ignoredBoxes,
|
|
264
|
+
hasIgnoreRectangles: ignoredBoxes.length > 0
|
|
265
|
+
};
|
|
266
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangles.test.d.ts","sourceRoot":"","sources":["../../src/methods/rectangles.test.ts"],"names":[],"mappings":""}
|