@applitools/eyes-cypress 3.57.0 → 3.57.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
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.57.1](https://github.com/Applitools-Dev/sdk/compare/js/eyes-cypress@3.57.0...js/eyes-cypress@3.57.1) (2025-12-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* improve error notification (UFG) | AD-12270 ([#3418](https://github.com/Applitools-Dev/sdk/issues/3418)) ([a4efc55](https://github.com/Applitools-Dev/sdk/commit/a4efc55cd178dc13096fbfb066c287b0d6a452d3))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/dom-snapshot bumped to 4.15.4
|
|
14
|
+
#### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* CSS variables in Shadow DOM style tags not expanded | FLD-3790 ([#3427](https://github.com/Applitools-Dev/sdk/issues/3427)) ([3d84b5f](https://github.com/Applitools-Dev/sdk/commit/3d84b5f120dd5e72dea5ec77b5d446e7ca696d52))
|
|
17
|
+
* @applitools/core bumped to 4.54.1
|
|
18
|
+
#### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* improve error notification (UFG) | AD-12270 ([#3418](https://github.com/Applitools-Dev/sdk/issues/3418)) ([a4efc55](https://github.com/Applitools-Dev/sdk/commit/a4efc55cd178dc13096fbfb066c287b0d6a452d3))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
* @applitools/eyes bumped to 1.36.19
|
|
25
|
+
|
|
26
|
+
|
|
3
27
|
## [3.57.0](https://github.com/Applitools-Dev/sdk/compare/js/eyes-cypress@3.56.6...js/eyes-cypress@3.57.0) (2025-12-14)
|
|
4
28
|
|
|
5
29
|
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const NewTestError_1 = require("@applitools/eyes/dist/errors/NewTestError");
|
|
3
4
|
function getErrorsAndDiffs(testResultsArr) {
|
|
4
5
|
return testResultsArr.reduce(({ failed, diffs, passed }, testResults) => {
|
|
5
6
|
if (testResults instanceof Error || testResults.error) {
|
|
6
|
-
|
|
7
|
+
if (testResults.error && Object.keys(testResults).length > 1) {
|
|
8
|
+
failed.push(testResults);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
failed.push(testResults instanceof Error ? testResults : new Error(testResults.error.message));
|
|
12
|
+
}
|
|
7
13
|
}
|
|
8
14
|
else {
|
|
9
15
|
const testStatus = testResults.status;
|
|
@@ -13,7 +19,7 @@ function getErrorsAndDiffs(testResultsArr) {
|
|
|
13
19
|
else {
|
|
14
20
|
if (testStatus === 'Unresolved') {
|
|
15
21
|
if (testResults.isNew) {
|
|
16
|
-
testResults.error = new
|
|
22
|
+
testResults.error = new NewTestError_1.NewTestError(`${testResults.name}. Please approve the new baseline at ${testResults.url}`);
|
|
17
23
|
failed.push(testResults);
|
|
18
24
|
}
|
|
19
25
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-cypress",
|
|
3
|
-
"version": "3.57.
|
|
3
|
+
"version": "3.57.1",
|
|
4
4
|
"homepage": "https://applitools.com/tutorials/sdks/cypress",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"test:ts:run": "yarn cypress$APPLITOOLS_FRAMEWORK_VERSION run --browser chrome --project ./test/e2e/ts --config-file ./cypress-$APPLITOOLS_FRAMEWORK_VERSION.config.ts",
|
|
42
42
|
"test:coverage": "cd test/generic && yarn && MOCHA_GROUP=coverage APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-cypress' APPLITOOLS_BATCH_ID=$(uuidgen) npx cypress run",
|
|
43
43
|
"test:coverage:chrome": "cd test/generic && yarn && MOCHA_GROUP=coverage APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-cypress' APPLITOOLS_BATCH_ID=$(uuidgen) npx cypress run --browser chrome",
|
|
44
|
-
"test:e2e": "MOCHA_GROUP=e2e mkdir -p test/fixtures/testAppCopies && run --top-level mocha --no-timeouts 'test/e2e/**/*.test.js'",
|
|
44
|
+
"test:e2e": "MOCHA_GROUP=e2e mkdir -p test/fixtures/testAppCopies && run --top-level mocha --no-timeouts 'test/e2e/**/*.test.js' --parallel --jobs 4",
|
|
45
45
|
"test:components": "cd test/components && yarn && npx cypress run --component",
|
|
46
46
|
"cypress": "cypress open --config-file test/fixtures/cypress-play.json",
|
|
47
47
|
"cypress:new": "cd test/play && yarn && npx cypress open",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"setup": "run --top-level xvfb:setup"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@applitools/core": "4.54.
|
|
56
|
-
"@applitools/eyes": "1.36.
|
|
55
|
+
"@applitools/core": "4.54.1",
|
|
56
|
+
"@applitools/eyes": "1.36.19",
|
|
57
57
|
"@applitools/functional-commons": "1.6.0",
|
|
58
58
|
"@applitools/logger": "2.2.7",
|
|
59
59
|
"@applitools/utils": "1.14.1",
|
package/src/browser/commands.js
CHANGED
|
@@ -6,6 +6,10 @@ const Socket = require('./socket')
|
|
|
6
6
|
const {socketCommands} = require('./socketCommands')
|
|
7
7
|
const {TestResultsSummaryData: TestResultsSummary} = require('@applitools/eyes/dist/output/TestResultsSummary')
|
|
8
8
|
const {TestResultsData} = require('@applitools/eyes/dist/output/TestResults')
|
|
9
|
+
const {NewTestError} = require('@applitools/eyes/dist/errors/NewTestError')
|
|
10
|
+
const {TestFailedError} = require('@applitools/eyes/dist/errors/TestFailedError')
|
|
11
|
+
const {DiffsFoundError} = require('@applitools/eyes/dist/errors/DiffsFoundError')
|
|
12
|
+
|
|
9
13
|
const refer = new Refer()
|
|
10
14
|
const target = refer.ref('__CYPRESS_DRIVER__')
|
|
11
15
|
const socket = new Socket()
|
|
@@ -44,6 +48,11 @@ function getGlobalConfigProperty(prop) {
|
|
|
44
48
|
return property ? (shouldParse.includes(prop) ? JSON.parse(property) : property) : undefined
|
|
45
49
|
}
|
|
46
50
|
|
|
51
|
+
function printToLog(message) {
|
|
52
|
+
Cypress.log({name: 'Eyes Log', message})
|
|
53
|
+
// cy.task('log', message)
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
// tasks = tapFile and closeBatch
|
|
48
57
|
const shouldDoPostSpecTasks =
|
|
49
58
|
!getGlobalConfigProperty('eyesIsDisabled') &&
|
|
@@ -53,8 +62,15 @@ const shouldCallAfterHook =
|
|
|
53
62
|
(shouldDoPostSpecTasks || Cypress.config('eyesFailCypressOnDiff')) &&
|
|
54
63
|
!Cypress.config('appliConfFile').failCypressAfterAllSpecs
|
|
55
64
|
|
|
65
|
+
const notFailCypressAfterAllSpecs = !Cypress.config('appliConfFile').failCypressAfterAllSpecs
|
|
66
|
+
|
|
56
67
|
Cypress.Commands.add('eyesGetAllTestResults', () => {
|
|
57
68
|
Cypress.log({name: 'Eyes: getAllTestResults'})
|
|
69
|
+
printToLog(
|
|
70
|
+
`Eyes: getAllTestResults commands eyesFailCypressOnDiff:${Cypress.config(
|
|
71
|
+
'eyesFailCypressOnDiff',
|
|
72
|
+
)}, failCypressAfterAllSpecs:${Cypress.config('appliConfFile').failCypressAfterAllSpecs}`,
|
|
73
|
+
)
|
|
58
74
|
return cy.then({timeout: 86400000}, async () => {
|
|
59
75
|
if (isCurrentTestDisabled) {
|
|
60
76
|
isCurrentTestDisabled = false
|
|
@@ -62,6 +78,11 @@ Cypress.Commands.add('eyesGetAllTestResults', () => {
|
|
|
62
78
|
}
|
|
63
79
|
|
|
64
80
|
const summary = await getSummary()
|
|
81
|
+
const hasErrors = summary.results?.some(({result}) => result.error !== undefined && isNonVisualTestError(result))
|
|
82
|
+
if (hasErrors && !shouldCallAfterHook && notFailCypressAfterAllSpecs) {
|
|
83
|
+
printToLog('Eyes: throwErrorIfExistsInSummary for all')
|
|
84
|
+
await throwErrorIfExistsInSummary(summary, true, true)
|
|
85
|
+
}
|
|
65
86
|
return new TestResultsSummary({summary, core: {deleteTest}})
|
|
66
87
|
})
|
|
67
88
|
})
|
|
@@ -79,30 +100,14 @@ Cypress.Commands.add('eyesGetResults', (args = {}) => {
|
|
|
79
100
|
if (shouldCallAfterHook) {
|
|
80
101
|
after(() => {
|
|
81
102
|
if (!manager) return
|
|
103
|
+
printToLog('Eyes: shouldCallAfterHook after each spec')
|
|
82
104
|
return cy.then({timeout: 86400000}, async () => {
|
|
83
105
|
if (isCurrentTestDisabled) {
|
|
84
106
|
isCurrentTestDisabled = false
|
|
85
107
|
return
|
|
86
108
|
}
|
|
87
|
-
const resultConfig = {
|
|
88
|
-
showLogs: Cypress.config('appliConfFile').showLogs,
|
|
89
|
-
shouldThrowError: Cypress.config('eyesFailCypressOnDiff'),
|
|
90
|
-
isTextTerminal: Cypress.config('isTextTerminal'),
|
|
91
|
-
tapDirPath: Cypress.config('appliConfFile').tapDirPath,
|
|
92
|
-
tapFileName: Cypress.config('appliConfFile').tapFileName,
|
|
93
|
-
shouldCreateTapFile: shouldDoPostSpecTasks,
|
|
94
|
-
}
|
|
95
|
-
|
|
96
109
|
const summary = await getSummary()
|
|
97
|
-
|
|
98
|
-
const message = await socket.request('Test.printTestResults', {testResults, resultConfig})
|
|
99
|
-
if (
|
|
100
|
-
!!getGlobalConfigProperty('eyesFailCypressOnDiff') &&
|
|
101
|
-
message &&
|
|
102
|
-
message.includes('Eyes-Cypress detected diffs or errors')
|
|
103
|
-
) {
|
|
104
|
-
throw new Error(message)
|
|
105
|
-
}
|
|
110
|
+
await throwErrorIfExistsInSummary(summary, Cypress.config('eyesFailCypressOnDiff'), false)
|
|
106
111
|
})
|
|
107
112
|
})
|
|
108
113
|
}
|
|
@@ -204,6 +209,61 @@ Cypress.Commands.add('debugHistory', async function () {
|
|
|
204
209
|
return history
|
|
205
210
|
})
|
|
206
211
|
|
|
212
|
+
function isNewTestError(testResult) {
|
|
213
|
+
const result = testResult.error instanceof NewTestError
|
|
214
|
+
printToLog(`Eyes: isNewTestError result: ${result} for testResult.error: ${JSON.stringify(testResult.error)}`)
|
|
215
|
+
return result
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function isTestFailedError(testResult) {
|
|
219
|
+
const result = testResult.error instanceof TestFailedError
|
|
220
|
+
printToLog(`Eyes: isTestFailedError result: ${result} for testResult.error: ${JSON.stringify(testResult.error)}`)
|
|
221
|
+
return result
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function isDiffsFoundError(testResult) {
|
|
225
|
+
const result = testResult.error instanceof DiffsFoundError
|
|
226
|
+
printToLog(`Eyes: isDiffsFoundError result: ${result} for testResult.error: ${JSON.stringify(testResult.error)}`)
|
|
227
|
+
return result
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function isNonVisualTestError(testResult) {
|
|
231
|
+
const result =
|
|
232
|
+
testResult.error && !isNewTestError(testResult) && !isTestFailedError(testResult) && !isDiffsFoundError(testResult)
|
|
233
|
+
printToLog(`Eyes: isNonVisualTestError result: ${result} for testResult.error: ${JSON.stringify(testResult.error)}`)
|
|
234
|
+
return result
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
async function throwErrorIfExistsInSummary(summary, shouldThrowError, shouldDisplayCriticalErrors) {
|
|
238
|
+
const resultConfig = {
|
|
239
|
+
showLogs: Cypress.config('appliConfFile').showLogs,
|
|
240
|
+
shouldThrowError: shouldThrowError,
|
|
241
|
+
isTextTerminal: Cypress.config('isTextTerminal'),
|
|
242
|
+
tapDirPath: Cypress.config('appliConfFile').tapDirPath,
|
|
243
|
+
tapFileName: Cypress.config('appliConfFile').tapFileName,
|
|
244
|
+
shouldCreateTapFile: shouldDoPostSpecTasks,
|
|
245
|
+
}
|
|
246
|
+
const testResults = summary.results?.map(({result}) => result) ?? []
|
|
247
|
+
const filteredTestResults = shouldDisplayCriticalErrors
|
|
248
|
+
? testResults.filter(testResult => testResult.error && isNonVisualTestError(testResult))
|
|
249
|
+
: testResults // all results
|
|
250
|
+
const message = await socket.request('Test.printTestResults', {testResults: filteredTestResults, resultConfig})
|
|
251
|
+
printToLog(
|
|
252
|
+
`Eyes: throwErrorIfExistsInSummary ${
|
|
253
|
+
shouldDisplayCriticalErrors ? 'critical errors' : 'all errors'
|
|
254
|
+
}, results message: ${message}`,
|
|
255
|
+
)
|
|
256
|
+
if (
|
|
257
|
+
(!!getGlobalConfigProperty('eyesFailCypressOnDiff') &&
|
|
258
|
+
message &&
|
|
259
|
+
message.includes('Eyes-Cypress detected diffs or errors')) ||
|
|
260
|
+
(shouldDisplayCriticalErrors && filteredTestResults.length > 0 && message)
|
|
261
|
+
) {
|
|
262
|
+
printToLog('Eyes: throwErrorIfExistsInSummary throwing error')
|
|
263
|
+
throw new Error(message)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
207
267
|
function setRootContext() {
|
|
208
268
|
cy.state('window').parent.document['applitools-marker'] = 'root-context'
|
|
209
269
|
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import {NewTestError} from '@applitools/eyes/dist/errors/NewTestError'
|
|
2
|
+
|
|
1
3
|
export default function getErrorsAndDiffs(testResultsArr: any) {
|
|
2
4
|
return testResultsArr.reduce(
|
|
3
5
|
({failed, diffs, passed}: any, testResults: any) => {
|
|
4
6
|
if (testResults instanceof Error || testResults.error) {
|
|
5
|
-
|
|
7
|
+
if (testResults.error && Object.keys(testResults).length > 1) {
|
|
8
|
+
failed.push(testResults)
|
|
9
|
+
} else {
|
|
10
|
+
failed.push(testResults instanceof Error ? testResults : new Error(testResults.error.message))
|
|
11
|
+
}
|
|
6
12
|
} else {
|
|
7
13
|
const testStatus = testResults.status
|
|
8
14
|
if (testStatus === 'Passed') {
|
|
@@ -10,7 +16,7 @@ export default function getErrorsAndDiffs(testResultsArr: any) {
|
|
|
10
16
|
} else {
|
|
11
17
|
if (testStatus === 'Unresolved') {
|
|
12
18
|
if (testResults.isNew) {
|
|
13
|
-
testResults.error = new
|
|
19
|
+
testResults.error = new NewTestError(
|
|
14
20
|
`${testResults.name}. Please approve the new baseline at ${testResults.url}`,
|
|
15
21
|
)
|
|
16
22
|
failed.push(testResults)
|