@applitools/driver 1.4.13 → 1.4.14

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,13 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
+ ## 1.4.14 - 2022/2/15
7
+
8
+ - add `viewportScale` getter to `Driver` class
9
+ - updated to @applitools/snippets@2.1.13 (from 2.1.12)
10
+ - updated to @applitools/types@1.0.25 (from 1.0.24)
11
+ - updated to @applitools/utils@1.2.13 (from 1.2.12)
12
+
6
13
  ## 1.4.13 - 2022/2/10
7
14
 
8
15
  - fix android helper
package/dist/driver.js CHANGED
@@ -99,6 +99,10 @@ class Driver {
99
99
  var _a;
100
100
  return (_a = this._driverInfo.pixelRatio) !== null && _a !== void 0 ? _a : 1;
101
101
  }
102
+ get viewportScale() {
103
+ var _a;
104
+ return (_a = this._driverInfo.viewportScale) !== null && _a !== void 0 ? _a : 1;
105
+ }
102
106
  get statusBarHeight() {
103
107
  var _a;
104
108
  return (_a = this._driverInfo.statusBarHeight) !== null && _a !== void 0 ? _a : (this.isNative ? 0 : undefined);
@@ -134,42 +138,43 @@ class Driver {
134
138
  this._currentContext = context;
135
139
  }
136
140
  async init() {
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;
141
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
142
+ var _w, _x, _y, _z, _0, _1, _2, _3;
139
143
  const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
140
144
  this._logger.log('Driver capabilities', capabilities);
141
145
  const capabilitiesInfo = capabilities ? capabilities_1.parseCapabilities(capabilities) : undefined;
142
146
  const driverInfo = await ((_d = (_c = this._spec).getDriverInfo) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
143
147
  this._driverInfo = Object.assign(Object.assign({}, capabilitiesInfo), driverInfo);
144
148
  if (this.isWeb) {
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));
149
+ (_e = (_w = this._driverInfo).pixelRatio) !== null && _e !== void 0 ? _e : (_w.pixelRatio = await this.execute(snippets.getPixelRatio));
150
+ (_f = (_x = this._driverInfo).viewportScale) !== null && _f !== void 0 ? _f : (_x.viewportScale = await this.execute(snippets.getViewportScale));
151
+ (_g = (_y = this._driverInfo).userAgent) !== null && _g !== void 0 ? _g : (_y.userAgent = await this.execute(snippets.getUserAgent));
147
152
  if (this._driverInfo.userAgent) {
148
153
  const userAgentInfo = user_agent_1.parseUserAgent(this._driverInfo.userAgent);
149
- this._driverInfo.browserName = (_g = userAgentInfo.browserName) !== null && _g !== void 0 ? _g : this._driverInfo.browserName;
150
- this._driverInfo.browserVersion = (_h = userAgentInfo.browserVersion) !== null && _h !== void 0 ? _h : this._driverInfo.browserVersion;
154
+ this._driverInfo.browserName = (_h = userAgentInfo.browserName) !== null && _h !== void 0 ? _h : this._driverInfo.browserName;
155
+ this._driverInfo.browserVersion = (_j = userAgentInfo.browserVersion) !== null && _j !== void 0 ? _j : this._driverInfo.browserVersion;
151
156
  if (this._driverInfo.isMobile) {
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);
157
+ (_k = (_z = this._driverInfo).platformName) !== null && _k !== void 0 ? _k : (_z.platformName = userAgentInfo.platformName);
158
+ (_l = (_0 = this._driverInfo).platformVersion) !== null && _l !== void 0 ? _l : (_0.platformVersion = userAgentInfo.platformVersion);
154
159
  }
155
160
  else {
156
- this._driverInfo.platformName = (_l = userAgentInfo.platformName) !== null && _l !== void 0 ? _l : this._driverInfo.platformName;
157
- this._driverInfo.platformVersion = (_m = userAgentInfo.platformVersion) !== null && _m !== void 0 ? _m : this._driverInfo.platformVersion;
161
+ this._driverInfo.platformName = (_m = userAgentInfo.platformName) !== null && _m !== void 0 ? _m : this._driverInfo.platformName;
162
+ this._driverInfo.platformVersion = (_o = userAgentInfo.platformVersion) !== null && _o !== void 0 ? _o : this._driverInfo.platformVersion;
158
163
  }
159
164
  }
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);
165
+ (_p = (_1 = this._driverInfo).features) !== null && _p !== void 0 ? _p : (_1.features = {});
166
+ (_q = (_2 = this._driverInfo.features).allCookies) !== null && _q !== void 0 ? _q : (_2.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
162
167
  }
