@applitools/driver 1.9.1 → 1.9.2

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.
Files changed (2) hide show
  1. package/dist/driver.js +19 -13
  2. package/package.json +1 -1
package/dist/driver.js CHANGED
@@ -175,13 +175,14 @@ class Driver {
175
175
  // this value always excludes the height of the navigation bar, and sometimes it also excludes the height of the status bar
176
176
  let windowSize = await this._spec.getWindowSize(this.target);
177
177
  (_r = (_4 = this._driverInfo).displaySize) !== null && _r !== void 0 ? _r : (_4.displaySize = windowSize);
178
+ const orientation = await this.getOrientation();
178
179
  if (this.isAndroid) {
179
180
  // bar sizes could be extracted only on android
180
181
  const barsSize = await ((_t = (_s = this._spec).getBarsSize) === null || _t === void 0 ? void 0 : _t.call(_s, this.target).catch(() => undefined));
181
182
  if (barsSize) {
182
183
  this._logger.log('Driver bars size', barsSize);
183
184
  // navigation bar height is replaced with the width in landscape orientation on android (due to the bug in appium)
184
- if ((await this.getOrientation()) === 'landscape')
185
+ if (orientation === 'landscape')
185
186
  barsSize.navigationBarHeight = barsSize.navigationBarWidth;
186
187
  // when status bar is overlapping content on android it returns status bar height equal to viewport height
187
188
  if (barsSize.statusBarHeight < this._driverInfo.displaySize.height) {
@@ -201,10 +202,18 @@ class Driver {
201
202
  // calculate viewport size
202
203
  if (!this._driverInfo.viewportSize) {
203
204
  if (this.navigationBarHeight > 1) {
204
- this._driverInfo.viewportSize = {
205
- width: this._driverInfo.displaySize.width,
206
- height: this._driverInfo.displaySize.height - this.statusBarHeight - this.navigationBarHeight,
207
- };
205
+ if (orientation === 'landscape') {
206
+ this._driverInfo.viewportSize = {
207
+ width: this._driverInfo.displaySize.height - this.navigationBarHeight,
208
+ height: this._driverInfo.displaySize.width - this.statusBarHeight,
209
+ };
210
+ }
211
+ else {
212
+ this._driverInfo.viewportSize = {
213
+ width: this._driverInfo.displaySize.width,
214
+ height: this._driverInfo.displaySize.height - this.statusBarHeight - this.navigationBarHeight,
215
+ };
216
+ }
208
217
  }
209
218
  else {
210
219
  this._driverInfo.viewportSize = {
@@ -454,12 +463,6 @@ class Driver {
454
463
  else {
455
464
  this._logger.log('Extracting viewport size from native driver');
456
465
  size = await this.getDisplaySize();
457
- if (size.height > size.width) {
458
- const orientation = await this.getOrientation();
459
- if (orientation === 'landscape') {
460
- size = { width: size.height, height: size.width };
461
- }
462
- }
463
466
  size.height -= this.statusBarHeight;
464
467
  }
465
468
  this._logger.log(`Rounding viewport size using`, this._customConfig.useCeilForViewportSize ? 'ceil' : 'round');
@@ -520,11 +523,14 @@ class Driver {
520
523
  var _a;
521
524
  if (this.isWeb && !this.isMobile)
522
525
  return;
523
- if ((_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.viewportSize) {
526
+ if ((_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.displaySize) {
524
527
  this._logger.log('Extracting display size from native driver using cached value');
525
528
  return this._driverInfo.displaySize;
526
529
  }
527
- const size = await this._spec.getWindowSize(this.target);
530
+ let size = await this._spec.getWindowSize(this.target);
531
+ if ((await this.getOrientation()) === 'landscape' && size.height > size.width) {
532
+ size = { width: size.height, height: size.width };
533
+ }
528
534
  const normalizedSize = this.isAndroid ? utils.geometry.scale(size, 1 / this.pixelRatio) : size;
529
535
  this._logger.log('Extracted and normalized display size:', normalizedSize);
530
536
  return normalizedSize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",