Skip to content

Commit 9485d32

Browse files
Zdravko BranzovZdravko Branzov
Zdravko Branzov
authored and
Zdravko Branzov
committed
fix: respect appium capabilities provided by the user in the json file
1 parent 6f91d58 commit 9485d32

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Diff for: lib/device-manager.ts

+1-3
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;

Diff for: lib/image-helper.ts

+2-2
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;

0 commit comments

Comments
 (0)