@applitools/driver 1.9.28 → 1.9.30
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 +36 -30
- package/package.json +3 -3
package/dist/driver.js
CHANGED
|
@@ -144,42 +144,47 @@ 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, _y, _z, _0, _1, _2, _3;
|
|
148
|
-
var
|
|
149
|
-
|
|
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, _1, _2, _3, _4, _5;
|
|
148
|
+
var _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
|
|
149
|
+
// NOTE: this is here because saucelabs does not provide right capabilities for the first call
|
|
150
|
+
await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
|
|
151
|
+
const capabilities = await ((_d = (_c = this._spec).getCapabilities) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
|
|
150
152
|
this._logger.log('Driver capabilities', capabilities);
|
|
151
153
|
const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities) : undefined;
|
|
152
|
-
const driverInfo = await ((
|
|
154
|
+
const driverInfo = await ((_f = (_e = this._spec).getDriverInfo) === null || _f === void 0 ? void 0 : _f.call(_e, this.target));
|
|
153
155
|
this._driverInfo = { ...capabilitiesInfo, ...driverInfo };
|
|
154
156
|
if (this.isMobile) {
|
|
155
157
|
this._driverInfo.orientation =
|
|
156
|
-
(
|
|
158
|
+
(_g = (await this.getOrientation().catch(() => undefined))) !== null && _g !== void 0 ? _g : this._driverInfo.orientation;
|
|
157
159
|
}
|
|
158
160
|
if (this.isWeb) {
|
|
159
|
-
(
|
|
160
|
-
(
|
|
161
|
-
(
|
|
161
|
+
(_h = (_6 = this._driverInfo).pixelRatio) !== null && _h !== void 0 ? _h : (_6.pixelRatio = await this.execute(snippets.getPixelRatio));
|
|
162
|
+
(_j = (_7 = this._driverInfo).viewportScale) !== null && _j !== void 0 ? _j : (_7.viewportScale = await this.execute(snippets.getViewportScale));
|
|
163
|
+
(_k = (_8 = this._driverInfo).userAgent) !== null && _k !== void 0 ? _k : (_8.userAgent = await this.execute(snippets.getUserAgent));
|
|
162
164
|
if (this._driverInfo.userAgent) {
|
|
163
165
|
const userAgentInfo = (0, user_agent_1.parseUserAgent)(this._driverInfo.userAgent);
|
|
164
|
-
this._driverInfo.browserName = (
|
|
165
|
-
this._driverInfo.browserVersion = (
|
|
166
|
+
this._driverInfo.browserName = (_l = userAgentInfo.browserName) !== null && _l !== void 0 ? _l : this._driverInfo.browserName;
|
|
167
|
+
this._driverInfo.browserVersion = (_m = userAgentInfo.browserVersion) !== null && _m !== void 0 ? _m : this._driverInfo.browserVersion;
|
|
166
168
|
if (this._driverInfo.isMobile) {
|
|
167
|
-
(
|
|
168
|
-
(
|
|
169
|
+
(_o = (_9 = this._driverInfo).platformName) !== null && _o !== void 0 ? _o : (_9.platformName = userAgentInfo.platformName);
|
|
170
|
+
(_p = (_10 = this._driverInfo).platformVersion) !== null && _p !== void 0 ? _p : (_10.platformVersion = userAgentInfo.platformVersion);
|
|
169
171
|
}
|
|
170
172
|
else {
|
|
171
|
-
this._driverInfo.platformName = (
|
|
172
|
-
this._driverInfo.platformVersion = (
|
|
173
|
+
this._driverInfo.platformName = (_q = userAgentInfo.platformName) !== null && _q !== void 0 ? _q : this._driverInfo.platformName;
|
|
174
|
+
this._driverInfo.platformVersion = (_r = userAgentInfo.platformVersion) !== null && _r !== void 0 ? _r : this._driverInfo.platformVersion;
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
if (!this._driverInfo.isMobile && (this.isAndroid || this.isIOS)) {
|
|
178
|
+
this._driverInfo.isMobile = true;
|
|
179
|
+
}
|
|
180
|
+
(_s = (_11 = this._driverInfo).features) !== null && _s !== void 0 ? _s : (_11.features = {});
|
|
181
|
+
(_t = (_12 = this._driverInfo.features).allCookies) !== null && _t !== void 0 ? _t : (_12.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
|
|
177
182
|
}
|
|
178
183
|
else {
|
|
179
184
|
// this value always excludes the height of the navigation bar, and sometimes it also excludes the height of the status bar
|
|
180
185
|
let windowSize = await this._spec.getWindowSize(this.target);
|
|
181
|
-
(
|
|
182
|
-
if (((
|
|
186
|
+
(_u = (_13 = this._driverInfo).displaySize) !== null && _u !== void 0 ? _u : (_13.displaySize = windowSize);
|
|
187
|
+
if (((_v = this.orientation) === null || _v === void 0 ? void 0 : _v.startsWith('landscape')) &&
|
|
183
188
|
this._driverInfo.displaySize.height > this._driverInfo.displaySize.width) {
|
|
184
189
|
this._driverInfo.displaySize = {
|
|
185
190
|
width: this._driverInfo.displaySize.height,
|
|
@@ -188,14 +193,14 @@ class Driver {
|
|
|
188
193
|
}
|
|
189
194
|
if (this.isAndroid) {
|
|
190
195
|
// bar sizes could be extracted only on android
|
|
191
|
-
const systemBars = await ((
|
|
196
|
+
const systemBars = await ((_x = (_w = this._spec).getSystemBars) === null || _x === void 0 ? void 0 : _x.call(_w, this.target).catch(() => null));
|
|
192
197
|
const { statusBar, navigationBar } = systemBars !== null && systemBars !== void 0 ? systemBars : {};
|
|
193
198
|
if (statusBar === null || statusBar === void 0 ? void 0 : statusBar.visible) {
|
|
194
199
|
this._logger.log('Driver status bar', statusBar);
|
|
195
200
|
const statusBarSize = statusBar.height;
|
|
196
201
|
// when status bar is overlapping content on android it returns status bar height equal to display height
|
|
197
202
|
if (statusBarSize < this._driverInfo.displaySize.height) {
|
|
198
|
-
this._driverInfo.statusBarSize = Math.max((
|
|
203
|
+
this._driverInfo.statusBarSize = Math.max((_y = this._driverInfo.statusBarSize) !== null && _y !== void 0 ? _y : 0, statusBarSize);
|
|
199
204
|
}
|
|
200
205
|
}
|
|
201
206
|
if (navigationBar === null || navigationBar === void 0 ? void 0 : navigationBar.visible) {
|
|
@@ -204,28 +209,28 @@ class Driver {
|
|
|
204
209
|
if (navigationBar.x > 0)
|
|
205
210
|
this._driverInfo.orientation = 'landscape-secondary';
|
|
206
211
|
// navigation bar size could be its height or width depending on screen orientation
|
|
207
|
-
const navigationBarSize = navigationBar[((
|
|
212
|
+
const navigationBarSize = navigationBar[((_z = this.orientation) === null || _z === void 0 ? void 0 : _z.startsWith('landscape')) ? 'width' : 'height'];
|
|
208
213
|
// when navigation bar is invisible on android it returns navigation bar size equal to display size
|
|
209
214
|
if (navigationBarSize <
|
|
210
|
-
this._driverInfo.displaySize[((
|
|
211
|
-
this._driverInfo.navigationBarSize = Math.max((
|
|
215
|
+
this._driverInfo.displaySize[((_0 = this.orientation) === null || _0 === void 0 ? void 0 : _0.startsWith('landscape')) ? 'width' : 'height']) {
|
|
216
|
+
this._driverInfo.navigationBarSize = Math.max((_1 = this._driverInfo.navigationBarSize) !== null && _1 !== void 0 ? _1 : 0, navigationBarSize);
|
|
212
217
|
}
|
|
213
218
|
else {
|
|
214
219
|
this._driverInfo.navigationBarSize = 0;
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
222
|
// bar sizes have to be scaled on android
|
|
218
|
-
(
|
|
219
|
-
(
|
|
223
|
+
(_14 = this._driverInfo).statusBarSize && (_14.statusBarSize = this._driverInfo.statusBarSize / this.pixelRatio);
|
|
224
|
+
(_15 = this._driverInfo).navigationBarSize && (_15.navigationBarSize = this._driverInfo.navigationBarSize / this.pixelRatio);
|
|
220
225
|
windowSize = utils.geometry.scale(windowSize, 1 / this.pixelRatio);
|
|
221
|
-
(
|
|
226
|
+
(_16 = this._driverInfo).displaySize && (_16.displaySize = utils.geometry.scale(this._driverInfo.displaySize, 1 / this.pixelRatio));
|
|
222
227
|
}
|
|
223
228
|
if (this.isIOS) {
|
|
224
|
-
if ((
|
|
229
|
+
if ((_2 = this.orientation) === null || _2 === void 0 ? void 0 : _2.startsWith('landscape'))
|
|
225
230
|
this._driverInfo.statusBarSize = 0;
|
|
226
231
|
}
|
|
227
232
|
// calculate viewport location
|
|
228
|
-
(
|
|
233
|
+
(_3 = (_17 = this._driverInfo).viewportLocation) !== null && _3 !== void 0 ? _3 : (_17.viewportLocation = {
|
|
229
234
|
x: this.orientation === 'landscape' ? this.navigationBarSize : 0,
|
|
230
235
|
y: this.statusBarSize,
|
|
231
236
|
});
|
|
@@ -234,7 +239,7 @@ class Driver {
|
|
|
234
239
|
this._driverInfo.viewportSize = { ...this._driverInfo.displaySize };
|
|
235
240
|
this._driverInfo.viewportSize.height -= this.statusBarSize;
|
|
236
241
|
if (this.isAndroid) {
|
|
237
|
-
this._driverInfo.viewportSize[((
|
|
242
|
+
this._driverInfo.viewportSize[((_4 = this.orientation) === null || _4 === void 0 ? void 0 : _4.startsWith('landscape')) ? 'width' : 'height'] -=
|
|
238
243
|
this.navigationBarSize;
|
|
239
244
|
}
|
|
240
245
|
}
|
|
@@ -257,7 +262,7 @@ class Driver {
|
|
|
257
262
|
}
|
|
258
263
|
// TODO: if user opts into NML, skip initializing the helpers
|
|
259
264
|
// init helper lib
|
|
260
|
-
if (!((
|
|
265
|
+
if (!((_5 = this._customConfig) === null || _5 === void 0 ? void 0 : _5.disableHelper)) {
|
|
261
266
|
this._helper = this.isIOS
|
|
262
267
|
? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this, logger: this._logger })
|
|
263
268
|
: await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
|
|
@@ -621,6 +626,7 @@ class Driver {
|
|
|
621
626
|
exports.Driver = Driver;
|
|
622
627
|
async function makeDriver(options) {
|
|
623
628
|
const driver = new Driver(options);
|
|
629
|
+
await utils.general.sleep(5000);
|
|
624
630
|
await driver.init();
|
|
625
631
|
await driver.refreshContexts();
|
|
626
632
|
return driver;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.30",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@applitools/logger": "1.1.
|
|
90
|
+
"@applitools/logger": "1.1.21",
|
|
91
91
|
"@applitools/snippets": "2.4.5",
|
|
92
|
-
"@applitools/types": "1.5.
|
|
92
|
+
"@applitools/types": "1.5.14",
|
|
93
93
|
"@applitools/utils": "1.3.12",
|
|
94
94
|
"semver": "7.3.7"
|
|
95
95
|
},
|