Files
98774b83b1 chore: fix Argos parallel idempotency and remove Chromatic E2E (#7257)
* chore: fix Argos parallel idempotency and remove Chromatic E2E

- Pin ARGOS_PARALLEL_NONCE to github.run_id so retries upload to
  the same Argos build instead of creating a new one
- Use ARGOS_PARALLEL_TOTAL=-1 with explicit finalize job so the
  build doesn't depend on a fixed shard count
- Replace Cypress Cloud parallel mode with deterministic round-robin
  spec sharding so each container always runs the same specs on retry
- Remove continue-on-error to surface failures
- Remove Chromatic E2E workflow and @chromatic-com/cypress dependency
  in favor of Argos as the sole visual regression tool

* chore: add reference branch/commit inputs to Argos workflow

Allows specifying a custom Argos baseline branch and commit SHA
when triggering the workflow manually.

---------

Co-authored-by: Hanzo Dev <[email protected]>
2026-03-02 11:44:59 +01:00

86 lines
2.3 KiB
JavaScript

import { defineConfig } from 'cypress'
import 'dotenv/config'
import * as fs from 'fs'
import { registerArgosTask } from '@argos-ci/cypress/task'
import { version } from './src/markdown/terms/version.js'
function setupArgosPlugin(on, config) {
registerArgosTask(on, config, {
uploadToArgos: !!process.env.ARGOS_TOKEN,
buildName: 'web-e2e',
})
}
// Headless browsers ignore Cypress viewport settings, so we set window size explicitly.
// See: https://argos-ci.com/docs/cypress
const HEADLESS_WIDTH = 1920 + 16 // +16px to account for the scrollbar gutter
const HEADLESS_HEIGHT = 1080
function setupHeadlessViewport(on) {
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push(`--window-size=${HEADLESS_WIDTH},${HEADLESS_HEIGHT}`)
launchOptions.args.push('--force-device-scale-factor=1')
}
if (browser.name === 'electron' && browser.isHeadless) {
launchOptions.preferences.width = HEADLESS_WIDTH
launchOptions.preferences.height = HEADLESS_HEIGHT
}
return launchOptions
})
}
export default defineConfig({
projectId: 'exhdra',
trashAssetsBeforeRuns: true,
reporter: 'junit',
reporterOptions: {
mochaFile: 'reports/junit-[hash].xml',
},
retries: {
runMode: 3,
openMode: 0,
},
e2e: {
screenshotsFolder: './cypress/snapshots/actual',
viewportWidth: 1280,
viewportHeight: 800,
setupNodeEvents(on, config) {
config.env.CURRENT_COOKIE_TERMS_VERSION = version
setupArgosPlugin(on, config)
setupHeadlessViewport(on)
on('task', {
log(message) {
console.log(message)
return null
},
})
on('after:spec', (spec, results) => {
if (results && results.video) {
const failures = results.tests.some((test) => test.attempts.some((attempt) => attempt.state === 'failed'))
if (!failures) {
fs.unlinkSync(results.video)
}
}
})
return config
},
env: {
...process.env,
},
baseUrl: 'http://localhost:3000',
testIsolation: false,
hideXHR: true,
defaultCommandTimeout: 10000,
pageLoadTimeout: 60000,
experimentalMemoryManagement: true,
numTestsKeptInMemory: 0,
},
chromeWebSecurity: false,
})