@applitools/driver
Advanced tools
Comparing version 1.9.8 to 1.9.9
@@ -147,4 +147,4 @@ "use strict"; | ||
async init() { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; | ||
var _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0; | ||
var _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12; | ||
const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target)); | ||
@@ -160,5 +160,5 @@ this._logger.log('Driver capabilities', capabilities); | ||
if (this.isWeb) { | ||
(_f = (_y = this._driverInfo).pixelRatio) !== null && _f !== void 0 ? _f : (_y.pixelRatio = await this.execute(snippets.getPixelRatio)); | ||
(_g = (_z = this._driverInfo).viewportScale) !== null && _g !== void 0 ? _g : (_z.viewportScale = await this.execute(snippets.getViewportScale)); | ||
(_h = (_0 = this._driverInfo).userAgent) !== null && _h !== void 0 ? _h : (_0.userAgent = await this.execute(snippets.getUserAgent)); | ||
(_f = (_1 = this._driverInfo).pixelRatio) !== null && _f !== void 0 ? _f : (_1.pixelRatio = await this.execute(snippets.getPixelRatio)); | ||
(_g = (_2 = this._driverInfo).viewportScale) !== null && _g !== void 0 ? _g : (_2.viewportScale = await this.execute(snippets.getViewportScale)); | ||
(_h = (_3 = this._driverInfo).userAgent) !== null && _h !== void 0 ? _h : (_3.userAgent = await this.execute(snippets.getUserAgent)); | ||
if (this._driverInfo.userAgent) { | ||
@@ -169,4 +169,4 @@ const userAgentInfo = (0, user_agent_1.parseUserAgent)(this._driverInfo.userAgent); | ||
if (this._driverInfo.isMobile) { | ||
(_l = (_1 = this._driverInfo).platformName) !== null && _l !== void 0 ? _l : (_1.platformName = userAgentInfo.platformName); | ||
(_m = (_2 = this._driverInfo).platformVersion) !== null && _m !== void 0 ? _m : (_2.platformVersion = userAgentInfo.platformVersion); | ||
(_l = (_4 = this._driverInfo).platformName) !== null && _l !== void 0 ? _l : (_4.platformName = userAgentInfo.platformName); | ||
(_m = (_5 = this._driverInfo).platformVersion) !== null && _m !== void 0 ? _m : (_5.platformVersion = userAgentInfo.platformVersion); | ||
} | ||
@@ -178,4 +178,4 @@ else { | ||
} | ||
(_q = (_3 = this._driverInfo).features) !== null && _q !== void 0 ? _q : (_3.features = {}); | ||
(_r = (_4 = this._driverInfo.features).allCookies) !== null && _r !== void 0 ? _r : (_4.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile); | ||
(_q = (_6 = this._driverInfo).features) !== null && _q !== void 0 ? _q : (_6.features = {}); | ||
(_r = (_7 = this._driverInfo.features).allCookies) !== null && _r !== void 0 ? _r : (_7.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile); | ||
} | ||
@@ -185,3 +185,3 @@ else { | ||
let windowSize = await this._spec.getWindowSize(this.target); | ||
(_s = (_5 = this._driverInfo).displaySize) !== null && _s !== void 0 ? _s : (_5.displaySize = windowSize); | ||
(_s = (_8 = this._driverInfo).displaySize) !== null && _s !== void 0 ? _s : (_8.displaySize = windowSize); | ||
if (this.isAndroid) { | ||
@@ -205,7 +205,7 @@ // bar sizes could be extracted only on android | ||
// navigation bar size could be its height or width depending on screen orientation | ||
const navigationBarSize = navigationBar[this.orientation.startsWith('landscape') ? 'width' : 'height']; | ||
const navigationBarSize = navigationBar[((_w = this.orientation) === null || _w === void 0 ? void 0 : _w.startsWith('landscape')) ? 'width' : 'height']; | ||
// when navigation bar is invisible on android it returns navigation bar size equal to display size | ||
if (navigationBarSize < | ||
this._driverInfo.displaySize[this.orientation.startsWith('landscape') ? 'width' : 'height']) { | ||
this._driverInfo.navigationBarSize = Math.max((_w = this._driverInfo.navigationBarSize) !== null && _w !== void 0 ? _w : 0, navigationBarSize); | ||
this._driverInfo.displaySize[((_x = this.orientation) === null || _x === void 0 ? void 0 : _x.startsWith('landscape')) ? 'width' : 'height']) { | ||
this._driverInfo.navigationBarSize = Math.max((_y = this._driverInfo.navigationBarSize) !== null && _y !== void 0 ? _y : 0, navigationBarSize); | ||
} | ||
@@ -217,9 +217,9 @@ else { | ||
// bar sizes have to be scaled on android | ||
(_6 = this._driverInfo).statusBarSize && (_6.statusBarSize = this._driverInfo.statusBarSize / this.pixelRatio); | ||
(_7 = this._driverInfo).navigationBarSize && (_7.navigationBarSize = this._driverInfo.navigationBarSize / this.pixelRatio); | ||
(_9 = this._driverInfo).statusBarSize && (_9.statusBarSize = this._driverInfo.statusBarSize / this.pixelRatio); | ||
(_10 = this._driverInfo).navigationBarSize && (_10.navigationBarSize = this._driverInfo.navigationBarSize / this.pixelRatio); | ||
windowSize = utils.geometry.scale(windowSize, 1 / this.pixelRatio); | ||
(_8 = this._driverInfo).displaySize && (_8.displaySize = utils.geometry.scale(this._driverInfo.displaySize, 1 / this.pixelRatio)); | ||
(_11 = this._driverInfo).displaySize && (_11.displaySize = utils.geometry.scale(this._driverInfo.displaySize, 1 / this.pixelRatio)); | ||
} | ||
// calculate viewport location | ||
(_x = (_9 = this._driverInfo).viewportLocation) !== null && _x !== void 0 ? _x : (_9.viewportLocation = { | ||
(_z = (_12 = this._driverInfo).viewportLocation) !== null && _z !== void 0 ? _z : (_12.viewportLocation = { | ||
x: this.orientation === 'landscape' ? this.navigationBarSize : 0, | ||
@@ -230,20 +230,12 @@ y: this.statusBarSize, | ||
if (!this._driverInfo.viewportSize) { | ||
if (this.navigationBarSize > 1) { | ||
if (this.orientation.startsWith('landscape')) { | ||
this._driverInfo.viewportSize = { | ||
width: this._driverInfo.displaySize.height - this.navigationBarSize, | ||
height: this._driverInfo.displaySize.width - this.statusBarSize, | ||
}; | ||
} | ||
else { | ||
this._driverInfo.viewportSize = { | ||
width: this._driverInfo.displaySize.width, | ||
height: this._driverInfo.displaySize.height - this.statusBarSize - this.navigationBarSize, | ||
}; | ||
} | ||
if ((_0 = this.orientation) === null || _0 === void 0 ? void 0 : _0.startsWith('landscape')) { | ||
this._driverInfo.viewportSize = { | ||
width: this._driverInfo.displaySize.height - this.navigationBarSize, | ||
height: this._driverInfo.displaySize.width - this.statusBarSize, | ||
}; | ||
} | ||
else { | ||
this._driverInfo.viewportSize = { | ||
width: windowSize.width, | ||
height: windowSize.height - this.statusBarSize, | ||
width: this._driverInfo.displaySize.width, | ||
height: this._driverInfo.displaySize.height - this.statusBarSize - this.navigationBarSize, | ||
}; | ||
@@ -551,3 +543,3 @@ } | ||
async getDisplaySize() { | ||
var _a; | ||
var _a, _b; | ||
if (this.isWeb && !this.isMobile) | ||
@@ -560,3 +552,3 @@ return; | ||
let size = await this._spec.getWindowSize(this.target); | ||
if ((await this.getOrientation()).startsWith('landscape') && size.height > size.width) { | ||
if (((_b = (await this.getOrientation())) === null || _b === void 0 ? void 0 : _b.startsWith('landscape')) && size.height > size.width) { | ||
size = { width: size.height, height: size.width }; | ||
@@ -563,0 +555,0 @@ } |
{ | ||
"name": "@applitools/driver", | ||
"version": "1.9.8", | ||
"version": "1.9.9", | ||
"description": "Applitools universal framework wrapper", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
214089
3381