88import { defineConfig } from 'cypress'
99
1010import vitePreprocessor from 'cypress-vite'
11- import getCompareSnapshotsPlugin from 'cypress-visual-regression/dist/plugin'
11+ import { configureVisualRegression } from 'cypress-visual-regression/dist/plugin'
1212
1313export 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} )
0 commit comments