Skip to content

Commit

Permalink
fix(cypress): update cypress config for new visual regression plugin …
Browse files Browse the repository at this point in the history
…update

Signed-off-by: John Molakvoæ <[email protected]>
  • Loading branch information
skjnldsv committed Mar 9, 2024
1 parent 29ef72a commit e4a36a9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { configureNextcloud, startNextcloud, stopNextcloud, waitOnNextcloud } from '@nextcloud/cypress/docker'
import { configureVisualRegression } from 'cypress-visual-regression/dist/plugin'
import { defineConfig } from 'cypress'
import cypressSplit from 'cypress-split'

import getCompareSnapshotsPlugin from 'cypress-visual-regression/dist/plugin'

export default defineConfig({
projectId: 'xysa6x',
Expand All @@ -27,7 +27,7 @@ export default defineConfig({
// Visual regression testing
env: {
failSilently: false,
type: 'actual',
visualRegressionType: 'regression',
},
screenshotsFolder: 'cypress/snapshots/actual',
trashAssetsBeforeRuns: true,
Expand All @@ -40,8 +40,7 @@ export default defineConfig({
// You may want to clean this up later by importing these.
async setupNodeEvents(on, config) {
cypressSplit(on, config)

getCompareSnapshotsPlugin(on, config)
configureVisualRegression(on)

// Disable spell checking to prevent rendering differences
on('before:browser:launch', (browser, launchOptions) => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import { addCommands, User } from '@nextcloud/cypress'
import { basename } from 'path'
import axios from '@nextcloud/axios'
import compareSnapshotCommand from 'cypress-visual-regression/dist/command.js'
import { addCompareSnapshotCommand } from 'cypress-visual-regression/dist/command'

addCommands()
compareSnapshotCommand()
addCompareSnapshotCommand()

const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
Cypress.env('baseUrl', url)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"cypress:e2e": "cypress run --e2e",
"cypress:gui": "cypress open --e2e",
"cypress:pre-snapshots": "TESTING=true npm run dev",
"cypress:visual-regression": "npm run cypress:pre-snapshots && cypress run --spec cypress/e2e/visual-regression.cy.js",
"cypress:update-snapshots": "npm run cypress:pre-snapshots && cypress run --env type=base --spec cypress/e2e/visual-regression.cy.js --config screenshotsFolder=cypress/snapshots/base"
"cypress:visual-regression": "npm run cypress:pre-snapshots && cypress run --spec cypress/e2e/visual-regression.cy.ts",
"cypress:update-snapshots": "npm run cypress:pre-snapshots && cypress run --env visualRegressionType=base --spec cypress/e2e/visual-regression.cy.ts --config screenshotsFolder=cypress/snapshots/base"
},
"dependencies": {
"@fontsource/roboto": "^5.0.12",
Expand Down

0 comments on commit e4a36a9

Please sign in to comment.