@argos-ci/cypress 3.3.2 → 3.4.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/dist/support.js +30 -14
- package/package.json +3 -3
package/dist/support.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@argos-ci/util/browser";
|
|
12
12
|
|
|
13
13
|
// package.json
|
|
14
|
-
var version = "3.3.
|
|
14
|
+
var version = "3.3.3";
|
|
15
15
|
|
|
16
16
|
// src/support.ts
|
|
17
17
|
function injectArgos() {
|
|
@@ -22,18 +22,33 @@ function injectArgos() {
|
|
|
22
22
|
window.eval(getGlobalScript());
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function beforeAll(options) {
|
|
26
26
|
const { argosCSS } = options;
|
|
27
27
|
const fullPage = !options.capture || options.capture === "fullPage";
|
|
28
28
|
cy.window({ log: false }).then(
|
|
29
|
-
(window) => window.__ARGOS__.
|
|
29
|
+
(window) => window.__ARGOS__.beforeAll({
|
|
30
|
+
fullPage,
|
|
31
|
+
argosCSS
|
|
32
|
+
})
|
|
30
33
|
);
|
|
31
34
|
return () => {
|
|
32
35
|
cy.window({ log: false }).then(
|
|
33
|
-
(window) => window.__ARGOS__.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
(window) => window.__ARGOS__.afterAll()
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function beforeEach(options) {
|
|
41
|
+
const { argosCSS } = options;
|
|
42
|
+
const fullPage = !options.capture || options.capture === "fullPage";
|
|
43
|
+
cy.window({ log: false }).then(
|
|
44
|
+
(window) => window.__ARGOS__.beforeEach({
|
|
45
|
+
fullPage,
|
|
46
|
+
argosCSS
|
|
47
|
+
})
|
|
48
|
+
);
|
|
49
|
+
return () => {
|
|
50
|
+
cy.window({ log: false }).then(
|
|
51
|
+
(window) => window.__ARGOS__.afterEach()
|
|
37
52
|
);
|
|
38
53
|
};
|
|
39
54
|
}
|
|
@@ -56,17 +71,19 @@ Cypress.Commands.add(
|
|
|
56
71
|
message: name
|
|
57
72
|
});
|
|
58
73
|
injectArgos();
|
|
59
|
-
const
|
|
74
|
+
const afterAll = beforeAll(options);
|
|
60
75
|
function stabilizeAndScreenshot(name2) {
|
|
61
76
|
if (stabilize) {
|
|
62
77
|
const stabilizationOptions = typeof stabilize === "object" ? stabilize : {};
|
|
63
78
|
cy.waitUntil(
|
|
64
79
|
() => cy.window({ log: false }).then((window) => {
|
|
65
|
-
const isStable = window.__ARGOS__.
|
|
80
|
+
const isStable = window.__ARGOS__.waitFor(
|
|
81
|
+
stabilizationOptions
|
|
82
|
+
);
|
|
66
83
|
if (isStable) {
|
|
67
84
|
return true;
|
|
68
85
|
}
|
|
69
|
-
const failureReasons = window.__ARGOS__.
|
|
86
|
+
const failureReasons = window.__ARGOS__.getWaitFailureExplanations(stabilizationOptions);
|
|
70
87
|
failureReasons.forEach((reason) => {
|
|
71
88
|
cy.log(`[argos] stability: ${reason}`);
|
|
72
89
|
});
|
|
@@ -74,6 +91,7 @@ Cypress.Commands.add(
|
|
|
74
91
|
})
|
|
75
92
|
);
|
|
76
93
|
}
|
|
94
|
+
const afterEach = beforeEach(options);
|
|
77
95
|
const ref = {};
|
|
78
96
|
cy.wrap(subject).screenshot(name2, {
|
|
79
97
|
blackout: ['[data-visual-test="blackout"]'].concat(
|
|
@@ -122,9 +140,7 @@ Cypress.Commands.add(
|
|
|
122
140
|
}
|
|
123
141
|
cy.writeFile(getMetadataPath(ref.props.path), JSON.stringify(metadata));
|
|
124
142
|
});
|
|
125
|
-
|
|
126
|
-
window.__ARGOS__.afterEach();
|
|
127
|
-
});
|
|
143
|
+
afterEach();
|
|
128
144
|
}
|
|
129
145
|
if (viewports) {
|
|
130
146
|
for (const viewport of viewports) {
|
|
@@ -141,6 +157,6 @@ Cypress.Commands.add(
|
|
|
141
157
|
} else {
|
|
142
158
|
stabilizeAndScreenshot(name);
|
|
143
159
|
}
|
|
144
|
-
|
|
160
|
+
afterAll();
|
|
145
161
|
}
|
|
146
162
|
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/cypress",
|
|
3
3
|
"description": "Cypress SDK for visual testing with Argos.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"node": ">=18.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@argos-ci/browser": "3.
|
|
48
|
+
"@argos-ci/browser": "3.2.0",
|
|
49
49
|
"@argos-ci/core": "3.1.0",
|
|
50
50
|
"@argos-ci/util": "2.3.0",
|
|
51
51
|
"cypress-wait-until": "^3.0.2"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"test": "pnpm exec cypress run",
|
|
66
66
|
"e2e": "UPLOAD_TO_ARGOS=true pnpm run test"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "fae9639b570fb2cd937ce8695eed1941c25678db"
|
|
69
69
|
}
|