Skip to content

Commit 40b448b

Browse files
susnuxskjnldsv
authored andcommitted
chore: Update cypress and its dependencies
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 5d80758 commit 40b448b

File tree

5 files changed

+520
-374
lines changed

5 files changed

+520
-374
lines changed

cypress.config.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { defineConfig } from 'cypress'
99

1010
import vitePreprocessor from 'cypress-vite'
11-
import getCompareSnapshotsPlugin from 'cypress-visual-regression/dist/plugin'
11+
import { configureVisualRegression } from 'cypress-visual-regression/dist/plugin'
1212

1313
export default defineConfig({
1414
projectId: '5bsgwk',
@@ -32,8 +32,9 @@ export default defineConfig({
3232

3333
// Visual regression testing
3434
env: {
35-
failSilently: false,
36-
type: 'actual',
35+
visualRegressionFailSilently: false,
36+
visualRegressionGenerateDiff: 'always',
37+
visualRegressionType: 'regression',
3738
},
3839
screenshotsFolder: 'cypress/snapshots/actual',
3940
trashAssetsBeforeRuns: true,
@@ -48,7 +49,7 @@ export default defineConfig({
4849
on('file:preprocessor', vitePreprocessor({ configFile: false }))
4950

5051
// Enable the snapshot compare plugin
51-
getCompareSnapshotsPlugin(on, config)
52+
configureVisualRegression(on)
5253

5354
// Disable spell checking to prevent rendering differences
5455
on('before:browser:launch', (browser, launchOptions) => {
@@ -69,23 +70,17 @@ export default defineConfig({
6970
})
7071

7172
// Remove container after run
72-
on('after:run', () => {
73-
stopNextcloud()
73+
on('after:run', async () => {
74+
await stopNextcloud()
7475
})
7576

7677
// Before the browser launches
7778
// starting Nextcloud testing container
78-
return startNextcloud(process.env.BRANCH)
79-
.then((ip) => {
80-
// Setting container's IP as base Url
81-
config.baseUrl = `http://${ip}/index.php`
82-
return ip
83-
})
84-
.then(waitOnNextcloud)
85-
.then(() => configureNextcloud(process.env.BRANCH))
86-
.then(() => {
87-
return config
88-
})
79+
const ip = await startNextcloud(process.env.BRANCH)
80+
config.baseUrl = `http://${ip}/index.php`
81+
await waitOnNextcloud(ip)
82+
await configureNextcloud(process.env.BRANCH)
83+
return config
8984
},
9085
},
9186
})

cypress/support/commands.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
*/
2222
/* eslint-disable n/no-unpublished-import */
2323
import { addCommands } from '@nextcloud/cypress'
24+
import { addCompareSnapshotCommand } from 'cypress-visual-regression/dist/command'
2425

2526
// Add custom commands
2627
import 'cypress-wait-until'
28+
2729
addCommands()
30+
addCompareSnapshotCommand()

cypress/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"compilerOptions": {
55
"types": [
66
"cypress",
7+
"cypress-visual-regression",
78
"dockerode",
89
"node"
910
]

0 commit comments

Comments
 (0)