@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,6 @@
|
|
|
1
|
+
import type { EnrichedInstanceData, InstanceOptions } from './instanceData.interfaces.js';
|
|
2
|
+
/**
|
|
3
|
+
* Enrich the instance data with more data
|
|
4
|
+
*/
|
|
5
|
+
export default function getEnrichedInstanceData(browserInstance: WebdriverIO.Browser, instanceOptions: InstanceOptions, addShadowPadding: boolean): Promise<EnrichedInstanceData>;
|
|
6
|
+
//# sourceMappingURL=instanceData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instanceData.d.ts","sourceRoot":"","sources":["../../src/methods/instanceData.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAEzF;;GAEG;AACH,wBAA8B,uBAAuB,CACjD,eAAe,EAAE,WAAW,CAAC,OAAO,EACpC,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,OAAO,GAC1B,OAAO,CAAC,oBAAoB,CAAC,CAsC/B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ScreenDimensions } from '../clientSideScripts/screenDimensions.interfaces.js';
|
|
2
|
+
import type { DeviceRectangles } from './rectangles.interfaces.js';
|
|
3
|
+
export interface InstanceData {
|
|
4
|
+
/** The name of the app */
|
|
5
|
+
appName: string;
|
|
6
|
+
/** The browser name of the instance */
|
|
7
|
+
browserName: string;
|
|
8
|
+
/** The browser version of the instance */
|
|
9
|
+
browserVersion: string;
|
|
10
|
+
/** The device name of the instance */
|
|
11
|
+
deviceName: string;
|
|
12
|
+
/** The devicePixelRatio of the instance */
|
|
13
|
+
devicePixelRatio: number;
|
|
14
|
+
/** The mobile viewport position */
|
|
15
|
+
deviceRectangles: DeviceRectangles;
|
|
16
|
+
/** The initial devicePixelRatio of the instance */
|
|
17
|
+
initialDevicePixelRatio: number;
|
|
18
|
+
/** Is this an Android device */
|
|
19
|
+
isAndroid: boolean;
|
|
20
|
+
/** Is this an iOS device */
|
|
21
|
+
isIOS: boolean;
|
|
22
|
+
/** Is this a mobile instance */
|
|
23
|
+
isMobile: boolean;
|
|
24
|
+
/** The log name of the instance */
|
|
25
|
+
logName: string;
|
|
26
|
+
/** The name of the instance */
|
|
27
|
+
name: string;
|
|
28
|
+
/** If the instance creates native webscreenshots */
|
|
29
|
+
nativeWebScreenshot: boolean;
|
|
30
|
+
/** The platform name of the instance */
|
|
31
|
+
platformName: string;
|
|
32
|
+
/** The platform version of the instance */
|
|
33
|
+
platformVersion: string;
|
|
34
|
+
}
|
|
35
|
+
export interface InstanceOptions extends InstanceData {
|
|
36
|
+
/** The browser name of the instance */
|
|
37
|
+
addressBarShadowPadding: number;
|
|
38
|
+
/** The browser name of the instance */
|
|
39
|
+
toolBarShadowPadding: number;
|
|
40
|
+
}
|
|
41
|
+
export interface EnrichedInstanceData extends ScreenDimensions, InstanceOptions {
|
|
42
|
+
/** Is this an Android device */
|
|
43
|
+
isAndroid: boolean;
|
|
44
|
+
/** Is this an Android ChromeDriver screenshot */
|
|
45
|
+
isAndroidChromeDriverScreenshot: boolean;
|
|
46
|
+
/** Is this an Android Native screenshot */
|
|
47
|
+
isAndroidNativeWebScreenshot: boolean;
|
|
48
|
+
/** Is this an iOS device */
|
|
49
|
+
isIOS: boolean;
|
|
50
|
+
/** Is this a mobile instance */
|
|
51
|
+
isMobile: boolean;
|
|
52
|
+
/** Is this a test in a desktop browser */
|
|
53
|
+
isTestInBrowser: boolean;
|
|
54
|
+
/** Is this a test in a mobile browser */
|
|
55
|
+
isTestInMobileBrowser: boolean;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=instanceData.interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instanceData.interfaces.d.ts","sourceRoot":"","sources":["../../src/methods/instanceData.interfaces.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAA;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAElE,MAAM,WAAW,YAAY;IACzB,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,gBAAgB,EAAE,MAAM,CAAC;IACzB,mCAAmC;IACnC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,mDAAmD;IACnD,uBAAuB,EAAE,MAAM,CAAC;IAChC,gCAAgC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,gCAAgC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACjD,uCAAuC;IACvC,uBAAuB,EAAE,MAAM,CAAC;IAChC,uCAAuC;IACvC,oBAAoB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB,EAAE,eAAe;IAC3E,gCAAgC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,+BAA+B,EAAE,OAAO,CAAC;IACzC,2CAA2C;IAC3C,4BAA4B,EAAE,OAAO,CAAC;IACtC,4BAA4B;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,gCAAgC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,0CAA0C;IAC1C,eAAe,EAAE,OAAO,CAAC;IACzB,yCAAyC;IACzC,qBAAqB,EAAE,OAAO,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { checkAndroidChromeDriverScreenshot, checkAndroidNativeWebScreenshot, checkTestInBrowser, checkTestInMobileBrowser, getAddressBarShadowPadding, getToolBarShadowPadding, } from '../helpers/utils.js';
|
|
2
|
+
import getScreenDimensions from '../clientSideScripts/getScreenDimensions.js';
|
|
3
|
+
/**
|
|
4
|
+
* Enrich the instance data with more data
|
|
5
|
+
*/
|
|
6
|
+
export default async function getEnrichedInstanceData(browserInstance, instanceOptions, addShadowPadding) {
|
|
7
|
+
// Get the current browser data
|
|
8
|
+
const browserData = await browserInstance.execute(getScreenDimensions, instanceOptions.isMobile);
|
|
9
|
+
const { addressBarShadowPadding, toolBarShadowPadding, browserName, nativeWebScreenshot } = instanceOptions;
|
|
10
|
+
// Determine some constants
|
|
11
|
+
const isAndroid = browserInstance.isAndroid;
|
|
12
|
+
const isIOS = browserInstance.isIOS;
|
|
13
|
+
const isMobile = browserInstance.isMobile;
|
|
14
|
+
const isTestInBrowser = checkTestInBrowser(browserName);
|
|
15
|
+
const isTestInMobileBrowser = checkTestInMobileBrowser(isMobile, browserName);
|
|
16
|
+
const isAndroidNativeWebScreenshot = checkAndroidNativeWebScreenshot(isAndroid, nativeWebScreenshot);
|
|
17
|
+
const isAndroidChromeDriverScreenshot = checkAndroidChromeDriverScreenshot(isAndroid, nativeWebScreenshot);
|
|
18
|
+
const addressBarPadding = getAddressBarShadowPadding({
|
|
19
|
+
browserName,
|
|
20
|
+
isAndroid,
|
|
21
|
+
isIOS,
|
|
22
|
+
isMobile,
|
|
23
|
+
nativeWebScreenshot,
|
|
24
|
+
addressBarShadowPadding,
|
|
25
|
+
addShadowPadding,
|
|
26
|
+
});
|
|
27
|
+
const toolBarPadding = getToolBarShadowPadding({ isAndroid, isIOS, isMobile, browserName, toolBarShadowPadding, addShadowPadding });
|
|
28
|
+
// Return the new instance data object
|
|
29
|
+
return {
|
|
30
|
+
...browserData,
|
|
31
|
+
...instanceOptions,
|
|
32
|
+
addressBarShadowPadding: addressBarPadding,
|
|
33
|
+
isAndroid,
|
|
34
|
+
isAndroidChromeDriverScreenshot,
|
|
35
|
+
isAndroidNativeWebScreenshot,
|
|
36
|
+
isIOS,
|
|
37
|
+
isMobile,
|
|
38
|
+
isTestInBrowser,
|
|
39
|
+
isTestInMobileBrowser,
|
|
40
|
+
toolBarShadowPadding: toolBarPadding,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instanceData.test.d.ts","sourceRoot":"","sources":["../../src/methods/instanceData.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
2
|
+
import getEnrichedInstanceData from './instanceData.js';
|
|
3
|
+
import { DEVICE_RECTANGLES, NOT_KNOWN } from '../helpers/constants.js';
|
|
4
|
+
describe('getEnrichedInstanceData', () => {
|
|
5
|
+
const createMockBrowserInstance = (mockExecuteFn = vi.fn().mockResolvedValue({
|
|
6
|
+
dimensions: {
|
|
7
|
+
body: {
|
|
8
|
+
offsetHeight: 0,
|
|
9
|
+
scrollHeight: 0,
|
|
10
|
+
},
|
|
11
|
+
html: {
|
|
12
|
+
clientHeight: 0,
|
|
13
|
+
clientWidth: 0,
|
|
14
|
+
offsetHeight: 0,
|
|
15
|
+
scrollHeight: 0,
|
|
16
|
+
scrollWidth: 0,
|
|
17
|
+
},
|
|
18
|
+
window: {
|
|
19
|
+
devicePixelRatio: 1,
|
|
20
|
+
isEmulated: false,
|
|
21
|
+
innerHeight: 768,
|
|
22
|
+
innerWidth: 1024,
|
|
23
|
+
outerHeight: 768,
|
|
24
|
+
outerWidth: 1024,
|
|
25
|
+
screenHeight: 0,
|
|
26
|
+
screenWidth: 0,
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
}), customProperties = {}) => {
|
|
30
|
+
return {
|
|
31
|
+
execute: mockExecuteFn,
|
|
32
|
+
...customProperties
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
vi.clearAllMocks();
|
|
37
|
+
});
|
|
38
|
+
const baseInstanceOptions = {
|
|
39
|
+
addressBarShadowPadding: 6,
|
|
40
|
+
toolBarShadowPadding: 6,
|
|
41
|
+
browserName: 'browserName',
|
|
42
|
+
browserVersion: 'browserVersion',
|
|
43
|
+
deviceName: 'deviceName',
|
|
44
|
+
logName: 'logName',
|
|
45
|
+
name: 'name',
|
|
46
|
+
nativeWebScreenshot: false,
|
|
47
|
+
platformName: 'platformName',
|
|
48
|
+
platformVersion: 'platformVersion',
|
|
49
|
+
// Defaults
|
|
50
|
+
appName: NOT_KNOWN,
|
|
51
|
+
devicePixelRatio: 1,
|
|
52
|
+
deviceRectangles: DEVICE_RECTANGLES,
|
|
53
|
+
initialDevicePixelRatio: 1,
|
|
54
|
+
isAndroid: false,
|
|
55
|
+
isIOS: false,
|
|
56
|
+
isMobile: false,
|
|
57
|
+
};
|
|
58
|
+
const createInstanceOptions = (overrides = {}) => ({
|
|
59
|
+
...baseInstanceOptions,
|
|
60
|
+
...overrides,
|
|
61
|
+
});
|
|
62
|
+
it('should be able to enrich the instance data with all the defaults for desktop with no shadow padding', async () => {
|
|
63
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: false, isIOS: false, isMobile: false });
|
|
64
|
+
const instanceOptions = createInstanceOptions();
|
|
65
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, false);
|
|
66
|
+
expect(result).toMatchSnapshot();
|
|
67
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), false);
|
|
68
|
+
});
|
|
69
|
+
it('should be able to enrich the instance data with all the defaults for Android ChromeDriver with no shadow padding', async () => {
|
|
70
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: true, isIOS: false, isMobile: true });
|
|
71
|
+
const instanceOptions = createInstanceOptions({
|
|
72
|
+
platformName: 'Android',
|
|
73
|
+
platformVersion: '8.0',
|
|
74
|
+
isAndroid: true,
|
|
75
|
+
isMobile: true,
|
|
76
|
+
});
|
|
77
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, false);
|
|
78
|
+
expect(result).toMatchSnapshot();
|
|
79
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), true);
|
|
80
|
+
});
|
|
81
|
+
it('should be able to enrich the instance data with all the defaults for Android Native Webscreenshot with no shadow padding', async () => {
|
|
82
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: true, isIOS: false, isMobile: true });
|
|
83
|
+
const instanceOptions = createInstanceOptions({
|
|
84
|
+
nativeWebScreenshot: true,
|
|
85
|
+
platformName: 'Android',
|
|
86
|
+
platformVersion: '8.0',
|
|
87
|
+
isAndroid: true,
|
|
88
|
+
isMobile: true,
|
|
89
|
+
});
|
|
90
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, false);
|
|
91
|
+
expect(result).toMatchSnapshot();
|
|
92
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), true);
|
|
93
|
+
});
|
|
94
|
+
it('should be able to enrich the instance data with all the defaults for iOS with shadow padding', async () => {
|
|
95
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: false, isIOS: true, isMobile: true });
|
|
96
|
+
const instanceOptions = createInstanceOptions({
|
|
97
|
+
platformName: 'iOS',
|
|
98
|
+
platformVersion: '12.4',
|
|
99
|
+
isIOS: true,
|
|
100
|
+
isMobile: true,
|
|
101
|
+
});
|
|
102
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, true);
|
|
103
|
+
expect(result).toMatchSnapshot();
|
|
104
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), true);
|
|
105
|
+
});
|
|
106
|
+
it('should handle test in mobile browser scenario', async () => {
|
|
107
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: true, isIOS: false, isMobile: true });
|
|
108
|
+
const instanceOptions = createInstanceOptions({
|
|
109
|
+
browserName: 'Chrome',
|
|
110
|
+
platformName: 'Android',
|
|
111
|
+
platformVersion: '11.0',
|
|
112
|
+
isAndroid: true,
|
|
113
|
+
isMobile: true,
|
|
114
|
+
});
|
|
115
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, false);
|
|
116
|
+
expect(result).toMatchSnapshot();
|
|
117
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), true);
|
|
118
|
+
});
|
|
119
|
+
it('should handle native context without browserName', async () => {
|
|
120
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: false, isIOS: true, isMobile: true });
|
|
121
|
+
const instanceOptions = createInstanceOptions({
|
|
122
|
+
browserName: '',
|
|
123
|
+
platformName: 'iOS',
|
|
124
|
+
platformVersion: '15.0',
|
|
125
|
+
isIOS: true,
|
|
126
|
+
isMobile: true,
|
|
127
|
+
});
|
|
128
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, false);
|
|
129
|
+
expect(result).toMatchSnapshot();
|
|
130
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), true);
|
|
131
|
+
});
|
|
132
|
+
it('should handle case-insensitive platform names', async () => {
|
|
133
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: true, isIOS: false, isMobile: true });
|
|
134
|
+
const instanceOptions = createInstanceOptions({
|
|
135
|
+
platformName: 'ANDROID',
|
|
136
|
+
platformVersion: '12.0',
|
|
137
|
+
isAndroid: true,
|
|
138
|
+
isMobile: true,
|
|
139
|
+
});
|
|
140
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, true);
|
|
141
|
+
expect(result).toMatchSnapshot();
|
|
142
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), true);
|
|
143
|
+
});
|
|
144
|
+
it('should handle unknown platform name', async () => {
|
|
145
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: false, isIOS: false, isMobile: false });
|
|
146
|
+
const instanceOptions = createInstanceOptions({
|
|
147
|
+
platformName: 'Windows',
|
|
148
|
+
platformVersion: '10',
|
|
149
|
+
});
|
|
150
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, false);
|
|
151
|
+
expect(result).toMatchSnapshot();
|
|
152
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), false);
|
|
153
|
+
});
|
|
154
|
+
it('should handle Android with shadow padding enabled', async () => {
|
|
155
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: true, isIOS: false, isMobile: true });
|
|
156
|
+
const instanceOptions = createInstanceOptions({
|
|
157
|
+
browserName: 'Chrome',
|
|
158
|
+
nativeWebScreenshot: true,
|
|
159
|
+
platformName: 'Android',
|
|
160
|
+
platformVersion: '10.0',
|
|
161
|
+
isAndroid: true,
|
|
162
|
+
isMobile: true,
|
|
163
|
+
});
|
|
164
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, true);
|
|
165
|
+
expect(result).toMatchSnapshot();
|
|
166
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), true);
|
|
167
|
+
});
|
|
168
|
+
it('should handle iOS home bar padding calculation', async () => {
|
|
169
|
+
const mockBrowserInstance = createMockBrowserInstance(undefined, { isAndroid: false, isIOS: true, isMobile: true });
|
|
170
|
+
const instanceOptions = createInstanceOptions({
|
|
171
|
+
browserName: 'Safari',
|
|
172
|
+
platformName: 'iOS',
|
|
173
|
+
platformVersion: '16.0',
|
|
174
|
+
toolBarShadowPadding: 10,
|
|
175
|
+
isIOS: true,
|
|
176
|
+
isMobile: true,
|
|
177
|
+
});
|
|
178
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, true);
|
|
179
|
+
expect(result).toMatchSnapshot();
|
|
180
|
+
expect(mockBrowserInstance.execute).toHaveBeenCalledWith(expect.any(Function), true);
|
|
181
|
+
});
|
|
182
|
+
it('should handle different screen dimensions', async () => {
|
|
183
|
+
const mockExecute = vi.fn().mockResolvedValue({
|
|
184
|
+
dimensions: {
|
|
185
|
+
body: {
|
|
186
|
+
offsetHeight: 100,
|
|
187
|
+
scrollHeight: 2000,
|
|
188
|
+
},
|
|
189
|
+
html: {
|
|
190
|
+
clientHeight: 1080,
|
|
191
|
+
clientWidth: 1920,
|
|
192
|
+
offsetHeight: 1080,
|
|
193
|
+
scrollHeight: 2000,
|
|
194
|
+
scrollWidth: 1920,
|
|
195
|
+
},
|
|
196
|
+
window: {
|
|
197
|
+
devicePixelRatio: 2,
|
|
198
|
+
isEmulated: true,
|
|
199
|
+
innerHeight: 1080,
|
|
200
|
+
innerWidth: 1920,
|
|
201
|
+
outerHeight: 1080,
|
|
202
|
+
outerWidth: 1920,
|
|
203
|
+
screenHeight: 1080,
|
|
204
|
+
screenWidth: 1920,
|
|
205
|
+
},
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
const mockBrowserInstance = createMockBrowserInstance(mockExecute);
|
|
209
|
+
const instanceOptions = createInstanceOptions({
|
|
210
|
+
devicePixelRatio: 2,
|
|
211
|
+
});
|
|
212
|
+
const result = await getEnrichedInstanceData(mockBrowserInstance, instanceOptions, false);
|
|
213
|
+
expect(result).toBeDefined();
|
|
214
|
+
expect(result.dimensions.window.devicePixelRatio).toBe(2);
|
|
215
|
+
expect(result.dimensions.window.isEmulated).toBe(true);
|
|
216
|
+
});
|
|
217
|
+
it('should handle browser execute failure gracefully', async () => {
|
|
218
|
+
const mockExecute = vi.fn().mockRejectedValue(new Error('Failed to get screen dimensions'));
|
|
219
|
+
const mockBrowserInstance = createMockBrowserInstance(mockExecute);
|
|
220
|
+
const instanceOptions = createInstanceOptions();
|
|
221
|
+
await expect(getEnrichedInstanceData(mockBrowserInstance, instanceOptions, false))
|
|
222
|
+
.rejects.toThrow('Failed to get screen dimensions');
|
|
223
|
+
});
|
|
224
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTE: This code/logic is based on logical research and support from the following sources:
|
|
3
|
+
* - Copilot AI
|
|
4
|
+
* - ChatGPT
|
|
5
|
+
*
|
|
6
|
+
* This is still a draft and may not be accurate, more research is needed and will tell you if this is correct.
|
|
7
|
+
* It produces the following log based on `150585` diff pixels:
|
|
8
|
+
*
|
|
9
|
+
* [0-0] Processing diff pixels started
|
|
10
|
+
* [0-0] Bounding boxes: [
|
|
11
|
+
* [0-0] { left: 912, top: 743, right: 1144, bottom: 762 },
|
|
12
|
+
* [0-0] { left: 650, top: 749, right: 790, bottom: 760 },
|
|
13
|
+
* [0-0] { left: 537, top: 749, right: 644, bottom: 760 },
|
|
14
|
+
* [0-0] { left: 377, top: 749, right: 415, bottom: 760 },
|
|
15
|
+
* [0-0] { left: 362, top: 749, right: 371, bottom: 759 },
|
|
16
|
+
* [0-0] { left: 290, top: 750, right: 356, bottom: 762 },
|
|
17
|
+
* [0-0] { left: 159, top: 746, right: 284, bottom: 760 },
|
|
18
|
+
* [0-0] { left: 536, top: 711, right: 754, bottom: 730 },
|
|
19
|
+
* [0-0] { left: 913, top: 711, right: 1186, bottom: 730 },
|
|
20
|
+
* [0-0] { left: 368, top: 717, right: 413, bottom: 730 },
|
|
21
|
+
* [0-0] { left: 159, top: 711, right: 362, bottom: 728 },
|
|
22
|
+
* [0-0] { left: 912, top: 652, right: 1144, bottom: 703 },
|
|
23
|
+
* [0-0] { left: 536, top: 652, right: 790, bottom: 701 },
|
|
24
|
+
* [0-0] { left: 377, top: 690, right: 415, bottom: 701 },
|
|
25
|
+
* [0-0] { left: 362, top: 690, right: 371, bottom: 700 },
|
|
26
|
+
* [0-0] { left: 159, top: 652, right: 356, bottom: 703 },
|
|
27
|
+
* [0-0] { left: 129, top: 529, right: 1236, bottom: 633 },
|
|
28
|
+
* [0-0] { left: 475, top: 457, right: 1046, bottom: 513 },
|
|
29
|
+
* [0-0] { left: 319, top: 470, right: 454, bottom: 513 },
|
|
30
|
+
* [0-0] { left: 387, top: 399, right: 514, bottom: 428 },
|
|
31
|
+
* [0-0] { left: 818, top: 398, right: 978, bottom: 422 },
|
|
32
|
+
* [0-0] { left: 527, top: 398, right: 807, bottom: 428 },
|
|
33
|
+
* [0-0] { left: 600, top: 143, right: 766, bottom: 338 },
|
|
34
|
+
* [0-0] { left: 25, top: 27, right: 56, bottom: 58 }
|
|
35
|
+
* [0-0] ]
|
|
36
|
+
* [0-0] Processing 150585 diff pixels
|
|
37
|
+
* [0-0] Union operations started
|
|
38
|
+
* [0-0] Union time: 155ms
|
|
39
|
+
* [0-0] Grouping pixels into bounding boxes
|
|
40
|
+
* [0-0] Grouping time: 19ms
|
|
41
|
+
* [0-0] Total analysis time: 209ms
|
|
42
|
+
* [0-0] Post-processing bounding boxes
|
|
43
|
+
* [0-0] Post-processing time: 3ms
|
|
44
|
+
* [0-0] Number merged: 24
|
|
45
|
+
*/
|
|
46
|
+
import type { Pixel, WicImageCompareOptions } from 'src/methods/images.interfaces.js';
|
|
47
|
+
import type { BoundingBox } from './rectangles.interfaces.js';
|
|
48
|
+
import type { IgnoreBoxes } from './rectangles.interfaces.js';
|
|
49
|
+
import type { CompareData } from '../resemble/compare.interfaces.js';
|
|
50
|
+
declare function processDiffPixels(diffPixels: Pixel[], proximity: number): BoundingBox[];
|
|
51
|
+
/**
|
|
52
|
+
* Generate and save diff image with bounding boxes
|
|
53
|
+
*/
|
|
54
|
+
export declare function generateAndSaveDiff(data: CompareData, imageCompareOptions: WicImageCompareOptions, ignoredBoxes: IgnoreBoxes[], diffFilePath: string, rawMisMatchPercentage: number): Promise<{
|
|
55
|
+
diffBoundingBoxes: BoundingBox[];
|
|
56
|
+
storeDiffs: boolean;
|
|
57
|
+
}>;
|
|
58
|
+
export { processDiffPixels };
|
|
59
|
+
//# sourceMappingURL=processDiffPixels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processDiffPixels.d.ts","sourceRoot":"","sources":["../../src/methods/processDiffPixels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAqFpE,iBAAS,iBAAiB,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,EAAE,CAkHhF;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACrC,IAAI,EAAE,WAAW,EACjB,mBAAmB,EAAE,sBAAsB,EAC3C,YAAY,EAAE,WAAW,EAAE,EAC3B,YAAY,EAAE,MAAM,EACpB,qBAAqB,EAAE,MAAM,GAC9B,OAAO,CAAC;IAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC,CA2BpE;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTE: This code/logic is based on logical research and support from the following sources:
|
|
3
|
+
* - Copilot AI
|
|
4
|
+
* - ChatGPT
|
|
5
|
+
*
|
|
6
|
+
* This is still a draft and may not be accurate, more research is needed and will tell you if this is correct.
|
|
7
|
+
* It produces the following log based on `150585` diff pixels:
|
|
8
|
+
*
|
|
9
|
+
* [0-0] Processing diff pixels started
|
|
10
|
+
* [0-0] Bounding boxes: [
|
|
11
|
+
* [0-0] { left: 912, top: 743, right: 1144, bottom: 762 },
|
|
12
|
+
* [0-0] { left: 650, top: 749, right: 790, bottom: 760 },
|
|
13
|
+
* [0-0] { left: 537, top: 749, right: 644, bottom: 760 },
|
|
14
|
+
* [0-0] { left: 377, top: 749, right: 415, bottom: 760 },
|
|
15
|
+
* [0-0] { left: 362, top: 749, right: 371, bottom: 759 },
|
|
16
|
+
* [0-0] { left: 290, top: 750, right: 356, bottom: 762 },
|
|
17
|
+
* [0-0] { left: 159, top: 746, right: 284, bottom: 760 },
|
|
18
|
+
* [0-0] { left: 536, top: 711, right: 754, bottom: 730 },
|
|
19
|
+
* [0-0] { left: 913, top: 711, right: 1186, bottom: 730 },
|
|
20
|
+
* [0-0] { left: 368, top: 717, right: 413, bottom: 730 },
|
|
21
|
+
* [0-0] { left: 159, top: 711, right: 362, bottom: 728 },
|
|
22
|
+
* [0-0] { left: 912, top: 652, right: 1144, bottom: 703 },
|
|
23
|
+
* [0-0] { left: 536, top: 652, right: 790, bottom: 701 },
|
|
24
|
+
* [0-0] { left: 377, top: 690, right: 415, bottom: 701 },
|
|
25
|
+
* [0-0] { left: 362, top: 690, right: 371, bottom: 700 },
|
|
26
|
+
* [0-0] { left: 159, top: 652, right: 356, bottom: 703 },
|
|
27
|
+
* [0-0] { left: 129, top: 529, right: 1236, bottom: 633 },
|
|
28
|
+
* [0-0] { left: 475, top: 457, right: 1046, bottom: 513 },
|
|
29
|
+
* [0-0] { left: 319, top: 470, right: 454, bottom: 513 },
|
|
30
|
+
* [0-0] { left: 387, top: 399, right: 514, bottom: 428 },
|
|
31
|
+
* [0-0] { left: 818, top: 398, right: 978, bottom: 422 },
|
|
32
|
+
* [0-0] { left: 527, top: 398, right: 807, bottom: 428 },
|
|
33
|
+
* [0-0] { left: 600, top: 143, right: 766, bottom: 338 },
|
|
34
|
+
* [0-0] { left: 25, top: 27, right: 56, bottom: 58 }
|
|
35
|
+
* [0-0] ]
|
|
36
|
+
* [0-0] Processing 150585 diff pixels
|
|
37
|
+
* [0-0] Union operations started
|
|
38
|
+
* [0-0] Union time: 155ms
|
|
39
|
+
* [0-0] Grouping pixels into bounding boxes
|
|
40
|
+
* [0-0] Grouping time: 19ms
|
|
41
|
+
* [0-0] Total analysis time: 209ms
|
|
42
|
+
* [0-0] Post-processing bounding boxes
|
|
43
|
+
* [0-0] Post-processing time: 3ms
|
|
44
|
+
* [0-0] Number merged: 24
|
|
45
|
+
*/
|
|
46
|
+
import logger from '@wdio/logger';
|
|
47
|
+
import { saveBase64Image, addBlockOuts } from './images.js';
|
|
48
|
+
const log = logger('@wdio/visual-service:@wdio/image-comparison-core:pixelDiffProcessing');
|
|
49
|
+
class DisjointSet {
|
|
50
|
+
parent;
|
|
51
|
+
rank;
|
|
52
|
+
constructor() {
|
|
53
|
+
this.parent = new Map();
|
|
54
|
+
this.rank = new Map();
|
|
55
|
+
}
|
|
56
|
+
find(x) {
|
|
57
|
+
if (this.parent.get(x) !== x) {
|
|
58
|
+
this.parent.set(x, this.find(this.parent.get(x))); // Path compression
|
|
59
|
+
}
|
|
60
|
+
return this.parent.get(x);
|
|
61
|
+
}
|
|
62
|
+
union(x, y) {
|
|
63
|
+
const rootX = this.find(x);
|
|
64
|
+
const rootY = this.find(y);
|
|
65
|
+
if (rootX !== rootY) {
|
|
66
|
+
const rankX = this.rank.get(rootX) || 0;
|
|
67
|
+
const rankY = this.rank.get(rootY) || 0;
|
|
68
|
+
if (rankX > rankY) {
|
|
69
|
+
this.parent.set(rootY, rootX);
|
|
70
|
+
}
|
|
71
|
+
else if (rankX < rankY) {
|
|
72
|
+
this.parent.set(rootX, rootY);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.parent.set(rootY, rootX);
|
|
76
|
+
this.rank.set(rootX, rankX + 1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
add(x) {
|
|
81
|
+
if (!this.parent.has(x)) {
|
|
82
|
+
this.parent.set(x, x);
|
|
83
|
+
this.rank.set(x, 0);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function mergeBoundingBoxes(boxes, proximity) {
|
|
88
|
+
log.info(`Merging bounding boxes started with a proximity of ${proximity} pixels`);
|
|
89
|
+
const merged = [];
|
|
90
|
+
while (boxes.length) {
|
|
91
|
+
const box = boxes.pop();
|
|
92
|
+
let mergedWithAnotherBox = false;
|
|
93
|
+
for (let i = 0; i < boxes.length; i++) {
|
|
94
|
+
const otherBox = boxes[i];
|
|
95
|
+
if (box.left <= otherBox.right + proximity &&
|
|
96
|
+
box.right >= otherBox.left - proximity &&
|
|
97
|
+
box.top <= otherBox.bottom + proximity &&
|
|
98
|
+
box.bottom >= otherBox.top - proximity) {
|
|
99
|
+
boxes.splice(i, 1);
|
|
100
|
+
boxes.push({
|
|
101
|
+
left: Math.min(box.left, otherBox.left),
|
|
102
|
+
top: Math.min(box.top, otherBox.top),
|
|
103
|
+
right: Math.max(box.right, otherBox.right),
|
|
104
|
+
bottom: Math.max(box.bottom, otherBox.bottom),
|
|
105
|
+
});
|
|
106
|
+
mergedWithAnotherBox = true;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (!mergedWithAnotherBox) {
|
|
111
|
+
merged.push(box);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return merged;
|
|
115
|
+
}
|
|
116
|
+
function processDiffPixels(diffPixels, proximity) {
|
|
117
|
+
log.info('Processing diff pixels started');
|
|
118
|
+
log.info(`Processing ${diffPixels.length} diff pixels`);
|
|
119
|
+
// Calculate total pixels and diff percentage
|
|
120
|
+
let maxX = 0;
|
|
121
|
+
let maxY = 0;
|
|
122
|
+
for (const pixel of diffPixels) {
|
|
123
|
+
maxX = Math.max(maxX, pixel.x);
|
|
124
|
+
maxY = Math.max(maxY, pixel.y);
|
|
125
|
+
}
|
|
126
|
+
const totalPixels = diffPixels.length > 0 ? (maxX + 1) * (maxY + 1) : 0;
|
|
127
|
+
const diffPercentage = totalPixels > 0 ? (diffPixels.length / totalPixels) * 100 : 0;
|
|
128
|
+
log.info(`Total pixels in image: ${totalPixels.toLocaleString()}`);
|
|
129
|
+
log.info(`Number of diff pixels: ${diffPixels.length.toLocaleString()}`);
|
|
130
|
+
log.info(`Diff percentage: ${diffPercentage.toFixed(2)}%`);
|
|
131
|
+
// Fail fast if there are too many differences
|
|
132
|
+
const MAX_DIFF_PERCENTAGE = 20; // 20% threshold
|
|
133
|
+
const MAX_DIFF_PIXELS = 5000000; // 5M pixels threshold
|
|
134
|
+
if (diffPercentage > MAX_DIFF_PERCENTAGE || diffPixels.length > MAX_DIFF_PIXELS) {
|
|
135
|
+
log.error(`Too many differences detected! Diff percentage: ${diffPercentage.toFixed(2)}%, Diff pixels: ${diffPixels.length.toLocaleString()}`);
|
|
136
|
+
log.error('This likely indicates a major visual difference or an issue with the comparison.');
|
|
137
|
+
log.error('Consider checking if the baseline image is correct or if there are major UI changes.');
|
|
138
|
+
// Return a single bounding box covering the entire image
|
|
139
|
+
return [{
|
|
140
|
+
left: 0,
|
|
141
|
+
top: 0,
|
|
142
|
+
right: maxX,
|
|
143
|
+
bottom: maxY
|
|
144
|
+
}];
|
|
145
|
+
}
|
|
146
|
+
const totalStartTime = Date.now();
|
|
147
|
+
const ds = new DisjointSet();
|
|
148
|
+
const pixelMap = new Map();
|
|
149
|
+
const directions = [
|
|
150
|
+
{ dx: 1, dy: 0 },
|
|
151
|
+
{ dx: 0, dy: 1 },
|
|
152
|
+
{ dx: 1, dy: 1 },
|
|
153
|
+
{ dx: -1, dy: 1 },
|
|
154
|
+
];
|
|
155
|
+
// Initialize disjoint set and pixel map
|
|
156
|
+
for (const pixel of diffPixels) {
|
|
157
|
+
const key = `${pixel.x},${pixel.y}`;
|
|
158
|
+
ds.add(key);
|
|
159
|
+
pixelMap.set(key, pixel);
|
|
160
|
+
}
|
|
161
|
+
log.info('Union operations started');
|
|
162
|
+
const unionStartTime = Date.now();
|
|
163
|
+
// Union pixels within the proximity range
|
|
164
|
+
for (const pixel of diffPixels) {
|
|
165
|
+
const key = `${pixel.x},${pixel.y}`;
|
|
166
|
+
for (const { dx, dy } of directions) {
|
|
167
|
+
const neighborKey = `${pixel.x + dx},${pixel.y + dy}`;
|
|
168
|
+
if (pixelMap.has(neighborKey)) {
|
|
169
|
+
ds.union(key, neighborKey);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
log.info(`Union time: ${Date.now() - unionStartTime}ms`);
|
|
174
|
+
log.info('Grouping pixels into bounding boxes');
|
|
175
|
+
const groupingStartTime = Date.now();
|
|
176
|
+
// Group pixels by their root
|
|
177
|
+
const groups = new Map();
|
|
178
|
+
for (const key of pixelMap.keys()) {
|
|
179
|
+
const root = ds.find(key);
|
|
180
|
+
if (!groups.has(root)) {
|
|
181
|
+
groups.set(root, []);
|
|
182
|
+
}
|
|
183
|
+
groups.get(root)?.push(pixelMap.get(key));
|
|
184
|
+
}
|
|
185
|
+
// Calculate bounding boxes
|
|
186
|
+
const boundingBoxes = [];
|
|
187
|
+
for (const pixels of groups.values()) {
|
|
188
|
+
let left = Infinity;
|
|
189
|
+
let top = Infinity;
|
|
190
|
+
let right = -Infinity;
|
|
191
|
+
let bottom = -Infinity;
|
|
192
|
+
for (const pixel of pixels) {
|
|
193
|
+
if (pixel.x < left) {
|
|
194
|
+
left = pixel.x;
|
|
195
|
+
}
|
|
196
|
+
if (pixel.y < top) {
|
|
197
|
+
top = pixel.y;
|
|
198
|
+
}
|
|
199
|
+
if (pixel.x > right) {
|
|
200
|
+
right = pixel.x;
|
|
201
|
+
}
|
|
202
|
+
if (pixel.y > bottom) {
|
|
203
|
+
bottom = pixel.y;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
boundingBoxes.push({ left, top, right, bottom });
|
|
207
|
+
}
|
|
208
|
+
log.info(`Grouping time: ${Date.now() - groupingStartTime}ms`);
|
|
209
|
+
const totalAnalysisTime = Date.now() - totalStartTime;
|
|
210
|
+
log.info(`Total analysis time: ${totalAnalysisTime}ms`);
|
|
211
|
+
// Post-process to merge nearby bounding boxes
|
|
212
|
+
log.info('Post-processing bounding boxes');
|
|
213
|
+
const postProcessStartTime = Date.now();
|
|
214
|
+
const mergedBoxes = mergeBoundingBoxes(boundingBoxes, proximity);
|
|
215
|
+
log.info(`Post-processing time: ${Date.now() - postProcessStartTime}ms`);
|
|
216
|
+
log.info(`Number merged: ${mergedBoxes.length}`);
|
|
217
|
+
return mergedBoxes;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Generate and save diff image with bounding boxes
|
|
221
|
+
*/
|
|
222
|
+
export async function generateAndSaveDiff(data, imageCompareOptions, ignoredBoxes, diffFilePath, rawMisMatchPercentage) {
|
|
223
|
+
const diffBoundingBoxes = [];
|
|
224
|
+
const saveAboveTolerance = imageCompareOptions.saveAboveTolerance ?? 0;
|
|
225
|
+
const storeDiffs = rawMisMatchPercentage > saveAboveTolerance || process.argv.includes('--store-diffs');
|
|
226
|
+
if (storeDiffs) {
|
|
227
|
+
const isDifference = rawMisMatchPercentage > saveAboveTolerance;
|
|
228
|
+
const isDifferenceMessage = 'WARNING:\n There was a difference. Saved the difference to';
|
|
229
|
+
const debugMessage = 'INFO:\n Debug mode is enabled. Saved the debug file to:';
|
|
230
|
+
if (imageCompareOptions.createJsonReportFiles) {
|
|
231
|
+
diffBoundingBoxes.push(...processDiffPixels(data.diffPixels, imageCompareOptions.diffPixelBoundingBoxProximity));
|
|
232
|
+
}
|
|
233
|
+
await saveBase64Image(await addBlockOuts(Buffer.from(await data.getBuffer()).toString('base64'), ignoredBoxes), diffFilePath);
|
|
234
|
+
log.warn('\x1b[33m%s\x1b[0m', `
|
|
235
|
+
#####################################################################################
|
|
236
|
+
${isDifference ? isDifferenceMessage : debugMessage}
|
|
237
|
+
${diffFilePath}
|
|
238
|
+
#####################################################################################`);
|
|
239
|
+
}
|
|
240
|
+
return { diffBoundingBoxes, storeDiffs };
|
|
241
|
+
}
|
|
242
|
+
export { processDiffPixels };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processDiffPixels.test.d.ts","sourceRoot":"","sources":["../../src/methods/processDiffPixels.test.ts"],"names":[],"mappings":""}
|