-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathcypress.config.ts
More file actions
28 lines (26 loc) · 833 Bytes
/
Copy pathcypress.config.ts
File metadata and controls
28 lines (26 loc) · 833 Bytes
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
import fs from 'fs';
import { defineConfig } from 'cypress';
export default defineConfig({
projectId: 'gahph7',
e2e: {
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
// delete videos for tests without errors
setupNodeEvents(on, _config) {
on('after:spec', (_spec: Cypress.Spec, results: CypressCommandLine.RunResult) => {
if (results && results.video) {
// Do we have failures for any retry attempts?
const failures = results.tests.some(test =>
test.attempts.some(attempt => attempt.state === 'failed')
);
if (!failures) {
// delete the video if the spec passed and no tests retried
fs.unlinkSync(results.video);
}
}
});
},
},
viewportWidth: 1920,
viewportHeight: 1080,
video: true,
});