@applitools/driver 1.15.3 → 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 +7 -0
- package/dist/driver.js +46 -30
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
|
|
3
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)
|
|
4
11
|
|
|
5
12
|
|
package/dist/driver.js
CHANGED
|
@@ -85,12 +85,17 @@ class Driver {
|
|
|
85
85
|
}
|
|
86
86
|
async refresh({ reset } = {}) {
|
|
87
87
|
if (reset) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
+
}
|
|
94
99
|
}
|
|
95
100
|
const spec = this._spec;
|
|
96
101
|
let currentContext = this.currentContext.target;
|
|
@@ -418,12 +423,18 @@ class Driver {
|
|
|
418
423
|
async getHelper() {
|
|
419
424
|
var _a, _b, _c;
|
|
420
425
|
if (this._helper === undefined) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
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
|
+
}
|
|
427
438
|
}
|
|
428
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}`);
|
|
429
440
|
return this._helper;
|
|
@@ -744,24 +755,29 @@ class Driver {
|
|
|
744
755
|
if (environment.isWeb)
|
|
745
756
|
return (_a = this._viewport) === null || _a === void 0 ? void 0 : _a.orientation;
|
|
746
757
|
if (environment.isAndroid) {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
.
|
|
752
|
-
.
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
orientation =
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
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
|
+
}
|
|
765
781
|
}
|
|
766
782
|
}
|
|
767
783
|
this._logger.log('Extracting device orientation');
|