Skip to content

Commit

Permalink
chore: Update cypress and its dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux authored and skjnldsv committed Feb 28, 2024
1 parent 5d80758 commit 40b448b
Show file tree
Hide file tree
Showing 5 changed files with 520 additions and 374 deletions.
29 changes: 12 additions & 17 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { defineConfig } from 'cypress'

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

export default defineConfig({
projectId: '5bsgwk',
Expand All @@ -32,8 +32,9 @@ export default defineConfig({

// Visual regression testing
env: {
failSilently: false,
type: 'actual',
visualRegressionFailSilently: false,
visualRegressionGenerateDiff: 'always',
visualRegressionType: 'regression',
},
screenshotsFolder: 'cypress/snapshots/actual',
trashAssetsBeforeRuns: true,
Expand All @@ -48,7 +49,7 @@ export default defineConfig({
on('file:preprocessor', vitePreprocessor({ configFile: false }))

// Enable the snapshot compare plugin
getCompareSnapshotsPlugin(on, config)
configureVisualRegression(on)

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

// Remove container after run
on('after:run', () => {
stopNextcloud()
on('after:run', async () => {
await stopNextcloud()
})

// Before the browser launches
// starting Nextcloud testing container
return startNextcloud(process.env.BRANCH)
.then((ip) => {
// Setting container's IP as base Url
config.baseUrl = `http://${ip}/index.php`
return ip
})
.then(waitOnNextcloud)
.then(() => configureNextcloud(process.env.BRANCH))
.then(() => {
return config
})
const ip = await startNextcloud(process.env.BRANCH)
config.baseUrl = `http://${ip}/index.php`
await waitOnNextcloud(ip)
await configureNextcloud(process.env.BRANCH)
return config
},
},
})
3 changes: 3 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
*/
/* eslint-disable n/no-unpublished-import */
import { addCommands } from '@nextcloud/cypress'
import { addCompareSnapshotCommand } from 'cypress-visual-regression/dist/command'

// Add custom commands
import 'cypress-wait-until'

addCommands()
addCompareSnapshotCommand()
1 change: 1 addition & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"compilerOptions": {
"types": [
"cypress",
"cypress-visual-regression",
"dockerode",
"node"
]
Expand Down
Loading

0 comments on commit 40b448b

Please sign in to comment.