@applitools/driver 1.4.7 → 1.4.8

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/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
+ ## 1.4.8 - 2022/1/5
7
+
8
+ - handle legacy appium capabilities
9
+ - updated to @applitools/utils@1.2.11 (from 1.2.5)
10
+
6
11
  ## 1.4.7 - 2021/12/22
7
12
 
8
13
  - updated to @applitools/snippets@2.1.12 (from 2.1.11)
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseCapabilities = void 0;
4
4
  function parseCapabilities(capabilities) {
5
- var _a, _b, _c, _d, _e, _f, _g, _h;
5
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
6
+ if (capabilities.capabilities)
7
+ capabilities = capabilities.capabilities;
6
8
  const info = {
7
9
  browserName: !capabilities.app && !capabilities.bundleId
8
10
  ? ((_a = capabilities.browserName) !== null && _a !== void 0 ? _a : (_b = capabilities.desired) === null || _b === void 0 ? void 0 : _b.browserName) || undefined
@@ -18,11 +20,11 @@ function parseCapabilities(capabilities) {
18
20
  info.isNative = info.isMobile && !info.browserName;
19
21
  info.isIOS = isIOS(capabilities);
20
22
  info.isAndroid = isAndroid(capabilities);
23
+ info.orientation = (_k = ((_j = capabilities.deviceOrientation) !== null && _j !== void 0 ? _j : capabilities.orientation)) === null || _k === void 0 ? void 0 : _k.toLowerCase();
21
24
  }
22
25
  if (info.isNative) {
23
26
  info.pixelRatio = capabilities.pixelRatio;
24
27
  info.statusBarHeight = capabilities.statBarHeight;
25
- info.navigationBarHeight = 0;
26
28
  }
27
29
  return info;
28
30
  }
package/dist/driver.js CHANGED
@@ -134,31 +134,31 @@ class Driver {
134
134
  this._currentContext = context;
135
135
  }
136
136
  async init() {
137
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
138
- var _t, _u, _v, _w, _x, _y, _z;
137
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
138
+ var _v, _w, _x, _y, _z, _0, _1;
139
139
  const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
140
140
  this._logger.log('Driver capabilities', capabilities);
141
141
  const capabilitiesInfo = capabilities ? capabilities_1.parseCapabilities(capabilities) : undefined;
142
142
  const driverInfo = await ((_d = (_c = this._spec).getDriverInfo) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
143
143
  this._driverInfo = Object.assign(Object.assign({}, capabilitiesInfo), driverInfo);
144
144
  if (this.isWeb) {
145
- (_e = (_t = this._driverInfo).pixelRatio) !== null && _e !== void 0 ? _e : (_t.pixelRatio = await this.execute(snippets.getPixelRatio));
146
- (_f = (_u = this._driverInfo).userAgent) !== null && _f !== void 0 ? _f : (_u.userAgent = await this.execute(snippets.getUserAgent));
145
+ (_e = (_v = this._driverInfo).pixelRatio) !== null && _e !== void 0 ? _e : (_v.pixelRatio = await this.execute(snippets.getPixelRatio));
146
+ (_f = (_w = this._driverInfo).userAgent) !== null && _f !== void 0 ? _f : (_w.userAgent = await this.execute(snippets.getUserAgent));
147
147
  if (this._driverInfo.userAgent) {
148
148
  const userAgentInfo = user_agent_1.parseUserAgent(this._driverInfo.userAgent);
149
149
  this._driverInfo.browserName = (_g = userAgentInfo.browserName) !== null && _g !== void 0 ? _g : this._driverInfo.browserName;
150
150
  this._driverInfo.browserVersion = (_h = userAgentInfo.browserVersion) !== null && _h !== void 0 ? _h : this._driverInfo.browserVersion;
151
151
  if (this._driverInfo.isMobile) {
152
- (_j = (_v = this._driverInfo).platformName) !== null && _j !== void 0 ? _j : (_v.platformName = userAgentInfo.platformName);
153
- (_k = (_w = this._driverInfo).platformVersion) !== null && _k !== void 0 ? _k : (_w.platformVersion = userAgentInfo.platformVersion);
152
+ (_j = (_x = this._driverInfo).platformName) !== null && _j !== void 0 ? _j : (_x.platformName = userAgentInfo.platformName);
153
+ (_k = (_y = this._driverInfo).platformVersion) !== null && _k !== void 0 ? _k : (_y.platformVersion = userAgentInfo.platformVersion);
154
154
  }
155
155
  else {
156
156
  this._driverInfo.platformName = (_l = userAgentInfo.platformName) !== null && _l !== void 0 ? _l : this._driverInfo.platformName;
157
157
  this._driverInfo.platformVersion = (_m = userAgentInfo.platformVersion) !== null && _m !== void 0 ? _m : this._driverInfo.platformVersion;
158
158
  }
159
159
  }
160
- (_o = (_x = this._driverInfo).features) !== null && _o !== void 0 ? _o : (_x.features = {});
161
- (_p = (_y = this._driverInfo.features).allCookies) !== null && _p !== void 0 ? _p : (_y.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
160
+ (_o = (_z = this._driverInfo).features) !== null && _o !== void 0 ? _o : (_z.features = {});
161
+ (_p = (_0 = this._driverInfo.features).allCookies) !== null && _p !== void 0 ? _p : (_0.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
162
162
  }
163
163
  else {
164
164
  const barsHeight = await ((_r = (_q = this._spec).getBarsHeight) === null || _r === void 0 ? void 0 : _r.call(_q, this.target).catch(() => undefined));
@@ -167,9 +167,9 @@ class Driver {
167
167
  if (barsHeight) {
168
168
  // when status bar is overlapping content on android it returns status bar height equal to viewport height
169
169
  if (this.isAndroid && barsHeight.statusBarHeight / this.pixelRatio < displaySize.height) {
170
- this._driverInfo.statusBarHeight = Math.max(this._driverInfo.statusBarHeight, barsHeight.statusBarHeight);
170
+ this._driverInfo.statusBarHeight = Math.max((_s = this._driverInfo.statusBarHeight) !== null && _s !== void 0 ? _s : 0, barsHeight.statusBarHeight);
171
171
  }
172
- this._driverInfo.navigationBarHeight = Math.max(this._driverInfo.navigationBarHeight, barsHeight.navigationBarHeight);
172
+ this._driverInfo.navigationBarHeight = Math.max((_t = this._driverInfo.navigationBarHeight) !== null && _t !== void 0 ? _t : 0, barsHeight.navigationBarHeight);
173
173
  }
174
174
  if (this.isAndroid) {
175
175
  this._driverInfo.statusBarHeight /= this.pixelRatio;
@@ -205,7 +205,7 @@ class Driver {
205
205
  : await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
206
206
  }
207
207
  if (this.isMobile) {
208
- (_s = (_z = this._driverInfo).orientation) !== null && _s !== void 0 ? _s : (_z.orientation = await this.getOrientation().catch(() => undefined));
208
+ (_u = (_1 = this._driverInfo).orientation) !== null && _u !== void 0 ? _u : (_1.orientation = await this.getOrientation().catch(() => undefined));
209
209
  }
210
210
  this._logger.log('Combined driver info', this._driverInfo);
211
211
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",
@@ -75,10 +75,10 @@
75
75
  "dependencies": {
76
76
  "@applitools/snippets": "2.1.12",
77
77
  "@applitools/types": "1.0.23",
78
- "@applitools/utils": "1.2.5"
78
+ "@applitools/utils": "1.2.11"
79
79
  },
80
80
  "devDependencies": {
81
- "@applitools/sdk-release-kit": "0.13.4",
81
+ "@applitools/sdk-release-kit": "0.13.10",
82
82
  "@types/mocha": "^9.0.0",
83
83
  "@types/node": "^16.3.3",
84
84
  "@typescript-eslint/eslint-plugin": "^4.28.3",