@applitools/eyes-cypress 3.31.0 → 3.32.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 +12 -0
- package/dist/browser/mergeCypressConfigs.js +11 -0
- package/dist/browser/transformCypressCheckSettings.js +281 -0
- package/dist/browser/transformCypressConfig.js +58 -0
- package/dist/browser/utils.js +55 -0
- package/dist/plugin/config.js +3 -0
- package/dist/plugin/server.js +1 -0
- package/package.json +8 -10
- package/src/browser/commands.js +19 -19
- package/src/browser/mergeCypressConfigs.ts +15 -0
- package/src/browser/transformCypressCheckSettings.ts +263 -0
- package/src/browser/transformCypressConfig.ts +56 -0
- package/src/browser/utils.ts +33 -0
- package/src/expose.ts +60 -31
- package/src/plugin/config.ts +3 -0
- package/src/plugin/index.ts +1 -0
- package/src/plugin/server.ts +1 -0
- package/types/expose.d.ts +256 -208
- package/src/browser/eyesCheckMapping.js +0 -283
- package/src/browser/eyesOpenMapping.js +0 -95
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,18 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
## 3.32.0 - 2023/4/21
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
- Add a timeout and max concurrency for fetching resources
|
|
19
|
+
### Bug fixes
|
|
20
|
+
|
|
21
|
+
## 3.31.1 - 2023/4/14
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
### Bug fixes
|
|
25
|
+
- Map values from open and global config
|
|
26
|
+
|
|
15
27
|
## 3.31.0 - 2023/4/4
|
|
16
28
|
|
|
17
29
|
### Features
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeCypressConfigs = void 0;
|
|
4
|
+
function mergeCypressConfigs({ globalConfig, openConfig, }) {
|
|
5
|
+
return {
|
|
6
|
+
...globalConfig,
|
|
7
|
+
...openConfig,
|
|
8
|
+
batch: { ...globalConfig.batch, ...openConfig.batch },
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.mergeCypressConfigs = mergeCypressConfigs;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.transformCypressCheckSettings = void 0;
|
|
27
|
+
const utils = __importStar(require("@applitools/utils"));
|
|
28
|
+
const utils_1 = require("./utils");
|
|
29
|
+
function transformCypressCheckSettings(settings, refer) {
|
|
30
|
+
if (utils.types.isString(settings)) {
|
|
31
|
+
return { name: settings };
|
|
32
|
+
}
|
|
33
|
+
const target = settings.target === 'region' ? transformTargetRegion(settings) : undefined;
|
|
34
|
+
return {
|
|
35
|
+
renderers: (0, utils_1.transformBrowsers)(settings.browser),
|
|
36
|
+
hooks: settings.scriptHooks,
|
|
37
|
+
disableBrowserFetching: settings.disableBrowserFetching,
|
|
38
|
+
layoutBreakpoints: settings.layoutBreakpoints,
|
|
39
|
+
ufgOptions: settings.visualGridOptions,
|
|
40
|
+
name: settings.tag,
|
|
41
|
+
ignoreRegions: transformRegionsWithOptions(settings.ignore),
|
|
42
|
+
floatingRegions: convertFloatingRegion(settings.floating),
|
|
43
|
+
strictRegions: transformRegionsWithOptions(settings.strict),
|
|
44
|
+
contentRegions: transformRegionsWithOptions(settings.content),
|
|
45
|
+
layoutRegions: transformRegionsWithOptions(settings.layout),
|
|
46
|
+
accessibilityRegions: convertAccessabilityRegions(settings.accessibility),
|
|
47
|
+
userCommandId: settings.variationGroupId,
|
|
48
|
+
region: utils.types.has(target, 'region') ? target.region : undefined,
|
|
49
|
+
ignoreCaret: settings.ignoreCaret,
|
|
50
|
+
ignoreDisplacements: settings.ignoreDisplacements,
|
|
51
|
+
fully: settings.fully,
|
|
52
|
+
waitBeforeCapture: settings.waitBeforeCapture,
|
|
53
|
+
lazyLoad: settings.lazyLoad,
|
|
54
|
+
matchLevel: settings.matchLevel,
|
|
55
|
+
useDom: settings.useDom,
|
|
56
|
+
sendDom: settings.sendDom,
|
|
57
|
+
enablePatterns: settings.enablePatterns,
|
|
58
|
+
pageId: settings.pageId,
|
|
59
|
+
};
|
|
60
|
+
function transformTargetRegion(checkSettings) {
|
|
61
|
+
const shadowDomSettings = {};
|
|
62
|
+
let regionSettings = {};
|
|
63
|
+
if (!Array.isArray(checkSettings.selector)) {
|
|
64
|
+
if (utils.types.has(checkSettings, 'element')) {
|
|
65
|
+
if (isHTMLElement(checkSettings.element)) {
|
|
66
|
+
regionSettings = {
|
|
67
|
+
region: Object.assign(refer.ref(checkSettings.element), { type: 'element' }),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
else if (utils.types.has(checkSettings.element, [0])) {
|
|
71
|
+
regionSettings = {
|
|
72
|
+
region: Object.assign(refer.ref(checkSettings.element[0]), { type: 'element' }),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else if (utils.types.has(checkSettings, 'region') &&
|
|
77
|
+
utils.types.has(checkSettings.region, 'top') &&
|
|
78
|
+
utils.types.has(checkSettings.region, 'left') &&
|
|
79
|
+
utils.types.has(checkSettings.region, 'width') &&
|
|
80
|
+
utils.types.has(checkSettings.region, 'height')) {
|
|
81
|
+
regionSettings = {
|
|
82
|
+
region: {
|
|
83
|
+
y: checkSettings.region.top,
|
|
84
|
+
x: checkSettings.region.left,
|
|
85
|
+
width: checkSettings.region.width,
|
|
86
|
+
height: checkSettings.region.height,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
else if (!utils.types.has(checkSettings, 'selector')) {
|
|
91
|
+
regionSettings = {
|
|
92
|
+
region: checkSettings.region,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
regionSettings = {
|
|
97
|
+
region: checkSettings.selector,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const selectors = checkSettings.selector;
|
|
103
|
+
for (let i = selectors.length - 1; i > -1; i--) {
|
|
104
|
+
if (i === selectors.length - 1) {
|
|
105
|
+
shadowDomSettings['shadow'] = selectors[i].selector;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const prevSettings = Object.assign({}, shadowDomSettings);
|
|
109
|
+
shadowDomSettings['selector'] = selectors[i].selector;
|
|
110
|
+
if (!prevSettings.hasOwnProperty('selector')) {
|
|
111
|
+
shadowDomSettings['shadow'] = prevSettings.shadow;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
shadowDomSettings['shadow'] = prevSettings;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
regionSettings = { region: shadowDomSettings };
|
|
119
|
+
}
|
|
120
|
+
return regionSettings;
|
|
121
|
+
}
|
|
122
|
+
function convertAccessabilityRegions(accessibilityRegions) {
|
|
123
|
+
if (!accessibilityRegions)
|
|
124
|
+
return;
|
|
125
|
+
if (!Array.isArray(accessibilityRegions)) {
|
|
126
|
+
accessibilityRegions = [accessibilityRegions];
|
|
127
|
+
}
|
|
128
|
+
const accessibility = [];
|
|
129
|
+
for (const region of accessibilityRegions) {
|
|
130
|
+
const accessabilityRegion = {
|
|
131
|
+
type: utils.types.has(region, 'accessibilityType') ? region.accessibilityType : undefined,
|
|
132
|
+
};
|
|
133
|
+
if (utils.types.has(region, 'selector')) {
|
|
134
|
+
const currRegion = { ...accessabilityRegion, region: region.selector };
|
|
135
|
+
delete region.selector;
|
|
136
|
+
accessibility.push(currRegion);
|
|
137
|
+
}
|
|
138
|
+
else if (utils.types.has(region, 'element')) {
|
|
139
|
+
const elements = refElements(region.element);
|
|
140
|
+
delete region['element'];
|
|
141
|
+
for (const element of elements) {
|
|
142
|
+
accessibility.push(Object.assign({}, region, accessabilityRegion, { region: element }));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else if (utils.types.has(region, 'region')) {
|
|
146
|
+
const currRegion = { ...region, type: region.region.accessibilityType };
|
|
147
|
+
delete currRegion.region.accessibilityType;
|
|
148
|
+
accessibility.push(currRegion);
|
|
149
|
+
}
|
|
150
|
+
else if (utils.types.has(region, 'top')) {
|
|
151
|
+
accessibility.push({
|
|
152
|
+
...accessabilityRegion,
|
|
153
|
+
region: { y: region.top, x: region.left, width: region.width, height: region.height },
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
accessibility.push(region);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return accessibility;
|
|
161
|
+
}
|
|
162
|
+
function convertFloatingRegion(floatingRegions) {
|
|
163
|
+
if (!floatingRegions)
|
|
164
|
+
return;
|
|
165
|
+
if (!Array.isArray(floatingRegions)) {
|
|
166
|
+
floatingRegions = [floatingRegions];
|
|
167
|
+
}
|
|
168
|
+
const floating = [];
|
|
169
|
+
for (const region of floatingRegions) {
|
|
170
|
+
const floatingRegion = {
|
|
171
|
+
offset: {
|
|
172
|
+
bottom: region.maxDownOffset || 0,
|
|
173
|
+
left: region.maxLeftOffset || 0,
|
|
174
|
+
top: region.maxUpOffset || 0,
|
|
175
|
+
right: region.maxRightOffset || 0,
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
delete region.maxDownOffset;
|
|
179
|
+
delete region.maxLeftOffset;
|
|
180
|
+
delete region.maxUpOffset;
|
|
181
|
+
delete region.maxRightOffset;
|
|
182
|
+
if (utils.types.has(region, 'selector')) {
|
|
183
|
+
const currRegion = { region: region.selector, ...region, ...floatingRegion };
|
|
184
|
+
delete currRegion.selector;
|
|
185
|
+
floating.push(currRegion);
|
|
186
|
+
}
|
|
187
|
+
else if (utils.types.has(region, 'element')) {
|
|
188
|
+
const elements = refElements(region.element);
|
|
189
|
+
delete region.element;
|
|
190
|
+
for (const element of elements) {
|
|
191
|
+
floating.push({ ...region, ...floatingRegion, region: element });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else if (utils.types.has(region, 'region')) {
|
|
195
|
+
const currRegion = { offset: floatingRegion.offset, ...region };
|
|
196
|
+
floating.push(currRegion);
|
|
197
|
+
}
|
|
198
|
+
else if (utils.types.has(region, 'top')) {
|
|
199
|
+
floating.push({
|
|
200
|
+
...floatingRegion,
|
|
201
|
+
region: {
|
|
202
|
+
y: region.top,
|
|
203
|
+
x: region.left,
|
|
204
|
+
width: region.width,
|
|
205
|
+
height: region.height,
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
floating.push(region);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return floating;
|
|
214
|
+
}
|
|
215
|
+
function transformRegionsWithOptions(regions) {
|
|
216
|
+
if (!regions)
|
|
217
|
+
return;
|
|
218
|
+
if (!Array.isArray(regions))
|
|
219
|
+
regions = [regions];
|
|
220
|
+
let resRegions = [];
|
|
221
|
+
for (const region of regions) {
|
|
222
|
+
if (utils.types.has(region, 'element')) {
|
|
223
|
+
if (utils.types.has(region, 'padding') || utils.types.has(region, 'regionId')) {
|
|
224
|
+
const currRefElements = refElements(region.element);
|
|
225
|
+
for (const refElement of currRefElements) {
|
|
226
|
+
const curr = { region: refElement };
|
|
227
|
+
if (region.padding) {
|
|
228
|
+
curr.padding = region.padding;
|
|
229
|
+
}
|
|
230
|
+
if (region.regionId) {
|
|
231
|
+
curr.regionId = region.regionId;
|
|
232
|
+
}
|
|
233
|
+
resRegions.push(curr);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
resRegions = [...resRegions, ...refElements(region.element)];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else if (isHTMLElement(region) || utils.types.has(region, 'jquery')) {
|
|
241
|
+
resRegions = [...resRegions, ...refElements(region)];
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
if (utils.types.has(region, 'selector') && !utils.types.has(region, 'type')) {
|
|
245
|
+
const currRegion = { region: region.selector, ...region };
|
|
246
|
+
delete currRegion.selector;
|
|
247
|
+
resRegions.push(currRegion);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
resRegions.push(region);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return resRegions;
|
|
255
|
+
}
|
|
256
|
+
function refElements(regions) {
|
|
257
|
+
if (!regions)
|
|
258
|
+
return;
|
|
259
|
+
if (!Array.isArray(regions))
|
|
260
|
+
regions = [regions];
|
|
261
|
+
const elements = [];
|
|
262
|
+
for (const region of regions) {
|
|
263
|
+
if (isHTMLElement(region)) {
|
|
264
|
+
elements.push(Object.assign(refer.ref(region), { type: 'element' }));
|
|
265
|
+
}
|
|
266
|
+
else if (utils.types.has(region, 'jquery')) {
|
|
267
|
+
region.each(function () {
|
|
268
|
+
elements.push(isHTMLElement(this) ? Object.assign(refer.ref(this), { type: 'element' }) : this);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
elements.push(region);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return elements;
|
|
276
|
+
}
|
|
277
|
+
function isHTMLElement(element) {
|
|
278
|
+
return utils.types.has(element, 'nodeType') && element.nodeType === Node.ELEMENT_NODE;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
exports.transformCypressCheckSettings = transformCypressCheckSettings;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformCypressConfig = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
function transformCypressConfig(config) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7
|
+
return {
|
|
8
|
+
open: {
|
|
9
|
+
apiKey: config.apiKey,
|
|
10
|
+
serverUrl: config.serverUrl,
|
|
11
|
+
proxy: config.proxy,
|
|
12
|
+
appName: config.appName,
|
|
13
|
+
testName: config.testName,
|
|
14
|
+
displayName: config.displayName,
|
|
15
|
+
batch: {
|
|
16
|
+
...config.batch,
|
|
17
|
+
id: (_a = config.batchId) !== null && _a !== void 0 ? _a : (_b = config.batch) === null || _b === void 0 ? void 0 : _b.id,
|
|
18
|
+
name: (_c = config.batchName) !== null && _c !== void 0 ? _c : (_d = config.batch) === null || _d === void 0 ? void 0 : _d.name,
|
|
19
|
+
sequenceName: (_e = config.batchSequenceName) !== null && _e !== void 0 ? _e : (_f = config.batch) === null || _f === void 0 ? void 0 : _f.sequenceName,
|
|
20
|
+
notifyOnCompletion: (_g = config.notifyOnCompletion) !== null && _g !== void 0 ? _g : (_h = config.batch) === null || _h === void 0 ? void 0 : _h.notifyOnCompletion,
|
|
21
|
+
},
|
|
22
|
+
keepBatchOpen: !config.shouldUseBrowserHooks,
|
|
23
|
+
environmentName: config.envName,
|
|
24
|
+
baselineBranchName: config.baselineBranchName,
|
|
25
|
+
branchName: config.branchName,
|
|
26
|
+
parentBranchName: config.parentBranchName,
|
|
27
|
+
compareWithParentBranch: config.compareWithParentBranch,
|
|
28
|
+
ignoreBaseline: config.ignoreBaseline,
|
|
29
|
+
ignoreGitBranching: config.ignoreGitMergeBase,
|
|
30
|
+
saveDiffs: config.saveDiffs,
|
|
31
|
+
properties: config.properties,
|
|
32
|
+
environment: {
|
|
33
|
+
viewportSize: config.viewportSize,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
check: {
|
|
37
|
+
renderers: (0, utils_1.transformBrowsers)(config.browser),
|
|
38
|
+
matchLevel: config.matchLevel,
|
|
39
|
+
ignoreCaret: config.ignoreCaret,
|
|
40
|
+
ignoreDisplacements: config.ignoreDisplacements,
|
|
41
|
+
accessibilitySettings: (0, utils_1.transformAccessibilityValidation)(config.accessibilityValidation),
|
|
42
|
+
layoutBreakpoints: config.layoutBreakpoints,
|
|
43
|
+
sendDom: config.sendDom,
|
|
44
|
+
useDom: config.useDom,
|
|
45
|
+
enablePatterns: config.enablePatterns,
|
|
46
|
+
ufgOptions: config.visualGridOptions,
|
|
47
|
+
disableBrowserFetching: config.disableBrowserFetching,
|
|
48
|
+
hooks: config.scriptHooks,
|
|
49
|
+
},
|
|
50
|
+
screenshot: {
|
|
51
|
+
waitBeforeCapture: config.waitBeforeCapture,
|
|
52
|
+
},
|
|
53
|
+
close: {
|
|
54
|
+
updateBaselineIfNew: config.saveNewTests,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
exports.transformCypressConfig = transformCypressConfig;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.transformAccessibilityValidation = exports.transformBrowsers = void 0;
|
|
27
|
+
const utils = __importStar(require("@applitools/utils"));
|
|
28
|
+
function transformBrowsers(browsers) {
|
|
29
|
+
if (!browsers)
|
|
30
|
+
return;
|
|
31
|
+
if (!Array.isArray(browsers))
|
|
32
|
+
browsers = [browsers];
|
|
33
|
+
return browsers.map(browser => {
|
|
34
|
+
if (utils.types.has(browser, 'width') && utils.types.has(browser, 'height') && !utils.types.has(browser, 'name')) {
|
|
35
|
+
browser.name = 'chrome';
|
|
36
|
+
return browser;
|
|
37
|
+
}
|
|
38
|
+
else if (utils.types.has(browser, 'deviceName')) {
|
|
39
|
+
return { chromeEmulationInfo: browser };
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return browser;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.transformBrowsers = transformBrowsers;
|
|
47
|
+
function transformAccessibilityValidation(accessibilityValidation) {
|
|
48
|
+
if (!accessibilityValidation)
|
|
49
|
+
return;
|
|
50
|
+
return {
|
|
51
|
+
level: accessibilityValidation.level,
|
|
52
|
+
version: accessibilityValidation.guidelinesVersion,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
exports.transformAccessibilityValidation = transformAccessibilityValidation;
|
package/dist/plugin/config.js
CHANGED
|
@@ -40,6 +40,8 @@ function makeConfig() {
|
|
|
40
40
|
'disableBrowserFetching',
|
|
41
41
|
'testConcurrency',
|
|
42
42
|
'removeDuplicateTests',
|
|
43
|
+
'eyesFetchConcurrency',
|
|
44
|
+
'universalDebug',
|
|
43
45
|
],
|
|
44
46
|
});
|
|
45
47
|
if ((!config.batch || !config.batch.id) && !config.batchId) {
|
|
@@ -69,6 +71,7 @@ function makeConfig() {
|
|
|
69
71
|
eyesTestConcurrency: config.testConcurrency || DEFAULT_TEST_CONCURRENCY,
|
|
70
72
|
eyesWaitBeforeCapture: config.waitBeforeCapture,
|
|
71
73
|
eyesRemoveDuplicateTests: !!config.removeDuplicateTests,
|
|
74
|
+
universalDebug: !!config.universalDebug,
|
|
72
75
|
};
|
|
73
76
|
return { config, eyesConfig };
|
|
74
77
|
}
|
package/dist/plugin/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-cypress",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.32.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git://github.com/applitools/eyes.sdk.javascript1.git",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
29
|
"lint": "eslint \"**/*.{js,ts}\"",
|
|
30
|
-
"build": "ttsc",
|
|
30
|
+
"build": "node ../../node_modules/.bin/ttsc",
|
|
31
31
|
"generate:tests": "coverage-tests generate",
|
|
32
32
|
"test": "yarn test:unit && yarn test:it && yarn test:e2e && yarn test:ts && yarn test:components && yarn test:coverage",
|
|
33
33
|
"test:sanity": "yarn test:unit && yarn test:it && yarn test:ts",
|
|
34
34
|
"test:unit": "mocha --no-timeouts 'test/unit/**/*.test.js'",
|
|
35
35
|
"test:it": "yarn build && mocha --no-timeouts 'test/it/**/*.test.js'",
|
|
36
36
|
"test:ts": "yarn test:ts:compile && yarn test:ts:run",
|
|
37
|
-
"test:ts:compile": "tsc --project test/e2e/ts/cypress",
|
|
37
|
+
"test:ts:compile": "node ../../node_modules/.bin/tsc --project test/e2e/ts/cypress",
|
|
38
38
|
"test:ts:run:legacy": "yarn cypress9 run --config-file ./test/e2e/ts/cypress-ts-legacy.json",
|
|
39
39
|
"cypress8": "./node_modules/cypress8/bin/cypress",
|
|
40
40
|
"test:ts:run:8": "yarn cypress8 run --project ./test/e2e/ts --config-file ./cypress-8.config.ts",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@applitools/core": "2.
|
|
72
|
+
"@applitools/core": "2.5.3",
|
|
73
73
|
"@applitools/eyes-api": "1.13.12",
|
|
74
74
|
"@applitools/functional-commons": "1.6.0",
|
|
75
75
|
"@applitools/logger": "1.1.48",
|
|
@@ -82,12 +82,12 @@
|
|
|
82
82
|
"ws": "8.5.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@applitools/api-extractor": "^1.2.
|
|
85
|
+
"@applitools/api-extractor": "^1.2.14",
|
|
86
86
|
"@applitools/bongo": "^3.0.3",
|
|
87
|
-
"@applitools/sdk-coverage-tests": "^3.0.
|
|
87
|
+
"@applitools/sdk-coverage-tests": "^3.0.2",
|
|
88
88
|
"@applitools/snaptdout": "1.0.1",
|
|
89
89
|
"@applitools/test-server": "1.1.28",
|
|
90
|
-
"@applitools/test-utils": "1.5.
|
|
90
|
+
"@applitools/test-utils": "1.5.16",
|
|
91
91
|
"@types/node": "12",
|
|
92
92
|
"@types/semver": "^7.3.13",
|
|
93
93
|
"@types/uuid": "^9.0.0",
|
|
@@ -110,9 +110,7 @@
|
|
|
110
110
|
"morgan": "1.9.1",
|
|
111
111
|
"ncp": "2.0.0",
|
|
112
112
|
"node-fetch": "2.6.0",
|
|
113
|
-
"prettier": "^2.6.2"
|
|
114
|
-
"ttypescript": "^1.5.13",
|
|
115
|
-
"typescript": "^4.7.2"
|
|
113
|
+
"prettier": "^2.6.2"
|
|
116
114
|
},
|
|
117
115
|
"engines": {
|
|
118
116
|
"node": ">=12.13.0"
|
package/src/browser/commands.js
CHANGED
|
@@ -4,12 +4,13 @@ const spec = require('../../dist/browser/spec-driver')
|
|
|
4
4
|
const Refer = require('./refer')
|
|
5
5
|
const Socket = require('./socket')
|
|
6
6
|
const {socketCommands} = require('./socketCommands')
|
|
7
|
-
const {eyesOpenMapValues, eyesOpenToCheckMapValues} = require('./eyesOpenMapping')
|
|
8
|
-
const {eyesCheckMapValues} = require('./eyesCheckMapping')
|
|
9
7
|
const {TestResultsSummary} = require('@applitools/eyes-api')
|
|
10
8
|
const refer = new Refer()
|
|
11
9
|
const socket = new Socket()
|
|
12
10
|
const throwErr = Cypress.config('failCypressOnDiff')
|
|
11
|
+
const {transformCypressConfig} = require('../../dist/browser/transformCypressConfig')
|
|
12
|
+
const {mergeCypressConfigs} = require('../../dist/browser/mergeCypressConfigs')
|
|
13
|
+
const {transformCypressCheckSettings} = require('../../dist/browser/transformCypressCheckSettings')
|
|
13
14
|
socketCommands(socket, refer)
|
|
14
15
|
|
|
15
16
|
let manager,
|
|
@@ -17,7 +18,7 @@ let manager,
|
|
|
17
18
|
closePromiseArr = [],
|
|
18
19
|
_summary,
|
|
19
20
|
connectedToUniversal,
|
|
20
|
-
|
|
21
|
+
openAndGlobalConfig
|
|
21
22
|
|
|
22
23
|
async function getSummary() {
|
|
23
24
|
if (_summary) return _summary
|
|
@@ -133,21 +134,15 @@ Cypress.Commands.add('eyesOpen', function (args = {}) {
|
|
|
133
134
|
(await socket.request('Core.makeManager', {
|
|
134
135
|
concurrency: Cypress.config('eyesTestConcurrency'),
|
|
135
136
|
type: 'ufg',
|
|
137
|
+
fetchConcurrency: Cypress.config('appliConfFile').eyesFetchConcurrency,
|
|
136
138
|
}))
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
const appliConfFile = Cypress.config('appliConfFile')
|
|
142
|
+
const mergedConfig = mergeCypressConfigs({globalConfig: appliConfFile, openConfig: {testName, ...args}})
|
|
143
|
+
openAndGlobalConfig = transformCypressConfig({...mergedConfig, shouldUseBrowserHooks})
|
|
140
144
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const settings = eyesOpenMapValues({
|
|
144
|
-
args,
|
|
145
|
-
appliConfFile,
|
|
146
|
-
testName,
|
|
147
|
-
shouldUseBrowserHooks,
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
eyes = await socket.request('EyesManager.openEyes', {manager, target, settings})
|
|
145
|
+
eyes = await socket.request('EyesManager.openEyes', {manager, target, config: openAndGlobalConfig})
|
|
151
146
|
})
|
|
152
147
|
})
|
|
153
148
|
|
|
@@ -160,16 +155,13 @@ Cypress.Commands.add('eyesCheckWindow', (args = {}) =>
|
|
|
160
155
|
|
|
161
156
|
Cypress.log({name: 'Eyes: check window'})
|
|
162
157
|
|
|
163
|
-
const settings =
|
|
164
|
-
args: {...openToCheckSettingsArgs, ...args},
|
|
165
|
-
refer,
|
|
166
|
-
appliConfFile: Cypress.config('appliConfFile'),
|
|
167
|
-
})
|
|
158
|
+
const settings = transformCypressCheckSettings(args, refer)
|
|
168
159
|
|
|
169
160
|
return socket.request('Eyes.check', {
|
|
170
161
|
eyes,
|
|
171
162
|
settings,
|
|
172
163
|
target,
|
|
164
|
+
config: openAndGlobalConfig,
|
|
173
165
|
})
|
|
174
166
|
}),
|
|
175
167
|
)
|
|
@@ -185,7 +177,7 @@ Cypress.Commands.add('eyesClose', () => {
|
|
|
185
177
|
}
|
|
186
178
|
|
|
187
179
|
// Eyes.close in core is not waiting on results anymore. So we should return it in order to await it
|
|
188
|
-
const p = socket.request('Eyes.close', {eyes}).catch(err => {
|
|
180
|
+
const p = socket.request('Eyes.close', {eyes, config: openAndGlobalConfig}).catch(err => {
|
|
189
181
|
console.log('Error in cy.eyesClose', err)
|
|
190
182
|
})
|
|
191
183
|
closePromiseArr.push(p)
|
|
@@ -193,6 +185,14 @@ Cypress.Commands.add('eyesClose', () => {
|
|
|
193
185
|
})
|
|
194
186
|
})
|
|
195
187
|
|
|
188
|
+
// internal command //
|
|
189
|
+
Cypress.Commands.add('debugHistory', async function () {
|
|
190
|
+
Cypress.log({name: 'Debug: history'})
|
|
191
|
+
const history = await socket.request('Debug.getHistory')
|
|
192
|
+
|
|
193
|
+
return history
|
|
194
|
+
})
|
|
195
|
+
|
|
196
196
|
function setRootContext() {
|
|
197
197
|
cy.state('window').document['applitools-marker'] = 'root-context'
|
|
198
198
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type {CypressEyesConfig} from '../expose'
|
|
2
|
+
|
|
3
|
+
export function mergeCypressConfigs({
|
|
4
|
+
globalConfig,
|
|
5
|
+
openConfig,
|
|
6
|
+
}: {
|
|
7
|
+
globalConfig: CypressEyesConfig
|
|
8
|
+
openConfig: CypressEyesConfig
|
|
9
|
+
}): CypressEyesConfig {
|
|
10
|
+
return {
|
|
11
|
+
...globalConfig,
|
|
12
|
+
...openConfig,
|
|
13
|
+
batch: {...globalConfig.batch, ...openConfig.batch},
|
|
14
|
+
}
|
|
15
|
+
}
|