Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 21cdc41

Browse files
author
Zdravko
authored
Merge pull request #263 from NativeScript/zbranzov/appium-fix
Zbranzov/appium-save-images
2 parents 6f91d58 + 0147399 commit 21cdc41

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

‎lib/device-manager.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ export class DeviceManager implements IDeviceManager {
174174
apiLevel: platformVersion || args.appiumCaps.platformVersion,
175175
config: { "density": args.appiumCaps.density, "offsetPixels": args.appiumCaps.offsetPixels }
176176
}
177-
178-
delete args.appiumCaps.density;
179-
delete args.appiumCaps.offsetPixels;
177+
180178
DeviceManager.cleanUnsetProperties(device);
181179

182180
return device;

‎lib/image-helper.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ export class ImageHelper {
102102
ImageHelper.fullClone(this._args.device.viewportRect, this._defaultOptions.cropRectangle)
103103
}
104104
if (!this._defaultOptions.cropRectangle
105-
|| !isNumber(this._defaultOptions.cropRectangle.y)) {
105+
|| !isNumber(this._defaultOptions.cropRectangle.y)||this._args.appiumCaps.offsetPixels>0) {
106106
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;
108108
this._defaultOptions.cropRectangle.x = 0;
109109
if (this._args.device.deviceScreenSize && this._args.device.deviceScreenSize.width && this._args.device.deviceScreenSize.height) {
110110
this._defaultOptions.cropRectangle.height = this._args.device.deviceScreenSize.height - this._defaultOptions.cropRectangle.y;
@@ -270,8 +270,12 @@ export class ImageHelper {
270270
const eventStartTime = Date.now().valueOf();
271271
let counter = 1;
272272
options.timeOutSeconds *= 1000;
273+
let pathActualImageCounter = resolvePath(this._args.reportsPath, imageName.replace(".", "_actual."));
274+
const shouldLogEveryImage = checkImageLogType(this._args.testReporter, LogImageType.everyImage);
273275
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+
}
275279
pathActualImage = await this._driver.saveScreenshot(pathActualImageCounter);
276280
if (!options.keepOriginalImageSize) {
277281
await this.clipRectangleImage(options.cropRectangle, pathActualImage);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /