forked from htmlacademy/accelerator-project-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pp.config.cjs
116 lines (109 loc) · 3.69 KB
/
pp.config.cjs
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
const desktopSections = [
{section: 'hero', misMatchThreshold: 0.7},
{section: 'about', misMatchThreshold: 0.9},
{section: 'price', misMatchThreshold: 0.9},
{section: 'games', misMatchThreshold: 0.9},
{section: 'juri', misMatchThreshold: 0.9},
{section: 'features', misMatchThreshold: 0.8},
{section: 'offers', misMatchThreshold: 0.9},
{section: 'faq', misMatchThreshold: 0.9},
{section: 'reviews', misMatchThreshold: 0.7},
{section: 'form', misMatchThreshold: 0.9},
{section: 'footer', misMatchThreshold: 1.0}
];
const tabletSections = [
{section: 'hero', misMatchThreshold: 1.0},
{section: 'about', misMatchThreshold: 0.8},
{section: 'price', misMatchThreshold: 0.7},
{section: 'games', misMatchThreshold: 0.8},
{section: 'juri', misMatchThreshold: 0.7},
{section: 'features', misMatchThreshold: 1.6},
{section: 'offers', misMatchThreshold: 0.7},
{section: 'faq', misMatchThreshold: 1.6},
{section: 'reviews', misMatchThreshold: 1.3},
{section: 'form', misMatchThreshold: 1.0},
{section: 'footer', misMatchThreshold: 1.9}
];
const mobileSections = [
{section: 'hero', misMatchThreshold: 3.7},
{section: 'about', misMatchThreshold: 1.8},
{section: 'price', misMatchThreshold: 0.9},
{section: 'games', misMatchThreshold: 1.1},
{section: 'juri', misMatchThreshold: 0.7},
{section: 'features', misMatchThreshold: 2.7},
{section: 'offers', misMatchThreshold: 1.4},
{section: 'faq', misMatchThreshold: 1.7},
{section: 'reviews', misMatchThreshold: 2.7},
{section: 'form', misMatchThreshold: 1.6},
{section: 'footer', misMatchThreshold: 2.0}
];
const VIEWPORTS = {
'desktop': {"label": "desktop", "width": 1366, "height": 800},
'tablet': {"label": "tablet", "width": 768, "height": 1024},
'mobile': {"label": "mobile", "width": 320, "height": 480}
};
const URL = 'http://localhost:3000/index.html';
const REFERENCE_URL = './figma/index.html';
function generateScenario(section, misMatchThreshold, viewport) {
return {
"label": `${section}`,
"url": URL,
"referenceUrl": REFERENCE_URL,
selectors: [`[data-test="${section}"]`],
misMatchThreshold: misMatchThreshold || 5,
requireSameDimensions: true,
delay: 500,
"viewports": [VIEWPORTS[viewport]]
};
}
module.exports = {
"id": "supergym test-pp",
"onReadyScript": "onReady.cjs",
"onBeforeScript": "onBefore.cjs",
"viewports": [
{
"label": "mobile",
"width": 320,
"height": 480,
},
{
"label": "tablet",
"width": 768,
"height": 1024,
},
{
"label": "desktop",
"width": 1366,
"height": 800,
}
],
"resembleOutputOptions": {
"ignoreAntialiasing": true,
"errorType": "movementDifferenceIntensity",
"transparency": 0.3,
scaleToSameSize: false
},
"scenarios": [
...desktopSections.map(({section, misMatchThreshold}) => generateScenario(section, misMatchThreshold, 'desktop')),
...tabletSections.map(({section, misMatchThreshold}) => generateScenario(section, misMatchThreshold, 'tablet')),
...mobileSections.map(({section, misMatchThreshold}) => generateScenario(section, misMatchThreshold, 'mobile')),
],
fileNameTemplate: '{scenarioLabel}_{viewportLabel}',
"paths": {
"bitmaps_reference": "bitmaps_reference/test-pp",
"bitmaps_test": "backstop_data/bitmaps_test",
"engine_scripts": "engine_scripts",
"html_report": "backstop_data/html_report",
"json_report": "backstop_data/json_report",
},
"report": ["browser", "json"],
"engine": "puppeteer",
"engineOptions": {
"args": ["--no-sandbox"],
"gotoParameters": {"waitUntil": ["load", "networkidle0"], timeout: 40000},
},
"asyncCaptureLimit": 10,
"asyncCompareLimit": 50,
"debug": false,
"debugWindow": false
}