@applitools/eyes-cypress 3.26.5 → 3.27.1
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 +22 -0
- package/README.md +52 -1
- package/bin/eyes-setup.js +10 -8
- package/package.json +8 -7
- package/src/browser/commands.js +1 -5
- package/src/browser/eyesCheckMapping.js +32 -4
- package/src/browser/refer.js +13 -3
- package/src/browser/spec-driver.ts +1 -1
- package/src/plugin/server.js +2 -0
- package/src/setup/handleCommands.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,28 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
## 3.27.1 - 2022/8/1
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
### Bug fixes
|
|
17
|
+
- Fix `Maximum call stack size exceeded` error in `eyesCheck`
|
|
18
|
+
|
|
19
|
+
## 3.27.0 - 2022/7/25
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
- Add support for padded coded regions
|
|
23
|
+
- Add support for dynamic coded regions
|
|
24
|
+
### Bug fixes
|
|
25
|
+
- Fix `npx eyes-setup` for Cypress version with a caret, support `e2e.ts` as support file
|
|
26
|
+
- Better support in DOM slot element
|
|
27
|
+
|
|
28
|
+
## 3.26.6 - 2022/7/15
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
- Internal architecture fixes
|
|
32
|
+
### Bug fixes
|
|
33
|
+
|
|
12
34
|
## 3.26.5 - 2022/7/12
|
|
13
35
|
|
|
14
36
|
### Features
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Eyes-Cypress
|
|
1
|
+
# Eyes-Cypress
|
|
2
2
|
|
|
3
3
|
Applitools Eyes SDK for [Cypress](https://www.cypress.io/).
|
|
4
4
|
|
|
@@ -213,6 +213,7 @@ Applitools will take screenshots and perform the visual comparisons in the backg
|
|
|
213
213
|
- [`layout`](#layout)
|
|
214
214
|
- [`strict`](#strict)
|
|
215
215
|
- [`content`](#content)
|
|
216
|
+
- [`padded coded regions`](#padded-coded-regions)
|
|
216
217
|
- [`accessibility`](#accessibility)
|
|
217
218
|
- [`region in shadow DOM`](#region-in-shadow-dom)
|
|
218
219
|
- [`scriptHooks`](#scripthooks)
|
|
@@ -224,6 +225,8 @@ Applitools will take screenshots and perform the visual comparisons in the backg
|
|
|
224
225
|
- [`enablePatterns`](#enablepatterns)
|
|
225
226
|
- [`matchLevel`](#matchlevel)
|
|
226
227
|
- [`visualGridOptions`](#visualgridoptions)
|
|
228
|
+
- [`coded regions-regionId`](#regionId)
|
|
229
|
+
- [`lazy loading`](#lazy-loading)
|
|
227
230
|
- [Close](#close)
|
|
228
231
|
- [GetAllTestResults](#getalltestresults)
|
|
229
232
|
- [deleteTestResults](#deletetestresults)
|
|
@@ -492,6 +495,22 @@ cy.get('.some-div-to-float').then($el => {
|
|
|
492
495
|
})
|
|
493
496
|
```
|
|
494
497
|
|
|
498
|
+
##### `padded coded regions`
|
|
499
|
+
|
|
500
|
+
```js
|
|
501
|
+
cy.get('some-region').then(el => {
|
|
502
|
+
cy.eyesCheckWindow({
|
|
503
|
+
// will add pedding to a region by a css selector at the left and top of the region
|
|
504
|
+
layout: {region: 'layout-region', padding: {left:20, top: 10}}
|
|
505
|
+
// will add padding of 20px to all JQuery elements at the top, button, right and left of the region
|
|
506
|
+
ignore: {element: el, padding: 20},
|
|
507
|
+
// will add padding for a DOM element on the top of the region
|
|
508
|
+
content: {element: el[0], padding: {top:10}}
|
|
509
|
+
})
|
|
510
|
+
|
|
511
|
+
})
|
|
512
|
+
```
|
|
513
|
+
|
|
495
514
|
##### `accessibility`
|
|
496
515
|
|
|
497
516
|
(optional): A single or an array of regions to perform accessibility checks, For example:
|
|
@@ -634,6 +653,38 @@ cy.eyesCheckWindow({
|
|
|
634
653
|
}
|
|
635
654
|
})
|
|
636
655
|
```
|
|
656
|
+
#### regionId
|
|
657
|
+
|
|
658
|
+
The regionId can be automaticaly set from the region that is passed or can be explicitly sent using `regionId` property
|
|
659
|
+
|
|
660
|
+
```js
|
|
661
|
+
cy.get('.region.two:nth-child(2)').then(el => {
|
|
662
|
+
cy.eyesCheckWindow({
|
|
663
|
+
fully: false,
|
|
664
|
+
ignore: [
|
|
665
|
+
{type: 'css', selector: '.region.three:nth-child(3n)'},
|
|
666
|
+
{type: 'xpath', selector: '//div[@class="region one"][3]'},
|
|
667
|
+
{element: el, regionId: 'my-region-id'},
|
|
668
|
+
],
|
|
669
|
+
});
|
|
670
|
+
})
|
|
671
|
+
```
|
|
672
|
+
#### lazy loading
|
|
673
|
+
|
|
674
|
+
It's possible to have the SDK scroll the entire page (or a specific length of the page) to make sure all lazyily loaded assets are on the page before performing a check.
|
|
675
|
+
|
|
676
|
+
```js
|
|
677
|
+
// lazy loads with sensible defaults
|
|
678
|
+
cy.eyesCheckWindow(lazyload:{})
|
|
679
|
+
|
|
680
|
+
// lazy loads with options specified
|
|
681
|
+
cy.eyesCheckWindow({lazyLoad: {
|
|
682
|
+
maxAmountToScroll: 1000, // total pixels of the page to be scrolled
|
|
683
|
+
scrollLength: 250, // amount of pixels to use for each scroll attempt
|
|
684
|
+
waitingTime: 500, // milliseconds to wait in-between each scroll attempt
|
|
685
|
+
}})
|
|
686
|
+
```
|
|
687
|
+
|
|
637
688
|
|
|
638
689
|
#### Close
|
|
639
690
|
|
package/bin/eyes-setup.js
CHANGED
|
@@ -8,6 +8,7 @@ const {handleTypeScript, handlerTypeScriptCypress10} = require('../src/setup/han
|
|
|
8
8
|
const {version} = require('../package');
|
|
9
9
|
const fs = require('fs');
|
|
10
10
|
const cwd = process.cwd();
|
|
11
|
+
const semver = require('semver');
|
|
11
12
|
|
|
12
13
|
console.log(chalk.cyan('Setup eyes-cypress', version));
|
|
13
14
|
const packageJson = JSON.parse(fs.readFileSync('package.json'));
|
|
@@ -18,17 +19,18 @@ if (packageJson.dependencies && packageJson.dependencies.cypress) {
|
|
|
18
19
|
} else if (packageJson.devDependencies && packageJson.devDependencies.cypress) {
|
|
19
20
|
cypressVersion = packageJson.devDependencies.cypress;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
const isCypress10 = parseFloat(cypressVersion, 10) >= 10 ? true : false;
|
|
22
|
+
const logStr = `Cypress version that was found ${cypressVersion}`;
|
|
23
23
|
try {
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
handleTypeScript(cwd);
|
|
28
|
-
} else {
|
|
29
|
-
handlePlugin(cwd, isCypress10);
|
|
24
|
+
if (semver.satisfies(semver.coerce(String(cypressVersion)), '>=10.0.0')) {
|
|
25
|
+
console.log(chalk.cyan(logStr, ' (above v10 handler)'));
|
|
26
|
+
handlePlugin(cwd, true);
|
|
30
27
|
const supportFilePath = handlerCommandsCypress10(cwd);
|
|
31
28
|
handlerTypeScriptCypress10(supportFilePath);
|
|
29
|
+
} else {
|
|
30
|
+
console.log(chalk.cyan(logStr));
|
|
31
|
+
handlePlugin(cwd, false);
|
|
32
|
+
handleCommands(cwd);
|
|
33
|
+
handleTypeScript(cwd);
|
|
32
34
|
}
|
|
33
35
|
} catch (e) {
|
|
34
36
|
console.log(chalk.red('Setup error:\n', e));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-cypress",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.27.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git://github.com/applitools/eyes.sdk.javascript1.git",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@applitools/eyes-api": "1.7.
|
|
59
|
-
"@applitools/eyes-universal": "2.
|
|
58
|
+
"@applitools/eyes-api": "1.7.5",
|
|
59
|
+
"@applitools/eyes-universal": "2.10.3",
|
|
60
60
|
"@applitools/functional-commons": "1.6.0",
|
|
61
61
|
"@applitools/logger": "1.1.15",
|
|
62
|
-
"@applitools/visual-grid-client": "15.13.
|
|
62
|
+
"@applitools/visual-grid-client": "15.13.13",
|
|
63
63
|
"chalk": "3.0.0",
|
|
64
64
|
"uuid": "8.3.2",
|
|
65
65
|
"ws": "8.5.0"
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@applitools/bongo": "^2.1.6",
|
|
69
69
|
"@applitools/scripts": "1.1.0",
|
|
70
|
-
"@applitools/sdk-coverage-tests": "^2.3.
|
|
70
|
+
"@applitools/sdk-coverage-tests": "^2.3.20",
|
|
71
71
|
"@applitools/snaptdout": "1.0.1",
|
|
72
72
|
"@applitools/test-server": "1.1.4",
|
|
73
|
-
"@applitools/test-utils": "1.4.
|
|
74
|
-
"@applitools/types": "^1.5.
|
|
73
|
+
"@applitools/test-utils": "1.4.3",
|
|
74
|
+
"@applitools/types": "^1.5.8",
|
|
75
75
|
"@applitools/utils": "1.3.10",
|
|
76
76
|
"@types/node": "12",
|
|
77
77
|
"@types/ws": "^8.2.2",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"ncp": "2.0.0",
|
|
93
93
|
"node-fetch": "2.6.0",
|
|
94
94
|
"prettier": "1.19.1",
|
|
95
|
+
"semver": "^7.3.7",
|
|
95
96
|
"typescript": "4.6.4"
|
|
96
97
|
},
|
|
97
98
|
"engines": {
|
package/src/browser/commands.js
CHANGED
|
@@ -7,11 +7,7 @@ const {socketCommands} = require('./socketCommands');
|
|
|
7
7
|
const {eyesOpenMapValues} = require('./eyesOpenMapping');
|
|
8
8
|
const {eyesCheckMapValues} = require('./eyesCheckMapping');
|
|
9
9
|
const {TestResultsSummary} = require('@applitools/eyes-api');
|
|
10
|
-
const refer = new Refer(
|
|
11
|
-
if (!value || !value.constructor || !value.constructor.name) return false;
|
|
12
|
-
const name = value.constructor.name;
|
|
13
|
-
return name === 'HTMLDocument' || name === 'Window' || value.ownerDocument;
|
|
14
|
-
});
|
|
10
|
+
const refer = new Refer();
|
|
15
11
|
const socket = new Socket();
|
|
16
12
|
const throwErr = Cypress.config('failCypressOnDiff');
|
|
17
13
|
socketCommands(socket, refer);
|
|
@@ -23,11 +23,11 @@ function eyesCheckMapValues({args, refer}) {
|
|
|
23
23
|
const checkSettings = {
|
|
24
24
|
name: config.tag,
|
|
25
25
|
hooks: config.scriptHooks,
|
|
26
|
-
ignoreRegions:
|
|
26
|
+
ignoreRegions: convertPaddedRegion(config.ignore),
|
|
27
27
|
floatingRegions: convertFloatingRegion(config.floating),
|
|
28
|
-
strictRegions:
|
|
29
|
-
layoutRegions:
|
|
30
|
-
contentRegions:
|
|
28
|
+
strictRegions: convertPaddedRegion(config.strict),
|
|
29
|
+
layoutRegions: convertPaddedRegion(config.layout),
|
|
30
|
+
contentRegions: convertPaddedRegion(config.content),
|
|
31
31
|
accessibilityRegions: convertAccessabilityRegions(config.accessibility),
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -82,6 +82,34 @@ function eyesCheckMapValues({args, refer}) {
|
|
|
82
82
|
|
|
83
83
|
// #region helper functions
|
|
84
84
|
|
|
85
|
+
function convertPaddedRegion(regions) {
|
|
86
|
+
if (!regions) return;
|
|
87
|
+
if (!Array.isArray(regions)) regions = [regions];
|
|
88
|
+
let resRegions = [];
|
|
89
|
+
for (const region of regions) {
|
|
90
|
+
if (region.element || isHTMLElement(region) || region.jquery) {
|
|
91
|
+
if (region.padding || region.regionId) {
|
|
92
|
+
let currRefElements = refElements(region.element);
|
|
93
|
+
for (const refElement of currRefElements) {
|
|
94
|
+
let curr = {region: refElement};
|
|
95
|
+
if (region.padding) {
|
|
96
|
+
curr.padding = region.padding;
|
|
97
|
+
}
|
|
98
|
+
if (region.regionId) {
|
|
99
|
+
curr.regionId = region.regionId;
|
|
100
|
+
}
|
|
101
|
+
resRegions.push(curr);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
resRegions = [...resRegions, ...refElements(region)];
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
resRegions.push(region);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return resRegions;
|
|
111
|
+
}
|
|
112
|
+
|
|
85
113
|
function convertAccessabilityRegions(accessibilityRegions) {
|
|
86
114
|
if (!accessibilityRegions) return accessibilityRegions;
|
|
87
115
|
const accessibility = [];
|
package/src/browser/refer.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/* global Node */
|
|
2
2
|
|
|
3
|
+
const uuid = require('uuid');
|
|
3
4
|
const REF_ID = 'applitools-ref-id';
|
|
5
|
+
|
|
4
6
|
class Refer {
|
|
5
|
-
constructor(
|
|
7
|
+
constructor() {
|
|
6
8
|
this.store = new Map();
|
|
7
9
|
this.relation = new Map();
|
|
8
|
-
this.check = check;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
isRef(ref) {
|
|
12
13
|
return Boolean(ref && ref[REF_ID]);
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
check(value) {
|
|
17
|
+
return (
|
|
18
|
+
value &&
|
|
19
|
+
(value.nodeType === Node.ELEMENT_NODE ||
|
|
20
|
+
value.nodeType === Node.DOCUMENT_NODE ||
|
|
21
|
+
value.ownerDocument ||
|
|
22
|
+
(value.constructor && value.constructor.name === 'Window'))
|
|
23
|
+
);
|
|
24
|
+
}
|
|
15
25
|
ref(value, parentRef) {
|
|
16
26
|
if (this.check(value)) {
|
|
17
27
|
const ref = uuid.v4();
|
|
@@ -61,7 +61,7 @@ export function setViewportSize(vs: any): void {
|
|
|
61
61
|
export function transformSelector(selector: Selector): Selector {
|
|
62
62
|
if (selector.hasOwnProperty('selector') && (!selector.hasOwnProperty('type') || (selector as EyesSelector).type === 'css')) {
|
|
63
63
|
return (selector as EyesSelector).selector
|
|
64
|
-
}
|
|
64
|
+
}
|
|
65
65
|
return selector
|
|
66
66
|
}
|
|
67
67
|
|
package/src/plugin/server.js
CHANGED
|
@@ -34,6 +34,8 @@ function makeStartServer({logger}) {
|
|
|
34
34
|
const {port: universalPort, close: closeUniversalServer} = await makeServerProcess({
|
|
35
35
|
key: path.resolve(__dirname, '../pem/server.key'),
|
|
36
36
|
cert: path.resolve(__dirname, '../pem/server.cert'),
|
|
37
|
+
detached: false,
|
|
38
|
+
idleTimeout: 0,
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
const managers = [];
|
|
@@ -33,6 +33,8 @@ function handlerCommandsCypress10(cwd) {
|
|
|
33
33
|
} else {
|
|
34
34
|
if (fs.existsSync(path.resolve(cwd, 'cypress/support/e2e.js'))) {
|
|
35
35
|
supportFilePath = path.resolve(cwd, 'cypress/support/e2e.js');
|
|
36
|
+
} else if (fs.existsSync(path.resolve(cwd, 'cypress/support/e2e.ts'))) {
|
|
37
|
+
supportFilePath = path.resolve(cwd, 'cypress/support/e2e.ts');
|
|
36
38
|
} else if (fs.existsSync(path.resolve(cwd, 'cypress/support/component.js'))) {
|
|
37
39
|
supportFilePath = path.resolve(cwd, 'cypress/support/component.js');
|
|
38
40
|
}
|