This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
forked from folio-org/stripes-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.js
90 lines (78 loc) · 2.43 KB
/
cypress.config.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
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
const { defineConfig } = require('cypress');
const path = require('path');
const globby = require('globby');
const { rmdir, unlink } = require('fs');
const { downloadFile } = require('cypress-downloadfile/lib/addPlugin');
const fs = require('fs');
const allureWriter = require('@shelex/cypress-allure-plugin/writer');
module.exports = defineConfig({
retries: {
runMode: 0,
openMode: 0,
},
viewportWidth: 1920,
viewportHeight: 1080,
video: false,
defaultCommandTimeout: 101000,
pageLoadTimeout: 120000,
env: {
OKAPI_HOST: 'https://folio-testing-cypress-okapi.ci.folio.org',
OKAPI_TENANT: 'diku',
diku_login: 'diku_admin',
diku_password: 'admin',
is_kiwi_release: false,
downloadTimeout: 1000,
allure: 'true',
grepFilterSpecs: true,
grepOmitFiltered: true,
},
e2e: {
async setupNodeEvents(on, config) {
allureWriter(on, config);
on('task', {
async findFiles(mask) {
if (!mask) {
throw new Error('Missing a file mask to search');
}
const list = await globby(mask);
if (!list.length) {
return null;
}
return list;
},
downloadFile,
deleteFolder(folderName) {
return new Promise((resolve, reject) => {
// eslint-disable-next-line consistent-return
rmdir(folderName, { maxRetries: 10, recursive: true }, (err) => {
if (err && err.code !== 'ENOENT') {
return reject(err);
}
resolve(null);
});
});
},
deleteFile(pathToFile) {
return new Promise((resolve, reject) => {
// eslint-disable-next-line consistent-return
unlink(pathToFile, (err) => {
if (err && err.code !== 'ENOENT') {
return reject(err);
}
resolve(null);
});
});
},
readFileFromDownloads(filename) {
const downloadsFolder = config.downloadsFolder || path.join(__dirname, '..', '..', 'Downloads');
const filePath = path.join(downloadsFolder, filename);
return fs.readFileSync(filePath, 'utf-8');
},
});
// eslint-disable-next-line global-require
await require('cypress-testrail-simple/src/plugin')(on, config);
return config;
},
baseUrl: 'https://folio-testing-cypress-diku.ci.folio.org',
},
});