webdriver-image-comparison
Advanced tools
Comparing version
@@ -14,2 +14,3 @@ import { RectanglesOutput } from '../methods/rectangles.interfaces'; | ||
saveAboveTolerance?: number; | ||
scaleImagesToSameSize?: boolean; | ||
} |
@@ -24,2 +24,3 @@ export interface ClassOptions { | ||
saveAboveTolerance?: number; | ||
scaleImagesToSameSize?: boolean; | ||
} | ||
@@ -50,3 +51,4 @@ export interface DefaultOptions { | ||
saveAboveTolerance: number; | ||
scaleImagesToSameSize: boolean; | ||
} | ||
export {}; |
@@ -38,2 +38,3 @@ "use strict"; | ||
saveAboveTolerance: options.saveAboveTolerance || 0, | ||
scaleImagesToSameSize: options.scaleImagesToSameSize || false | ||
}, | ||
@@ -48,5 +49,5 @@ }; | ||
function methodCompareOptions(options) { | ||
return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, ('blockOut' in options ? { blockOut: options.blockOut } : {})), ('ignoreAlpha' in options ? { ignoreAlpha: options.ignoreAlpha } : {})), ('ignoreAntialiasing' in options ? { ignoreAntialiasing: options.ignoreAntialiasing } : {})), ('ignoreColors' in options ? { ignoreColors: options.ignoreColors } : {})), ('ignoreLess' in options ? { ignoreLess: options.ignoreLess } : {})), ('ignoreNothing' in options ? { ignoreNothing: options.ignoreNothing } : {})), ('rawMisMatchPercentage' in options ? { rawMisMatchPercentage: options.rawMisMatchPercentage } : {})), ('returnAllCompareData' in options ? { returnAllCompareData: options.returnAllCompareData } : {})), ('saveAboveTolerance' in options ? { saveAboveTolerance: options.saveAboveTolerance } : {})); | ||
return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, ('blockOut' in options ? { blockOut: options.blockOut } : {})), ('ignoreAlpha' in options ? { ignoreAlpha: options.ignoreAlpha } : {})), ('ignoreAntialiasing' in options ? { ignoreAntialiasing: options.ignoreAntialiasing } : {})), ('ignoreColors' in options ? { ignoreColors: options.ignoreColors } : {})), ('ignoreLess' in options ? { ignoreLess: options.ignoreLess } : {})), ('ignoreNothing' in options ? { ignoreNothing: options.ignoreNothing } : {})), ('rawMisMatchPercentage' in options ? { rawMisMatchPercentage: options.rawMisMatchPercentage } : {})), ('returnAllCompareData' in options ? { returnAllCompareData: options.returnAllCompareData } : {})), ('saveAboveTolerance' in options ? { saveAboveTolerance: options.saveAboveTolerance } : {})), ('scaleImagesToSameSize' in options ? { scaleImagesToSameSize: options.scaleImagesToSameSize } : {})); | ||
} | ||
exports.methodCompareOptions = methodCompareOptions; | ||
//# sourceMappingURL=options.js.map |
@@ -30,2 +30,3 @@ "use strict"; | ||
saveAboveTolerance: 12, | ||
scaleImagesToSameSize: true | ||
}; | ||
@@ -50,2 +51,3 @@ expect(options_1.defaultOptions(options)).toMatchSnapshot(); | ||
saveAboveTolerance: 12, | ||
scaleImagesToSameSize: true, | ||
}; | ||
@@ -72,2 +74,3 @@ expect(options_1.methodCompareOptions(options)).toMatchSnapshot(); | ||
saveAboveTolerance: 12, | ||
scaleImagesToSameSize: true | ||
}; | ||
@@ -74,0 +77,0 @@ expect(options_1.screenMethodCompareOptions(options)).toMatchSnapshot(); |
@@ -49,2 +49,3 @@ import { RectanglesOutput } from './rectangles.interfaces'; | ||
saveAboveTolerance?: number; | ||
scaleImagesToSameSize?: boolean; | ||
} | ||
@@ -75,2 +76,3 @@ export interface ImageCompareFolderOptions { | ||
}; | ||
scaleToSameSize?: boolean; | ||
} | ||
@@ -77,0 +79,0 @@ export interface IgnoreBoxes { |
@@ -128,3 +128,3 @@ "use strict"; | ||
}); | ||
compareOptions = __assign({ ignore: ignore }, (ignoredBoxes.length > 0 ? { output: { ignoredBoxes: ignoredBoxes } } : {})); | ||
compareOptions = __assign(__assign({ ignore: ignore }, (ignoredBoxes.length > 0 ? { output: { ignoredBoxes: ignoredBoxes } } : {})), { scaleToSameSize: imageCompareOptions.scaleImagesToSameSize }); | ||
return [4, compareImages_1.default(fs_extra_1.readFileSync(baselineFilePath), fs_extra_1.readFileSync(actualFilePath), compareOptions)]; | ||
@@ -131,0 +131,0 @@ case 3: |
@@ -44,3 +44,7 @@ "use strict"; | ||
return [2, new Promise(function (resolve, reject) { | ||
resemble.compare(image1, image2, options, function (err, data) { | ||
var _a = options.scaleToSameSize && image1.length > image2.length ? { | ||
imageToCompare1: image2, | ||
imageToCompare2: image1 | ||
} : { imageToCompare1: image1, imageToCompare2: image2 }, imageToCompare1 = _a.imageToCompare1, imageToCompare2 = _a.imageToCompare2; | ||
resemble.compare(imageToCompare1, imageToCompare2, options, function (err, data) { | ||
if (err) { | ||
@@ -47,0 +51,0 @@ reject(err); |
{ | ||
"name": "webdriver-image-comparison", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "An image compare module that can be used for different NodeJS Test automation frameworks that support the webdriver protocol", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
699943
0.34%6333
0.22%