File tree 3 files changed +17
-1
lines changed
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -590,6 +590,9 @@ export class AppiumDriver {
590
590
// First time capture
591
591
if ( ! existsSync ( pathExpectedImage ) ) {
592
592
const pathActualImage = resolvePath ( this . _storageByDeviceName , imageName . replace ( "." , "_actual." ) ) ;
593
+ if ( this . imageHelper . waitOnCreatingInitialSnapshot > 0 ) {
594
+ await this . driver . wait ( this . imageHelper . waitOnCreatingInitialSnapshot ) ;
595
+ }
593
596
await this . takeScreenshot ( pathActualImage ) ;
594
597
595
598
if ( rect ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ export declare class ImageHelper {
5
5
private _args ;
6
6
private _imageCropRect ;
7
7
private _blockOutAreas ;
8
+ private _waitOnCreatingInitialSnapshot ;
8
9
constructor ( _args : INsCapabilities ) ;
10
+ waitOnCreatingInitialSnapshot : number ;
9
11
imageCropRect : IRectangle ;
10
12
blockOutAreas : IRectangle [ ] ;
11
13
imageOutputLimit ( ) : ImageOptions ;
Original file line number Diff line number Diff line change @@ -10,10 +10,19 @@ export class ImageHelper {
10
10
11
11
private _imageCropRect : IRectangle ;
12
12
private _blockOutAreas : IRectangle [ ] ;
13
+ private _waitOnCreatingInitialSnapshot : number ;
13
14
14
15
constructor ( private _args : INsCapabilities ) {
15
16
}
16
17
18
+ get waitOnCreatingInitialSnapshot ( ) {
19
+ return this . _waitOnCreatingInitialSnapshot ;
20
+ }
21
+
22
+ set waitOnCreatingInitialSnapshot ( waitOnCreatingInitialSnapshot : number ) {
23
+ this . _waitOnCreatingInitialSnapshot = waitOnCreatingInitialSnapshot ;
24
+ }
25
+
17
26
get imageCropRect ( ) : IRectangle {
18
27
return this . _imageCropRect ;
19
28
}
@@ -103,9 +112,11 @@ export class ImageHelper {
103
112
104
113
if ( typeThreshold == ImageOptions . percent ) {
105
114
valueThreshold = Math . floor ( valueThreshold * 100 ) ;
115
+ console . log ( `Using ${ valueThreshold } \ ${ typeThreshold } tolerance` ) ;
116
+ } else {
117
+ console . log ( `Using ${ valueThreshold } tolerance` ) ;
106
118
}
107
119
108
- console . log ( `Using ${ valueThreshold } \ ${ typeThreshold } tolerance` ) ;
109
120
const result = this . runDiff ( diff , output ) ;
110
121
this . _blockOutAreas = undefined ;
111
122
return result ;
You can’t perform that action at this time.
0 commit comments