@applitools/driver 1.9.27 → 1.9.29

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.
@@ -1,41 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseCapabilities = void 0;
4
- function parseCapabilities(capabilities, customConfig) {
5
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
4
+ function parseCapabilities(capabilities) {
5
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
6
6
  if (capabilities.capabilities)
7
7
  capabilities = capabilities.capabilities;
8
- if (!(customConfig === null || customConfig === void 0 ? void 0 : customConfig.keepPlatformNameAsIs)) {
9
- // We use `startsWith` for just a theorerical reason. It's not based on any concrete case that we knew of at the time of writing this code.
10
- if ((_a = capabilities.platformName) === null || _a === void 0 ? void 0 : _a.startsWith('android')) {
11
- capabilities.platformName = capabilities.platformName.charAt(0).toUpperCase() + capabilities.platformName.slice(1);
12
- }
13
- // We use `startsWith` for just a theorerical reason. It's not based on any concrete case that we knew of at the time of writing this code.
14
- if ((_b = capabilities.platformName) === null || _b === void 0 ? void 0 : _b.startsWith('ios')) {
15
- capabilities.platformName = 'iOS' + capabilities.platformName.slice(3);
16
- }
17
- }
18
8
  const info = {
19
9
  browserName: !capabilities.app && !capabilities.bundleId
20
- ? ((_c = capabilities.browserName) !== null && _c !== void 0 ? _c : (_d = capabilities.desired) === null || _d === void 0 ? void 0 : _d.browserName) || undefined
10
+ ? ((_a = capabilities.browserName) !== null && _a !== void 0 ? _a : (_b = capabilities.desired) === null || _b === void 0 ? void 0 : _b.browserName) || undefined
21
11
  : undefined,
22
- browserVersion: ((_e = capabilities.browserVersion) !== null && _e !== void 0 ? _e : capabilities.version) || undefined,
23
- platformName: ((_g = (_f = capabilities.platformName) !== null && _f !== void 0 ? _f : capabilities.platform) !== null && _g !== void 0 ? _g : (_h = capabilities.desired) === null || _h === void 0 ? void 0 : _h.platformName) || undefined,
12
+ browserVersion: ((_c = capabilities.browserVersion) !== null && _c !== void 0 ? _c : capabilities.version) || undefined,
13
+ platformName: ((_e = (_d = capabilities.platformName) !== null && _d !== void 0 ? _d : capabilities.platform) !== null && _e !== void 0 ? _e : (_f = capabilities.desired) === null || _f === void 0 ? void 0 : _f.platformName) || undefined,
24
14
  platformVersion: capabilities.platformVersion || undefined,
25
15
  isW3C: isW3C(capabilities),
26
16
  isMobile: isMobile(capabilities),
27
17
  };
28
18
  if (info.isMobile) {
29
- info.deviceName = ((_k = (_j = capabilities.desired) === null || _j === void 0 ? void 0 : _j.deviceName) !== null && _k !== void 0 ? _k : capabilities.deviceName) || undefined;
19
+ info.deviceName = ((_h = (_g = capabilities.desired) === null || _g === void 0 ? void 0 : _g.deviceName) !== null && _h !== void 0 ? _h : capabilities.deviceName) || undefined;
30
20
  info.isNative = info.isMobile && !info.browserName;
31
21
  info.isIOS = isIOS(capabilities);
32
22
  info.isAndroid = isAndroid(capabilities);
33
- info.orientation = (_m = ((_l = capabilities.deviceOrientation) !== null && _l !== void 0 ? _l : capabilities.orientation)) === null || _m === void 0 ? void 0 : _m.toLowerCase();
23
+ info.orientation = (_k = ((_j = capabilities.deviceOrientation) !== null && _j !== void 0 ? _j : capabilities.orientation)) === null || _k === void 0 ? void 0 : _k.toLowerCase();
34
24
  }
35
25
  if (info.isNative) {
36
26
  info.displaySize = extractDisplaySize(capabilities);
37
27
  info.pixelRatio = capabilities.pixelRatio;
38
- info.statusBarSize = (_o = capabilities.statBarHeight) !== null && _o !== void 0 ? _o : (_p = capabilities.viewportRect) === null || _p === void 0 ? void 0 : _p.top;
28
+ info.statusBarSize = (_l = capabilities.statBarHeight) !== null && _l !== void 0 ? _l : (_m = capabilities.viewportRect) === null || _m === void 0 ? void 0 : _m.top;
39
29
  if (info.displaySize && info.orientation && capabilities.viewportRect) {
40
30
  info.navigationBarSize =
41
31
  info.orientation === 'landscape'
package/dist/driver.js CHANGED
@@ -148,7 +148,7 @@ class Driver {
148
148
  var _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
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
- const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities, this._customConfig) : undefined;
151
+ const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities) : undefined;
152
152
  const driverInfo = await ((_d = (_c = this._spec).getDriverInfo) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
153
153
  this._driverInfo = { ...capabilitiesInfo, ...driverInfo };
154
154
  if (this.isMobile) {
@@ -172,6 +172,9 @@ class Driver {
172
172
  this._driverInfo.platformVersion = (_p = userAgentInfo.platformVersion) !== null && _p !== void 0 ? _p : this._driverInfo.platformVersion;
173
173
  }
174
174
  }
175
+ if (!this._driverInfo.isMobile && (this.isAndroid || this.isIOS)) {
176
+ this._driverInfo.isMobile = true;
177
+ }
175
178
  (_q = (_9 = this._driverInfo).features) !== null && _q !== void 0 ? _q : (_9.features = {});
176
179
  (_r = (_10 = this._driverInfo.features).allCookies) !== null && _r !== void 0 ? _r : (_10.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
177
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.9.27",
3
+ "version": "1.9.29",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",
@@ -87,10 +87,10 @@
87
87
  }
88
88
  },
89
89
  "dependencies": {
90
- "@applitools/logger": "1.1.17",
90
+ "@applitools/logger": "1.1.20",
91
91
  "@applitools/snippets": "2.4.5",
92
- "@applitools/types": "1.5.10",
93
- "@applitools/utils": "1.3.11",
92
+ "@applitools/types": "1.5.13",
93
+ "@applitools/utils": "1.3.12",
94
94
  "semver": "7.3.7"
95
95
  },
96
96
  "devDependencies": {
@@ -1,4 +1,4 @@
1
1
  import type * as types from '@applitools/types';
2
2
  declare type Capabilities = Record<string, any>;
3
- export declare function parseCapabilities(capabilities: Capabilities, customConfig?: types.CustomCapabilitiesConfig): types.DriverInfo;
3
+ export declare function parseCapabilities(capabilities: Capabilities): types.DriverInfo;
4
4
  export {};