@applitools/driver
Advanced tools
Comparing version 1.9.1 to 1.9.2
@@ -178,2 +178,3 @@ "use strict"; | ||
(_r = (_4 = this._driverInfo).displaySize) !== null && _r !== void 0 ? _r : (_4.displaySize = windowSize); | ||
const orientation = await this.getOrientation(); | ||
if (this.isAndroid) { | ||
@@ -185,3 +186,3 @@ // bar sizes could be extracted only on android | ||
// navigation bar height is replaced with the width in landscape orientation on android (due to the bug in appium) | ||
if ((await this.getOrientation()) === 'landscape') | ||
if (orientation === 'landscape') | ||
barsSize.navigationBarHeight = barsSize.navigationBarWidth; | ||
@@ -206,6 +207,14 @@ // when status bar is overlapping content on android it returns status bar height equal to viewport height | ||
if (this.navigationBarHeight > 1) { | ||
this._driverInfo.viewportSize = { | ||
width: this._driverInfo.displaySize.width, | ||
height: this._driverInfo.displaySize.height - this.statusBarHeight - this.navigationBarHeight, | ||
}; | ||
if (orientation === 'landscape') { | ||
this._driverInfo.viewportSize = { | ||
width: this._driverInfo.displaySize.height - this.navigationBarHeight, | ||
height: this._driverInfo.displaySize.width - this.statusBarHeight, | ||
}; | ||
} | ||
else { | ||
this._driverInfo.viewportSize = { | ||
width: this._driverInfo.displaySize.width, | ||
height: this._driverInfo.displaySize.height - this.statusBarHeight - this.navigationBarHeight, | ||
}; | ||
} | ||
} | ||
@@ -460,8 +469,2 @@ else { | ||
size = await this.getDisplaySize(); | ||
if (size.height > size.width) { | ||
const orientation = await this.getOrientation(); | ||
if (orientation === 'landscape') { | ||
size = { width: size.height, height: size.width }; | ||
} | ||
} | ||
size.height -= this.statusBarHeight; | ||
@@ -527,7 +530,10 @@ } | ||
return; | ||
if ((_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.viewportSize) { | ||
if ((_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.displaySize) { | ||
this._logger.log('Extracting display size from native driver using cached value'); | ||
return this._driverInfo.displaySize; | ||
} | ||
const size = await this._spec.getWindowSize(this.target); | ||
let size = await this._spec.getWindowSize(this.target); | ||
if ((await this.getOrientation()) === 'landscape' && size.height > size.width) { | ||
size = { width: size.height, height: size.width }; | ||
} | ||
const normalizedSize = this.isAndroid ? utils.geometry.scale(size, 1 / this.pixelRatio) : size; | ||
@@ -534,0 +540,0 @@ this._logger.log('Extracted and normalized display size:', normalizedSize); |
{ | ||
"name": "@applitools/driver", | ||
"version": "1.9.1", | ||
"version": "1.9.2", | ||
"description": "Applitools universal framework wrapper", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
204355
3189