@applitools/driver 1.11.39 → 1.11.41
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/capabilities.js +28 -16
- package/dist/driver.js +1 -1
- package/package.json +1 -1
package/dist/capabilities.js
CHANGED
|
@@ -2,23 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractCapabilitiesViewport = exports.extractCapabilitiesEnvironment = void 0;
|
|
4
4
|
function extractCapabilitiesEnvironment(capabilities) {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
6
6
|
if (capabilities.capabilities)
|
|
7
7
|
capabilities = capabilities.capabilities;
|
|
8
8
|
const environment = {
|
|
9
|
-
browserName: !capabilities.app && !capabilities.bundleId
|
|
10
|
-
? ((
|
|
9
|
+
browserName: !((_b = (_a = capabilities.app) !== null && _a !== void 0 ? _a : capabilities['appium:app']) !== null && _b !== void 0 ? _b : (_c = capabilities['appium:desired']) === null || _c === void 0 ? void 0 : _c.app) && !capabilities.bundleId
|
|
10
|
+
? ((_d = capabilities.browserName) !== null && _d !== void 0 ? _d : (_e = capabilities.desired) === null || _e === void 0 ? void 0 : _e.browserName) || undefined
|
|
11
11
|
: undefined,
|
|
12
|
-
browserVersion: ((
|
|
13
|
-
platformName: ((
|
|
14
|
-
|
|
12
|
+
browserVersion: ((_f = capabilities.browserVersion) !== null && _f !== void 0 ? _f : capabilities.version) || undefined,
|
|
13
|
+
platformName: ((_k = (_g = capabilities.platformName) !== null && _g !== void 0 ? _g : (_j = ((_h = capabilities.desired) !== null && _h !== void 0 ? _h : capabilities['appium:desired'])) === null || _j === void 0 ? void 0 : _j.platformName) !== null && _k !== void 0 ? _k : capabilities.platform) ||
|
|
14
|
+
undefined,
|
|
15
|
+
platformVersion: ((_m = (_l = capabilities.platformVersion) !== null && _l !== void 0 ? _l : capabilities['appium:platformVersion']) !== null && _m !== void 0 ? _m : (_o = capabilities['appium:desired']) === null || _o === void 0 ? void 0 : _o.platformVersion) ||
|
|
16
|
+
undefined,
|
|
15
17
|
isW3C: isW3C(capabilities),
|
|
16
18
|
isMobile: isMobile(capabilities),
|
|
17
19
|
isChrome: isChrome(capabilities),
|
|
18
20
|
isECClient: Boolean(capabilities['applitools:isECClient']),
|
|
19
21
|
};
|
|
20
22
|
if (environment === null || environment === void 0 ? void 0 : environment.isMobile) {
|
|
21
|
-
environment.deviceName =
|
|
23
|
+
environment.deviceName =
|
|
24
|
+
((_s = (_r = (_q = ((_p = capabilities['appium:desired']) !== null && _p !== void 0 ? _p : capabilities.desired)) === null || _q === void 0 ? void 0 : _q.deviceName) !== null && _r !== void 0 ? _r : capabilities['appium:deviceName']) !== null && _s !== void 0 ? _s : capabilities.deviceName) ||
|
|
25
|
+
undefined;
|
|
22
26
|
environment.isIOS = isIOS(capabilities);
|
|
23
27
|
environment.isAndroid = isAndroid(capabilities);
|
|
24
28
|
if (!environment.browserName) {
|
|
@@ -36,20 +40,26 @@ function extractCapabilitiesEnvironment(capabilities) {
|
|
|
36
40
|
}
|
|
37
41
|
exports.extractCapabilitiesEnvironment = extractCapabilitiesEnvironment;
|
|
38
42
|
function extractCapabilitiesViewport(capabilities) {
|
|
39
|
-
var _a, _b, _c, _d;
|
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
40
44
|
if (capabilities.capabilities)
|
|
41
45
|
capabilities = capabilities.capabilities;
|
|
42
46
|
const viewport = {
|
|
43
47
|
displaySize: extractDisplaySize(capabilities),
|
|
44
|
-
orientation: (_b = (
|
|
45
|
-
pixelRatio: capabilities.pixelRatio,
|
|
46
|
-
statusBarSize: (
|
|
48
|
+
orientation: (_c = ((_b = (_a = capabilities['appium:orientation']) !== null && _a !== void 0 ? _a : capabilities.deviceOrientation) !== null && _b !== void 0 ? _b : capabilities.orientation)) === null || _c === void 0 ? void 0 : _c.toLowerCase(),
|
|
49
|
+
pixelRatio: (_d = capabilities['appium:pixelRatio']) !== null && _d !== void 0 ? _d : capabilities.pixelRatio,
|
|
50
|
+
statusBarSize: (_f = (_e = capabilities['appium:statBarHeight']) !== null && _e !== void 0 ? _e : capabilities.statBarHeight) !== null && _f !== void 0 ? _f : (_h = ((_g = capabilities['appium:viewportRect']) !== null && _g !== void 0 ? _g : capabilities.viewportRect)) === null || _h === void 0 ? void 0 : _h.top,
|
|
47
51
|
};
|
|
48
|
-
if (viewport.displaySize &&
|
|
52
|
+
if (viewport.displaySize &&
|
|
53
|
+
viewport.orientation &&
|
|
54
|
+
((_j = capabilities['appium:viewportRect']) !== null && _j !== void 0 ? _j : capabilities.viewportRect)) {
|
|
49
55
|
viewport.navigationBarSize =
|
|
50
56
|
viewport.orientation === 'landscape'
|
|
51
|
-
? viewport.displaySize.width -
|
|
52
|
-
|
|
57
|
+
? viewport.displaySize.width -
|
|
58
|
+
(((_k = capabilities['appium:viewportRect']) !== null && _k !== void 0 ? _k : capabilities.viewportRect).left +
|
|
59
|
+
((_l = capabilities['appium:viewportRect']) !== null && _l !== void 0 ? _l : capabilities.viewportRect).width)
|
|
60
|
+
: viewport.displaySize.height -
|
|
61
|
+
(((_m = capabilities['appium:viewportRect']) !== null && _m !== void 0 ? _m : capabilities.viewportRect).top +
|
|
62
|
+
((_o = capabilities['appium:viewportRect']) !== null && _o !== void 0 ? _o : capabilities.viewportRect).height);
|
|
53
63
|
}
|
|
54
64
|
return viewport;
|
|
55
65
|
}
|
|
@@ -82,9 +92,11 @@ function isAndroid(capabilities) {
|
|
|
82
92
|
return /Android/i.test(capabilities.platformName) || /Android/i.test(capabilities.browserName);
|
|
83
93
|
}
|
|
84
94
|
function extractDisplaySize(capabilities) {
|
|
85
|
-
|
|
95
|
+
var _a;
|
|
96
|
+
const deviceScreenSize = (_a = capabilities['appium:deviceScreenSize']) !== null && _a !== void 0 ? _a : capabilities.deviceScreenSize;
|
|
97
|
+
if (!deviceScreenSize)
|
|
86
98
|
return undefined;
|
|
87
|
-
const [width, height] =
|
|
99
|
+
const [width, height] = deviceScreenSize.split('x');
|
|
88
100
|
if (Number.isNaN(Number(width)) || Number.isNaN(Number(height)))
|
|
89
101
|
return undefined;
|
|
90
102
|
return { width: Number(width), height: Number(height) };
|
package/dist/driver.js
CHANGED
|
@@ -404,7 +404,7 @@ class Driver {
|
|
|
404
404
|
if (!environment.isNative)
|
|
405
405
|
return null;
|
|
406
406
|
this._logger.log('Broker url extraction is started');
|
|
407
|
-
(_a = (_b = this._state).nmlElement) !== null && _a !== void 0 ? _a : (_b.nmlElement = await this.waitFor({ type: 'accessibility id', selector: 'Applitools_View' }, { timeout: 10000 }));
|
|
407
|
+
(_a = (_b = this._state).nmlElement) !== null && _a !== void 0 ? _a : (_b.nmlElement = await this.waitFor({ type: 'accessibility id', selector: 'Applitools_View' }, { timeout: 10000 }).catch(() => null));
|
|
408
408
|
if (!this._state.nmlElement) {
|
|
409
409
|
this._logger.log('Broker url extraction is failed due to absence of nml element');
|
|
410
410
|
return null;
|