@@ -102,9 +102,9 @@ export class ImageHelper {
102
102
ImageHelper . fullClone ( this . _args . device . viewportRect , this . _defaultOptions . cropRectangle )
103
103
}
104
104
if ( ! this . _defaultOptions . cropRectangle
105
- || ! isNumber ( this . _defaultOptions . cropRectangle . y ) ) {
105
+ || ! isNumber ( this . _defaultOptions . cropRectangle . y ) || this . _args . appiumCaps . offsetPixels > 0 ) {
106
106
this . _defaultOptions . cropRectangle = this . _defaultOptions . cropRectangle || { } ;
107
- this . _defaultOptions . cropRectangle . y = this . _args . device . config . offsetPixels || 0 ;
107
+ this . _defaultOptions . cropRectangle . y = this . _args . appiumCaps . offsetPixels || this . _args . device . config . offsetPixels || 0 ;
108
108
this . _defaultOptions . cropRectangle . x = 0 ;
109
109
if ( this . _args . device . deviceScreenSize && this . _args . device . deviceScreenSize . width && this . _args . device . deviceScreenSize . height ) {
110
110
this . _defaultOptions . cropRectangle . height = this . _args . device . deviceScreenSize . height - this . _defaultOptions . cropRectangle . y ;
@@ -270,8 +270,12 @@ export class ImageHelper {
270
270
const eventStartTime = Date . now ( ) . valueOf ( ) ;
271
271
let counter = 1 ;
272
272
options . timeOutSeconds *= 1000 ;
273
+ let pathActualImageCounter = resolvePath ( this . _args . reportsPath , imageName . replace ( "." , "_actual." ) ) ;
274
+ const shouldLogEveryImage = checkImageLogType ( this . _args . testReporter , LogImageType . everyImage ) ;
273
275
while ( ( Date . now ( ) . valueOf ( ) - eventStartTime ) <= options . timeOutSeconds && ! result ) {
274
- const pathActualImageCounter = resolvePath ( this . _args . reportsPath , imageName . replace ( "." , "_actual_" + counter + "." ) ) ;
276
+ if ( shouldLogEveryImage ) {
277
+ pathActualImageCounter = resolvePath ( this . _args . reportsPath , imageName . replace ( "." , "_actual_" + counter + "." ) ) ;
278
+ }
275
279
pathActualImage = await this . _driver . saveScreenshot ( pathActualImageCounter ) ;
276
280
if ( ! options . keepOriginalImageSize ) {
277
281
await this . clipRectangleImage ( options . cropRectangle , pathActualImage ) ;
0 commit comments