@applitools/eyes-nightwatch 1.16.2 → 1.16.4
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 +203 -0
- package/dist/api.js +9 -9
- package/dist/extract-environment.js +7 -0
- package/dist/spec-driver.js +42 -68
- package/package.json +13 -13
- package/types/index.d.ts +65 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,208 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.16.4](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-nightwatch@1.16.3...js/eyes-nightwatch@1.16.4) (2023-08-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* @applitools/utils bumped to 1.5.2
|
|
9
|
+
#### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fixed some types ([498b1d7](https://github.com/applitools/eyes.sdk.javascript1/commit/498b1d7c547df04773b64b66ee39cccb402c093e))
|
|
12
|
+
* @applitools/nml-client bumped to 1.5.9
|
|
13
|
+
#### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* update broker url when server respond with error ([#1882](https://github.com/applitools/eyes.sdk.javascript1/issues/1882)) ([ab5a6ae](https://github.com/applitools/eyes.sdk.javascript1/commit/ab5a6ae8976b061bda8b56a9cc11c149e47d6dea))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
* @applitools/core bumped to 3.10.0
|
|
20
|
+
#### Features
|
|
21
|
+
|
|
22
|
+
* allowed running multiple classic test with different devices for applitoolsified native apps ([#1891](https://github.com/applitools/eyes.sdk.javascript1/issues/1891)) ([a84311f](https://github.com/applitools/eyes.sdk.javascript1/commit/a84311f88e6f532268543a96f841ae5ad87d5659))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
* @applitools/eyes bumped to 1.8.0
|
|
27
|
+
#### Features
|
|
28
|
+
|
|
29
|
+
* added more iOS devices ([a84311f](https://github.com/applitools/eyes.sdk.javascript1/commit/a84311f88e6f532268543a96f841ae5ad87d5659))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
* @applitools/logger bumped to 2.0.9
|
|
34
|
+
|
|
35
|
+
* @applitools/socket bumped to 1.1.9
|
|
36
|
+
|
|
37
|
+
* @applitools/req bumped to 1.5.4
|
|
38
|
+
|
|
39
|
+
* @applitools/image bumped to 1.1.4
|
|
40
|
+
|
|
41
|
+
* @applitools/spec-driver-webdriver bumped to 1.0.43
|
|
42
|
+
|
|
43
|
+
* @applitools/spec-driver-selenium bumped to 1.5.57
|
|
44
|
+
|
|
45
|
+
* @applitools/spec-driver-puppeteer bumped to 1.1.74
|
|
46
|
+
|
|
47
|
+
* @applitools/driver bumped to 1.13.6
|
|
48
|
+
|
|
49
|
+
* @applitools/screenshoter bumped to 3.8.9
|
|
50
|
+
|
|
51
|
+
* @applitools/tunnel-client bumped to 1.2.1
|
|
52
|
+
|
|
53
|
+
* @applitools/ufg-client bumped to 1.7.2
|
|
54
|
+
|
|
55
|
+
* @applitools/ec-client bumped to 1.7.6
|
|
56
|
+
|
|
57
|
+
* @applitools/core-base bumped to 1.5.2
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## [1.16.3](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-nightwatch@1.16.2...js/eyes-nightwatch@1.16.3) (2023-08-18)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Code Refactoring
|
|
64
|
+
|
|
65
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Dependencies
|
|
69
|
+
|
|
70
|
+
* @applitools/utils bumped to 1.5.1
|
|
71
|
+
#### Code Refactoring
|
|
72
|
+
|
|
73
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
74
|
+
* @applitools/logger bumped to 2.0.8
|
|
75
|
+
#### Code Refactoring
|
|
76
|
+
|
|
77
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
* @applitools/socket bumped to 1.1.8
|
|
82
|
+
#### Code Refactoring
|
|
83
|
+
|
|
84
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
* @applitools/req bumped to 1.5.3
|
|
89
|
+
#### Code Refactoring
|
|
90
|
+
|
|
91
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
* @applitools/image bumped to 1.1.3
|
|
96
|
+
#### Code Refactoring
|
|
97
|
+
|
|
98
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
* @applitools/snippets bumped to 2.4.23
|
|
103
|
+
#### Code Refactoring
|
|
104
|
+
|
|
105
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
106
|
+
* @applitools/spec-driver-webdriver bumped to 1.0.42
|
|
107
|
+
#### Code Refactoring
|
|
108
|
+
|
|
109
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
* @applitools/spec-driver-selenium bumped to 1.5.56
|
|
114
|
+
#### Code Refactoring
|
|
115
|
+
|
|
116
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
* @applitools/spec-driver-puppeteer bumped to 1.1.73
|
|
121
|
+
#### Code Refactoring
|
|
122
|
+
|
|
123
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
* @applitools/driver bumped to 1.13.5
|
|
128
|
+
#### Bug Fixes
|
|
129
|
+
|
|
130
|
+
* optimize driver usage in close ([#1867](https://github.com/applitools/eyes.sdk.javascript1/issues/1867)) ([60dff6b](https://github.com/applitools/eyes.sdk.javascript1/commit/60dff6b160e69d3893c91a1125d668fa18b43072))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
#### Code Refactoring
|
|
134
|
+
|
|
135
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
* @applitools/screenshoter bumped to 3.8.8
|
|
140
|
+
#### Code Refactoring
|
|
141
|
+
|
|
142
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
* @applitools/nml-client bumped to 1.5.8
|
|
147
|
+
#### Code Refactoring
|
|
148
|
+
|
|
149
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
* @applitools/tunnel-client bumped to 1.2.0
|
|
154
|
+
#### Features
|
|
155
|
+
|
|
156
|
+
* replace and destroy tunnels by tunnel id ([#1878](https://github.com/applitools/eyes.sdk.javascript1/issues/1878)) ([22bcc15](https://github.com/applitools/eyes.sdk.javascript1/commit/22bcc15b31457e3da56cdb6f73bee3dcb7e051a1))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
#### Code Refactoring
|
|
160
|
+
|
|
161
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
* @applitools/ufg-client bumped to 1.7.1
|
|
166
|
+
#### Code Refactoring
|
|
167
|
+
|
|
168
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
* @applitools/ec-client bumped to 1.7.5
|
|
173
|
+
#### Code Refactoring
|
|
174
|
+
|
|
175
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
* @applitools/core-base bumped to 1.5.1
|
|
180
|
+
#### Code Refactoring
|
|
181
|
+
|
|
182
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
* @applitools/core bumped to 3.9.1
|
|
187
|
+
#### Bug Fixes
|
|
188
|
+
|
|
189
|
+
* optimize driver usage in close ([#1867](https://github.com/applitools/eyes.sdk.javascript1/issues/1867)) ([60dff6b](https://github.com/applitools/eyes.sdk.javascript1/commit/60dff6b160e69d3893c91a1125d668fa18b43072))
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
#### Code Refactoring
|
|
193
|
+
|
|
194
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
* @applitools/eyes bumped to 1.7.3
|
|
199
|
+
#### Code Refactoring
|
|
200
|
+
|
|
201
|
+
* refactored spec driver interface ([#1839](https://github.com/applitools/eyes.sdk.javascript1/issues/1839)) ([aa49ec2](https://github.com/applitools/eyes.sdk.javascript1/commit/aa49ec2a7d14b8529acc3a8a4c2baecfa113d98a))
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
3
206
|
## [1.16.2](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-nightwatch@1.16.1...js/eyes-nightwatch@1.16.2) (2023-08-10)
|
|
4
207
|
|
|
5
208
|
|
package/dist/api.js
CHANGED
|
@@ -31,8 +31,11 @@ const extract_environment_1 = require("./extract-environment");
|
|
|
31
31
|
const eyes = __importStar(require("@applitools/eyes"));
|
|
32
32
|
const spec = __importStar(require("./spec-driver"));
|
|
33
33
|
__exportStar(require("@applitools/eyes"), exports);
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const sdk = {
|
|
35
|
+
spec: spec,
|
|
36
|
+
agentId: `eyes.nightwatch/${require('../package.json').version}`,
|
|
37
|
+
environment: (0, extract_environment_1.extractEnvironment)(),
|
|
38
|
+
};
|
|
36
39
|
class Eyes extends eyes.Eyes {
|
|
37
40
|
}
|
|
38
41
|
exports.Eyes = Eyes;
|
|
@@ -40,19 +43,16 @@ Eyes._sdk = sdk;
|
|
|
40
43
|
class CheckSettingsAutomation extends eyes.CheckSettingsAutomation {
|
|
41
44
|
}
|
|
42
45
|
exports.CheckSettingsAutomation = CheckSettingsAutomation;
|
|
43
|
-
CheckSettingsAutomation._spec = spec;
|
|
46
|
+
CheckSettingsAutomation._spec = sdk.spec;
|
|
44
47
|
class CheckSettings extends CheckSettingsAutomation {
|
|
45
48
|
}
|
|
46
49
|
exports.CheckSettings = CheckSettings;
|
|
47
|
-
exports.TargetAutomation = {
|
|
48
|
-
|
|
49
|
-
spec: spec,
|
|
50
|
-
};
|
|
51
|
-
exports.Target = { ...eyes.Target, spec: spec };
|
|
50
|
+
exports.TargetAutomation = { ...eyes.TargetAutomation, spec: sdk.spec };
|
|
51
|
+
exports.Target = { ...eyes.Target, spec: sdk.spec };
|
|
52
52
|
class Configuration extends eyes.Configuration {
|
|
53
53
|
}
|
|
54
54
|
exports.Configuration = Configuration;
|
|
55
|
-
Configuration._spec = spec;
|
|
55
|
+
Configuration._spec = sdk.spec;
|
|
56
56
|
class BatchClose extends eyes.BatchClose {
|
|
57
57
|
}
|
|
58
58
|
exports.BatchClose = BatchClose;
|
|
@@ -10,6 +10,13 @@ function extractEnvironment() {
|
|
|
10
10
|
catch {
|
|
11
11
|
// NOTE: ignore error
|
|
12
12
|
}
|
|
13
|
+
try {
|
|
14
|
+
const { name, version } = require('webdriver/package.json');
|
|
15
|
+
versions[name] = version;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// NOTE: ignore error
|
|
19
|
+
}
|
|
13
20
|
return { versions };
|
|
14
21
|
}
|
|
15
22
|
exports.extractEnvironment = extractEnvironment;
|
package/dist/spec-driver.js
CHANGED
|
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.build = exports.findElements = exports.findElement = exports.
|
|
29
|
+
exports.build = exports.findElements = exports.findElement = exports.toSimpleCommonSelector = exports.toSelector = exports.toElement = exports.toDriver = exports.isSelector = exports.isSecondaryElement = exports.isSecondaryDriver = void 0;
|
|
30
30
|
const spec = __importStar(require("@applitools/spec-driver-webdriver"));
|
|
31
31
|
const utils = __importStar(require("@applitools/utils"));
|
|
32
32
|
__exportStar(require("@applitools/spec-driver-webdriver"), exports);
|
|
@@ -34,32 +34,20 @@ const byHash = ['className', 'css', 'id', 'js', 'linkText', 'name', 'partialLink
|
|
|
34
34
|
function isByHashSelector(selector) {
|
|
35
35
|
return byHash.includes(Object.keys(selector)[0]);
|
|
36
36
|
}
|
|
37
|
-
const SHADOW_ROOT_ID = 'shadow-6066-11e4-a52e-4f735466cecf';
|
|
38
|
-
function extractShadowRootId(shadowRoot) {
|
|
39
|
-
var _a;
|
|
40
|
-
return ((_a = shadowRoot[SHADOW_ROOT_ID]) !== null && _a !== void 0 ? _a : shadowRoot.id_);
|
|
41
|
-
}
|
|
42
|
-
function transformShadowRoot(shadowRoot) {
|
|
43
|
-
return { [SHADOW_ROOT_ID]: extractShadowRootId(shadowRoot) };
|
|
44
|
-
}
|
|
45
37
|
const XPATH_SELECTOR_START = ['/', '(', '../', './', '*/'];
|
|
46
38
|
function isXpathSelector(selector) {
|
|
47
39
|
return XPATH_SELECTOR_START.some(start => selector.startsWith(start));
|
|
48
40
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
exports.isDriver = isDriver;
|
|
53
|
-
function isElement(element) {
|
|
54
|
-
return utils.types.has(element, 'value') ? spec.isElement(element.value) : spec.isElement(element);
|
|
41
|
+
function isSecondaryDriver(driver) {
|
|
42
|
+
return utils.types.instanceOf(driver, 'NightwatchAPI') || spec.isSecondaryDriver(driver);
|
|
55
43
|
}
|
|
56
|
-
exports.
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
exports.isSecondaryDriver = isSecondaryDriver;
|
|
45
|
+
function isSecondaryElement(element) {
|
|
46
|
+
return ((utils.types.has(element, 'value') && spec.isElement(element.value)) ||
|
|
47
|
+
utils.types.has(element, 'webElement') ||
|
|
48
|
+
utils.types.instanceOf(element, 'WebElement'));
|
|
61
49
|
}
|
|
62
|
-
exports.
|
|
50
|
+
exports.isSecondaryElement = isSecondaryElement;
|
|
63
51
|
function isSelector(selector) {
|
|
64
52
|
if (!selector)
|
|
65
53
|
return false;
|
|
@@ -71,30 +59,37 @@ function isSelector(selector) {
|
|
|
71
59
|
utils.types.instanceOf(selector, 'RelativeBy'));
|
|
72
60
|
}
|
|
73
61
|
exports.isSelector = isSelector;
|
|
74
|
-
function
|
|
62
|
+
function toDriver(driver) {
|
|
75
63
|
var _a, _b, _c, _d;
|
|
76
64
|
if (spec.isDriver(driver))
|
|
77
65
|
return driver;
|
|
66
|
+
if (spec.isSecondaryDriver(driver))
|
|
67
|
+
return spec.toDriver(driver);
|
|
78
68
|
const selenium = driver.options.selenium;
|
|
79
69
|
const webdriver = driver.options.webdriver;
|
|
80
70
|
const ssl = (_a = selenium === null || selenium === void 0 ? void 0 : selenium.ssl) !== null && _a !== void 0 ? _a : webdriver === null || webdriver === void 0 ? void 0 : webdriver.ssl;
|
|
81
71
|
const hostname = (_b = selenium === null || selenium === void 0 ? void 0 : selenium.host) !== null && _b !== void 0 ? _b : webdriver === null || webdriver === void 0 ? void 0 : webdriver.host;
|
|
82
72
|
const port = (_c = selenium === null || selenium === void 0 ? void 0 : selenium.port) !== null && _c !== void 0 ? _c : webdriver === null || webdriver === void 0 ? void 0 : webdriver.port;
|
|
83
73
|
const path = (_d = selenium === null || selenium === void 0 ? void 0 : selenium.default_path_prefix) !== null && _d !== void 0 ? _d : webdriver === null || webdriver === void 0 ? void 0 : webdriver.default_path_prefix;
|
|
84
|
-
|
|
74
|
+
return spec.toDriver({
|
|
85
75
|
sessionId: driver.sessionId,
|
|
86
76
|
serverUrl: `http${ssl ? 's' : ''}://${hostname !== null && hostname !== void 0 ? hostname : 'localhost'}${port ? `:${port}` : ''}${path}`,
|
|
87
77
|
capabilities: driver.capabilities,
|
|
78
|
+
original: driver,
|
|
88
79
|
});
|
|
89
|
-
transformedDriver.original = driver;
|
|
90
|
-
return transformedDriver;
|
|
91
80
|
}
|
|
92
|
-
exports.
|
|
93
|
-
function
|
|
94
|
-
|
|
81
|
+
exports.toDriver = toDriver;
|
|
82
|
+
function toElement(element) {
|
|
83
|
+
if (utils.types.has(element, 'value')) {
|
|
84
|
+
return element.value;
|
|
85
|
+
}
|
|
86
|
+
else if (utils.types.instanceOf(element, 'WebElement')) {
|
|
87
|
+
return element.getId().then(elementId => spec.toElement({ elementId }));
|
|
88
|
+
}
|
|
89
|
+
return element;
|
|
95
90
|
}
|
|
96
|
-
exports.
|
|
97
|
-
function
|
|
91
|
+
exports.toElement = toElement;
|
|
92
|
+
function toSelector(selector) {
|
|
98
93
|
if (utils.types.isString(selector)) {
|
|
99
94
|
return { locateStrategy: isXpathSelector(selector) ? 'xpath' : 'css selector', selector };
|
|
100
95
|
}
|
|
@@ -114,8 +109,8 @@ function transformSelector(selector) {
|
|
|
114
109
|
}
|
|
115
110
|
return selector;
|
|
116
111
|
}
|
|
117
|
-
exports.
|
|
118
|
-
function
|
|
112
|
+
exports.toSelector = toSelector;
|
|
113
|
+
function toSimpleCommonSelector(selector) {
|
|
119
114
|
if (utils.types.instanceOf(selector, 'RelativeBy') || utils.types.isFunction(selector)) {
|
|
120
115
|
return null;
|
|
121
116
|
}
|
|
@@ -140,41 +135,29 @@ function untransformSelector(selector) {
|
|
|
140
135
|
}
|
|
141
136
|
return selector;
|
|
142
137
|
}
|
|
143
|
-
exports.
|
|
138
|
+
exports.toSimpleCommonSelector = toSimpleCommonSelector;
|
|
144
139
|
async function findElement(driver, selector, parent) {
|
|
145
|
-
const originalDriver = driver.original;
|
|
146
|
-
let element = null;
|
|
147
140
|
if (utils.types.has(selector, 'selector') && selector.locateStrategy && !selector.index) {
|
|
148
|
-
|
|
149
|
-
element = await spec.findElement(driver, { using: selector.locateStrategy, value: selector.selector }, parent);
|
|
141
|
+
return spec.findElement(driver, { using: selector.locateStrategy, value: selector.selector }, parent);
|
|
150
142
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
element = null;
|
|
157
|
-
}
|
|
143
|
+
try {
|
|
144
|
+
return await driver.original.findElement(selector);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return null;
|
|
158
148
|
}
|
|
159
|
-
return spec.isElement(element) ? spec.transformElement(element) : null;
|
|
160
149
|
}
|
|
161
150
|
exports.findElement = findElement;
|
|
162
151
|
async function findElements(driver, selector, parent) {
|
|
163
|
-
const originalDriver = driver.original;
|
|
164
|
-
let elements = [];
|
|
165
152
|
if (utils.types.has(selector, 'selector') && selector.locateStrategy && !selector.index) {
|
|
166
|
-
|
|
167
|
-
elements = await spec.findElements(driver, { using: selector.locateStrategy, value: selector.selector }, parent);
|
|
153
|
+
return spec.findElements(driver, { using: selector.locateStrategy, value: selector.selector }, parent);
|
|
168
154
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
elements = [];
|
|
175
|
-
}
|
|
155
|
+
try {
|
|
156
|
+
return await driver.original.findElements(selector);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
return [];
|
|
176
160
|
}
|
|
177
|
-
return utils.types.isArray(elements) ? elements : [];
|
|
178
161
|
}
|
|
179
162
|
exports.findElements = findElements;
|
|
180
163
|
const browserOptionsNames = {
|
|
@@ -223,16 +206,7 @@ async function build(env) {
|
|
|
223
206
|
options.capabilities.browserName = null;
|
|
224
207
|
if (options.capabilities.browserName !== 'firefox')
|
|
225
208
|
options.selenium = options.webdriver;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const client = Nightwatch.client(options);
|
|
229
|
-
client.isES6AsyncTestcase = true;
|
|
230
|
-
await client.createSession();
|
|
231
|
-
return [client.api, () => client.session.close()];
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
const driver = await Nightwatch.createClient(options).launchBrowser();
|
|
235
|
-
return [driver, () => driver.end()];
|
|
236
|
-
}
|
|
209
|
+
const driver = await Nightwatch.createClient(options).launchBrowser();
|
|
210
|
+
return [driver, () => driver.end()];
|
|
237
211
|
}
|
|
238
212
|
exports.build = build;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-nightwatch",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.4",
|
|
4
4
|
"description": "Applitools Eyes SDK for Nightwatch.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eyes-nightwatch",
|
|
@@ -48,29 +48,29 @@
|
|
|
48
48
|
"test:e2e": "nightwatch --config test/e2e/nightwatch.conf.js --eyes-config applitools.config.js test/e2e/*.spec.js",
|
|
49
49
|
"test:coverage": "APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-nightwatch' APPLITOOLS_BATCH_ID=$(uuidgen) MOCHA_GROUP=coverage run --top-level mocha './test/generated-coverage/*.spec.js' -r @applitools/test-utils/mocha-hooks/docker --parallel --jobs ${MOCHA_JOBS:-15} --exit",
|
|
50
50
|
"setup": "run --top-level browsers:setup",
|
|
51
|
-
"up:framework": "
|
|
51
|
+
"up:framework": "yarn add --dev --caret nightwatch${APPLITOOLS_FRAMEWORK_VERSION:+@$APPLITOOLS_FRAMEWORK_VERSION}"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@applitools/driver": "1.13.
|
|
55
|
-
"@applitools/eyes": "1.
|
|
56
|
-
"@applitools/spec-driver-webdriver": "1.0.
|
|
57
|
-
"@applitools/utils": "1.5.
|
|
58
|
-
"webdriver": "7.
|
|
54
|
+
"@applitools/driver": "1.13.6",
|
|
55
|
+
"@applitools/eyes": "1.8.0",
|
|
56
|
+
"@applitools/spec-driver-webdriver": "1.0.43",
|
|
57
|
+
"@applitools/utils": "1.5.2",
|
|
58
|
+
"webdriver": "7.31.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@applitools/api-extractor": "^1.2.21",
|
|
62
|
-
"@applitools/bongo": "^5.
|
|
63
|
-
"@applitools/generic": "^3.3.
|
|
62
|
+
"@applitools/bongo": "^5.6.1",
|
|
63
|
+
"@applitools/generic": "^3.3.10",
|
|
64
64
|
"@applitools/test-utils": "^1.5.17",
|
|
65
|
-
"@types/nightwatch": "^2.3.
|
|
65
|
+
"@types/nightwatch": "^2.3.25",
|
|
66
66
|
"@types/node": "^12.20.55",
|
|
67
|
-
"chromedriver": "^
|
|
67
|
+
"chromedriver": "^115.0.1",
|
|
68
68
|
"cucumber": "6.0.7",
|
|
69
69
|
"geckodriver": "^3.0.1",
|
|
70
|
-
"nightwatch": "^
|
|
70
|
+
"nightwatch": "^3.1.2"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"nightwatch": ">=
|
|
73
|
+
"nightwatch": ">=2.0.0"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=12.13.0"
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export type Driver = import('nightwatch').NightwatchBrowser & { __applitoolsBrand?: undefined; };
|
|
2
|
-
export type Element = ((({ 'element-6066-11e4-a52e-4f735466cecf': string; } | { ELEMENT: string; }) & { __applitoolsBrand?: undefined; })
|
|
3
|
-
export type Selector = (string |
|
|
4
|
-
export type SpecType = {
|
|
2
|
+
export type Element = ((({ 'element-6066-11e4-a52e-4f735466cecf': string; } | { ELEMENT: string; }) & { __applitoolsBrand?: undefined; }) | import('selenium-webdriver').WebElement | import('nightwatch').NightwatchTypedCallbackResult<(({ 'element-6066-11e4-a52e-4f735466cecf': string; } | { ELEMENT: string; }) & { __applitoolsBrand?: undefined; }) & { __applitoolsBrand?: undefined; }>) & { __applitoolsBrand?: undefined; };
|
|
3
|
+
export type Selector = (string | import('nightwatch').ElementProperties | import('selenium-webdriver').By | import('selenium-webdriver').ByHash | import('selenium-webdriver').RelativeBy | { using: string; value: string; } | ((webdriver: import('selenium-webdriver').WebDriver) => Promise<any>)) & { __applitoolsBrand?: undefined; };
|
|
4
|
+
export type SpecType = {
|
|
5
|
+
driver: Driver;
|
|
6
|
+
context: Driver;
|
|
7
|
+
element: Element;
|
|
8
|
+
selector: Selector;
|
|
9
|
+
secondary: never;
|
|
10
|
+
};
|
|
5
11
|
export class Eyes {
|
|
6
12
|
static setViewportSize: (driver: Driver, viewportSize: RectangleSize) => Promise<void>;
|
|
7
13
|
static getExecutionCloudUrl(config?: undefined | ConfigurationPlain): Promise<string>;
|
|
@@ -351,7 +357,7 @@ export type TargetAutomation = {
|
|
|
351
357
|
webview(webview?: undefined | string): CheckSettingsAutomation;
|
|
352
358
|
webview(webview?: undefined | boolean): CheckSettingsAutomation;
|
|
353
359
|
};
|
|
354
|
-
export
|
|
360
|
+
export type Target = TargetImage & TargetAutomation;
|
|
355
361
|
export type OCRRegion = { target: Element | RegionPlain | EyesSelector<Selector>; hint?: undefined | string; minMatch?: undefined | number; language?: undefined | string; };
|
|
356
362
|
export type ConfigurationPlain = {
|
|
357
363
|
debugScreenshots?: undefined | { save: boolean; path?: undefined | string; prefix?: undefined | string; };
|
|
@@ -664,7 +670,7 @@ export class BatchClose {
|
|
|
664
670
|
setProxy(proxy: ProxySettingsPlain): BatchClose;
|
|
665
671
|
}
|
|
666
672
|
export const closeBatch: (options: { batchIds: Array<string>; serverUrl: string; apiKey: string; proxy?: undefined | ProxySettingsPlain; }) => Promise<void>;
|
|
667
|
-
export type BrowserTypePlain = "
|
|
673
|
+
export type BrowserTypePlain = "firefox" | "chrome" | "chrome-one-version-back" | "chrome-two-versions-back" | "firefox-one-version-back" | "firefox-two-versions-back" | "ie" | "ie10" | "edge" | "edgechromium" | "edgelegacy" | "edgechromium-one-version-back" | "edgechromium-two-versions-back" | "safari" | "safari-earlyaccess" | "safari-one-version-back" | "safari-two-versions-back";
|
|
668
674
|
export enum BrowserType {
|
|
669
675
|
CHROME = 'chrome',
|
|
670
676
|
CHROME_ONE_VERSION_BACK = 'chrome-one-version-back',
|
|
@@ -768,33 +774,66 @@ export enum FailureReport {
|
|
|
768
774
|
IMMEDIATE = 'IMMEDIATE',
|
|
769
775
|
ON_CLOSE = 'ON_CLOSE'
|
|
770
776
|
}
|
|
771
|
-
export type IosDeviceNamePlain = "iPhone 11" | "iPhone 11 Pro" | "iPhone 11 Pro Max" | "iPhone X" | "iPhone XR" | "iPhone
|
|
777
|
+
export type IosDeviceNamePlain = "iPad Air 2" | "iPhone 11" | "iPhone 11 Pro" | "iPhone 11 Pro Max" | "iPhone X" | "iPhone XR" | "iPhone 6s" | "iPhone 6s Plus" | "iPhone 7" | "iPhone 7 Plus" | "iPhone 8" | "iPhone 8 Plus" | "iPhone Xs" | "iPhone Xs Max" | "iPhone 12" | "iPhone 12 mini" | "iPhone 12 Pro" | "iPhone 12 Pro Max" | "iPhone 13" | "iPhone 13 mini" | "iPhone 13 Pro" | "iPhone 13 Pro Max" | "iPhone 14" | "iPhone 14 Plus" | "iPhone 14 Pro" | "iPhone 14 Pro Max" | "iPhone SE (1st generation)" | "iPhone SE (2nd generation)" | "iPhone SE (3rd generation)" | "iPad (5th generation)" | "iPad (6th generation)" | "iPad (7th generation)" | "iPad (8th generation)" | "iPad (9th generation)" | "iPad (10th generation)" | "iPad Air (3rd generation)" | "iPad Air (4th generation)" | "iPad Air (5th generation)" | "iPad mini 4" | "iPad mini (5th generation)" | "iPad mini (6th generation)" | "iPad Pro (9.7-inch)" | "iPad Pro (10.5-inch)" | "iPad Pro (11-inch) (1st generation)" | "iPad Pro (12.9-inch) (1st generation)" | "iPad Pro (11-inch) (2nd generation)" | "iPad Pro (12.9-inch) (2nd generation)" | "iPad Pro (11-inch) (3rd generation)" | "iPad Pro (12.9-inch) (3rd generation)" | "iPad Pro (11-inch) (4th generation)" | "iPad Pro (12.9-inch) (4th generation)" | "iPad Pro (12.9-inch) (5th generation)" | "iPad Pro (12.9-inch) (6th generation)" | "iPod touch (7th generation)";
|
|
772
778
|
export enum IosDeviceName {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
iPhone_13 = 'iPhone 13',
|
|
778
|
-
iPhone_12_Pro_Max = 'iPhone 12 Pro Max',
|
|
779
|
-
iPhone_12_Pro = 'iPhone 12 Pro',
|
|
780
|
-
iPhone_12 = 'iPhone 12',
|
|
781
|
-
iPhone_12_mini = 'iPhone 12 mini',
|
|
782
|
-
iPhone_11_Pro = 'iPhone 11 Pro',
|
|
783
|
-
iPhone_11_Pro_Max = 'iPhone 11 Pro Max',
|
|
784
|
-
iPhone_11 = 'iPhone 11',
|
|
785
|
-
iPhone_XR = 'iPhone XR',
|
|
786
|
-
iPhone_XS = 'iPhone Xs',
|
|
787
|
-
iPhone_X = 'iPhone X',
|
|
779
|
+
iPhone_6s = 'iPhone 6s',
|
|
780
|
+
iPhone_6s_Plus = 'iPhone 6s Plus',
|
|
781
|
+
iPhone_7 = 'iPhone 7',
|
|
782
|
+
iPhone_7_Plus = 'iPhone 7 Plus',
|
|
788
783
|
iPhone_8 = 'iPhone 8',
|
|
789
784
|
iPhone_8_Plus = 'iPhone 8 Plus',
|
|
790
|
-
|
|
785
|
+
iPhone_X = 'iPhone X',
|
|
786
|
+
iPhone_XR = 'iPhone XR',
|
|
787
|
+
iPhone_Xs = 'iPhone Xs',
|
|
788
|
+
iPhone_XS = 'iPhone Xs',
|
|
789
|
+
iPhone_Xs_Max = 'iPhone Xs Max',
|
|
790
|
+
iPhone_11 = 'iPhone 11',
|
|
791
|
+
iPhone_11_Pro = 'iPhone 11 Pro',
|
|
792
|
+
iPhone_11_Pro_Max = 'iPhone 11 Pro Max',
|
|
793
|
+
iPhone_12 = 'iPhone 12',
|
|
794
|
+
iPhone_12_mini = 'iPhone 12 mini',
|
|
795
|
+
iPhone_12_Pro = 'iPhone 12 Pro',
|
|
796
|
+
iPhone_12_Pro_Max = 'iPhone 12 Pro Max',
|
|
797
|
+
iPhone_13 = 'iPhone 13',
|
|
798
|
+
iPhone_13_mini = 'iPhone 13 mini',
|
|
799
|
+
iPhone_13_Pro = 'iPhone 13 Pro',
|
|
800
|
+
iPhone_13_Pro_Max = 'iPhone 13 Pro Max',
|
|
801
|
+
iPhone_14 = 'iPhone 14',
|
|
802
|
+
iPhone_14_Plus = 'iPhone 14 Plus',
|
|
803
|
+
iPhone_14_Pro = 'iPhone 14 Pro',
|
|
804
|
+
iPhone_14_Pro_Max = 'iPhone 14 Pro Max',
|
|
791
805
|
iPhone_SE = 'iPhone SE (1st generation)',
|
|
792
|
-
|
|
793
|
-
|
|
806
|
+
iPhone_SE_1 = 'iPhone SE (1st generation)',
|
|
807
|
+
iPhone_SE_2 = 'iPhone SE (2nd generation)',
|
|
808
|
+
iPhone_SE_3 = 'iPhone SE (3rd generation)',
|
|
809
|
+
iPad_5 = 'iPad (5th generation)',
|
|
810
|
+
iPad_6 = 'iPad (6th generation)',
|
|
794
811
|
iPad_7 = 'iPad (7th generation)',
|
|
812
|
+
iPad_8 = 'iPad (8th generation)',
|
|
795
813
|
iPad_9 = 'iPad (9th generation)',
|
|
796
|
-
|
|
797
|
-
|
|
814
|
+
iPad_10 = 'iPad (10th generation)',
|
|
815
|
+
iPad_Air_2 = 'iPad Air 2',
|
|
816
|
+
iPad_Air_3 = 'iPad Air (3rd generation)',
|
|
817
|
+
iPad_Air_4 = 'iPad Air (4th generation)',
|
|
818
|
+
iPad_Air_5 = 'iPad Air (5th generation)',
|
|
819
|
+
iPad_mini_4 = 'iPad mini 4',
|
|
820
|
+
iPad_mini_5 = 'iPad mini (5th generation)',
|
|
821
|
+
iPad_mini_6 = 'iPad mini (6th generation)',
|
|
822
|
+
iPad_Pro_9_7_inch_1 = 'iPad Pro (9.7-inch)',
|
|
823
|
+
iPad_Pro_10_5_inch_1 = 'iPad Pro (10.5-inch)',
|
|
824
|
+
iPad_Pro_11_inch_1 = 'iPad Pro (11-inch) (1st generation)',
|
|
825
|
+
iPad_Pro_12_9_inch_1 = 'iPad Pro (12.9-inch) (1st generation)',
|
|
826
|
+
iPad_Pro_11_inch_2 = 'iPad Pro (11-inch) (2nd generation)',
|
|
827
|
+
iPad_Pro_12_9_inch_2 = 'iPad Pro (12.9-inch) (2nd generation)',
|
|
828
|
+
iPad_Pro_11_inch_3 = 'iPad Pro (11-inch) (3rd generation)',
|
|
829
|
+
iPad_Pro_12_9_inch_3 = 'iPad Pro (12.9-inch) (3rd generation)',
|
|
830
|
+
iPad_Pro_3 = 'iPad Pro (12.9-inch) (3rd generation)',
|
|
831
|
+
iPad_Pro_11_inch_4 = 'iPad Pro (11-inch) (4th generation)',
|
|
832
|
+
iPad_Pro_4 = 'iPad Pro (11-inch) (4th generation)',
|
|
833
|
+
iPad_Pro_12_9_inch_4 = 'iPad Pro (12.9-inch) (4th generation)',
|
|
834
|
+
iPad_Pro_12_9_inch_5 = 'iPad Pro (12.9-inch) (5th generation)',
|
|
835
|
+
iPad_Pro_12_9_inch_6 = 'iPad Pro (12.9-inch) (6th generation)',
|
|
836
|
+
iPod_touch_7 = 'iPod touch (7th generation)'
|
|
798
837
|
}
|
|
799
838
|
export type IosVersionPlain = AndroidVersionPlain;
|
|
800
839
|
export enum IosVersion {
|