@centreon/js-config 23.10.60 → 23.10.62
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.
|
@@ -96,20 +96,32 @@ Cypress.Commands.add(
|
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
interface MoveSortableElementProps {
|
|
100
|
+
direction: 'up' | 'down' | 'left' | 'right';
|
|
101
|
+
element: Cypress.Chainable<JQuery<HTMLElement>>;
|
|
102
|
+
times?: number;
|
|
103
|
+
}
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
})
|
|
105
|
+
Cypress.Commands.add(
|
|
106
|
+
'moveSortableElement',
|
|
107
|
+
({ element, direction, times = 1 }: MoveSortableElementProps): void => {
|
|
108
|
+
const key = `{${direction}arrow}`;
|
|
109
|
+
|
|
110
|
+
element.type(' ', {
|
|
111
|
+
force: true,
|
|
112
|
+
scrollBehavior: false
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
Array.from({ length: times }).forEach(() => {
|
|
116
|
+
element.eq(-1).type(key, {
|
|
117
|
+
scrollBehavior: false
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
element.eq(-1).type(' ', {
|
|
121
|
+
scrollBehavior: false
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
);
|
|
113
125
|
|
|
114
126
|
Cypress.Commands.add(
|
|
115
127
|
'moveSortableElementUsingAriaLabel',
|
|
@@ -150,7 +162,11 @@ declare global {
|
|
|
150
162
|
interceptRequest: (method, path, mock, alias) => Cypress.Chainable;
|
|
151
163
|
makeSnapshot: (title?: string) => void;
|
|
152
164
|
mount: ({ Component, options }: MountProps) => Cypress.Chainable;
|
|
153
|
-
moveSortableElement: ({
|
|
165
|
+
moveSortableElement: ({
|
|
166
|
+
element,
|
|
167
|
+
direction,
|
|
168
|
+
times
|
|
169
|
+
}: MoveSortableElementProps) => void;
|
|
154
170
|
moveSortableElementUsingAriaLabel: ({ ariaLabel, direction }) => void;
|
|
155
171
|
waitForRequest: (alias) => Cypress.Chainable;
|
|
156
172
|
}
|
package/cypress/e2e/commands.ts
CHANGED
|
@@ -178,13 +178,11 @@ Cypress.Commands.add(
|
|
|
178
178
|
.getByLabel({ label: 'Connect', tag: 'button' })
|
|
179
179
|
.click();
|
|
180
180
|
|
|
181
|
-
return cy
|
|
182
|
-
.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
});
|
|
181
|
+
return cy.get('.MuiAlert-message').then(($snackbar) => {
|
|
182
|
+
if ($snackbar.text().includes('Login succeeded')) {
|
|
183
|
+
cy.wait('@getNavigationList');
|
|
184
|
+
}
|
|
185
|
+
});
|
|
188
186
|
}
|
|
189
187
|
);
|
|
190
188
|
|
|
@@ -334,6 +332,11 @@ Cypress.Commands.add(
|
|
|
334
332
|
name,
|
|
335
333
|
source: '/var/log/centreon'
|
|
336
334
|
})
|
|
335
|
+
.copyFromContainer({
|
|
336
|
+
destination: `${logDirectory}/centreon-gorgone`,
|
|
337
|
+
name,
|
|
338
|
+
source: '/var/log/centreon-gorgone'
|
|
339
|
+
})
|
|
337
340
|
.then(() => {
|
|
338
341
|
if (Cypress.env('WEB_IMAGE_OS').includes('alma')) {
|
|
339
342
|
return cy.copyFromContainer({
|
|
@@ -352,6 +355,24 @@ Cypress.Commands.add(
|
|
|
352
355
|
{ failOnNonZeroExit: false }
|
|
353
356
|
);
|
|
354
357
|
})
|
|
358
|
+
.then(() => {
|
|
359
|
+
if (Cypress.env('WEB_IMAGE_OS').includes('alma')) {
|
|
360
|
+
return cy.copyFromContainer({
|
|
361
|
+
destination: `${logDirectory}/httpd`,
|
|
362
|
+
name,
|
|
363
|
+
source: '/var/log/httpd'
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return cy.copyFromContainer(
|
|
368
|
+
{
|
|
369
|
+
destination: `${logDirectory}/apache2`,
|
|
370
|
+
name,
|
|
371
|
+
source: '/var/log/apache2'
|
|
372
|
+
},
|
|
373
|
+
{ failOnNonZeroExit: false }
|
|
374
|
+
);
|
|
375
|
+
})
|
|
355
376
|
.exec(`chmod -R 755 "${logDirectory}"`)
|
|
356
377
|
.stopContainer({ name });
|
|
357
378
|
}
|
|
@@ -368,7 +389,7 @@ Cypress.Commands.add(
|
|
|
368
389
|
|
|
369
390
|
cy.exec(`docker logs ${name}`).then(({ stdout }) => {
|
|
370
391
|
cy.writeFile(
|
|
371
|
-
`
|
|
392
|
+
`results/logs/${Cypress.spec.name.replace(
|
|
372
393
|
artifactIllegalCharactersMatcher,
|
|
373
394
|
'_'
|
|
374
395
|
)}/${Cypress.currentTest.title.replace(
|
|
@@ -416,6 +437,41 @@ Cypress.Commands.add(
|
|
|
416
437
|
}
|
|
417
438
|
);
|
|
418
439
|
|
|
440
|
+
Cypress.Commands.add(
|
|
441
|
+
'insertDashboardWithWidget',
|
|
442
|
+
(dashboardBody, patchBody) => {
|
|
443
|
+
cy.request({
|
|
444
|
+
body: {
|
|
445
|
+
...dashboardBody
|
|
446
|
+
},
|
|
447
|
+
method: 'POST',
|
|
448
|
+
url: '/centreon/api/latest/configuration/dashboards'
|
|
449
|
+
}).then((response) => {
|
|
450
|
+
const dashboardId = response.body.id;
|
|
451
|
+
cy.waitUntil(
|
|
452
|
+
() => {
|
|
453
|
+
return cy
|
|
454
|
+
.request({
|
|
455
|
+
method: 'GET',
|
|
456
|
+
url: `/centreon/api/latest/configuration/dashboards/${dashboardId}`
|
|
457
|
+
})
|
|
458
|
+
.then((getResponse) => {
|
|
459
|
+
return getResponse.body && getResponse.body.id === dashboardId;
|
|
460
|
+
});
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
timeout: 10000
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
cy.request({
|
|
467
|
+
body: patchBody,
|
|
468
|
+
method: 'PATCH',
|
|
469
|
+
url: `/centreon/api/latest/configuration/dashboards/${dashboardId}`
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
);
|
|
474
|
+
|
|
419
475
|
interface ShareDashboardToUserProps {
|
|
420
476
|
dashboardName: string;
|
|
421
477
|
role: string;
|
|
@@ -430,6 +486,30 @@ interface ListingRequestResult {
|
|
|
430
486
|
};
|
|
431
487
|
}
|
|
432
488
|
|
|
489
|
+
interface PatchDashboardBody {
|
|
490
|
+
panels: Array<{
|
|
491
|
+
layout: {
|
|
492
|
+
height: number;
|
|
493
|
+
min_height: number;
|
|
494
|
+
min_width: number;
|
|
495
|
+
width: number;
|
|
496
|
+
x: number;
|
|
497
|
+
y: number;
|
|
498
|
+
};
|
|
499
|
+
name: string;
|
|
500
|
+
widget_settings: {
|
|
501
|
+
options: {
|
|
502
|
+
description: {
|
|
503
|
+
content: string;
|
|
504
|
+
enabled: boolean;
|
|
505
|
+
};
|
|
506
|
+
name: string;
|
|
507
|
+
};
|
|
508
|
+
};
|
|
509
|
+
widget_type: string;
|
|
510
|
+
}>;
|
|
511
|
+
}
|
|
512
|
+
|
|
433
513
|
Cypress.Commands.add(
|
|
434
514
|
'shareDashboardToUser',
|
|
435
515
|
({ dashboardName, userName, role }: ShareDashboardToUserProps): void => {
|
|
@@ -502,6 +582,11 @@ declare global {
|
|
|
502
582
|
hoverRootMenuItem: (rootItemNumber: number) => Cypress.Chainable;
|
|
503
583
|
insertDashboard: (dashboard: Dashboard) => Cypress.Chainable;
|
|
504
584
|
insertDashboardList: (fixtureFile: string) => Cypress.Chainable;
|
|
585
|
+
insertDashboardWithWidget: (
|
|
586
|
+
dashboard: Dashboard,
|
|
587
|
+
patch: PatchDashboardBody
|
|
588
|
+
) => Cypress.Chainable;
|
|
589
|
+
|
|
505
590
|
loginByTypeOfUser: ({
|
|
506
591
|
jsonName,
|
|
507
592
|
loginViaApi
|
|
@@ -5,6 +5,7 @@ import { execSync } from 'child_process';
|
|
|
5
5
|
|
|
6
6
|
import { defineConfig } from 'cypress';
|
|
7
7
|
import installLogsPrinter from 'cypress-terminal-report/src/installLogsPrinter';
|
|
8
|
+
import { config as configDotenv } from 'dotenv';
|
|
8
9
|
|
|
9
10
|
import esbuildPreprocessor from './esbuild-preprocessor';
|
|
10
11
|
import plugins from './plugins';
|
|
@@ -14,6 +15,7 @@ interface ConfigurationOptions {
|
|
|
14
15
|
cypressFolder?: string;
|
|
15
16
|
dockerName?: string;
|
|
16
17
|
env?: Record<string, unknown>;
|
|
18
|
+
envFile?: string;
|
|
17
19
|
isDevelopment?: boolean;
|
|
18
20
|
specPattern: string;
|
|
19
21
|
}
|
|
@@ -23,8 +25,13 @@ export default ({
|
|
|
23
25
|
cypressFolder,
|
|
24
26
|
isDevelopment,
|
|
25
27
|
dockerName,
|
|
26
|
-
env
|
|
28
|
+
env,
|
|
29
|
+
envFile
|
|
27
30
|
}: ConfigurationOptions): Cypress.ConfigOptions => {
|
|
31
|
+
if (envFile) {
|
|
32
|
+
configDotenv({ path: envFile });
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
const resultsFolder = `${cypressFolder || '.'}/results`;
|
|
29
36
|
|
|
30
37
|
const webImageVersion = execSync('git rev-parse --abbrev-ref HEAD')
|
|
@@ -53,7 +60,7 @@ export default ({
|
|
|
53
60
|
},
|
|
54
61
|
env: {
|
|
55
62
|
...env,
|
|
56
|
-
OPENID_IMAGE_VERSION: '
|
|
63
|
+
OPENID_IMAGE_VERSION: process.env.MAJOR || '24.04',
|
|
57
64
|
WEB_IMAGE_OS: 'alma9',
|
|
58
65
|
WEB_IMAGE_VERSION: webImageVersion,
|
|
59
66
|
dockerName: dockerName || 'centreon-dev'
|
package/cypress/e2e/plugins.ts
CHANGED
package/jest/index.js
CHANGED
|
@@ -5,7 +5,6 @@ module.exports = {
|
|
|
5
5
|
'jest-transform-stub',
|
|
6
6
|
'^react($|/.+)': '<rootDir>/node_modules/react$1'
|
|
7
7
|
},
|
|
8
|
-
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
|
|
9
8
|
testEnvironment: 'jsdom',
|
|
10
9
|
testPathIgnorePatterns: ['/node_modules/', '!*.cypress.spec.tsx'],
|
|
11
10
|
transform: {
|
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.
|
|
4
|
+
"version": "23.10.62",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/centreon/centreon-frontend.git"
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"cypress-multi-reporters": "^1.6.4",
|
|
54
54
|
"cypress-terminal-report": "^5.3.9",
|
|
55
55
|
"dockerode": "^4.0.0",
|
|
56
|
+
"dotenv": "^16.3.1",
|
|
56
57
|
"esbuild": "^0.19.5",
|
|
57
58
|
"mochawesome": "^7.1.3"
|
|
58
59
|
}
|
package/webpack/base/index.js
CHANGED
|
@@ -33,19 +33,17 @@ const getBaseConfiguration = ({
|
|
|
33
33
|
shared: [
|
|
34
34
|
{
|
|
35
35
|
'@centreon/ui-context': {
|
|
36
|
-
requiredVersion: '22.10.0',
|
|
37
36
|
singleton: true
|
|
38
37
|
}
|
|
39
38
|
},
|
|
40
39
|
{
|
|
41
40
|
jotai: {
|
|
42
|
-
requiredVersion: '
|
|
41
|
+
requiredVersion: '2.x',
|
|
43
42
|
singleton: true
|
|
44
43
|
}
|
|
45
44
|
},
|
|
46
45
|
{
|
|
47
46
|
'jotai-suspense': {
|
|
48
|
-
requiredVersion: '0.1.x',
|
|
49
47
|
singleton: true
|
|
50
48
|
}
|
|
51
49
|
},
|
|
@@ -79,10 +77,10 @@ const getBaseConfiguration = ({
|
|
|
79
77
|
].filter(Boolean),
|
|
80
78
|
resolve: {
|
|
81
79
|
alias: {
|
|
82
|
-
react: path.resolve('./node_modules/react'),
|
|
83
80
|
'@centreon/ui/fonts': path.resolve(
|
|
84
81
|
'./node_modules/@centreon/ui/public/fonts'
|
|
85
|
-
)
|
|
82
|
+
),
|
|
83
|
+
react: path.resolve('./node_modules/react')
|
|
86
84
|
},
|
|
87
85
|
extensions: ['.js', '.jsx', '.ts', '.tsx']
|
|
88
86
|
}
|