@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,241 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import checkAppElement from './checkAppElement.js';
|
|
3
|
+
vi.mock('../helpers/options.js', () => ({
|
|
4
|
+
methodCompareOptions: vi.fn().mockReturnValue({
|
|
5
|
+
ignoreAlpha: false,
|
|
6
|
+
ignoreAntialiasing: false,
|
|
7
|
+
ignoreColors: false,
|
|
8
|
+
ignoreLess: false,
|
|
9
|
+
ignoreNothing: false,
|
|
10
|
+
rawMisMatchPercentage: false,
|
|
11
|
+
returnAllCompareData: false,
|
|
12
|
+
saveAboveTolerance: 0,
|
|
13
|
+
scaleImagesToSameSize: false,
|
|
14
|
+
})
|
|
15
|
+
}));
|
|
16
|
+
vi.mock('../methods/images.js', () => ({
|
|
17
|
+
executeImageCompare: vi.fn().mockResolvedValue({
|
|
18
|
+
fileName: 'test-result.png',
|
|
19
|
+
misMatchPercentage: 0,
|
|
20
|
+
isExactSameImage: true,
|
|
21
|
+
isNewBaseline: false,
|
|
22
|
+
isAboveTolerance: false,
|
|
23
|
+
})
|
|
24
|
+
}));
|
|
25
|
+
vi.mock('./saveAppElement.js', () => ({
|
|
26
|
+
default: vi.fn().mockResolvedValue({
|
|
27
|
+
devicePixelRatio: 2,
|
|
28
|
+
fileName: 'test-element.png'
|
|
29
|
+
})
|
|
30
|
+
}));
|
|
31
|
+
vi.mock('../helpers/utils.js', () => ({
|
|
32
|
+
extractCommonCheckVariables: vi.fn().mockImplementation((params) => ({
|
|
33
|
+
actualFolder: params.folders.actualFolder,
|
|
34
|
+
baselineFolder: params.folders.baselineFolder,
|
|
35
|
+
diffFolder: params.folders.diffFolder,
|
|
36
|
+
browserName: params.instanceData.browserName,
|
|
37
|
+
deviceName: params.instanceData.deviceName,
|
|
38
|
+
deviceRectangles: params.instanceData.deviceRectangles,
|
|
39
|
+
isAndroid: params.instanceData.isAndroid,
|
|
40
|
+
isMobile: params.instanceData.isMobile,
|
|
41
|
+
isAndroidNativeWebScreenshot: params.instanceData.nativeWebScreenshot,
|
|
42
|
+
autoSaveBaseline: params.wicOptions.autoSaveBaseline,
|
|
43
|
+
savePerInstance: params.wicOptions.savePerInstance,
|
|
44
|
+
})),
|
|
45
|
+
buildBaseExecuteCompareOptions: vi.fn().mockImplementation((params) => ({
|
|
46
|
+
compareOptions: {
|
|
47
|
+
wic: params.isElementScreenshot ? {
|
|
48
|
+
...params.wicCompareOptions,
|
|
49
|
+
blockOutSideBar: false,
|
|
50
|
+
blockOutStatusBar: false,
|
|
51
|
+
blockOutToolBar: false,
|
|
52
|
+
} : params.wicCompareOptions,
|
|
53
|
+
method: params.methodCompareOptions,
|
|
54
|
+
},
|
|
55
|
+
devicePixelRatio: params.devicePixelRatio,
|
|
56
|
+
deviceRectangles: params.commonCheckVariables.deviceRectangles,
|
|
57
|
+
fileName: params.fileName,
|
|
58
|
+
folderOptions: {
|
|
59
|
+
autoSaveBaseline: params.commonCheckVariables.autoSaveBaseline,
|
|
60
|
+
actualFolder: params.commonCheckVariables.actualFolder,
|
|
61
|
+
baselineFolder: params.commonCheckVariables.baselineFolder,
|
|
62
|
+
diffFolder: params.commonCheckVariables.diffFolder,
|
|
63
|
+
browserName: params.commonCheckVariables.browserName,
|
|
64
|
+
deviceName: params.commonCheckVariables.deviceName,
|
|
65
|
+
isMobile: params.commonCheckVariables.isMobile,
|
|
66
|
+
savePerInstance: params.commonCheckVariables.savePerInstance,
|
|
67
|
+
},
|
|
68
|
+
isAndroid: params.commonCheckVariables.isAndroid,
|
|
69
|
+
isAndroidNativeWebScreenshot: params.commonCheckVariables.isAndroidNativeWebScreenshot,
|
|
70
|
+
...params.additionalProperties,
|
|
71
|
+
})),
|
|
72
|
+
}));
|
|
73
|
+
describe('checkAppElement', () => {
|
|
74
|
+
let executeImageCompareSpy;
|
|
75
|
+
let saveAppElementSpy;
|
|
76
|
+
const baseOptions = {
|
|
77
|
+
checkElementOptions: {
|
|
78
|
+
wic: {
|
|
79
|
+
addressBarShadowPadding: 6,
|
|
80
|
+
autoElementScroll: true,
|
|
81
|
+
addIOSBezelCorners: false,
|
|
82
|
+
autoSaveBaseline: false,
|
|
83
|
+
clearFolder: false,
|
|
84
|
+
userBasedFullPageScreenshot: false,
|
|
85
|
+
enableLegacyScreenshotMethod: false,
|
|
86
|
+
formatImageName: '{tag}-{logName}-{width}x{height}-dpr-{dpr}',
|
|
87
|
+
isHybridApp: false,
|
|
88
|
+
savePerInstance: true,
|
|
89
|
+
toolBarShadowPadding: 6,
|
|
90
|
+
disableBlinkingCursor: false,
|
|
91
|
+
disableCSSAnimation: false,
|
|
92
|
+
enableLayoutTesting: false,
|
|
93
|
+
fullPageScrollTimeout: 1500,
|
|
94
|
+
hideScrollBars: true,
|
|
95
|
+
waitForFontsLoaded: true,
|
|
96
|
+
compareOptions: {
|
|
97
|
+
ignoreAlpha: false,
|
|
98
|
+
ignoreAntialiasing: false,
|
|
99
|
+
ignoreColors: false,
|
|
100
|
+
ignoreLess: false,
|
|
101
|
+
ignoreNothing: false,
|
|
102
|
+
rawMisMatchPercentage: false,
|
|
103
|
+
returnAllCompareData: false,
|
|
104
|
+
saveAboveTolerance: 0,
|
|
105
|
+
scaleImagesToSameSize: false,
|
|
106
|
+
blockOutSideBar: false,
|
|
107
|
+
blockOutStatusBar: false,
|
|
108
|
+
blockOutToolBar: false,
|
|
109
|
+
createJsonReportFiles: false,
|
|
110
|
+
diffPixelBoundingBoxProximity: 5,
|
|
111
|
+
},
|
|
112
|
+
tabbableOptions: {
|
|
113
|
+
circle: {
|
|
114
|
+
backgroundColor: 'rgba(255, 0, 0, 0.4)',
|
|
115
|
+
borderColor: 'rgba(255, 0, 0, 1)',
|
|
116
|
+
borderWidth: 1,
|
|
117
|
+
fontColor: 'rgba(0, 0, 0, 1)',
|
|
118
|
+
fontFamily: 'Arial',
|
|
119
|
+
fontSize: 10,
|
|
120
|
+
size: 10,
|
|
121
|
+
},
|
|
122
|
+
line: {
|
|
123
|
+
color: 'rgba(255, 0, 0, 1)',
|
|
124
|
+
width: 1,
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
method: {}
|
|
129
|
+
},
|
|
130
|
+
browserInstance: { isAndroid: false },
|
|
131
|
+
element: { selector: '#test-element' },
|
|
132
|
+
folders: {
|
|
133
|
+
actualFolder: '/test/actual',
|
|
134
|
+
baselineFolder: '/test/baseline',
|
|
135
|
+
diffFolder: '/test/diff'
|
|
136
|
+
},
|
|
137
|
+
instanceData: {
|
|
138
|
+
appName: 'TestApp',
|
|
139
|
+
browserName: 'Chrome',
|
|
140
|
+
browserVersion: '118.0.0.0',
|
|
141
|
+
deviceName: 'iPhone 14',
|
|
142
|
+
devicePixelRatio: 2,
|
|
143
|
+
deviceRectangles: {
|
|
144
|
+
bottomBar: { y: 800, x: 0, width: 390, height: 0 },
|
|
145
|
+
homeBar: { x: 0, y: 780, width: 390, height: 34 },
|
|
146
|
+
leftSidePadding: { y: 0, x: 0, width: 0, height: 0 },
|
|
147
|
+
rightSidePadding: { y: 0, x: 0, width: 0, height: 0 },
|
|
148
|
+
screenSize: { height: 844, width: 390 },
|
|
149
|
+
statusBar: { x: 0, y: 0, width: 390, height: 47 },
|
|
150
|
+
statusBarAndAddressBar: { y: 0, x: 0, width: 390, height: 47 },
|
|
151
|
+
viewport: { y: 47, x: 0, width: 390, height: 733 }
|
|
152
|
+
},
|
|
153
|
+
initialDevicePixelRatio: 2,
|
|
154
|
+
isAndroid: false,
|
|
155
|
+
isIOS: true,
|
|
156
|
+
isMobile: true,
|
|
157
|
+
logName: 'test-log',
|
|
158
|
+
name: 'test-device',
|
|
159
|
+
nativeWebScreenshot: false,
|
|
160
|
+
platformName: 'iOS',
|
|
161
|
+
platformVersion: '17.0'
|
|
162
|
+
},
|
|
163
|
+
isNativeContext: true,
|
|
164
|
+
tag: 'test-element',
|
|
165
|
+
testContext: {
|
|
166
|
+
commandName: 'checkElement',
|
|
167
|
+
framework: 'vitest',
|
|
168
|
+
parent: 'test suite',
|
|
169
|
+
title: 'test title',
|
|
170
|
+
tag: 'test-tag',
|
|
171
|
+
instanceData: {
|
|
172
|
+
browser: { name: 'Chrome', version: '118.0.0.0' },
|
|
173
|
+
deviceName: 'iPhone 14',
|
|
174
|
+
platform: { name: 'iOS', version: '17.0' },
|
|
175
|
+
app: 'TestApp',
|
|
176
|
+
isMobile: true,
|
|
177
|
+
isAndroid: false,
|
|
178
|
+
isIOS: true
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
beforeEach(async () => {
|
|
183
|
+
const { executeImageCompare } = await import('../methods/images.js');
|
|
184
|
+
const saveAppElement = (await import('./saveAppElement.js')).default;
|
|
185
|
+
executeImageCompareSpy = vi.mocked(executeImageCompare);
|
|
186
|
+
saveAppElementSpy = vi.mocked(saveAppElement);
|
|
187
|
+
});
|
|
188
|
+
afterEach(() => {
|
|
189
|
+
vi.clearAllMocks();
|
|
190
|
+
});
|
|
191
|
+
it('should execute checkAppElement with basic options', async () => {
|
|
192
|
+
const result = await checkAppElement(baseOptions);
|
|
193
|
+
expect(result).toMatchSnapshot();
|
|
194
|
+
expect(saveAppElementSpy.mock.calls[0]).toMatchSnapshot();
|
|
195
|
+
});
|
|
196
|
+
it('should handle Android device correctly', async () => {
|
|
197
|
+
const options = {
|
|
198
|
+
...baseOptions,
|
|
199
|
+
browserInstance: { isAndroid: true },
|
|
200
|
+
instanceData: {
|
|
201
|
+
...baseOptions.instanceData,
|
|
202
|
+
deviceName: 'Pixel 4',
|
|
203
|
+
isAndroid: true,
|
|
204
|
+
isIOS: false,
|
|
205
|
+
platformName: 'Android',
|
|
206
|
+
platformVersion: '11.0'
|
|
207
|
+
},
|
|
208
|
+
testContext: {
|
|
209
|
+
...baseOptions.testContext,
|
|
210
|
+
instanceData: {
|
|
211
|
+
...baseOptions.testContext.instanceData,
|
|
212
|
+
deviceName: 'Pixel 4',
|
|
213
|
+
platform: { name: 'Android', version: '11.0' },
|
|
214
|
+
isAndroid: true,
|
|
215
|
+
isIOS: false
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
await checkAppElement(options);
|
|
220
|
+
expect(executeImageCompareSpy.mock.calls[0]).toMatchSnapshot();
|
|
221
|
+
});
|
|
222
|
+
it('should always disable block out options for element screenshots', async () => {
|
|
223
|
+
const options = {
|
|
224
|
+
...baseOptions,
|
|
225
|
+
checkElementOptions: {
|
|
226
|
+
...baseOptions.checkElementOptions,
|
|
227
|
+
wic: {
|
|
228
|
+
...baseOptions.checkElementOptions.wic,
|
|
229
|
+
compareOptions: {
|
|
230
|
+
...baseOptions.checkElementOptions.wic.compareOptions,
|
|
231
|
+
blockOutSideBar: true,
|
|
232
|
+
blockOutStatusBar: true,
|
|
233
|
+
blockOutToolBar: true,
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
await checkAppElement(options);
|
|
239
|
+
expect(executeImageCompareSpy.mock.calls[0]).toMatchSnapshot();
|
|
240
|
+
});
|
|
241
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ImageCompareResult } from '../methods/images.interfaces.js';
|
|
2
|
+
import type { InternalCheckScreenMethodOptions } from './check.interfaces.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compare an image of the viewport of the screen
|
|
5
|
+
*/
|
|
6
|
+
export default function checkAppScreen({ browserInstance, checkScreenOptions, folders, instanceData, isNativeContext, tag, testContext, }: InternalCheckScreenMethodOptions): Promise<ImageCompareResult | number>;
|
|
7
|
+
//# sourceMappingURL=checkAppScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkAppScreen.d.ts","sourceRoot":"","sources":["../../src/commands/checkAppScreen.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAIzE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAA;AAI7E;;GAEG;AACH,wBAA8B,cAAc,CACxC,EACI,eAAe,EACf,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,eAAsB,EACtB,GAAG,EACH,WAAW,GACd,EAAE,gCAAgC,GACpC,OAAO,CAAC,kBAAkB,GAAG,MAAM,CAAC,CAqEtC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { screenMethodCompareOptions } from '../helpers/options.js';
|
|
2
|
+
import { executeImageCompare } from '../methods/images.js';
|
|
3
|
+
import { determineDeviceBlockOuts, determineIgnoreRegions } from '../methods/rectangles.js';
|
|
4
|
+
import { extractCommonCheckVariables, buildBaseExecuteCompareOptions } from '../helpers/utils.js';
|
|
5
|
+
import saveAppScreen from './saveAppScreen.js';
|
|
6
|
+
/**
|
|
7
|
+
* Compare an image of the viewport of the screen
|
|
8
|
+
*/
|
|
9
|
+
export default async function checkAppScreen({ browserInstance, checkScreenOptions, folders, instanceData, isNativeContext = true, tag, testContext, }) {
|
|
10
|
+
// 1. Set some variables
|
|
11
|
+
const commonCheckVariables = extractCommonCheckVariables({ folders, instanceData, wicOptions: checkScreenOptions.wic });
|
|
12
|
+
const saveAppScreenOptions = {
|
|
13
|
+
wic: checkScreenOptions.wic,
|
|
14
|
+
method: {
|
|
15
|
+
...{ hideElements: [] },
|
|
16
|
+
...{ removeElements: [] },
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const screenCompareOptions = {
|
|
20
|
+
...checkScreenOptions.wic.compareOptions,
|
|
21
|
+
...checkScreenOptions.method,
|
|
22
|
+
// Use the hide and remove elements from the checkScreenOptions and add them to the ignore array
|
|
23
|
+
ignore: [
|
|
24
|
+
...checkScreenOptions.method.ignore || [],
|
|
25
|
+
...checkScreenOptions.method.hideElements || [],
|
|
26
|
+
...checkScreenOptions.method.removeElements || [],
|
|
27
|
+
]
|
|
28
|
+
};
|
|
29
|
+
// 2. Take the actual screenshot and retrieve the needed data
|
|
30
|
+
const { devicePixelRatio, fileName } = await saveAppScreen({
|
|
31
|
+
browserInstance,
|
|
32
|
+
folders,
|
|
33
|
+
instanceData,
|
|
34
|
+
isNativeContext,
|
|
35
|
+
saveScreenOptions: saveAppScreenOptions,
|
|
36
|
+
tag,
|
|
37
|
+
});
|
|
38
|
+
// 3. Determine the ignore regions and compare options
|
|
39
|
+
const ignoreRegions = await determineIgnoreRegions(browserInstance, screenCompareOptions.ignore || []);
|
|
40
|
+
const deviceIgnoreRegions = await determineDeviceBlockOuts({
|
|
41
|
+
isAndroid: commonCheckVariables.isAndroid,
|
|
42
|
+
screenCompareOptions,
|
|
43
|
+
instanceData,
|
|
44
|
+
});
|
|
45
|
+
const methodCompareOptions = screenMethodCompareOptions(checkScreenOptions.method);
|
|
46
|
+
const baseExecuteCompareOptions = buildBaseExecuteCompareOptions({
|
|
47
|
+
commonCheckVariables,
|
|
48
|
+
wicCompareOptions: checkScreenOptions.wic.compareOptions,
|
|
49
|
+
methodCompareOptions,
|
|
50
|
+
devicePixelRatio,
|
|
51
|
+
fileName,
|
|
52
|
+
additionalProperties: {
|
|
53
|
+
ignoreRegions: [...ignoreRegions, ...deviceIgnoreRegions],
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
// 4. Now execute the compare and return the data
|
|
57
|
+
const executeCompareOptions = {
|
|
58
|
+
compareOptions: baseExecuteCompareOptions.compareOptions,
|
|
59
|
+
devicePixelRatio: baseExecuteCompareOptions.devicePixelRatio,
|
|
60
|
+
deviceRectangles: baseExecuteCompareOptions.deviceRectangles,
|
|
61
|
+
fileName: baseExecuteCompareOptions.fileName,
|
|
62
|
+
folderOptions: baseExecuteCompareOptions.folderOptions,
|
|
63
|
+
ignoreRegions: baseExecuteCompareOptions.ignoreRegions,
|
|
64
|
+
isAndroid: baseExecuteCompareOptions.isAndroid,
|
|
65
|
+
isAndroidNativeWebScreenshot: baseExecuteCompareOptions.isAndroidNativeWebScreenshot,
|
|
66
|
+
};
|
|
67
|
+
return executeImageCompare({
|
|
68
|
+
isViewPortScreenshot: true,
|
|
69
|
+
isNativeContext,
|
|
70
|
+
options: executeCompareOptions,
|
|
71
|
+
testContext,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkAppScreen.test.d.ts","sourceRoot":"","sources":["../../src/commands/checkAppScreen.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import checkAppScreen from './checkAppScreen.js';
|
|
3
|
+
import { BASE_CHECK_OPTIONS } from '../mocks/mocks.js';
|
|
4
|
+
vi.mock('../helpers/options.js', () => ({
|
|
5
|
+
screenMethodCompareOptions: vi.fn().mockReturnValue({
|
|
6
|
+
ignoreAlpha: false,
|
|
7
|
+
ignoreAntialiasing: false,
|
|
8
|
+
ignoreColors: false,
|
|
9
|
+
ignoreLess: false,
|
|
10
|
+
ignoreNothing: false,
|
|
11
|
+
rawMisMatchPercentage: false,
|
|
12
|
+
returnAllCompareData: false,
|
|
13
|
+
saveAboveTolerance: 0,
|
|
14
|
+
scaleImagesToSameSize: false,
|
|
15
|
+
})
|
|
16
|
+
}));
|
|
17
|
+
vi.mock('../methods/images.js', () => ({
|
|
18
|
+
executeImageCompare: vi.fn().mockResolvedValue({
|
|
19
|
+
fileName: 'test-result.png',
|
|
20
|
+
misMatchPercentage: 0,
|
|
21
|
+
isExactSameImage: true,
|
|
22
|
+
isNewBaseline: false,
|
|
23
|
+
isAboveTolerance: false,
|
|
24
|
+
})
|
|
25
|
+
}));
|
|
26
|
+
vi.mock('../methods/rectangles.js', () => ({
|
|
27
|
+
determineIgnoreRegions: vi.fn().mockResolvedValue([
|
|
28
|
+
{ x: 0, y: 0, width: 100, height: 100 }
|
|
29
|
+
]),
|
|
30
|
+
determineDeviceBlockOuts: vi.fn().mockResolvedValue([
|
|
31
|
+
{ x: 0, y: 0, width: 50, height: 50 }
|
|
32
|
+
])
|
|
33
|
+
}));
|
|
34
|
+
vi.mock('./saveAppScreen.js', () => ({
|
|
35
|
+
default: vi.fn().mockResolvedValue({
|
|
36
|
+
devicePixelRatio: 2,
|
|
37
|
+
fileName: 'test-screen.png'
|
|
38
|
+
})
|
|
39
|
+
}));
|
|
40
|
+
vi.mock('../helpers/utils.js', () => ({
|
|
41
|
+
extractCommonCheckVariables: vi.fn().mockImplementation((params) => ({
|
|
42
|
+
actualFolder: params.folders.actualFolder,
|
|
43
|
+
baselineFolder: params.folders.baselineFolder,
|
|
44
|
+
diffFolder: params.folders.diffFolder,
|
|
45
|
+
browserName: params.instanceData.browserName,
|
|
46
|
+
deviceName: params.instanceData.deviceName,
|
|
47
|
+
deviceRectangles: params.instanceData.deviceRectangles,
|
|
48
|
+
isAndroid: params.instanceData.isAndroid,
|
|
49
|
+
isMobile: params.instanceData.isMobile,
|
|
50
|
+
isAndroidNativeWebScreenshot: params.instanceData.nativeWebScreenshot,
|
|
51
|
+
autoSaveBaseline: params.wicOptions.autoSaveBaseline,
|
|
52
|
+
savePerInstance: params.wicOptions.savePerInstance,
|
|
53
|
+
})),
|
|
54
|
+
buildBaseExecuteCompareOptions: vi.fn().mockImplementation((params) => ({
|
|
55
|
+
compareOptions: {
|
|
56
|
+
wic: params.wicCompareOptions,
|
|
57
|
+
method: params.methodCompareOptions,
|
|
58
|
+
},
|
|
59
|
+
devicePixelRatio: params.devicePixelRatio,
|
|
60
|
+
deviceRectangles: params.commonCheckVariables.deviceRectangles,
|
|
61
|
+
fileName: params.fileName,
|
|
62
|
+
folderOptions: {
|
|
63
|
+
autoSaveBaseline: params.commonCheckVariables.autoSaveBaseline,
|
|
64
|
+
actualFolder: params.commonCheckVariables.actualFolder,
|
|
65
|
+
baselineFolder: params.commonCheckVariables.baselineFolder,
|
|
66
|
+
diffFolder: params.commonCheckVariables.diffFolder,
|
|
67
|
+
browserName: params.commonCheckVariables.browserName,
|
|
68
|
+
deviceName: params.commonCheckVariables.deviceName,
|
|
69
|
+
isMobile: params.commonCheckVariables.isMobile,
|
|
70
|
+
savePerInstance: params.commonCheckVariables.savePerInstance,
|
|
71
|
+
},
|
|
72
|
+
isAndroid: params.commonCheckVariables.isAndroid,
|
|
73
|
+
isAndroidNativeWebScreenshot: params.commonCheckVariables.isAndroidNativeWebScreenshot,
|
|
74
|
+
ignoreRegions: params.additionalProperties?.ignoreRegions || [],
|
|
75
|
+
})),
|
|
76
|
+
}));
|
|
77
|
+
describe('checkAppScreen', () => {
|
|
78
|
+
let executeImageCompareSpy;
|
|
79
|
+
let saveAppScreenSpy;
|
|
80
|
+
let determineIgnoreRegionsSpy;
|
|
81
|
+
let determineDeviceBlockOutsSpy;
|
|
82
|
+
const baseOptions = {
|
|
83
|
+
checkScreenOptions: {
|
|
84
|
+
wic: BASE_CHECK_OPTIONS.wic,
|
|
85
|
+
method: {
|
|
86
|
+
hideElements: [],
|
|
87
|
+
removeElements: [],
|
|
88
|
+
ignore: [],
|
|
89
|
+
blockOut: [],
|
|
90
|
+
blockOutSideBar: false,
|
|
91
|
+
blockOutStatusBar: false,
|
|
92
|
+
blockOutToolBar: false,
|
|
93
|
+
ignoreAlpha: false,
|
|
94
|
+
ignoreAntialiasing: false,
|
|
95
|
+
ignoreColors: false,
|
|
96
|
+
ignoreLess: false,
|
|
97
|
+
ignoreNothing: false,
|
|
98
|
+
rawMisMatchPercentage: false,
|
|
99
|
+
returnAllCompareData: false,
|
|
100
|
+
saveAboveTolerance: 0,
|
|
101
|
+
scaleImagesToSameSize: false,
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
browserInstance: { isAndroid: false },
|
|
105
|
+
folders: BASE_CHECK_OPTIONS.folders,
|
|
106
|
+
instanceData: BASE_CHECK_OPTIONS.instanceData,
|
|
107
|
+
isNativeContext: true,
|
|
108
|
+
tag: 'test-screen',
|
|
109
|
+
testContext: BASE_CHECK_OPTIONS.testContext
|
|
110
|
+
};
|
|
111
|
+
beforeEach(async () => {
|
|
112
|
+
const { executeImageCompare } = await import('../methods/images.js');
|
|
113
|
+
const { determineIgnoreRegions, determineDeviceBlockOuts } = await import('../methods/rectangles.js');
|
|
114
|
+
const saveAppScreen = (await import('./saveAppScreen.js')).default;
|
|
115
|
+
executeImageCompareSpy = vi.mocked(executeImageCompare);
|
|
116
|
+
determineIgnoreRegionsSpy = vi.mocked(determineIgnoreRegions);
|
|
117
|
+
determineDeviceBlockOutsSpy = vi.mocked(determineDeviceBlockOuts);
|
|
118
|
+
saveAppScreenSpy = vi.mocked(saveAppScreen);
|
|
119
|
+
});
|
|
120
|
+
afterEach(() => {
|
|
121
|
+
vi.clearAllMocks();
|
|
122
|
+
});
|
|
123
|
+
it('should execute checkAppScreen with basic options', async () => {
|
|
124
|
+
const result = await checkAppScreen(baseOptions);
|
|
125
|
+
expect(result).toMatchSnapshot();
|
|
126
|
+
expect(saveAppScreenSpy.mock.calls[0]).toMatchSnapshot();
|
|
127
|
+
});
|
|
128
|
+
it('should handle ignore regions and device blockouts', async () => {
|
|
129
|
+
const mockElement = { elementId: 'test-element', selector: '#test' };
|
|
130
|
+
const options = {
|
|
131
|
+
...baseOptions,
|
|
132
|
+
checkScreenOptions: {
|
|
133
|
+
...baseOptions.checkScreenOptions,
|
|
134
|
+
method: {
|
|
135
|
+
...baseOptions.checkScreenOptions.method,
|
|
136
|
+
hideElements: [mockElement],
|
|
137
|
+
removeElements: [mockElement],
|
|
138
|
+
ignore: [mockElement]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
await checkAppScreen(options);
|
|
143
|
+
expect(determineIgnoreRegionsSpy.mock.calls[0]).toMatchSnapshot();
|
|
144
|
+
expect(determineDeviceBlockOutsSpy.mock.calls[0]).toMatchSnapshot();
|
|
145
|
+
expect(executeImageCompareSpy.mock.calls[0]).toMatchSnapshot();
|
|
146
|
+
});
|
|
147
|
+
it('should handle Android device correctly', async () => {
|
|
148
|
+
const options = {
|
|
149
|
+
...baseOptions,
|
|
150
|
+
browserInstance: { isAndroid: true },
|
|
151
|
+
instanceData: {
|
|
152
|
+
...baseOptions.instanceData,
|
|
153
|
+
deviceName: 'Pixel 4',
|
|
154
|
+
isAndroid: true,
|
|
155
|
+
isIOS: false,
|
|
156
|
+
platformName: 'Android',
|
|
157
|
+
platformVersion: '11.0'
|
|
158
|
+
},
|
|
159
|
+
testContext: {
|
|
160
|
+
...baseOptions.testContext,
|
|
161
|
+
instanceData: {
|
|
162
|
+
...baseOptions.testContext.instanceData,
|
|
163
|
+
deviceName: 'Pixel 4',
|
|
164
|
+
platform: { name: 'Android', version: '11.0' },
|
|
165
|
+
isAndroid: true,
|
|
166
|
+
isIOS: false
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
await checkAppScreen(options);
|
|
171
|
+
expect(determineDeviceBlockOutsSpy.mock.calls[0]).toMatchSnapshot();
|
|
172
|
+
expect(executeImageCompareSpy.mock.calls[0]).toMatchSnapshot();
|
|
173
|
+
});
|
|
174
|
+
it('should merge compare options correctly', async () => {
|
|
175
|
+
const options = {
|
|
176
|
+
...baseOptions,
|
|
177
|
+
checkScreenOptions: {
|
|
178
|
+
...baseOptions.checkScreenOptions,
|
|
179
|
+
wic: {
|
|
180
|
+
...baseOptions.checkScreenOptions.wic,
|
|
181
|
+
compareOptions: {
|
|
182
|
+
...baseOptions.checkScreenOptions.wic.compareOptions,
|
|
183
|
+
ignoreAlpha: true,
|
|
184
|
+
ignoreAntialiasing: true,
|
|
185
|
+
ignoreColors: true,
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
method: {
|
|
189
|
+
...baseOptions.checkScreenOptions.method,
|
|
190
|
+
ignoreAlpha: false,
|
|
191
|
+
ignoreAntialiasing: false,
|
|
192
|
+
ignoreColors: false,
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
await checkAppScreen(options);
|
|
197
|
+
expect(executeImageCompareSpy.mock.calls[0]).toMatchSnapshot();
|
|
198
|
+
});
|
|
199
|
+
it('should spread hideElements and removeElements into ignore array', async () => {
|
|
200
|
+
const mockElement1 = { elementId: 'hide-element', selector: '#hide' };
|
|
201
|
+
const mockElement2 = { elementId: 'remove-element', selector: '#remove' };
|
|
202
|
+
const mockElement3 = { elementId: 'ignore-element', selector: '#ignore' };
|
|
203
|
+
const options = {
|
|
204
|
+
...baseOptions,
|
|
205
|
+
checkScreenOptions: {
|
|
206
|
+
...baseOptions.checkScreenOptions,
|
|
207
|
+
method: {
|
|
208
|
+
...baseOptions.checkScreenOptions.method,
|
|
209
|
+
hideElements: [mockElement1],
|
|
210
|
+
removeElements: [mockElement2],
|
|
211
|
+
ignore: [mockElement3]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
await checkAppScreen(options);
|
|
216
|
+
expect(determineIgnoreRegionsSpy.mock.calls[0]).toMatchSnapshot();
|
|
217
|
+
expect(executeImageCompareSpy.mock.calls[0]).toMatchSnapshot();
|
|
218
|
+
});
|
|
219
|
+
it('should create screenCompareOptions with correct structure', async () => {
|
|
220
|
+
const mockElement1 = { elementId: 'hide-element', selector: '#hide' };
|
|
221
|
+
const mockElement2 = { elementId: 'remove-element', selector: '#remove' };
|
|
222
|
+
const mockElement3 = { elementId: 'ignore-element', selector: '#ignore' };
|
|
223
|
+
const options = {
|
|
224
|
+
...baseOptions,
|
|
225
|
+
checkScreenOptions: {
|
|
226
|
+
...baseOptions.checkScreenOptions,
|
|
227
|
+
wic: {
|
|
228
|
+
...baseOptions.checkScreenOptions.wic,
|
|
229
|
+
compareOptions: {
|
|
230
|
+
...baseOptions.checkScreenOptions.wic.compareOptions,
|
|
231
|
+
ignoreAlpha: true,
|
|
232
|
+
ignoreAntialiasing: true,
|
|
233
|
+
ignoreColors: true,
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
method: {
|
|
237
|
+
hideElements: [mockElement1],
|
|
238
|
+
removeElements: [mockElement2],
|
|
239
|
+
ignore: [mockElement3],
|
|
240
|
+
ignoreAlpha: false,
|
|
241
|
+
ignoreAntialiasing: false,
|
|
242
|
+
ignoreColors: false,
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
await checkAppScreen(options);
|
|
247
|
+
expect(determineIgnoreRegionsSpy.mock.calls[0]).toMatchSnapshot();
|
|
248
|
+
expect(determineDeviceBlockOutsSpy.mock.calls[0]).toMatchSnapshot();
|
|
249
|
+
});
|
|
250
|
+
it('should spread wic.compareOptions and method options into screenCompareOptions', async () => {
|
|
251
|
+
const options = {
|
|
252
|
+
...baseOptions,
|
|
253
|
+
checkScreenOptions: {
|
|
254
|
+
...baseOptions.checkScreenOptions,
|
|
255
|
+
wic: {
|
|
256
|
+
...baseOptions.checkScreenOptions.wic,
|
|
257
|
+
compareOptions: {
|
|
258
|
+
ignoreAlpha: true,
|
|
259
|
+
ignoreAntialiasing: true,
|
|
260
|
+
ignoreColors: true,
|
|
261
|
+
blockOutSideBar: true,
|
|
262
|
+
blockOutStatusBar: true,
|
|
263
|
+
blockOutToolBar: true,
|
|
264
|
+
createJsonReportFiles: true,
|
|
265
|
+
diffPixelBoundingBoxProximity: 10,
|
|
266
|
+
ignoreLess: true,
|
|
267
|
+
ignoreNothing: true,
|
|
268
|
+
rawMisMatchPercentage: true,
|
|
269
|
+
returnAllCompareData: true,
|
|
270
|
+
saveAboveTolerance: 1,
|
|
271
|
+
scaleImagesToSameSize: true,
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
method: {
|
|
275
|
+
ignoreAlpha: false,
|
|
276
|
+
ignoreAntialiasing: false,
|
|
277
|
+
ignoreColors: false,
|
|
278
|
+
blockOutSideBar: false,
|
|
279
|
+
blockOutStatusBar: false,
|
|
280
|
+
blockOutToolBar: false,
|
|
281
|
+
createJsonReportFiles: false,
|
|
282
|
+
diffPixelBoundingBoxProximity: 5,
|
|
283
|
+
ignoreLess: false,
|
|
284
|
+
ignoreNothing: false,
|
|
285
|
+
rawMisMatchPercentage: false,
|
|
286
|
+
returnAllCompareData: false,
|
|
287
|
+
saveAboveTolerance: 0,
|
|
288
|
+
scaleImagesToSameSize: false,
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
await checkAppScreen(options);
|
|
293
|
+
expect(determineDeviceBlockOutsSpy.mock.calls[0]).toMatchSnapshot();
|
|
294
|
+
});
|
|
295
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ImageCompareResult } from '../methods/images.interfaces.js';
|
|
2
|
+
import type { InternalCheckElementMethodOptions } from './check.interfaces.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compare an image of the element
|
|
5
|
+
*/
|
|
6
|
+
export default function checkElement({ browserInstance, instanceData, folders, element, tag, checkElementOptions, isNativeContext, testContext, }: InternalCheckElementMethodOptions): Promise<ImageCompareResult | number>;
|
|
7
|
+
//# sourceMappingURL=checkElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkElement.d.ts","sourceRoot":"","sources":["../../src/commands/checkElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAGzE,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAA;AAE9E;;GAEG;AACH,wBAA8B,YAAY,CACtC,EACI,eAAe,EACf,YAAY,EACZ,OAAO,EACP,OAAO,EACP,GAAG,EACH,mBAAmB,EACnB,eAAe,EACf,WAAW,GACd,EAAE,iCAAiC,GACrC,OAAO,CAAC,kBAAkB,GAAG,MAAM,CAAC,CAItC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import checkAppElement from './checkAppElement.js';
|
|
2
|
+
import checkWebElement from './checkWebElement.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compare an image of the element
|
|
5
|
+
*/
|
|
6
|
+
export default async function checkElement({ browserInstance, instanceData, folders, element, tag, checkElementOptions, isNativeContext, testContext, }) {
|
|
7
|
+
return isNativeContext
|
|
8
|
+
? checkAppElement({ browserInstance, element, folders, instanceData, checkElementOptions, isNativeContext, tag, testContext })
|
|
9
|
+
: checkWebElement({ browserInstance, element, folders, instanceData, checkElementOptions, tag, testContext });
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkElement.test.d.ts","sourceRoot":"","sources":["../../src/commands/checkElement.test.ts"],"names":[],"mappings":""}
|