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