@centreon/js-config 24.4.4 → 24.4.5

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',
@@ -165,11 +153,7 @@ declare global {
165
153
  interceptRequest: (method, path, mock, alias) => Cypress.Chainable;
166
154
  makeSnapshot: (title?: string) => void;
167
155
  mount: ({ Component, options }: MountProps) => Cypress.Chainable;
168
- moveSortableElement: ({
169
- element,
170
- direction,
171
- times
172
- }: MoveSortableElementProps) => void;
156
+ moveSortableElement: ({ element, direction }) => void;
173
157
  moveSortableElementUsingAriaLabel: ({ ariaLabel, direction }) => void;
174
158
  waitForRequest: (alias) => Cypress.Chainable;
175
159
  }
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress');
3
3
  const {
4
4
  addMatchImageSnapshotPlugin
5
5
  } = require('@simonsmith/cypress-image-snapshot/plugin');
6
- const cypressCodeCoverageTask = require('@cypress/code-coverage/task');
7
6
 
8
7
  module.exports = ({
9
8
  webpackConfig,
@@ -26,8 +25,6 @@ module.exports = ({
26
25
  setupNodeEvents: (on, config) => {
27
26
  addMatchImageSnapshotPlugin(on, config);
28
27
 
29
- cypressCodeCoverageTask(on, config);
30
-
31
28
  on('before:browser:launch', (browser, launchOptions) => {
32
29
  if (browser.name === 'chrome' && browser.isHeadless) {
33
30
  launchOptions.args.push('--headless=new');
@@ -40,17 +37,8 @@ module.exports = ({
40
37
  supportFile: `${mainCypressFolder}/support/component.tsx`
41
38
  },
42
39
  env: {
43
- baseUrl: 'http://localhost:9092',
44
- codeCoverage: {
45
- exclude: [
46
- 'cypress/**/*.*',
47
- 'packages/**',
48
- 'node_modules',
49
- '**/*.js',
50
- '**/*.spec.tsx'
51
- ]
52
- },
53
- ...env
40
+ ...env,
41
+ baseUrl: 'http://localhost:9092'
54
42
  },
55
43
  reporter: 'mochawesome',
56
44
  reporterOptions: {
@@ -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,63 +1,59 @@
1
1
  {
2
- "name": "@centreon/js-config",
3
- "description": "Centreon Frontend shared build configuration",
4
- "version": "24.4.4",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/centreon/centreon-frontend.git"
8
- },
9
- "keywords": [
10
- "centreon",
11
- "eslint"
12
- ],
13
- "author": "centreon@centreon.com",
14
- "license": "GPL-2.0",
15
- "bugs": {
16
- "url": "https://github.com/centreon/centreon-frontend/issues"
17
- },
18
- "homepage": "https://github.com/centreon/centreon-frontend#readme",
19
- "files": [
20
- "eslint",
21
- "jest",
22
- "tsconfig",
23
- "webpack",
24
- "cypress"
25
- ],
26
- "peerDependencies": {
27
- "prettier": "^3.0.0",
28
- "eslint": "^8.53.0"
29
- },
30
- "dependencies": {
31
- "@badeball/cypress-cucumber-preprocessor": "^19.1.0",
32
- "@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
33
- "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
34
- "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
35
- "@tsconfig/node16": "^16.1.1",
36
- "@tsconfig/node20": "^20.1.2",
37
- "@types/cypress-cucumber-preprocessor": "^4.0.5",
38
- "@types/dockerode": "^3.3.23",
39
- "cypress-multi-reporters": "^1.6.4",
40
- "cypress-terminal-report": "^5.3.9",
41
- "dockerode": "^4.0.0",
42
- "dotenv": "^16.3.1",
43
- "esbuild": "^0.19.5",
44
- "eslint": "^8.53.0",
45
- "eslint-config-airbnb": "19.0.4",
46
- "eslint-config-prettier": "^8.5.0",
47
- "eslint-import-resolver-alias": "^1.1.2",
48
- "eslint-import-resolver-typescript": "^3.5.5",
49
- "eslint-plugin-babel": "^5.3.1",
50
- "eslint-plugin-hooks": "^0.4.3",
51
- "eslint-plugin-import": "^2.26.0",
52
- "eslint-plugin-jest": "^26.1.5",
53
- "eslint-plugin-jsx-a11y": "^6.5.1",
54
- "eslint-plugin-node": "^11.1.0",
55
- "eslint-plugin-prefer-arrow-functions": "^3.1.4",
56
- "eslint-plugin-prettier": "^5.0.0",
57
- "eslint-plugin-react": "^7.29.4",
58
- "eslint-plugin-react-hooks": "^4.5.0",
59
- "eslint-plugin-sort-keys-fix": "^1.1.2",
60
- "eslint-plugin-typescript-sort-keys": "^2.1.0",
61
- "mochawesome": "^7.1.3"
62
- }
2
+ "name": "@centreon/js-config",
3
+ "description": "Centreon Frontend shared build configuration",
4
+ "version": "24.4.5",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/centreon/centreon-frontend.git"
8
+ },
9
+ "keywords": [
10
+ "centreon",
11
+ "eslint"
12
+ ],
13
+ "author": "centreon@centreon.com",
14
+ "license": "GPL-2.0",
15
+ "bugs": {
16
+ "url": "https://github.com/centreon/centreon-frontend/issues"
17
+ },
18
+ "devDependencies": {
19
+ "@tsconfig/node16": "^16.1.1",
20
+ "eslint": "^8.17.0",
21
+ "eslint-config-airbnb": "19.0.4",
22
+ "eslint-config-prettier": "^8.5.0",
23
+ "eslint-import-resolver-alias": "^1.1.2",
24
+ "eslint-import-resolver-typescript": "^3.5.5",
25
+ "eslint-plugin-babel": "^5.3.1",
26
+ "eslint-plugin-hooks": "^0.4.3",
27
+ "eslint-plugin-import": "^2.26.0",
28
+ "eslint-plugin-jest": "^26.1.5",
29
+ "eslint-plugin-jsx-a11y": "^6.5.1",
30
+ "eslint-plugin-node": "^11.1.0",
31
+ "eslint-plugin-prefer-arrow-functions": "^3.1.4",
32
+ "eslint-plugin-prettier": "^4.0.0",
33
+ "eslint-plugin-react": "^7.29.4",
34
+ "eslint-plugin-react-hooks": "^4.5.0",
35
+ "eslint-plugin-sort-keys-fix": "^1.1.2",
36
+ "eslint-plugin-typescript-sort-keys": "^2.1.0"
37
+ },
38
+ "homepage": "https://github.com/centreon/centreon-frontend#readme",
39
+ "files": [
40
+ "eslint",
41
+ "jest",
42
+ "tsconfig",
43
+ "webpack",
44
+ "cypress"
45
+ ],
46
+ "dependencies": {
47
+ "@badeball/cypress-cucumber-preprocessor": "^19.1.0",
48
+ "@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
49
+ "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
50
+ "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
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
+ "mochawesome": "^7.1.3"
58
+ }
63
59
  }
@@ -1,10 +1,10 @@
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,
6
6
  excludeNodeModulesExceptCentreonUi,
7
- getModuleConfiguration: (jscTransformConfiguration, enableCoverage) => ({
7
+ getModuleConfiguration: (jscTransformConfiguration) => ({
8
8
  rules: [
9
9
  {
10
10
  parser: { system: false },
@@ -17,11 +17,6 @@ module.exports = {
17
17
  loader: 'swc-loader',
18
18
  options: {
19
19
  jsc: {
20
- experimental: {
21
- plugins: [
22
- enableCoverage && ['swc-plugin-coverage-instrument', {}]
23
- ].filter(Boolean)
24
- },
25
20
  parser: {
26
21
  syntax: 'typescript',
27
22
  tsx: true
@@ -13,11 +13,10 @@ const {
13
13
  const getBaseConfiguration = ({
14
14
  moduleName,
15
15
  moduleFederationConfig,
16
- jscTransformConfiguration,
17
- enableCoverage
16
+ jscTransformConfiguration
18
17
  }) => ({
19
18
  cache,
20
- module: getModuleConfiguration(jscTransformConfiguration, enableCoverage),
19
+ module: getModuleConfiguration(jscTransformConfiguration),
21
20
  optimization,
22
21
  output: {
23
22
  ...output,
@@ -34,18 +33,19 @@ const getBaseConfiguration = ({
34
33
  shared: [
35
34
  {
36
35
  '@centreon/ui-context': {
37
- requiredVersion: '24.x',
36
+ requiredVersion: '22.10.0',
38
37
  singleton: true
39
38
  }
40
39
  },
41
40
  {
42
41
  jotai: {
43
- requiredVersion: '2.x',
42
+ requiredVersion: '1.x',
44
43
  singleton: true
45
44
  }
46
45
  },
47
46
  {
48
47
  'jotai-suspense': {
48
+ requiredVersion: '0.1.x',
49
49
  singleton: true
50
50
  }
51
51
  },
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "@tsconfig/node20/tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": true,
5
- "allowJs": true,
6
- "strictNullChecks": false,
7
- "declaration": false,
8
- "esModuleInterop": true,
9
- "strict": true,
10
- "types": ["@types/jest", "node"]
11
- }
12
- }