diff --git a/cypress.config.ts b/cypress.config.ts index 3dd29a781..1fbb98392 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -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', @@ -27,7 +27,7 @@ export default defineConfig({ // Visual regression testing env: { failSilently: false, - type: 'actual', + visualRegressionType: 'regression', }, screenshotsFolder: 'cypress/snapshots/actual', trashAssetsBeforeRuns: true, @@ -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) => { diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 83c173d12..25027f89d 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -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) diff --git a/package.json b/package.json index 83aec708f..198b32f1e 100644 --- a/package.json +++ b/package.json @@ -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",