@applitools/driver 1.11.38 → 1.11.40

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 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;
@@ -649,7 +649,7 @@ class Driver {
649
649
  }
650
650
  async setViewportSize(size) {
651
651
  const environment = await this.getEnvironment();
652
- if (environment.isMobile)
652
+ if (environment.isMobile && !environment.isEmulation)
653
653
  return;
654
654
  if (this._spec.setViewportSize) {
655
655
  this._logger.log('Setting viewport size to', size, 'using spec method');
@@ -702,10 +702,12 @@ class Driver {
702
702
  return normalizedSize;
703
703
  }
704
704
  async getOrientation() {
705
- var _a, _b;
705
+ var _a, _b, _c;
706
706
  const environment = await this.getEnvironment();
707
707
  if (!environment.isMobile)
708
708
  return undefined;
709
+ if (environment.isEmulation)
710
+ return (_a = this._viewport) === null || _a === void 0 ? void 0 : _a.orientation;
709
711
  if (environment.isAndroid) {
710
712
  this._logger.log('Extracting device orientation using adb command on android');
711
713
  const rotation = await this.execute('mobile:shell', {
@@ -728,7 +730,7 @@ class Driver {
728
730
  }
729
731
  }
730
732
  this._logger.log('Extracting device orientation');
731
- const orientation = await ((_b = (_a = this._spec).getOrientation) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
733
+ const orientation = await ((_c = (_b = this._spec).getOrientation) === null || _c === void 0 ? void 0 : _c.call(_b, this.target));
732
734
  this._logger.log('Extracted device orientation:', orientation);
733
735
  return orientation;
734
736
  }
@@ -60,7 +60,7 @@ const WINDOWS_VERSIONS = {
60
60
  '15.0.0': '11',
61
61
  };
62
62
  function extractUserAgentEnvironment(userAgent) {
63
- var _a, _b;
63
+ var _a, _b, _c, _d;
64
64
  let userAgentLegacy, userAgentObject;
65
65
  if (utils.types.isString(userAgent)) {
66
66
  userAgentLegacy = userAgent.trim();
@@ -74,9 +74,11 @@ function extractUserAgentEnvironment(userAgent) {
74
74
  ...extractUserAgentLegacyBrowser(userAgentLegacy),
75
75
  };
76
76
  const userAgentEnvironment = userAgentObject && extractUserAgentObjectEnvironment(userAgentObject);
77
- const environment = { ...userAgentLegacyEnvironment, ...userAgentEnvironment };
78
- environment.browserName = (_a = userAgentLegacyEnvironment.browserName) !== null && _a !== void 0 ? _a : userAgentEnvironment === null || userAgentEnvironment === void 0 ? void 0 : userAgentEnvironment.browserName;
79
- environment.browserVersion = (_b = userAgentLegacyEnvironment.browserVersion) !== null && _b !== void 0 ? _b : userAgentEnvironment === null || userAgentEnvironment === void 0 ? void 0 : userAgentEnvironment.browserVersion;
77
+ const environment = { ...userAgentEnvironment };
78
+ (_a = environment.platformName) !== null && _a !== void 0 ? _a : (environment.platformName = userAgentLegacyEnvironment.platformName);
79
+ (_b = environment.platformVersion) !== null && _b !== void 0 ? _b : (environment.platformVersion = userAgentLegacyEnvironment.platformVersion);
80
+ environment.browserName = (_c = userAgentLegacyEnvironment.browserName) !== null && _c !== void 0 ? _c : environment.browserName;
81
+ environment.browserVersion = (_d = userAgentLegacyEnvironment.browserVersion) !== null && _d !== void 0 ? _d : environment.browserVersion;
80
82
  return environment;
81
83
  }
82
84
  exports.extractUserAgentEnvironment = extractUserAgentEnvironment;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.11.38",
3
+ "version": "1.11.40",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",
@@ -82,7 +82,7 @@
82
82
  },
83
83
  "dependencies": {
84
84
  "@applitools/logger": "1.1.48",
85
- "@applitools/snippets": "2.4.18",
85
+ "@applitools/snippets": "2.4.19",
86
86
  "@applitools/utils": "1.3.32",
87
87
  "semver": "7.3.7"
88
88
  },