@centreon/js-config 23.10.57 → 23.10.59
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
|
|
|
@@ -416,6 +414,41 @@ Cypress.Commands.add(
|
|
|
416
414
|
}
|
|
417
415
|
);
|
|
418
416
|
|
|
417
|
+
Cypress.Commands.add(
|
|
418
|
+
'insertDashboardWithWidget',
|
|
419
|
+
(dashboardBody, patchBody) => {
|
|
420
|
+
cy.request({
|
|
421
|
+
body: {
|
|
422
|
+
...dashboardBody
|
|
423
|
+
},
|
|
424
|
+
method: 'POST',
|
|
425
|
+
url: '/centreon/api/latest/configuration/dashboards'
|
|
426
|
+
}).then((response) => {
|
|
427
|
+
const dashboardId = response.body.id;
|
|
428
|
+
cy.waitUntil(
|
|
429
|
+
() => {
|
|
430
|
+
return cy
|
|
431
|
+
.request({
|
|
432
|
+
method: 'GET',
|
|
433
|
+
url: `/centreon/api/latest/configuration/dashboards/${dashboardId}`
|
|
434
|
+
})
|
|
435
|
+
.then((getResponse) => {
|
|
436
|
+
return getResponse.body && getResponse.body.id === dashboardId;
|
|
437
|
+
});
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
timeout: 10000
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
cy.request({
|
|
444
|
+
body: patchBody,
|
|
445
|
+
method: 'PATCH',
|
|
446
|
+
url: `/centreon/api/latest/configuration/dashboards/${dashboardId}`
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
|
|
419
452
|
interface ShareDashboardToUserProps {
|
|
420
453
|
dashboardName: string;
|
|
421
454
|
role: string;
|
|
@@ -430,6 +463,30 @@ interface ListingRequestResult {
|
|
|
430
463
|
};
|
|
431
464
|
}
|
|
432
465
|
|
|
466
|
+
interface PatchDashboardBody {
|
|
467
|
+
panels: Array<{
|
|
468
|
+
layout: {
|
|
469
|
+
height: number;
|
|
470
|
+
min_height: number;
|
|
471
|
+
min_width: number;
|
|
472
|
+
width: number;
|
|
473
|
+
x: number;
|
|
474
|
+
y: number;
|
|
475
|
+
};
|
|
476
|
+
name: string;
|
|
477
|
+
widget_settings: {
|
|
478
|
+
options: {
|
|
479
|
+
description: {
|
|
480
|
+
content: string;
|
|
481
|
+
enabled: boolean;
|
|
482
|
+
};
|
|
483
|
+
name: string;
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
widget_type: string;
|
|
487
|
+
}>;
|
|
488
|
+
}
|
|
489
|
+
|
|
433
490
|
Cypress.Commands.add(
|
|
434
491
|
'shareDashboardToUser',
|
|
435
492
|
({ dashboardName, userName, role }: ShareDashboardToUserProps): void => {
|
|
@@ -502,6 +559,11 @@ declare global {
|
|
|
502
559
|
hoverRootMenuItem: (rootItemNumber: number) => Cypress.Chainable;
|
|
503
560
|
insertDashboard: (dashboard: Dashboard) => Cypress.Chainable;
|
|
504
561
|
insertDashboardList: (fixtureFile: string) => Cypress.Chainable;
|
|
562
|
+
insertDashboardWithWidget: (
|
|
563
|
+
dashboard: Dashboard,
|
|
564
|
+
patch: PatchDashboardBody
|
|
565
|
+
) => Cypress.Chainable;
|
|
566
|
+
|
|
505
567
|
loginByTypeOfUser: ({
|
|
506
568
|
jsonName,
|
|
507
569
|
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/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.59",
|
|
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
|
@@ -18,30 +18,32 @@ const getBaseConfiguration = ({
|
|
|
18
18
|
cache,
|
|
19
19
|
module: getModuleConfiguration(jscTransformConfiguration),
|
|
20
20
|
optimization,
|
|
21
|
-
output
|
|
21
|
+
output: {
|
|
22
|
+
...output,
|
|
23
|
+
library: moduleName,
|
|
24
|
+
uniqueName: moduleName
|
|
25
|
+
},
|
|
22
26
|
plugins: [
|
|
23
27
|
new CleanWebpackPlugin(),
|
|
24
28
|
moduleName &&
|
|
25
29
|
new ModuleFederationPlugin({
|
|
26
30
|
filename: 'remoteEntry.[chunkhash:8].js',
|
|
27
|
-
library: { name: moduleName, type: '
|
|
31
|
+
library: { name: moduleName, type: 'umd' },
|
|
28
32
|
name: moduleName,
|
|
29
33
|
shared: [
|
|
30
34
|
{
|
|
31
35
|
'@centreon/ui-context': {
|
|
32
|
-
requiredVersion: '22.10.0',
|
|
33
36
|
singleton: true
|
|
34
37
|
}
|
|
35
38
|
},
|
|
36
39
|
{
|
|
37
40
|
jotai: {
|
|
38
|
-
requiredVersion: '
|
|
41
|
+
requiredVersion: '2.x',
|
|
39
42
|
singleton: true
|
|
40
43
|
}
|
|
41
44
|
},
|
|
42
45
|
{
|
|
43
46
|
'jotai-suspense': {
|
|
44
|
-
requiredVersion: '0.1.x',
|
|
45
47
|
singleton: true
|
|
46
48
|
}
|
|
47
49
|
},
|
|
@@ -75,10 +77,10 @@ const getBaseConfiguration = ({
|
|
|
75
77
|
].filter(Boolean),
|
|
76
78
|
resolve: {
|
|
77
79
|
alias: {
|
|
78
|
-
react: path.resolve('./node_modules/react'),
|
|
79
80
|
'@centreon/ui/fonts': path.resolve(
|
|
80
81
|
'./node_modules/@centreon/ui/public/fonts'
|
|
81
|
-
)
|
|
82
|
+
),
|
|
83
|
+
react: path.resolve('./node_modules/react')
|
|
82
84
|
},
|
|
83
85
|
extensions: ['.js', '.jsx', '.ts', '.tsx']
|
|
84
86
|
}
|