diff --git a/cypress-visual-screenshots/baseline/pages.spec-index.png b/cypress-visual-screenshots/baseline/pages.spec-index.png index 8e9a3bd..d3906ab 100755 Binary files a/cypress-visual-screenshots/baseline/pages.spec-index.png and b/cypress-visual-screenshots/baseline/pages.spec-index.png differ diff --git a/cypress-visual-screenshots/baseline/pages.spec-settings.png b/cypress-visual-screenshots/baseline/pages.spec-settings.png index fc6c109..c4450a5 100755 Binary files a/cypress-visual-screenshots/baseline/pages.spec-settings.png and b/cypress-visual-screenshots/baseline/pages.spec-settings.png differ diff --git a/cypress.config.js b/cypress.config.js index 512c153..b62d098 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -3,9 +3,11 @@ const { defineConfig } = require('cypress'); const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin'); module.exports = defineConfig({ + viewportHeight: 920, + viewportWidth: 1280, env: { cypressImageDiff: { - FAILURE_THRESHOLD: 0, + FAILURE_THRESHOLD: 0.1, } }, e2e: { @@ -15,8 +17,6 @@ module.exports = defineConfig({ 'cypress/e2e/**/*.feature', 'cypress/regression/**/*.spec.js' ], - 'viewportHeight': 920, - 'viewportWidth': 1280, setupNodeEvents(on, config) { on('file:preprocessor', cucumber()); getCompareSnapshotsPlugin(on, config); diff --git a/cypress/regression/pages.spec.js b/cypress/regression/pages.spec.js index e749a7b..06196df 100644 --- a/cypress/regression/pages.spec.js +++ b/cypress/regression/pages.spec.js @@ -1,14 +1,26 @@ -describe('visual testing regression', () => { +describe.only('visual testing regression', () => { + const visit = (path, darkAppearance) => + cy.visit(path, { + onBeforeLoad(win) { + cy.stub(win, 'matchMedia') + .withArgs('(prefers-color-scheme: dark)') + .returns({ + matches: darkAppearance, + }); + }, + }); it('should display the index page', () => { - cy.visit('/'); + cy.viewport(1280, 920); + visit('/', true); cy.wait(3000); - cy.compareSnapshot('index', 0); + cy.compareSnapshot('index', 0.1); }); it('should display the settings page', () => { - cy.visit('/#/settings'); + cy.viewport(1280, 920); + visit('/#/settings', true); cy.wait(3000); - cy.compareSnapshot('settings', 0); + cy.compareSnapshot('settings', 0.1); }); }); \ No newline at end of file