@centreon/js-config 23.10.59 → 23.10.60

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,32 +96,20 @@ Cypress.Commands.add(
96
96
  }
97
97
  );
98
98
 
99
- interface MoveSortableElementProps {
100
- direction: 'up' | 'down' | 'left' | 'right';
101
- element: Cypress.Chainable<JQuery<HTMLElement>>;
102
- times?: number;
103
- }
99
+ Cypress.Commands.add('moveSortableElement', ({ element, direction }): void => {
100
+ const key = `{${direction}arrow}`;
104
101
 
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
- );
102
+ element.type(' ', {
103
+ force: true,
104
+ scrollBehavior: false
105
+ });
106
+ element.eq(-1).type(key, {
107
+ scrollBehavior: false
108
+ });
109
+ element.eq(-1).type(' ', {
110
+ scrollBehavior: false
111
+ });
112
+ });
125
113
 
126
114
  Cypress.Commands.add(
127
115
  'moveSortableElementUsingAriaLabel',
@@ -162,11 +150,7 @@ declare global {
162
150
  interceptRequest: (method, path, mock, alias) => Cypress.Chainable;
163
151
  makeSnapshot: (title?: string) => void;
164
152
  mount: ({ Component, options }: MountProps) => Cypress.Chainable;
165
- moveSortableElement: ({
166
- element,
167
- direction,
168
- times
169
- }: MoveSortableElementProps) => void;
153
+ moveSortableElement: ({ element, direction }) => void;
170
154
  moveSortableElementUsingAriaLabel: ({ ariaLabel, direction }) => void;
171
155
  waitForRequest: (alias) => Cypress.Chainable;
172
156
  }
@@ -178,11 +178,13 @@ Cypress.Commands.add(
178
178
  .getByLabel({ label: 'Connect', tag: 'button' })
179
179
  .click();
180
180
 
181
- return cy.get('.MuiAlert-message').then(($snackbar) => {
182
- if ($snackbar.text().includes('Login succeeded')) {
183
- cy.wait('@getNavigationList');
184
- }
185
- });
181
+ return cy
182
+ .get('.SnackbarContent-root > .MuiPaper-root')
183
+ .then(($snackbar) => {
184
+ if ($snackbar.text().includes('Login succeeded')) {
185
+ cy.wait('@getNavigationList');
186
+ }
187
+ });
186
188
  }
187
189
  );
188
190
 
@@ -414,41 +416,6 @@ Cypress.Commands.add(
414
416
  }
415
417
  );
416
418
 
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
-
452
419
  interface ShareDashboardToUserProps {
453
420
  dashboardName: string;
454
421
  role: string;
@@ -463,30 +430,6 @@ interface ListingRequestResult {
463
430
  };
464
431
  }
465
432
 
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
-
490
433
  Cypress.Commands.add(
491
434
  'shareDashboardToUser',
492
435
  ({ dashboardName, userName, role }: ShareDashboardToUserProps): void => {
@@ -559,11 +502,6 @@ declare global {
559
502
  hoverRootMenuItem: (rootItemNumber: number) => Cypress.Chainable;
560
503
  insertDashboard: (dashboard: Dashboard) => Cypress.Chainable;
561
504
  insertDashboardList: (fixtureFile: string) => Cypress.Chainable;
562
- insertDashboardWithWidget: (
563
- dashboard: Dashboard,
564
- patch: PatchDashboardBody
565
- ) => Cypress.Chainable;
566
-
567
505
  loginByTypeOfUser: ({
568
506
  jsonName,
569
507
  loginViaApi
@@ -5,7 +5,6 @@ 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';
9
8
 
10
9
  import esbuildPreprocessor from './esbuild-preprocessor';
11
10
  import plugins from './plugins';
@@ -15,7 +14,6 @@ interface ConfigurationOptions {
15
14
  cypressFolder?: string;
16
15
  dockerName?: string;
17
16
  env?: Record<string, unknown>;
18
- envFile?: string;
19
17
  isDevelopment?: boolean;
20
18
  specPattern: string;
21
19
  }
@@ -25,13 +23,8 @@ export default ({
25
23
  cypressFolder,
26
24
  isDevelopment,
27
25
  dockerName,
28
- env,
29
- envFile
26
+ env
30
27
  }: ConfigurationOptions): Cypress.ConfigOptions => {
31
- if (envFile) {
32
- configDotenv({ path: envFile });
33
- }
34
-
35
28
  const resultsFolder = `${cypressFolder || '.'}/results`;
36
29
 
37
30
  const webImageVersion = execSync('git rev-parse --abbrev-ref HEAD')
@@ -60,7 +53,7 @@ export default ({
60
53
  },
61
54
  env: {
62
55
  ...env,
63
- OPENID_IMAGE_VERSION: process.env.MAJOR || '24.04',
56
+ OPENID_IMAGE_VERSION: '23.04',
64
57
  WEB_IMAGE_OS: 'alma9',
65
58
  WEB_IMAGE_VERSION: webImageVersion,
66
59
  dockerName: dockerName || 'centreon-dev'
package/jest/index.js CHANGED
@@ -5,6 +5,7 @@ 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'],
8
9
  testEnvironment: 'jsdom',
9
10
  testPathIgnorePatterns: ['/node_modules/', '!*.cypress.spec.tsx'],
10
11
  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.59",
4
+ "version": "23.10.60",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"
@@ -53,7 +53,6 @@
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",
57
56
  "esbuild": "^0.19.5",
58
57
  "mochawesome": "^7.1.3"
59
58
  }
@@ -1,5 +1,5 @@
1
1
  const excludeNodeModulesExceptCentreonUi =
2
- /node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon|file\+packages\+ui-context))/;
2
+ /node_modules(\\|\/)\.pnpm(\\|\/)(?!(@centreon))/;
3
3
 
4
4
  module.exports = {
5
5
  cache: false,
@@ -33,17 +33,19 @@ const getBaseConfiguration = ({
33
33
  shared: [
34
34
  {
35
35
  '@centreon/ui-context': {
36
+ requiredVersion: '22.10.0',
36
37
  singleton: true
37
38
  }
38
39
  },
39
40
  {
40
41
  jotai: {
41
- requiredVersion: '2.x',
42
+ requiredVersion: '1.x',
42
43
  singleton: true
43
44
  }
44
45
  },
45
46
  {
46
47
  'jotai-suspense': {
48
+ requiredVersion: '0.1.x',
47
49
  singleton: true
48
50
  }
49
51
  },
@@ -77,10 +79,10 @@ const getBaseConfiguration = ({
77
79
  ].filter(Boolean),
78
80
  resolve: {
79
81
  alias: {
82
+ react: path.resolve('./node_modules/react'),
80
83
  '@centreon/ui/fonts': path.resolve(
81
84
  './node_modules/@centreon/ui/public/fonts'
82
- ),
83
- react: path.resolve('./node_modules/react')
85
+ )
84
86
  },
85
87
  extensions: ['.js', '.jsx', '.ts', '.tsx']
86
88
  }