@centreon/js-config 23.10.1-display-pretty-output.3 → 23.10.1-downgrade.0
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.
|
@@ -11,6 +11,8 @@ import { ThemeProvider } from '@centreon/ui';
|
|
|
11
11
|
import '@testing-library/cypress/add-commands';
|
|
12
12
|
import 'cypress-msw-interceptor';
|
|
13
13
|
|
|
14
|
+
import disableMotion from './disableCssTransitions';
|
|
15
|
+
|
|
14
16
|
interface MountProps {
|
|
15
17
|
Component: React.ReactNode;
|
|
16
18
|
options?: object;
|
|
@@ -132,9 +134,16 @@ Cypress.Commands.add('makeSnapshot', (title?: string) => {
|
|
|
132
134
|
cy.matchImageSnapshot(title);
|
|
133
135
|
});
|
|
134
136
|
|
|
137
|
+
Cypress.Commands.add('cssDisableMotion', (): void => {
|
|
138
|
+
Cypress.on('window:before:load', (cyWindow) => {
|
|
139
|
+
disableMotion(cyWindow);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
135
143
|
declare global {
|
|
136
144
|
namespace Cypress {
|
|
137
145
|
interface Chainable {
|
|
146
|
+
cssDisableMotion: () => Cypress.Chainable;
|
|
138
147
|
interceptAPIRequest: <T extends object>(
|
|
139
148
|
props: InterceptAPIRequestProps<T>
|
|
140
149
|
) => Cypress.Chainable;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const disableMotion = (win): void => {
|
|
2
|
+
const injectedStyleEl = win.document.getElementById('__cy_disable_motion__');
|
|
3
|
+
if (injectedStyleEl) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
win.document.head.insertAdjacentHTML(
|
|
7
|
+
'beforeend',
|
|
8
|
+
`
|
|
9
|
+
<style id="__cy_disable_motion__">
|
|
10
|
+
/* Disable CSS transitions. */
|
|
11
|
+
*, *::before, *::after { -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; -ms-transition: none !important; transition: none !important; }
|
|
12
|
+
/* Disable CSS animations. */
|
|
13
|
+
*, *::before, *::after { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; -ms-animation: none !important; animation: none !important; }
|
|
14
|
+
</style>
|
|
15
|
+
`.trim()
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default disableMotion;
|
package/cypress/e2e/commands.ts
CHANGED
|
@@ -5,7 +5,7 @@ import './commands/monitoring';
|
|
|
5
5
|
|
|
6
6
|
import installLogsCollector from 'cypress-terminal-report/src/installLogsCollector';
|
|
7
7
|
|
|
8
|
-
installLogsCollector();
|
|
8
|
+
installLogsCollector({ enableExtendedCollector: true });
|
|
9
9
|
|
|
10
10
|
const apiLoginV2 = '/centreon/authentication/providers/configurations/local';
|
|
11
11
|
|
|
@@ -211,7 +211,20 @@ interface ExecInContainerProps {
|
|
|
211
211
|
Cypress.Commands.add(
|
|
212
212
|
'execInContainer',
|
|
213
213
|
({ command, name }: ExecInContainerProps): Cypress.Chainable => {
|
|
214
|
-
return cy
|
|
214
|
+
return cy
|
|
215
|
+
.exec(`docker exec -i ${name} ${command}`, { failOnNonZeroExit: false })
|
|
216
|
+
.then((result) => {
|
|
217
|
+
if (result.code) {
|
|
218
|
+
// output will not be truncated
|
|
219
|
+
throw new Error(`
|
|
220
|
+
Execution of "${command}" failed
|
|
221
|
+
Exit code: ${result.code}
|
|
222
|
+
Stdout:\n${result.stdout}
|
|
223
|
+
Stderr:\n${result.stderr}`);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return cy.wrap(result);
|
|
227
|
+
});
|
|
215
228
|
}
|
|
216
229
|
);
|
|
217
230
|
|
|
@@ -229,7 +242,20 @@ interface StartContainerProps {
|
|
|
229
242
|
Cypress.Commands.add(
|
|
230
243
|
'startContainer',
|
|
231
244
|
({ name, image, portBindings }: StartContainerProps): Cypress.Chainable => {
|
|
232
|
-
|
|
245
|
+
cy.log(`Starting container ${name} from image ${image}`);
|
|
246
|
+
|
|
247
|
+
return cy.task(
|
|
248
|
+
'startContainer',
|
|
249
|
+
{ image, name, portBindings },
|
|
250
|
+
{ timeout: 600000 } // 10 minutes because docker pull can be very slow
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
Cypress.Commands.add(
|
|
256
|
+
'createDirectory',
|
|
257
|
+
(directoryPath: string): Cypress.Chainable => {
|
|
258
|
+
return cy.task('createDirectory', directoryPath);
|
|
233
259
|
}
|
|
234
260
|
);
|
|
235
261
|
|
|
@@ -282,7 +308,7 @@ Cypress.Commands.add(
|
|
|
282
308
|
({
|
|
283
309
|
name = Cypress.env('dockerName')
|
|
284
310
|
}: StopWebContainerProps = {}): Cypress.Chainable => {
|
|
285
|
-
const logDirectory = `
|
|
311
|
+
const logDirectory = `results/logs/${Cypress.spec.name.replace(
|
|
286
312
|
artifactIllegalCharactersMatcher,
|
|
287
313
|
'_'
|
|
288
314
|
)}/${Cypress.currentTest.title.replace(
|
|
@@ -292,7 +318,7 @@ Cypress.Commands.add(
|
|
|
292
318
|
|
|
293
319
|
return cy
|
|
294
320
|
.visitEmptyPage()
|
|
295
|
-
.
|
|
321
|
+
.createDirectory(logDirectory)
|
|
296
322
|
.copyFromContainer({
|
|
297
323
|
destination: `${logDirectory}/broker`,
|
|
298
324
|
name,
|
|
@@ -338,6 +364,8 @@ interface StopContainerProps {
|
|
|
338
364
|
Cypress.Commands.add(
|
|
339
365
|
'stopContainer',
|
|
340
366
|
({ name }: StopContainerProps): Cypress.Chainable => {
|
|
367
|
+
cy.log(`Stopping container ${name}`);
|
|
368
|
+
|
|
341
369
|
cy.exec(`docker logs ${name}`).then(({ stdout }) => {
|
|
342
370
|
cy.writeFile(
|
|
343
371
|
`cypress/results/logs/${Cypress.spec.name.replace(
|
|
@@ -463,6 +491,7 @@ declare global {
|
|
|
463
491
|
props: CopyToContainerProps,
|
|
464
492
|
options?: Partial<Cypress.ExecOptions>
|
|
465
493
|
) => Cypress.Chainable;
|
|
494
|
+
createDirectory: (directoryPath: string) => Cypress.Chainable;
|
|
466
495
|
execInContainer: ({
|
|
467
496
|
command,
|
|
468
497
|
name
|
|
@@ -25,7 +25,7 @@ export default ({
|
|
|
25
25
|
dockerName,
|
|
26
26
|
env
|
|
27
27
|
}: ConfigurationOptions): Cypress.ConfigOptions => {
|
|
28
|
-
const resultsFolder = `${cypressFolder || '
|
|
28
|
+
const resultsFolder = `${cypressFolder || '.'}/results`;
|
|
29
29
|
|
|
30
30
|
const webImageVersion = execSync('git rev-parse --abbrev-ref HEAD')
|
|
31
31
|
.toString('utf8')
|
|
@@ -36,6 +36,7 @@ export default ({
|
|
|
36
36
|
defaultCommandTimeout: 6000,
|
|
37
37
|
e2e: {
|
|
38
38
|
excludeSpecPattern: ['*.js', '*.ts', '*.md'],
|
|
39
|
+
fixturesFolder: 'fixtures',
|
|
39
40
|
reporter: require.resolve('cypress-multi-reporters'),
|
|
40
41
|
reporterOptions: {
|
|
41
42
|
configFile: `${__dirname}/reporter-config.js`
|
|
@@ -47,7 +48,8 @@ export default ({
|
|
|
47
48
|
|
|
48
49
|
return plugins(on, config);
|
|
49
50
|
},
|
|
50
|
-
specPattern
|
|
51
|
+
specPattern,
|
|
52
|
+
supportFile: 'support/e2e.{js,jsx,ts,tsx}'
|
|
51
53
|
},
|
|
52
54
|
env: {
|
|
53
55
|
...env,
|
package/cypress/e2e/tasks.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
|
+
import { existsSync, mkdirSync } from 'fs';
|
|
2
3
|
|
|
3
4
|
import Docker from 'dockerode';
|
|
4
5
|
|
|
@@ -21,6 +22,13 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
on('task', {
|
|
25
|
+
createDirectory: async (directoryPath: string) => {
|
|
26
|
+
if (!existsSync(directoryPath)) {
|
|
27
|
+
mkdirSync(directoryPath, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return null;
|
|
31
|
+
},
|
|
24
32
|
startContainer: async ({
|
|
25
33
|
image,
|
|
26
34
|
name,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/js-config",
|
|
3
3
|
"description": "Centreon Frontend shared build configuration",
|
|
4
|
-
"version": "23.10.1-
|
|
4
|
+
"version": "23.10.1-downgrade.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/centreon/centreon-frontend.git"
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
|
|
49
49
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
50
50
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
51
|
-
"@types/cypress-cucumber-preprocessor": "^4.0.
|
|
52
|
-
"@types/dockerode": "^3.3.
|
|
53
|
-
"cypress-multi-reporters": "^1.6.
|
|
54
|
-
"cypress-terminal-report": "^5.3.
|
|
55
|
-
"dockerode": "^
|
|
56
|
-
"esbuild": "^0.19.
|
|
51
|
+
"@types/cypress-cucumber-preprocessor": "^4.0.5",
|
|
52
|
+
"@types/dockerode": "^3.3.23",
|
|
53
|
+
"cypress-multi-reporters": "^1.6.4",
|
|
54
|
+
"cypress-terminal-report": "^5.3.9",
|
|
55
|
+
"dockerode": "^4.0.0",
|
|
56
|
+
"esbuild": "^0.19.5",
|
|
57
57
|
"mochawesome": "^7.1.3"
|
|
58
58
|
}
|
|
59
59
|
}
|