@@ -286,19 +286,19 @@ export class AppiumDriver {
286286 return await this . driver . getSessionId ( ) ;
287287 }
288288
289- public async compareElement ( element : UIElement , imageName : string , ) {
290- return await this . compareRectangle ( await element . getActualRectangle ( ) , imageName ) ;
289+ public async compareElement ( element : UIElement , imageName : string , tolerance : number = 0.01 , timeOutSeconds : number = 3 , toleranceType ?: ImageOptions ) {
290+ return await this . compareRectangle ( await element . getActualRectangle ( ) , imageName , timeOutSeconds , tolerance , toleranceType ) ;
291291 }
292292
293- public async compareRectangle ( rect : IRectangle , imageName : string , timeOutSeconds : number = 3 , tollerance : number = 0.01 ) {
294- return await this . compare ( imageName , timeOutSeconds , tollerance , rect ) ;
293+ public async compareRectangle ( rect : IRectangle , imageName : string , timeOutSeconds : number = 3 , tolerance : number = 0.01 , toleranceType ?: ImageOptions ) {
294+ return await this . compare ( imageName , timeOutSeconds , tolerance , rect , toleranceType ) ;
295295 }
296296
297- public async compareScreen ( imageName : string , timeOutSeconds : number = 3 , tollerance : number = 0.01 ) {
298- return await this . compare ( imageName , timeOutSeconds , tollerance ) ;
297+ public async compareScreen ( imageName : string , timeOutSeconds : number = 3 , tolerance : number = 0.01 , toleranceType ?: ImageOptions ) {
298+ return await this . compare ( imageName , timeOutSeconds , tolerance , undefined , toleranceType ) ;
299299 }
300300
301- private async compare ( imageName : string , timeOutSeconds : number = 3 , tollerance : number = 0.01 , rect ?: IRectangle ) {
301+ private async compare ( imageName : string , timeOutSeconds : number = 3 , tolerance : number = 0.01 , rect ?: IRectangle , toleranceType ?: ImageOptions ) {
302302
303303 if ( ! this . _logPath ) {
304304 this . _logPath = getReportPath ( this . _args ) ;
@@ -326,7 +326,7 @@ export class AppiumDriver {
326326 const pathDiffImage = pathActualImage . replace ( "actual" , "diff" ) ;
327327
328328 await this . prepareImageToCompare ( pathActualImage , rect ) ;
329- let result = await this . _imageHelper . compareImages ( pathActualImage , pathExpectedImage , pathDiffImage , tollerance ) ;
329+ let result = await this . _imageHelper . compareImages ( pathActualImage , pathExpectedImage , pathDiffImage , tolerance , toleranceType ) ;
330330
331331 // Iterate
332332 if ( ! result ) {
@@ -338,7 +338,7 @@ export class AppiumDriver {
338338 pathActualImage = await this . takeScreenshot ( pathActualImageConter ) ;
339339
340340 await this . prepareImageToCompare ( pathActualImage , rect ) ;
341- result = await this . _imageHelper . compareImages ( pathActualImage , pathExpectedImage , pathDiffImage , tollerance ) ;
341+ result = await this . _imageHelper . compareImages ( pathActualImage , pathExpectedImage , pathDiffImage , tolerance , toleranceType ) ;
342342 counter ++ ;
343343 }
344344 } else {
0 commit comments