@applitools/driver 1.13.1 → 1.13.3
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 +32 -0
- package/dist/driver.js +30 -14
- package/package.json +3 -3
- package/types/driver.d.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.13.3](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.13.2...js/driver@1.13.3) (2023-07-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* fix workspace dependencies ([2a3856f](https://github.com/applitools/eyes.sdk.javascript1/commit/2a3856f3ce3bcf1407f59c676653b6f218556760))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/logger bumped to 2.0.7
|
|
14
|
+
#### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* fix workspace dependencies ([2a3856f](https://github.com/applitools/eyes.sdk.javascript1/commit/2a3856f3ce3bcf1407f59c676653b6f218556760))
|
|
17
|
+
|
|
18
|
+
## [1.13.2](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.13.1...js/driver@1.13.2) (2023-07-21)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* improve performance by not resetting the environment ([#1779](https://github.com/applitools/eyes.sdk.javascript1/issues/1779)) ([8178978](https://github.com/applitools/eyes.sdk.javascript1/commit/8178978e9443e60f3e8b10693395e4c80cb9e02f))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Code Refactoring
|
|
27
|
+
|
|
28
|
+
* ufg client ([#1780](https://github.com/applitools/eyes.sdk.javascript1/issues/1780)) ([d60cf16](https://github.com/applitools/eyes.sdk.javascript1/commit/d60cf1616741a96b152a1548760bb98116e5c3f9))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Dependencies
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
3
35
|
## [1.13.1](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.13.0...js/driver@1.13.1) (2023-07-13)
|
|
4
36
|
|
|
5
37
|
|
package/dist/driver.js
CHANGED
|
@@ -38,6 +38,7 @@ class Driver {
|
|
|
38
38
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
39
39
|
this._state = {};
|
|
40
40
|
this._customConfig = {};
|
|
41
|
+
this._original = this;
|
|
41
42
|
this._logger = (0, logger_1.makeLogger)({ logger: options.logger, format: { label: 'driver' } });
|
|
42
43
|
this._customConfig = (_a = options.customConfig) !== null && _a !== void 0 ? _a : {};
|
|
43
44
|
this._guid = utils.general.guid();
|
|
@@ -76,15 +77,17 @@ class Driver {
|
|
|
76
77
|
}
|
|
77
78
|
async reloadPage() {
|
|
78
79
|
await this.mainContext.execute(snippets.reloadPage).catch(() => null);
|
|
79
|
-
return this.refresh();
|
|
80
|
-
}
|
|
81
|
-
async refresh() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
return this.refresh({ reset: false });
|
|
81
|
+
}
|
|
82
|
+
async refresh({ reset } = {}) {
|
|
83
|
+
if (reset) {
|
|
84
|
+
this._driverInfo = undefined;
|
|
85
|
+
this._environment = undefined;
|
|
86
|
+
this._viewport = undefined;
|
|
87
|
+
this._features = undefined;
|
|
88
|
+
this._helper = undefined;
|
|
89
|
+
this._state = {};
|
|
90
|
+
}
|
|
88
91
|
const spec = this._spec;
|
|
89
92
|
let currentContext = this.currentContext.target;
|
|
90
93
|
let contextInfo;
|
|
@@ -92,7 +95,7 @@ class Driver {
|
|
|
92
95
|
contextInfo = await getContextInfo(currentContext);
|
|
93
96
|
}
|
|
94
97
|
catch (err) {
|
|
95
|
-
return this;
|
|
98
|
+
return reset ? resetReference(this) : this;
|
|
96
99
|
}
|
|
97
100
|
const path = [];
|
|
98
101
|
if (spec.parentContext) {
|
|
@@ -111,7 +114,16 @@ class Driver {
|
|
|
111
114
|
}
|
|
112
115
|
this._currentContext = this._mainContext;
|
|
113
116
|
await this.switchToChildContext(...path);
|
|
114
|
-
return this;
|
|
117
|
+
return reset ? resetReference(this) : this;
|
|
118
|
+
function resetReference(driver) {
|
|
119
|
+
return new Proxy(driver._original, {
|
|
120
|
+
get(driver, key, receiver) {
|
|
121
|
+
if (key === '_original')
|
|
122
|
+
return driver;
|
|
123
|
+
return Reflect.get(driver, key, receiver);
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
115
127
|
function transformSelector(selector) {
|
|
116
128
|
return specUtils.transformSelector(spec, selector, { isWeb: true });
|
|
117
129
|
}
|
|
@@ -188,7 +200,11 @@ class Driver {
|
|
|
188
200
|
var _f;
|
|
189
201
|
if (((_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.userAgent) === undefined || force) {
|
|
190
202
|
(_b = this._driverInfo) !== null && _b !== void 0 ? _b : (this._driverInfo = {});
|
|
191
|
-
(_c = (_f = this._driverInfo).userAgent) !== null && _c !== void 0 ? _c : (_f.userAgent = (_d = (await this.currentContext.executePoll(snippets.getUserAgent
|
|
203
|
+
(_c = (_f = this._driverInfo).userAgent) !== null && _c !== void 0 ? _c : (_f.userAgent = (_d = (await this.currentContext.executePoll(snippets.getUserAgent, {
|
|
204
|
+
main: undefined,
|
|
205
|
+
poll: undefined,
|
|
206
|
+
pollTimeout: 100,
|
|
207
|
+
}))) !== null && _d !== void 0 ? _d : null);
|
|
192
208
|
this._logger.log('Extracted user agent', this._driverInfo.userAgent);
|
|
193
209
|
}
|
|
194
210
|
return (_e = this._driverInfo.userAgent) !== null && _e !== void 0 ? _e : undefined;
|
|
@@ -493,7 +509,7 @@ class Driver {
|
|
|
493
509
|
}
|
|
494
510
|
try {
|
|
495
511
|
await this._spec.switchWorld(this.target, name);
|
|
496
|
-
this.refresh();
|
|
512
|
+
this.refresh({ reset: true });
|
|
497
513
|
}
|
|
498
514
|
catch (error) {
|
|
499
515
|
this._logger.error('Unable to switch world due to the error', error);
|
|
@@ -813,6 +829,6 @@ async function makeDriver(options) {
|
|
|
813
829
|
const driver = options.driver instanceof Driver ? options.driver : new Driver(options);
|
|
814
830
|
if (options.logger)
|
|
815
831
|
driver.updateLogger(options.logger);
|
|
816
|
-
return driver.refresh();
|
|
832
|
+
return driver.refresh({ reset: options.reset });
|
|
817
833
|
}
|
|
818
834
|
exports.makeDriver = makeDriver;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.3",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"test": "run --top-level mocha './test/**/*.spec.ts'"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@applitools/logger": "2.0.
|
|
76
|
+
"@applitools/logger": "2.0.7",
|
|
77
77
|
"@applitools/snippets": "2.4.21",
|
|
78
78
|
"@applitools/utils": "1.5.0",
|
|
79
|
-
"semver": "7.
|
|
79
|
+
"semver": "7.5.4"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@types/node": "^12.20.55"
|
package/types/driver.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare class Driver<T extends SpecType> {
|
|
|
30
30
|
private _customConfig;
|
|
31
31
|
private _logger;
|
|
32
32
|
protected readonly _spec: SpecDriver<T>;
|
|
33
|
+
protected readonly _original: this;
|
|
33
34
|
constructor(options: DriverOptions<T>);
|
|
34
35
|
get logger(): Logger;
|
|
35
36
|
get target(): T['driver'];
|
|
@@ -39,7 +40,9 @@ export declare class Driver<T extends SpecType> {
|
|
|
39
40
|
updateLogger(logger: Logger): void;
|
|
40
41
|
updateCurrentContext(context: Context<T>): void;
|
|
41
42
|
reloadPage(): Promise<this>;
|
|
42
|
-
refresh(
|
|
43
|
+
refresh({ reset }?: {
|
|
44
|
+
reset?: boolean;
|
|
45
|
+
}): Promise<this>;
|
|
43
46
|
getDriverInfo({ force }?: {
|
|
44
47
|
force?: boolean;
|
|
45
48
|
}): Promise<DriverInfo>;
|
|
@@ -91,6 +94,7 @@ export declare function makeDriver<T extends SpecType>(options: {
|
|
|
91
94
|
customConfig?: {
|
|
92
95
|
useCeilForViewportSize?: boolean;
|
|
93
96
|
};
|
|
97
|
+
reset?: boolean;
|
|
94
98
|
logger?: Logger;
|
|
95
99
|
}): Promise<Driver<T>>;
|
|
96
100
|
export {};
|