-
Notifications
You must be signed in to change notification settings - Fork 1
/
run-snapshots.js
53 lines (49 loc) · 1.77 KB
/
run-snapshots.js
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
const cypress = require('cypress')
const shouldUpdateSnapshots = process.argv[3] == 'updateSnapshots';
if (shouldUpdateSnapshots) {
console.log('updateSnapshots passed so will update snapshots');
}
async function runSnapshotTests(framework) {
console.log('Running example snapshots for ', framework)
return await cypress.run({
browser: 'chrome',
headless: true,
config: {
// As we have split the tests out we do not want to trash the shared folder as then only end up with the
// last set of snapshots instead of all of them.
trashAssetsBeforeRuns: false
},
spec: './cypress/integration/themes/examples.spec.js',
reporterOptions: `mochaFile=test-results/snapshots_${framework}.xml`,
env: {
framework: framework,
updateSnapshots: shouldUpdateSnapshots
},
})
}
async function runDemoSnapshot() {
console.log('Running demo snapshot')
return await cypress.run({
browser: 'chrome',
headless: true,
config: {
// As we have split the tests out we do not want to trash the shared folder as then only end up with the
// last set of snapshots instead of all of them.
trashAssetsBeforeRuns: false
},
spec: './cypress/integration/themes/demo.spec.js',
reporterOptions: `mochaFile=test-results/snapshots_demo.xml`,
env: {
updateSnapshots: shouldUpdateSnapshots
}
})
}
; (async () => {
await runDemoSnapshot();
await runSnapshotTests('vanilla');
await runSnapshotTests('typescript');
await runSnapshotTests('angular');
await runSnapshotTests('reactFunctional');
await runSnapshotTests('vue');
await runSnapshotTests('vue3');
})()