@applitools/driver 1.11.49 → 1.11.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/driver.js +16 -13
- package/package.json +1 -1
package/dist/driver.js
CHANGED
|
@@ -249,8 +249,8 @@ class Driver {
|
|
|
249
249
|
return this._environment;
|
|
250
250
|
}
|
|
251
251
|
async getViewport() {
|
|
252
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
253
|
-
var
|
|
252
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
253
|
+
var _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
254
254
|
if (!this._viewport) {
|
|
255
255
|
const environment = await this.getEnvironment();
|
|
256
256
|
const driverInfo = await this.getDriverInfo();
|
|
@@ -267,10 +267,10 @@ class Driver {
|
|
|
267
267
|
const capabilitiesViewport = capabilities ? (0, capabilities_1.extractCapabilitiesViewport)(capabilities) : null;
|
|
268
268
|
this._logger.log('Extracted capabilities viewport', capabilitiesViewport);
|
|
269
269
|
this._viewport = { ...capabilitiesViewport, ...this._viewport };
|
|
270
|
-
(_a = (
|
|
270
|
+
(_a = (_y = this._viewport).pixelRatio) !== null && _a !== void 0 ? _a : (_y.pixelRatio = 1);
|
|
271
271
|
// this value always excludes the height of the navigation bar, and sometimes it also excludes the height of the status bar
|
|
272
272
|
let windowSize = await this._spec.getWindowSize(this.target);
|
|
273
|
-
(_b = (
|
|
273
|
+
(_b = (_z = this._viewport).displaySize) !== null && _b !== void 0 ? _b : (_z.displaySize = windowSize);
|
|
274
274
|
if (((_c = this._viewport.orientation) === null || _c === void 0 ? void 0 : _c.startsWith('landscape')) &&
|
|
275
275
|
this._viewport.displaySize.height > this._viewport.displaySize.width) {
|
|
276
276
|
this._viewport.displaySize = utils.geometry.rotate(this._viewport.displaySize, 90);
|
|
@@ -303,19 +303,19 @@ class Driver {
|
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
// bar sizes have to be scaled on android
|
|
306
|
-
(
|
|
307
|
-
(
|
|
306
|
+
(_0 = this._viewport).statusBarSize && (_0.statusBarSize = this._viewport.statusBarSize / this._viewport.pixelRatio);
|
|
307
|
+
(_1 = this._viewport).navigationBarSize && (_1.navigationBarSize = this._viewport.navigationBarSize / this._viewport.pixelRatio);
|
|
308
308
|
windowSize = utils.geometry.scale(windowSize, 1 / this._viewport.pixelRatio);
|
|
309
|
-
(
|
|
310
|
-
(_l = (
|
|
309
|
+
(_2 = this._viewport).displaySize && (_2.displaySize = utils.geometry.scale(this._viewport.displaySize, 1 / this._viewport.pixelRatio));
|
|
310
|
+
(_l = (_3 = this._viewport).navigationBarSize) !== null && _l !== void 0 ? _l : (_3.navigationBarSize = 0);
|
|
311
311
|
}
|
|
312
312
|
else if (environment.isIOS) {
|
|
313
313
|
if ((_m = this._viewport.orientation) === null || _m === void 0 ? void 0 : _m.startsWith('landscape'))
|
|
314
314
|
this._viewport.statusBarSize = 0;
|
|
315
315
|
}
|
|
316
|
-
(_o = (
|
|
316
|
+
(_o = (_4 = this._viewport).statusBarSize) !== null && _o !== void 0 ? _o : (_4.statusBarSize = 0);
|
|
317
317
|
// calculate viewport location
|
|
318
|
-
(_p = (
|
|
318
|
+
(_p = (_5 = this._viewport).viewportLocation) !== null && _p !== void 0 ? _p : (_5.viewportLocation = {
|
|
319
319
|
x: this._viewport.orientation === 'landscape' ? (_q = this._viewport.navigationBarSize) !== null && _q !== void 0 ? _q : 0 : 0,
|
|
320
320
|
y: this._viewport.statusBarSize,
|
|
321
321
|
});
|
|
@@ -354,10 +354,13 @@ class Driver {
|
|
|
354
354
|
}
|
|
355
355
|
if (environment.isWeb) {
|
|
356
356
|
const browserViewport = await this.execute(snippets.getViewport);
|
|
357
|
-
|
|
357
|
+
(_s = (_6 = this._viewport).viewportSize) !== null && _s !== void 0 ? _s : (_6.viewportSize = browserViewport.viewportSize);
|
|
358
|
+
(_t = (_7 = this._viewport).pixelRatio) !== null && _t !== void 0 ? _t : (_7.pixelRatio = browserViewport.pixelRatio);
|
|
359
|
+
(_u = (_8 = this._viewport).viewportScale) !== null && _u !== void 0 ? _u : (_8.viewportScale = browserViewport.viewportScale);
|
|
360
|
+
(_v = (_9 = this._viewport).orientation) !== null && _v !== void 0 ? _v : (_9.orientation = browserViewport.orientation);
|
|
358
361
|
}
|
|
359
|
-
(
|
|
360
|
-
(
|
|
362
|
+
(_w = (_10 = this._viewport).pixelRatio) !== null && _w !== void 0 ? _w : (_10.pixelRatio = 1);
|
|
363
|
+
(_x = (_11 = this._viewport).viewportScale) !== null && _x !== void 0 ? _x : (_11.viewportScale = 1);
|
|
361
364
|
this._logger.log('Extracted viewport', this._viewport);
|
|
362
365
|
}
|
|
363
366
|
return this._viewport;
|