@applitools/driver 1.15.2 → 1.16.0

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
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.16.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.15.3...js/driver@1.16.0) (2023-12-18)
4
+
5
+
6
+ ### Features
7
+
8
+ * add set of env variables to skip/ignore some optional automations ([#2097](https://github.com/applitools/eyes.sdk.javascript1/issues/2097)) ([bd3b08c](https://github.com/applitools/eyes.sdk.javascript1/commit/bd3b08c3d2997eb98d545b308a1f15501192178e))
9
+
10
+ ## [1.15.3](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.15.2...js/driver@1.15.3) (2023-12-12)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * layout breakpoints reload and lazy load ([#2073](https://github.com/applitools/eyes.sdk.javascript1/issues/2073)) ([ab2c49e](https://github.com/applitools/eyes.sdk.javascript1/commit/ab2c49ea1ecff3fef337637a83aa5bef755a7b01))
16
+
3
17
  ## [1.15.2](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.15.1...js/driver@1.15.2) (2023-12-05)
4
18
 
5
19
 
package/dist/context.js CHANGED
@@ -394,24 +394,26 @@ class Context {
394
394
  async getScrollingElement() {
395
395
  if (!(0, element_1.isElementInstance)(this._scrollingElement)) {
396
396
  await this.focus();
397
- const environment = await this.driver.getEnvironment();
398
397
  if (this._scrollingElement) {
399
398
  this._scrollingElement = await this.element(this._scrollingElement);
400
399
  }
401
- else if (environment.isWeb) {
402
- let selector;
403
- if (environment.isIOS && !environment.isEmulation) {
404
- selector = 'html';
405
- this.logger.log(`Using hardcoded default scrolling element for Safari on iOS - "${selector}"`);
400
+ else {
401
+ const environment = await this.driver.getEnvironment();
402
+ if (environment.isWeb) {
403
+ let selector;
404
+ if (environment.isIOS && !environment.isEmulation) {
405
+ selector = 'html';
406
+ this.logger.log(`Using hardcoded default scrolling element for Safari on iOS - "${selector}"`);
407
+ }
408
+ else {
409
+ selector = await this.execute(snippets.getDocumentScrollingElement);
410
+ this.logger.log(`Using dynamic default scrolling element - "${selector}"`);
411
+ }
412
+ this._scrollingElement = await this.element({ type: 'css', selector });
406
413
  }
407
414
  else {
408
- selector = await this.execute(snippets.getDocumentScrollingElement);
409
- this.logger.log(`Using dynamic default scrolling element - "${selector}"`);
415
+ this._scrollingElement = await this.element({ type: 'xpath', selector: '//*[@scrollable="true"]' });
410
416
  }
411
- this._scrollingElement = await this.element({ type: 'css', selector });
412
- }
413
- else {
414
- this._scrollingElement = await this.element({ type: 'xpath', selector: '//*[@scrollable="true"]' });
415
417
  }
416
418
  }
417
419
  return this._scrollingElement;
package/dist/driver.js CHANGED
@@ -78,16 +78,24 @@ class Driver {
78
78
  }
79
79
  async reloadPage() {
80
80
  await this.mainContext.execute(snippets.reloadPage).catch(() => null);
81
- return this.refresh({ reset: false });
81
+ const refreshThis = await this.refresh({ reset: false });
82
+ const scrollingElement = await this.mainContext.getScrollingElement();
83
+ await (scrollingElement === null || scrollingElement === void 0 ? void 0 : scrollingElement.refresh());
84
+ return refreshThis;
82
85
  }
83
86
  async refresh({ reset } = {}) {
84
87
  if (reset) {
85
- this._driverInfo = undefined;
86
- this._environment = undefined;
87
- this._viewport = undefined;
88
- this._features = undefined;
89
- this._helper = undefined;
90
- this._state = {};
88
+ if (utils.general.getEnvValue('AVOID_DRIVER_STATE_REST', 'boolean')) {
89
+ this._logger.log(`Skipping reset of the driver state`);
90
+ }
91
+ else {
92
+ this._driverInfo = undefined;
93
+ this._environment = undefined;
94
+ this._viewport = undefined;
95
+ this._features = undefined;
96
+ this._helper = undefined;
97
+ this._state = {};
98
+ }
91
99
  }
92
100
  const spec = this._spec;
93
101
  let currentContext = this.currentContext.target;
@@ -415,12 +423,18 @@ class Driver {
415
423
  async getHelper() {
416
424
  var _a, _b, _c;
417
425
  if (this._helper === undefined) {
418
- const environment = await this.getEnvironment();
419
- this._logger.log(`Extracting helper for ${environment.isIOS ? 'ios' : 'android'}`);
420
- this._helper = environment.isIOS
421
- ? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this })
422
- : await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this });
423
- this._logger.log(`Extracted helper of type ${(_a = this._helper) === null || _a === void 0 ? void 0 : _a.name}`);
426
+ if (utils.general.getEnvValue('IGNORE_HELPER_LIB', 'boolean')) {
427
+ this._logger.log(`Skipping helper lib extraction`);
428
+ this._helper = null;
429
+ }
430
+ else {
431
+ const environment = await this.getEnvironment();
432
+ this._logger.log(`Extracting helper for ${environment.isIOS ? 'ios' : 'android'}`);
433
+ this._helper = environment.isIOS
434
+ ? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this })
435
+ : await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this });
436
+ this._logger.log(`Extracted helper of type ${(_a = this._helper) === null || _a === void 0 ? void 0 : _a.name}`);
437
+ }
424
438
  }
425
439
  this._logger.log(`Returning helper for of type ${(_c = (_b = this._helper) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : null}`);
426
440
  return this._helper;
@@ -741,24 +755,29 @@ class Driver {
741
755
  if (environment.isWeb)
742
756
  return (_a = this._viewport) === null || _a === void 0 ? void 0 : _a.orientation;
743
757
  if (environment.isAndroid) {
744
- this._logger.log('Extracting device orientation using adb command on android');
745
- const rotation = await this.execute('mobile:shell', {
746
- command: "dumpsys window | grep 'mCurrentRotation' | cut -d = -f2",
747
- })
748
- .then(rotation => { var _a; return (_a = rotation === null || rotation === void 0 ? void 0 : rotation.trim) === null || _a === void 0 ? void 0 : _a.call(rotation); })
749
- .catch(() => null);
750
- if (rotation) {
751
- let orientation = undefined;
752
- if (rotation === 'ROTATION_0' || rotation === '0')
753
- orientation = 'portrait';
754
- else if (rotation === 'ROTATION_90' || rotation === '3')
755
- orientation = 'landscape-secondary';
756
- else if (rotation === 'ROTATION_180' || rotation === '2')
757
- orientation = 'portrait-secondary';
758
- else if (rotation === 'ROTATION_270' || rotation === '1')
759
- orientation = 'landscape';
760
- this._logger.log('Extracted device orientation:', orientation);
761
- return orientation;
758
+ if (utils.general.getEnvValue('AVOID_ADB_USAGE', 'boolean')) {
759
+ this._logger.log(`Skipping device orientation extraction using adb command on android`);
760
+ }
761
+ else {
762
+ this._logger.log('Extracting device orientation using adb command on android');
763
+ const rotation = await this.execute('mobile:shell', {
764
+ command: "dumpsys window | grep 'mCurrentRotation' | cut -d = -f2",
765
+ })
766
+ .then(rotation => { var _a; return (_a = rotation === null || rotation === void 0 ? void 0 : rotation.trim) === null || _a === void 0 ? void 0 : _a.call(rotation); })
767
+ .catch(() => null);
768
+ if (rotation) {
769
+ let orientation = undefined;
770
+ if (rotation === 'ROTATION_0' || rotation === '0')
771
+ orientation = 'portrait';
772
+ else if (rotation === 'ROTATION_90' || rotation === '3')
773
+ orientation = 'landscape-secondary';
774
+ else if (rotation === 'ROTATION_180' || rotation === '2')
775
+ orientation = 'portrait-secondary';
776
+ else if (rotation === 'ROTATION_270' || rotation === '1')
777
+ orientation = 'landscape';
778
+ this._logger.log('Extracted device orientation:', orientation);
779
+ return orientation;
780
+ }
762
781
  }
763
782
  }
764
783
  this._logger.log('Extracting device orientation');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.15.2",
3
+ "version": "1.16.0",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",