@applitools/driver 1.9.8 → 1.9.9
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 +26 -34
- package/package.json +1 -1
package/dist/driver.js
CHANGED
|
@@ -144,8 +144,8 @@ class Driver {
|
|
|
144
144
|
this._currentContext = context;
|
|
145
145
|
}
|
|
146
146
|
async init() {
|
|
147
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
148
|
-
var
|
|
147
|
+
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;
|
|
148
|
+
var _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
|
|
149
149
|
const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
|
|
150
150
|
this._logger.log('Driver capabilities', capabilities);
|
|
151
151
|
const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities, this._customConfig) : undefined;
|
|
@@ -156,29 +156,29 @@ class Driver {
|
|
|
156
156
|
(_e = (await this.getOrientation().catch(() => undefined))) !== null && _e !== void 0 ? _e : this._driverInfo.orientation;
|
|
157
157
|
}
|
|
158
158
|
if (this.isWeb) {
|
|
159
|
-
(_f = (
|
|
160
|
-
(_g = (
|
|
161
|
-
(_h = (
|
|
159
|
+
(_f = (_1 = this._driverInfo).pixelRatio) !== null && _f !== void 0 ? _f : (_1.pixelRatio = await this.execute(snippets.getPixelRatio));
|
|
160
|
+
(_g = (_2 = this._driverInfo).viewportScale) !== null && _g !== void 0 ? _g : (_2.viewportScale = await this.execute(snippets.getViewportScale));
|
|
161
|
+
(_h = (_3 = this._driverInfo).userAgent) !== null && _h !== void 0 ? _h : (_3.userAgent = await this.execute(snippets.getUserAgent));
|
|
162
162
|
if (this._driverInfo.userAgent) {
|
|
163
163
|
const userAgentInfo = (0, user_agent_1.parseUserAgent)(this._driverInfo.userAgent);
|
|
164
164
|
this._driverInfo.browserName = (_j = userAgentInfo.browserName) !== null && _j !== void 0 ? _j : this._driverInfo.browserName;
|
|
165
165
|
this._driverInfo.browserVersion = (_k = userAgentInfo.browserVersion) !== null && _k !== void 0 ? _k : this._driverInfo.browserVersion;
|
|
166
166
|
if (this._driverInfo.isMobile) {
|
|
167
|
-
(_l = (
|
|
168
|
-
(_m = (
|
|
167
|
+
(_l = (_4 = this._driverInfo).platformName) !== null && _l !== void 0 ? _l : (_4.platformName = userAgentInfo.platformName);
|
|
168
|
+
(_m = (_5 = this._driverInfo).platformVersion) !== null && _m !== void 0 ? _m : (_5.platformVersion = userAgentInfo.platformVersion);
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
171
|
this._driverInfo.platformName = (_o = userAgentInfo.platformName) !== null && _o !== void 0 ? _o : this._driverInfo.platformName;
|
|
172
172
|
this._driverInfo.platformVersion = (_p = userAgentInfo.platformVersion) !== null && _p !== void 0 ? _p : this._driverInfo.platformVersion;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
(_q = (
|
|
176
|
-
(_r = (
|
|
175
|
+
(_q = (_6 = this._driverInfo).features) !== null && _q !== void 0 ? _q : (_6.features = {});
|
|
176
|
+
(_r = (_7 = this._driverInfo.features).allCookies) !== null && _r !== void 0 ? _r : (_7.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
|
|
177
177
|
}
|
|
178
178
|
else {
|
|
179
179
|
// this value always excludes the height of the navigation bar, and sometimes it also excludes the height of the status bar
|
|
180
180
|
let windowSize = await this._spec.getWindowSize(this.target);
|
|
181
|
-
(_s = (
|
|
181
|
+
(_s = (_8 = this._driverInfo).displaySize) !== null && _s !== void 0 ? _s : (_8.displaySize = windowSize);
|
|
182
182
|
if (this.isAndroid) {
|
|
183
183
|
// bar sizes could be extracted only on android
|
|
184
184
|
const systemBars = await ((_u = (_t = this._spec).getSystemBars) === null || _u === void 0 ? void 0 : _u.call(_t, this.target).catch(() => null));
|
|
@@ -197,47 +197,39 @@ class Driver {
|
|
|
197
197
|
if (navigationBar.x > 0)
|
|
198
198
|
this._driverInfo.orientation = 'landscape-secondary';
|
|
199
199
|
// navigation bar size could be its height or width depending on screen orientation
|
|
200
|
-
const navigationBarSize = navigationBar[this.orientation.startsWith('landscape') ? 'width' : 'height'];
|
|
200
|
+
const navigationBarSize = navigationBar[((_w = this.orientation) === null || _w === void 0 ? void 0 : _w.startsWith('landscape')) ? 'width' : 'height'];
|
|
201
201
|
// when navigation bar is invisible on android it returns navigation bar size equal to display size
|
|
202
202
|
if (navigationBarSize <
|
|
203
|
-
this._driverInfo.displaySize[this.orientation.startsWith('landscape') ? 'width' : 'height']) {
|
|
204
|
-
this._driverInfo.navigationBarSize = Math.max((
|
|
203
|
+
this._driverInfo.displaySize[((_x = this.orientation) === null || _x === void 0 ? void 0 : _x.startsWith('landscape')) ? 'width' : 'height']) {
|
|
204
|
+
this._driverInfo.navigationBarSize = Math.max((_y = this._driverInfo.navigationBarSize) !== null && _y !== void 0 ? _y : 0, navigationBarSize);
|
|
205
205
|
}
|
|
206
206
|
else {
|
|
207
207
|
this._driverInfo.navigationBarSize = 0;
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
// bar sizes have to be scaled on android
|
|
211
|
-
(
|
|
212
|
-
(
|
|
211
|
+
(_9 = this._driverInfo).statusBarSize && (_9.statusBarSize = this._driverInfo.statusBarSize / this.pixelRatio);
|
|
212
|
+
(_10 = this._driverInfo).navigationBarSize && (_10.navigationBarSize = this._driverInfo.navigationBarSize / this.pixelRatio);
|
|
213
213
|
windowSize = utils.geometry.scale(windowSize, 1 / this.pixelRatio);
|
|
214
|
-
(
|
|
214
|
+
(_11 = this._driverInfo).displaySize && (_11.displaySize = utils.geometry.scale(this._driverInfo.displaySize, 1 / this.pixelRatio));
|
|
215
215
|
}
|
|
216
216
|
// calculate viewport location
|
|
217
|
-
(
|
|
217
|
+
(_z = (_12 = this._driverInfo).viewportLocation) !== null && _z !== void 0 ? _z : (_12.viewportLocation = {
|
|
218
218
|
x: this.orientation === 'landscape' ? this.navigationBarSize : 0,
|
|
219
219
|
y: this.statusBarSize,
|
|
220
220
|
});
|
|
221
221
|
// calculate viewport size
|
|
222
222
|
if (!this._driverInfo.viewportSize) {
|
|
223
|
-
if (this.
|
|
224
|
-
|
|
225
|
-
this._driverInfo.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
this._driverInfo.viewportSize = {
|
|
232
|
-
width: this._driverInfo.displaySize.width,
|
|
233
|
-
height: this._driverInfo.displaySize.height - this.statusBarSize - this.navigationBarSize,
|
|
234
|
-
};
|
|
235
|
-
}
|
|
223
|
+
if ((_0 = this.orientation) === null || _0 === void 0 ? void 0 : _0.startsWith('landscape')) {
|
|
224
|
+
this._driverInfo.viewportSize = {
|
|
225
|
+
width: this._driverInfo.displaySize.height - this.navigationBarSize,
|
|
226
|
+
height: this._driverInfo.displaySize.width - this.statusBarSize,
|
|
227
|
+
};
|
|
236
228
|
}
|
|
237
229
|
else {
|
|
238
230
|
this._driverInfo.viewportSize = {
|
|
239
|
-
width:
|
|
240
|
-
height:
|
|
231
|
+
width: this._driverInfo.displaySize.width,
|
|
232
|
+
height: this._driverInfo.displaySize.height - this.statusBarSize - this.navigationBarSize,
|
|
241
233
|
};
|
|
242
234
|
}
|
|
243
235
|
}
|
|
@@ -540,7 +532,7 @@ class Driver {
|
|
|
540
532
|
throw new Error('Failed to set viewport size!');
|
|
541
533
|
}
|
|
542
534
|
async getDisplaySize() {
|
|
543
|
-
var _a;
|
|
535
|
+
var _a, _b;
|
|
544
536
|
if (this.isWeb && !this.isMobile)
|
|
545
537
|
return;
|
|
546
538
|
if ((_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.displaySize) {
|
|
@@ -548,7 +540,7 @@ class Driver {
|
|
|
548
540
|
return this._driverInfo.displaySize;
|
|
549
541
|
}
|
|
550
542
|
let size = await this._spec.getWindowSize(this.target);
|
|
551
|
-
if ((await this.getOrientation()).startsWith('landscape') && size.height > size.width) {
|
|
543
|
+
if (((_b = (await this.getOrientation())) === null || _b === void 0 ? void 0 : _b.startsWith('landscape')) && size.height > size.width) {
|
|
552
544
|
size = { width: size.height, height: size.width };
|
|
553
545
|
}
|
|
554
546
|
const normalizedSize = this.isAndroid ? utils.geometry.scale(size, 1 / this.pixelRatio) : size;
|