@centreon/js-config 24.10.5 → 24.10.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/component/configuration.js +116 -76
- package/package.json +1 -1
|
@@ -1,76 +1,116 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
const { devServer } = require('cypress-rspack-dev-server');
|
|
3
|
-
const { defineConfig } = require('cypress');
|
|
4
|
-
const {
|
|
5
|
-
addMatchImageSnapshotPlugin
|
|
6
|
-
} = require('@simonsmith/cypress-image-snapshot/plugin');
|
|
7
|
-
const cypressCodeCoverageTask = require('@cypress/code-coverage/task');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
on
|
|
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
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
const { devServer } = require('cypress-rspack-dev-server');
|
|
3
|
+
const { defineConfig } = require('cypress');
|
|
4
|
+
const {
|
|
5
|
+
addMatchImageSnapshotPlugin
|
|
6
|
+
} = require('@simonsmith/cypress-image-snapshot/plugin');
|
|
7
|
+
const cypressCodeCoverageTask = require('@cypress/code-coverage/task');
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
module.exports = ({
|
|
13
|
+
rspackConfig,
|
|
14
|
+
cypressFolder,
|
|
15
|
+
specPattern,
|
|
16
|
+
env,
|
|
17
|
+
excludeSpecPattern
|
|
18
|
+
}) => {
|
|
19
|
+
const mainCypressFolder = cypressFolder || 'cypress';
|
|
20
|
+
|
|
21
|
+
return defineConfig({
|
|
22
|
+
component: {
|
|
23
|
+
devServer: (devServerConfig) =>
|
|
24
|
+
devServer({
|
|
25
|
+
...devServerConfig,
|
|
26
|
+
framework: 'react',
|
|
27
|
+
rspackConfig
|
|
28
|
+
}),
|
|
29
|
+
excludeSpecPattern,
|
|
30
|
+
setupNodeEvents: (on, config) => {
|
|
31
|
+
addMatchImageSnapshotPlugin(on, config);
|
|
32
|
+
|
|
33
|
+
cypressCodeCoverageTask(on, config);
|
|
34
|
+
on('task', {
|
|
35
|
+
coverageReport: () => {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
on('before:browser:launch', (browser, launchOptions) => {
|
|
41
|
+
if (browser.name === 'chrome' && browser.isHeadless) {
|
|
42
|
+
launchOptions.args.push('--headless=new');
|
|
43
|
+
launchOptions.args.push('--force-color-profile=srgb');
|
|
44
|
+
launchOptions.args.push('--window-size=1400,1200');
|
|
45
|
+
launchOptions.args.push('--max-old-space-size=4096');
|
|
46
|
+
launchOptions.args.push('--disable-dev-shm-usage');
|
|
47
|
+
launchOptions.args.push('--disable-gpu');
|
|
48
|
+
launchOptions.args.push('--no-sandbox');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return launchOptions;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
on('after:run', (results) => {
|
|
55
|
+
const testRetries = {};
|
|
56
|
+
if ('runs' in results) {
|
|
57
|
+
results.runs.forEach((run) => {
|
|
58
|
+
run.tests.forEach((test) => {
|
|
59
|
+
if (test.attempts && test.attempts.length > 1 && test.state === 'passed') {
|
|
60
|
+
const testTitle = test.title.join(' > '); // Convert the array to a string
|
|
61
|
+
testRetries[testTitle] = test.attempts.length - 1;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Save the testRetries object to a file in the e2e/results directory
|
|
68
|
+
const resultFilePath = path.join(
|
|
69
|
+
mainCypressFolder,
|
|
70
|
+
'results',
|
|
71
|
+
'retries.json'
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
fs.writeFileSync(resultFilePath, JSON.stringify(testRetries, null, 2));
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
on('after:spec', () => {
|
|
78
|
+
if (global.__coverage__) {
|
|
79
|
+
delete global.__coverage__;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
specPattern,
|
|
84
|
+
supportFile: `${mainCypressFolder}/support/component.tsx`
|
|
85
|
+
},
|
|
86
|
+
env: {
|
|
87
|
+
baseUrl: 'http://localhost:9092',
|
|
88
|
+
codeCoverage: {
|
|
89
|
+
exclude: [
|
|
90
|
+
'cypress/**/*.*',
|
|
91
|
+
'packages/**',
|
|
92
|
+
'node_modules',
|
|
93
|
+
'**/*.js',
|
|
94
|
+
'**/*.spec.tsx'
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
...env
|
|
98
|
+
},
|
|
99
|
+
reporter: 'mochawesome',
|
|
100
|
+
reporterOptions: {
|
|
101
|
+
html: false,
|
|
102
|
+
json: true,
|
|
103
|
+
overwrite: true,
|
|
104
|
+
reportDir: `${mainCypressFolder}/results`,
|
|
105
|
+
reportFilename: '[name]-report.json'
|
|
106
|
+
},
|
|
107
|
+
retries: {
|
|
108
|
+
openMode: 0,
|
|
109
|
+
runMode: 2
|
|
110
|
+
},
|
|
111
|
+
video: true,
|
|
112
|
+
videosFolder: `${mainCypressFolder}/results/videos`,
|
|
113
|
+
viewportHeight: 590,
|
|
114
|
+
viewportWidth: 1280
|
|
115
|
+
});
|
|
116
|
+
};
|
package/package.json
CHANGED