| 1 | import eyesPlugin from '@applitools/eyes-cypress'; |
| 2 | import { registerArgosTask } from '@argos-ci/cypress/task'; |
| 3 | import coverage from '@cypress/code-coverage/task.js'; |
| 4 | import { defineConfig } from 'cypress'; |
| 5 | import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin.js'; |
| 6 | import cypressSplit from 'cypress-split'; |
| 7 | import 'dotenv/config'; |
| 8 | |
| 9 | export default eyesPlugin( |
| 10 | defineConfig({ |
| 11 | projectId: 'n2sma2', |
| 12 | viewportWidth: 1440, |
| 13 | viewportHeight: 1024, |
| 14 | e2e: { |
| 15 | baseUrl: `http://localhost:${process.env.MERMAID_PORT ?? 9000}`, |
| 16 | specPattern: 'cypress/integration/**/*.{js,ts}', |
| 17 | setupNodeEvents(on, config) { |
| 18 | coverage(on, config); |
| 19 | cypressSplit(on, config); |
| 20 | on('before:browser:launch', (browser, launchOptions) => { |
| 21 | if (browser.name === 'chrome' && browser.isHeadless) { |
| 22 | launchOptions.args.push('--window-size=1440,1024', '--force-device-scale-factor=1'); |
| 23 | } |
| 24 | return launchOptions; |
| 25 | }); |
| 26 | // copy any needed variables from process.env to config.env |
| 27 | config.env.useAppli = process.env.USE_APPLI ? true : false; |
| 28 | config.env.useArgos = process.env.RUN_VISUAL_TEST === 'true'; |
| 29 | |
| 30 | if (config.env.useArgos) { |
| 31 | registerArgosTask(on, config, { |
| 32 | // Enable upload to Argos only when it runs on CI. |
| 33 | uploadToArgos: !!process.env.CI, |
| 34 | }); |
| 35 | } else { |
| 36 | addMatchImageSnapshotPlugin(on, config); |
| 37 | } |
| 38 | // do not forget to return the changed config object! |
| 39 | return config; |
| 40 | }, |
| 41 | }, |
| 42 | video: false, |
| 43 | }) |
| 44 | ); |
| 45 | |