-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
cypress.config.ts
32 lines (28 loc) · 1016 Bytes
/
cypress.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { defineConfig } from 'cypress';
import getCompareSnapshotsPlugin from "cypress-visual-regression/dist/plugin";
import { platform } from 'os';
const getPlatformForCypressSnapshots = () => {
const isMac = platform() === 'darwin';
const isLinux = platform() === 'linux';
if (!isMac && !isLinux) {
throw new Error('Unsupported platform for cypress snapshots');
}
return isMac ? 'mac' : 'linux';
}
const platformForCypressSnapshots = getPlatformForCypressSnapshots();
export default defineConfig({
video: false,
env: {
SNAPSHOT_BASE_DIRECTORY: `./cypress/snapshots/${platformForCypressSnapshots}/base`,
SNAPSHOT_DIFF_DIRECTORY: `./cypress/snapshots/${platformForCypressSnapshots}/diff`,
ALWAYS_GENERATE_DIFF: true,
screenshotsFolder: `./cypress/snapshots/${platformForCypressSnapshots}/actual`,
trashAssetsBeforeRuns: true,
},
e2e: {
baseUrl: 'http://localhost:5173',
setupNodeEvents(on, config) {
getCompareSnapshotsPlugin(on, config);
},
},
});