@centreon/js-config 23.10.62 → 23.10.63

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
 
@@ -332,11 +334,6 @@ Cypress.Commands.add(
332
334
  name,
333
335
  source: '/var/log/centreon'
334
336
  })
335
- .copyFromContainer({
336
- destination: `${logDirectory}/centreon-gorgone`,
337
- name,
338
- source: '/var/log/centreon-gorgone'
339
- })
340
337
  .then(() => {
341
338
  if (Cypress.env('WEB_IMAGE_OS').includes('alma')) {
342
339
  return cy.copyFromContainer({
@@ -355,24 +352,6 @@ Cypress.Commands.add(
355
352
  { failOnNonZeroExit: false }
356
353
  );
357
354
  })
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
- })
376
355
  .exec(`chmod -R 755 "${logDirectory}"`)
377
356
  .stopContainer({ name });
378
357
  }
@@ -389,7 +368,7 @@ Cypress.Commands.add(
389
368
 
390
369
  cy.exec(`docker logs ${name}`).then(({ stdout }) => {
391
370
  cy.writeFile(
392
- `results/logs/${Cypress.spec.name.replace(
371
+ `cypress/results/logs/${Cypress.spec.name.replace(
393
372
  artifactIllegalCharactersMatcher,
394
373
  '_'
395
374
  )}/${Cypress.currentTest.title.replace(
@@ -437,41 +416,6 @@ Cypress.Commands.add(
437
416
  }
438
417
  );
439
418
 
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
-
475
419
  interface ShareDashboardToUserProps {
476
420
  dashboardName: string;
477
421
  role: string;
@@ -486,30 +430,6 @@ interface ListingRequestResult {
486
430
  };
487
431
  }
488
432
 
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
-
513
433
  Cypress.Commands.add(
514
434
  'shareDashboardToUser',
515
435
  ({ dashboardName, userName, role }: ShareDashboardToUserProps): void => {
@@ -582,11 +502,6 @@ declare global {
582
502
  hoverRootMenuItem: (rootItemNumber: number) => Cypress.Chainable;
583
503
  insertDashboard: (dashboard: Dashboard) => Cypress.Chainable;
584
504
  insertDashboardList: (fixtureFile: string) => Cypress.Chainable;
585
- insertDashboardWithWidget: (
586
- dashboard: Dashboard,
587
- patch: PatchDashboardBody
588
- ) => Cypress.Chainable;
589
-
590
505
  loginByTypeOfUser: ({
591
506
  jsonName,
592
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'
@@ -11,7 +11,7 @@ export default (
11
11
  const width = 1920;
12
12
  const height = 1080;
13
13
 
14
- if (browser.family === 'chromium') {
14
+ if (browser.name === 'chrome') {
15
15
  if (browser.isHeadless) {
16
16
  launchOptions.args.push('--headless=new');
17
17
  }
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.62",
4
+ "version": "23.10.63",
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
  }