-
Notifications
You must be signed in to change notification settings - Fork 63
/
cypress.config.ts
50 lines (48 loc) · 1.21 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
import path from "path";
import { defineConfig } from "cypress";
import ComparePdf, { ComparePdfConfig } from "compare-pdf";
const comparePDFConfig: ComparePdfConfig = {
paths: {
actualPdfRootFolder: path.join(process.cwd(), "cypress", "downloads"),
baselinePdfRootFolder: path.join(process.cwd(), "cypress", "baseline"),
actualPngRootFolder: path.join(
process.cwd(),
"cypress",
"downloads",
"png"
),
baselinePngRootFolder: path.join(
process.cwd(),
"cypress",
"baseline",
"png"
),
diffPngRootFolder: path.join(process.cwd(), "cypress", "baseline", "diff"),
},
settings: {
imageEngine: "native",
density: 150,
quality: 80,
tolerance: 0,
threshold: 0.1,
cleanPngPaths: false,
matchPageCount: true,
disableFontFace: true,
verbosity: 0,
},
};
export default defineConfig({
e2e: {
setupNodeEvents(on) {
on("task", {
async compareFile(filename: string) {
const comparisonResults = await new ComparePdf(comparePDFConfig)
.actualPdfFile(filename)
.baselinePdfFile(filename)
.compare();
return comparisonResults;
},
});
},
},
});