163
168
  else {
164
- const barsHeight = await ((_r = (_q = this._spec).getBarsHeight) === null || _r === void 0 ? void 0 : _r.call(_q, this.target).catch(() => undefined));
169
+ const barsHeight = await ((_s = (_r = this._spec).getBarsHeight) === null || _s === void 0 ? void 0 : _s.call(_r, this.target).catch(() => undefined));
165
170
  const displaySize = await this.getDisplaySize();
166
171
  // calculate status and navigation bars sizes
167
172
  if (barsHeight) {
168
173
  // when status bar is overlapping content on android it returns status bar height equal to viewport height
169
174
  if (this.isAndroid && barsHeight.statusBarHeight / this.pixelRatio < displaySize.height) {
170
- this._driverInfo.statusBarHeight = Math.max((_s = this._driverInfo.statusBarHeight) !== null && _s !== void 0 ? _s : 0, barsHeight.statusBarHeight);
175
+ this._driverInfo.statusBarHeight = Math.max((_t = this._driverInfo.statusBarHeight) !== null && _t !== void 0 ? _t : 0, barsHeight.statusBarHeight);
171
176
  }
172
- this._driverInfo.navigationBarHeight = Math.max((_t = this._driverInfo.navigationBarHeight) !== null && _t !== void 0 ? _t : 0, barsHeight.navigationBarHeight);
177
+ this._driverInfo.navigationBarHeight = Math.max((_u = this._driverInfo.navigationBarHeight) !== null && _u !== void 0 ? _u : 0, barsHeight.navigationBarHeight);
173
178
  }
174
179
  if (this.isAndroid) {
175
180
  this._driverInfo.statusBarHeight /= this.pixelRatio;
@@ -205,7 +210,7 @@ class Driver {
205
210
  : await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
206
211
  }
207
212
  if (this.isMobile) {
208
- (_u = (_1 = this._driverInfo).orientation) !== null && _u !== void 0 ? _u : (_1.orientation = await this.getOrientation().catch(() => undefined));
213
+ (_v = (_3 = this._driverInfo).orientation) !== null && _v !== void 0 ? _v : (_3.orientation = await this.getOrientation().catch(() => undefined));
209
214
  }
210
215
  this._logger.log('Combined driver info', this._driverInfo);
211
216
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.4.13",
3
+ "version": "1.4.14",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",
@@ -73,9 +73,9 @@
73
73
  }
74
74
  },
75
75
  "dependencies": {
76
- "@applitools/snippets": "2.1.12",
77
- "@applitools/types": "1.0.24",
78
- "@applitools/utils": "1.2.12"
76
+ "@applitools/snippets": "2.1.13",
77
+ "@applitools/types": "1.0.25",
78
+ "@applitools/utils": "1.2.13"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@applitools/sdk-release-kit": "0.13.11",
package/types/driver.d.ts CHANGED
@@ -34,6 +34,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
34
34
  get userAgent(): string;
35
35
  get orientation(): 'portrait' | 'landscape';
36
36
  get pixelRatio(): number;
37
+ get viewportScale(): number;
37
38
  get statusBarHeight(): number;
38
39
  get navigationBarHeight(): number;
39
40
  get isNative(): boolean;