-
Notifications
You must be signed in to change notification settings - Fork 8
/
cypress.config.ts
54 lines (49 loc) · 1.35 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { defineConfig } from 'cypress';
import getCompareSnapshotsPlugin from 'cypress-image-diff-js/dist/plugin';
export default defineConfig({
component: {
// macbook-15 default
viewportWidth: 1440,
viewportHeight: 900,
devServer: {
framework: 'react',
bundler: 'vite',
},
setupNodeEvents(on, config) {
const compareSnapshotsPlugin = getCompareSnapshotsPlugin(on, config);
// Add the imageSnapshot configuration options to the plugin
compareSnapshotsPlugin.options = {
threshold: 0.05,
thresholdType: 'pixel',
includeAA: true,
diffColor: [255, 0, 0],
diffColorAlt: [0, 255, 0],
capture: 'fullPage',
antialiasingTolerance: 0,
createDiffImage: true,
diffPath: 'cypress/diffs',
update: false,
debug: false,
errorColor: [255, 0, 0],
errorType: 'movement',
waitBeforeScreenshot: 0,
waitAfterScreenshot: 0,
tabbableOptions: {
include: ['button', 'input', 'select', 'textarea', 'a[href]'],
},
};
on('task', {
deleteScreenshot() {
// your task code here
return null;
},
});
return compareSnapshotsPlugin;
},
},
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});