@applitools/eyes-cypress 3.22.7 → 3.23.2
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 +19 -0
- package/README.md +16 -0
- package/package.json +4 -4
- package/src/browser/commands.js +14 -2
- package/src/browser/eyesCheckWindow.js +8 -2
- package/src/plugin/config.js +1 -0
- package/src/plugin/{shouldSetGlobalHooks.js → isGlobalHooksSupported.js} +2 -2
- package/src/plugin/pluginExport.js +14 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 3.23.2 - 2021/11/17
|
|
7
|
+
|
|
8
|
+
- updated to @applitools/visual-grid-client@15.8.46 (from 15.8.45)
|
|
9
|
+
|
|
10
|
+
## 3.23.1 - 2021/11/15
|
|
11
|
+
|
|
12
|
+
- fix types for region inside shadow
|
|
13
|
+
- updated to @applitools/visual-grid-client@15.8.45 (from 15.8.44)
|
|
14
|
+
|
|
15
|
+
## 3.23.0 - 2021/11/11
|
|
16
|
+
|
|
17
|
+
- support waitBeforeCapture
|
|
18
|
+
- updated to @applitools/visual-grid-client@15.8.44 (from 15.8.43)
|
|
19
|
+
|
|
20
|
+
## 3.22.8 - 2021/11/9
|
|
21
|
+
|
|
22
|
+
- fix not calling the global hooks before:run and after:run at all, unless the user also called them in his plugins file.
|
|
23
|
+
- fix not calling the browser hooks for Cypress versions < 6.2.0 (where global hooks are not supported).
|
|
24
|
+
|
|
6
25
|
## 3.22.7 - 2021/11/7
|
|
7
26
|
|
|
8
27
|
- replace legacy logger construction with new
|
package/README.md
CHANGED
|
@@ -192,6 +192,7 @@ Applitools will take screenshots and perform the visual comparisons in the backg
|
|
|
192
192
|
- [layoutBreakpoints](#layoutBreakpoints)
|
|
193
193
|
- [sendDom](#sendDom)
|
|
194
194
|
- [variationGroupId](#variationGroupId)
|
|
195
|
+
- [waitBeforeCapture](#waitBeforeCapture)
|
|
195
196
|
- [Close](#Close)
|
|
196
197
|
- [Concurrency](#Concurrency)
|
|
197
198
|
- [Advanced configuration](#Advanced-configuration)
|
|
@@ -449,6 +450,20 @@ cy.eyesCheckWindow({variationGroupId: 'Login screen variation #1'})
|
|
|
449
450
|
|
|
450
451
|
For more information, visit our documentation page: https://applitools.com/docs/features/baseline-variations-groups.html
|
|
451
452
|
|
|
453
|
+
##### `waitBeforeCapture`
|
|
454
|
+
|
|
455
|
+
A parameter that is set to wait a certain amount of milliseconds before capturing the pages snapshot. This will also apply between page resizes when using `layoutBreakpoints`.
|
|
456
|
+
|
|
457
|
+
```
|
|
458
|
+
cy.eyesOpen({
|
|
459
|
+
waitBeforeCapture: 1000
|
|
460
|
+
// ...
|
|
461
|
+
})
|
|
462
|
+
|
|
463
|
+
cy.eyesCheckWindow({
|
|
464
|
+
waitBeforeCapture: 1000
|
|
465
|
+
})
|
|
466
|
+
```
|
|
452
467
|
|
|
453
468
|
##### `useDom`
|
|
454
469
|
|
|
@@ -544,6 +559,7 @@ The list above is also the order of precedence, which means that if you pass a p
|
|
|
544
559
|
| `accessibilityValidation` | undefined | An object that specifies the accessibility level and guidelines version to use for the screenshots. Possible values for **level** are `None`, `AA` and `AAA`, and possible values for **guidelinesVersion** are `WCAG_2_0` and `WCAG_2_1`. For example: `{level: 'AA', guidelinesVersion: 'WCAG_2_0'}`|
|
|
545
560
|
| `visualGridOptions` | undefined | An object that specifies options to configure renderings on the Ultrafast grid. See more information [here](#visualgridoptions) |
|
|
546
561
|
|`layoutBreakpoints`| undefined | When set to `true`, a snapshot of the DOM will be taken once for each browser/device size in the `browser` configuration. For optimization purposes, an array of numbers can be passed. The DOM snapshot will be taken once for every **width** in the array. For more information, see [layoutBreakpoints](#layoutBreakpoints)|
|
|
562
|
+
|`waitBeforeCapture`| 100 | A parameter that is set to wait a certain amount of milliseconds before capturing the pages snapshot. This will also apply between page resizes when using `layoutBreakpoints`.
|
|
547
563
|
|
|
548
564
|
### Global configuration properties:
|
|
549
565
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-cypress",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.23.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@applitools/dom-snapshot": "4.5.10",
|
|
43
43
|
"@applitools/functional-commons": "1.6.0",
|
|
44
44
|
"@applitools/logger": "1.0.5",
|
|
45
|
-
"@applitools/visual-grid-client": "15.8.
|
|
45
|
+
"@applitools/visual-grid-client": "15.8.46",
|
|
46
46
|
"body-parser": "1.19.0",
|
|
47
47
|
"chalk": "3.0.0",
|
|
48
48
|
"cors": "2.8.5",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@applitools/scripts": "^1.0.1",
|
|
54
54
|
"@applitools/sdk-release-kit": "0.13.4",
|
|
55
|
-
"@applitools/sdk-shared": "0.9.
|
|
55
|
+
"@applitools/sdk-shared": "0.9.9",
|
|
56
56
|
"@applitools/snaptdout": "1.0.1",
|
|
57
|
-
"@applitools/test-server": "1.0.
|
|
57
|
+
"@applitools/test-server": "1.0.7",
|
|
58
58
|
"chai": "^4.2.0",
|
|
59
59
|
"chai-spies": "^1.0.0",
|
|
60
60
|
"cookie-parser": "^1.4.4",
|
package/src/browser/commands.js
CHANGED
|
@@ -18,7 +18,13 @@ function getGlobalConfigProperty(prop) {
|
|
|
18
18
|
const shouldParse = ['eyesBrowser', 'eyesLayoutBreakpoints'];
|
|
19
19
|
return property ? (shouldParse.includes(prop) ? JSON.parse(property) : property) : undefined;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
const shouldUseBrowserHooks =
|
|
23
|
+
!getGlobalConfigProperty('eyesIsDisabled') &&
|
|
24
|
+
(getGlobalConfigProperty('isInteractive') ||
|
|
25
|
+
!getGlobalConfigProperty('eyesIsGlobalHooksSupported'));
|
|
26
|
+
|
|
27
|
+
if (shouldUseBrowserHooks) {
|
|
22
28
|
const batchEnd = poll(() => {
|
|
23
29
|
return sendRequest({command: 'batchEnd'});
|
|
24
30
|
});
|
|
@@ -94,6 +100,7 @@ Cypress.Commands.add('eyesCheckWindow', args => {
|
|
|
94
100
|
const globalArgs = {
|
|
95
101
|
browser: getGlobalConfigProperty('eyesBrowser'),
|
|
96
102
|
layoutBreakpoints: getGlobalConfigProperty('eyesLayoutBreakpoints'),
|
|
103
|
+
waitBeforeCapture: getGlobalConfigProperty('eyesWaitBeforeCapture'),
|
|
97
104
|
};
|
|
98
105
|
|
|
99
106
|
const browser = eyesOpenArgs.browser || globalArgs.browser || defaultBrowser;
|
|
@@ -102,7 +109,12 @@ Cypress.Commands.add('eyesCheckWindow', args => {
|
|
|
102
109
|
(eyesOpenArgs && eyesOpenArgs.layoutBreakpoints) ||
|
|
103
110
|
globalArgs.layoutBreakpoints;
|
|
104
111
|
|
|
105
|
-
const
|
|
112
|
+
const waitBeforeCapture =
|
|
113
|
+
(args && args.waitBeforeCapture) ||
|
|
114
|
+
(eyesOpenArgs && eyesOpenArgs.waitBeforeCapture) ||
|
|
115
|
+
globalArgs.waitBeforeCapture;
|
|
116
|
+
|
|
117
|
+
const checkArgs = {layoutBreakpoints, browser, waitBeforeCapture};
|
|
106
118
|
if (typeof args === 'object') {
|
|
107
119
|
Object.assign(checkArgs, args);
|
|
108
120
|
} else {
|
|
@@ -21,11 +21,17 @@ function makeEyesCheckWindow({sendRequest, processPage, domSnapshotOptions, cypr
|
|
|
21
21
|
function takeDomSnapshots(options) {
|
|
22
22
|
const browser = args.browser;
|
|
23
23
|
const breakpoints = args.layoutBreakpoints;
|
|
24
|
+
const waitBeforeCapture = args.waitBeforeCapture ? args.waitBeforeCapture : 100;
|
|
24
25
|
const browsers = Array.isArray(browser) ? browser : [browser];
|
|
25
26
|
|
|
26
27
|
if (!breakpoints) {
|
|
27
28
|
//console.log('no breakpoints, taking single dom snapshot');
|
|
28
|
-
return
|
|
29
|
+
return cypress
|
|
30
|
+
.wrap({}, {log: false})
|
|
31
|
+
.wait(waitBeforeCapture)
|
|
32
|
+
.then(() => {
|
|
33
|
+
return takeDomSnapshot(options);
|
|
34
|
+
});
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
return browsers
|
|
@@ -52,7 +58,7 @@ function makeEyesCheckWindow({sendRequest, processPage, domSnapshotOptions, cypr
|
|
|
52
58
|
// console.log(`taking dom snapshot for width ${requiredWidth}`);
|
|
53
59
|
cypress
|
|
54
60
|
.viewport(Number(requiredWidth), height, {log: false})
|
|
55
|
-
.wait(
|
|
61
|
+
.wait(waitBeforeCapture, {log: false})
|
|
56
62
|
.then({log: false, timeout: 900000}, () => {
|
|
57
63
|
return takeDomSnapshot(options).then(snapshot => {
|
|
58
64
|
browsersInfo.forEach(({index}) => (snapshots[index] = snapshot));
|
package/src/plugin/config.js
CHANGED
|
@@ -43,6 +43,7 @@ function makeConfig() {
|
|
|
43
43
|
config.failCypressOnDiff === undefined ? true : !!config.failCypressOnDiff,
|
|
44
44
|
eyesDisableBrowserFetching: !!config.disableBrowserFetching,
|
|
45
45
|
eyesTestConcurrency: config.testConcurrency || DEFAULT_TEST_CONCURRENCY,
|
|
46
|
+
eyesWaitBeforeCapture: config.waitBeforeCapture,
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
return {config, eyesConfig};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const CYPRESS_SUPPORTED_VERSION = '6.2.0';
|
|
2
2
|
const CYPRESS_NO_FLAG_VERSION = '6.7.0';
|
|
3
3
|
|
|
4
|
-
function
|
|
4
|
+
function isGlobalHooksSupported(config) {
|
|
5
5
|
const {version, experimentalRunEvents} = config;
|
|
6
6
|
|
|
7
7
|
return (
|
|
@@ -10,4 +10,4 @@ function shouldSetGlobalHooks(config) {
|
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
module.exports =
|
|
13
|
+
module.exports = isGlobalHooksSupported;
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
const
|
|
2
|
+
const isGlobalHooksSupported = require('./isGlobalHooksSupported');
|
|
3
3
|
const {presult} = require('@applitools/functional-commons');
|
|
4
4
|
|
|
5
5
|
function makePluginExport({startServer, eyesConfig, globalHooks}) {
|
|
6
6
|
return function pluginExport(pluginModule) {
|
|
7
7
|
let closeEyesServer;
|
|
8
8
|
const pluginModuleExports = pluginModule.exports;
|
|
9
|
-
pluginModule.exports = async (...args)
|
|
9
|
+
pluginModule.exports = async function(...args) {
|
|
10
10
|
const {eyesPort, closeServer} = await startServer();
|
|
11
11
|
closeEyesServer = closeServer;
|
|
12
12
|
const [origOn, config] = args;
|
|
13
|
+
let isGlobalHookCalledFromUserHandler = false;
|
|
14
|
+
eyesConfig.eyesIsGlobalHooksSupported = isGlobalHooksSupported(config);
|
|
13
15
|
const moduleExportsResult = await pluginModuleExports(onThatCallsUserDefinedHandler, config);
|
|
16
|
+
if (eyesConfig.eyesIsGlobalHooksSupported && !isGlobalHookCalledFromUserHandler) {
|
|
17
|
+
for (const [eventName, eventHandler] of Object.entries(globalHooks)) {
|
|
18
|
+
origOn.call(this, eventName, eventHandler);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
14
21
|
return Object.assign({}, eyesConfig, {eyesPort}, moduleExportsResult);
|
|
15
22
|
|
|
16
23
|
// This piece of code exists because at the point of writing, Cypress does not support multiple event handlers:
|
|
@@ -19,8 +26,11 @@ function makePluginExport({startServer, eyesConfig, globalHooks}) {
|
|
|
19
26
|
// in addition to the user's handler
|
|
20
27
|
function onThatCallsUserDefinedHandler(eventName, handler) {
|
|
21
28
|
const isRunEvent = eventName === 'before:run' || eventName === 'after:run';
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
let handlerToCall = handler;
|
|
30
|
+
if (eyesConfig.eyesIsGlobalHooksSupported && isRunEvent) {
|
|
31
|
+
handlerToCall = handlerThatCallsUserDefinedHandler;
|
|
32
|
+
isGlobalHookCalledFromUserHandler = true;
|
|
33
|
+
}
|
|
24
34
|
return origOn.call(this, eventName, handlerToCall);
|
|
25
35
|
|
|
26
36
|
async function handlerThatCallsUserDefinedHandler() {
|