Created
January 6, 2023 17:45
-
-
Save Josh68/25d318e2678116cb82b60a5d7b5d82d5 to your computer and use it in GitHub Desktop.
Cypress config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable @typescript-eslint/no-var-requires */ | |
const { defineConfig } = require("cypress"); | |
const htmlvalidate = require("cypress-html-validate/plugin"); | |
const getCompareSnapshotsPlugin = require("cypress-visual-regression/dist/plugin"); | |
let shouldSkip = false; | |
let planYearConfig = {}; | |
// eslint-disable-next-line no-undef | |
module.exports = defineConfig({ | |
chromeWebSecurity: false, | |
defaultCommandTimeout: 6000, | |
pageLoadTimeout: 8000, | |
screenshotsFolder: "./cypress/snapshots/actual", // visual regression plugin is looking for this here | |
env: { | |
// This value is set in the `test:integration` NPM script, possibly also elsewhere | |
apiUrl: "", | |
// Cypress Visual Regression settings | |
// @see https://github.com/cypress-visual-regression/cypress-visual-regression/blob/master/README.md#typescript | |
failSilently: false, | |
SNAPSHOT_BASE_DIRECTORY: "./cypress/snapshots/base", | |
SNAPSHOT_DIFF_DIRECTORY: "./cypress/snapshots/diff", | |
INTEGRATION_FOLDER: "cypress/integration/", | |
ALWAYS_GENERATE_DIFF: false, | |
ALLOW_VISUAL_REGRESSION_TO_FAIL: true, | |
trashAssetsBeforeRuns: true, | |
video: false, | |
}, | |
e2e: { | |
baseUrl: "https://localhost/#", | |
specPattern: "./cypress/integration/**/*.spec.{js,jsx,ts,tsx}", | |
supportFile: "./cypress/support/e2e.{js,jsx,ts,tsx}", | |
setupNodeEvents(on, config) { | |
on("task", { | |
log(message) { | |
console.log(message); | |
return null; | |
}, | |
resetShouldSkipFlag() { | |
shouldSkip = false; | |
return null; | |
}, | |
shouldSkip(value) { | |
if (value != null) shouldSkip = value; | |
return shouldSkip; | |
}, | |
setPlanYearConfig(value) { | |
planYearConfig = value; | |
return true; | |
}, | |
getPlanYearConfig() { | |
return planYearConfig; | |
}, | |
}); | |
getCompareSnapshotsPlugin(on, config); | |
htmlvalidate.install(on); | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment