File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -590,6 +590,9 @@ export class AppiumDriver {
590590 // First time capture
591591 if ( ! existsSync ( pathExpectedImage ) ) {
592592 const pathActualImage = resolvePath ( this . _storageByDeviceName , imageName . replace ( "." , "_actual." ) ) ;
593+ if ( this . imageHelper . waitOnCreatingInitialSnapshot > 0 ) {
594+ await this . driver . wait ( this . imageHelper . waitOnCreatingInitialSnapshot ) ;
595+ }
593596 await this . takeScreenshot ( pathActualImage ) ;
594597
595598 if ( rect ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ export declare class ImageHelper {
55 private _args ;
66 private _imageCropRect ;
77 private _blockOutAreas ;
8+ private _waitOnCreatingInitialSnapshot ;
89 constructor ( _args : INsCapabilities ) ;
10+ waitOnCreatingInitialSnapshot : number ;
911 imageCropRect : IRectangle ;
1012 blockOutAreas : IRectangle [ ] ;
1113 imageOutputLimit ( ) : ImageOptions ;
Original file line number Diff line number Diff line change @@ -10,10 +10,19 @@ export class ImageHelper {
1010
1111 private _imageCropRect : IRectangle ;
1212 private _blockOutAreas : IRectangle [ ] ;
13+ private _waitOnCreatingInitialSnapshot : number ;
1314
1415 constructor ( private _args : INsCapabilities ) {
1516 }
1617
18+ get waitOnCreatingInitialSnapshot ( ) {
19+ return this . _waitOnCreatingInitialSnapshot ;
20+ }
21+
22+ set waitOnCreatingInitialSnapshot ( waitOnCreatingInitialSnapshot : number ) {
23+ this . _waitOnCreatingInitialSnapshot = waitOnCreatingInitialSnapshot ;
24+ }
25+
1726 get imageCropRect ( ) : IRectangle {
1827 return this . _imageCropRect ;
1928 }
@@ -103,9 +112,11 @@ export class ImageHelper {
103112
104113 if ( typeThreshold == ImageOptions . percent ) {
105114 valueThreshold = Math . floor ( valueThreshold * 100 ) ;
115+ console . log ( `Using ${ valueThreshold } \ ${ typeThreshold } tolerance` ) ;
116+ } else {
117+ console . log ( `Using ${ valueThreshold } tolerance` ) ;
106118 }
107119
108- console . log ( `Using ${ valueThreshold } \ ${ typeThreshold } tolerance` ) ;
109120 const result = this . runDiff ( diff , output ) ;
110121 this . _blockOutAreas = undefined ;
111122 return result ;
You can’t perform that action at this time.
0 commit comments