@centreon/js-config 23.10.64 → 23.10.65

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.
@@ -4,13 +4,15 @@ import React from 'react';
4
4
  import { mount } from 'cypress/react18';
5
5
  import { equals, isNil } from 'ramda';
6
6
 
7
- import { Box } from '@mui/material';
7
+ import { Box, CssBaseline } from '@mui/material';
8
8
 
9
9
  import { ThemeProvider } from '@centreon/ui';
10
10
 
11
11
  import '@testing-library/cypress/add-commands';
12
12
  import 'cypress-msw-interceptor';
13
13
 
14
+ import disableMotion from './disableCssTransitions';
15
+
14
16
  interface MountProps {
15
17
  Component: React.ReactNode;
16
18
  options?: object;
@@ -24,7 +26,7 @@ export enum Method {
24
26
  PUT = 'PUT'
25
27
  }
26
28
 
27
- Cypress.Commands.add('mount', ({ Component, options }) => {
29
+ Cypress.Commands.add('mount', ({ Component, options = {} }) => {
28
30
  const wrapped = (
29
31
  <ThemeProvider>
30
32
  <Box
@@ -36,11 +38,10 @@ Cypress.Commands.add('mount', ({ Component, options }) => {
36
38
  >
37
39
  {Component}
38
40
  </Box>
41
+ <CssBaseline />
39
42
  </ThemeProvider>
40
43
  );
41
44
 
42
- document.getElementsByTagName('body')[0].setAttribute('style', 'margin:0px');
43
-
44
45
  return mount(wrapped, options);
45
46
  });
46
47
 
@@ -128,15 +129,28 @@ Cypress.Commands.add(
128
129
  }
129
130
  );
130
131
 
132
+ Cypress.Commands.add('makeSnapshot', (title?: string) => {
133
+ cy.viewport(1280, 590);
134
+ cy.matchImageSnapshot(title);
135
+ });
136
+
137
+ Cypress.Commands.add('cssDisableMotion', (): void => {
138
+ Cypress.on('window:before:load', (cyWindow) => {
139
+ disableMotion(cyWindow);
140
+ });
141
+ });
142
+
131
143
  declare global {
132
144
  namespace Cypress {
133
145
  interface Chainable {
146
+ cssDisableMotion: () => Cypress.Chainable;
134
147
  interceptAPIRequest: <T extends object>(
135
148
  props: InterceptAPIRequestProps<T>
136
149
  ) => Cypress.Chainable;
137
150
  interceptRequest: (method, path, mock, alias) => Cypress.Chainable;
138
- mount: ({ Component, options = {} }: MountProps) => Cypress.Chainable;
139
- moveSortableElement: ({ ariaLabel, direction }) => void;
151
+ makeSnapshot: (title?: string) => void;
152
+ mount: ({ Component, options }: MountProps) => Cypress.Chainable;
153
+ moveSortableElement: ({ element, direction }) => void;
140
154
  moveSortableElementUsingAriaLabel: ({ ariaLabel, direction }) => void;
141
155
  waitForRequest: (alias) => Cypress.Chainable;
142
156
  }
@@ -4,28 +4,30 @@ const {
4
4
  addMatchImageSnapshotPlugin
5
5
  } = require('@simonsmith/cypress-image-snapshot/plugin');
6
6
 
7
- module.exports = ({ webpackConfig, cypressFolder, specPattern, env }) => {
7
+ module.exports = ({
8
+ webpackConfig,
9
+ cypressFolder,
10
+ specPattern,
11
+ env,
12
+ useVite = false,
13
+ excludeSpecPattern
14
+ }) => {
8
15
  const mainCypressFolder = cypressFolder || 'cypress';
9
16
 
10
17
  return defineConfig({
11
18
  component: {
12
19
  devServer: {
13
- bundler: 'webpack',
20
+ bundler: useVite ? 'vite' : 'webpack',
14
21
  framework: 'react',
15
22
  webpackConfig
16
23
  },
24
+ excludeSpecPattern,
17
25
  setupNodeEvents: (on, config) => {
18
26
  addMatchImageSnapshotPlugin(on, config);
19
27
 
20
28
  on('before:browser:launch', (browser, launchOptions) => {
21
29
  if (browser.name === 'chrome' && browser.isHeadless) {
22
- launchOptions.args = launchOptions.args.map((arg) => {
23
- if (arg === '--headless') {
24
- return '--headless=new';
25
- }
26
-
27
- return arg;
28
- });
30
+ launchOptions.args.push('--headless=new');
29
31
  }
30
32
 
31
33
  return launchOptions;
@@ -0,0 +1,19 @@
1
+ const disableMotion = (win): void => {
2
+ const injectedStyleEl = win.document.getElementById('__cy_disable_motion__');
3
+ if (injectedStyleEl) {
4
+ return;
5
+ }
6
+ win.document.head.insertAdjacentHTML(
7
+ 'beforeend',
8
+ `
9
+ <style id="__cy_disable_motion__">
10
+ /* Disable CSS transitions. */
11
+ *, *::before, *::after { -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; -ms-transition: none !important; transition: none !important; }
12
+ /* Disable CSS animations. */
13
+ *, *::before, *::after { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; -ms-animation: none !important; animation: none !important; }
14
+ </style>
15
+ `.trim()
16
+ );
17
+ };
18
+
19
+ export default disableMotion;
@@ -13,7 +13,7 @@ const enableVisualTesting = (cypressFolder = 'cypress'): void => {
13
13
  capture: 'viewport',
14
14
  customDiffConfig: { threshold: 0.01 },
15
15
  customSnapshotsDir: `${cypressFolder}/visual-testing-snapshots`,
16
- failureThreshold: 0.06,
16
+ failureThreshold: 0.07,
17
17
  failureThresholdType: 'percent'
18
18
  });
19
19
  };
@@ -0,0 +1,75 @@
1
+ /* eslint-disable @typescript-eslint/no-namespace */
2
+
3
+ const apiBase = '/centreon/api';
4
+ const apiActionV1 = `${apiBase}/index.php`;
5
+
6
+ const getStatusNumberFromString = (status: string): number => {
7
+ const statuses = {
8
+ critical: '2',
9
+ down: '1',
10
+ ok: '0',
11
+ unknown: '3',
12
+ unreachable: '2',
13
+ up: '0',
14
+ warning: '1'
15
+ };
16
+
17
+ if (status in statuses) {
18
+ return statuses[status];
19
+ }
20
+
21
+ throw new Error(`Status ${status} does not exist`);
22
+ };
23
+
24
+ interface SubmitResult {
25
+ host: string;
26
+ output: string;
27
+ perfdata?: string | null;
28
+ service?: string | null;
29
+ status: string;
30
+ }
31
+
32
+ Cypress.Commands.add(
33
+ 'submitResults',
34
+ (results: Array<SubmitResult>): Cypress.Chainable => {
35
+ results.forEach(
36
+ ({ host, output, perfdata = '', service = null, status }) => {
37
+ const timestampNow = Math.floor(Date.now() / 1000) - 15;
38
+ const updatetime = timestampNow.toString();
39
+
40
+ const result = {
41
+ host,
42
+ output,
43
+ perfdata,
44
+ service,
45
+ status: getStatusNumberFromString(status),
46
+ updatetime
47
+ };
48
+
49
+ cy.request({
50
+ body: {
51
+ results: [result]
52
+ },
53
+ headers: {
54
+ 'Content-Type': 'application/json',
55
+ 'centreon-auth-token': window.localStorage.getItem('userTokenApiV1')
56
+ },
57
+ method: 'POST',
58
+ url: `${apiActionV1}?action=submit&object=centreon_submit_results`
59
+ });
60
+ }
61
+ );
62
+
63
+ return cy.wrap(null);
64
+ }
65
+ );
66
+
67
+ declare global {
68
+ namespace Cypress {
69
+ interface Chainable {
70
+ submitResults: (props: Array<SubmitResult>) => Cypress.Chainable;
71
+ }
72
+ }
73
+ }
74
+
75
+ export {};
@@ -1,6 +1,11 @@
1
1
  /* eslint-disable @typescript-eslint/no-namespace */
2
2
 
3
3
  import './commands/configuration';
4
+ import './commands/monitoring';
5
+
6
+ import installLogsCollector from 'cypress-terminal-report/src/installLogsCollector';
7
+
8
+ installLogsCollector({ enableExtendedCollector: true });
4
9
 
5
10
  const apiLoginV2 = '/centreon/authentication/providers/configurations/local';
6
11
 
@@ -23,7 +28,7 @@ Cypress.Commands.add('getWebVersion', (): Cypress.Chainable => {
23
28
 
24
29
  Cypress.Commands.add('getIframeBody', (): Cypress.Chainable => {
25
30
  return cy
26
- .get('iframe#main-content')
31
+ .get('iframe#main-content', { timeout: 10000 })
27
32
  .its('0.contentDocument.body')
28
33
  .should('not.be.empty')
29
34
  .then(cy.wrap);
@@ -39,6 +44,13 @@ Cypress.Commands.add(
39
44
  }
40
45
  );
41
46
 
47
+ Cypress.Commands.add(
48
+ 'clickSubRootMenuItem',
49
+ (page: string): Cypress.Chainable => {
50
+ return cy.get('div[data-cy="collapse"]').eq(1).contains(page).click();
51
+ }
52
+ );
53
+
42
54
  interface NavigateToProps {
43
55
  page: string;
44
56
  rootItemNumber: number;
@@ -51,8 +63,13 @@ Cypress.Commands.add(
51
63
  if (subMenu) {
52
64
  cy.hoverRootMenuItem(rootItemNumber)
53
65
  .contains(subMenu)
54
- .trigger('mouseover', { force: true });
55
- cy.contains(page).click({ force: true });
66
+ .trigger('mouseover')
67
+ .get('.MuiCollapse-wrapper')
68
+ .find('div[data-cy="collapse"]')
69
+ .should('be.visible')
70
+ .and('contain', page);
71
+
72
+ cy.clickSubRootMenuItem(page);
56
73
 
57
74
  return;
58
75
  }
@@ -85,29 +102,41 @@ Cypress.Commands.add(
85
102
 
86
103
  interface CopyFromContainerProps {
87
104
  destination: string;
105
+ name?: string;
88
106
  source: string;
89
107
  }
90
108
 
91
109
  Cypress.Commands.add(
92
110
  'copyFromContainer',
93
- ({ source, destination }: CopyFromContainerProps) => {
94
- return cy.exec(
95
- `docker cp ${Cypress.env('dockerName')}:${source} "${destination}"`
96
- );
111
+ (
112
+ {
113
+ name = Cypress.env('dockerName'),
114
+ source,
115
+ destination
116
+ }: CopyFromContainerProps,
117
+ options?: Partial<Cypress.ExecOptions>
118
+ ) => {
119
+ return cy.exec(`docker cp ${name}:${source} "${destination}"`, options);
97
120
  }
98
121
  );
99
122
 
100
123
  interface CopyToContainerProps {
101
124
  destination: string;
125
+ name?: string;
102
126
  source: string;
103
127
  }
104
128
 
105
129
  Cypress.Commands.add(
106
130
  'copyToContainer',
107
- ({ source, destination }: CopyToContainerProps) => {
108
- return cy.exec(
109
- `docker cp ${source} ${Cypress.env('dockerName')}:${destination}`
110
- );
131
+ (
132
+ {
133
+ name = Cypress.env('dockerName'),
134
+ source,
135
+ destination
136
+ }: CopyToContainerProps,
137
+ options?: Partial<Cypress.ExecOptions>
138
+ ) => {
139
+ return cy.exec(`docker cp ${source} ${name}:${destination}`, options);
111
140
  }
112
141
  );
113
142
 
@@ -118,7 +147,7 @@ interface LoginByTypeOfUserProps {
118
147
 
119
148
  Cypress.Commands.add(
120
149
  'loginByTypeOfUser',
121
- ({ jsonName, loginViaApi }): Cypress.Chainable => {
150
+ ({ jsonName = 'admin', loginViaApi = false }): Cypress.Chainable => {
122
151
  if (loginViaApi) {
123
152
  return cy
124
153
  .fixture(`users/${jsonName}.json`)
@@ -135,12 +164,15 @@ Cypress.Commands.add(
135
164
  .visit(`${Cypress.config().baseUrl}`)
136
165
  .wait('@getNavigationList');
137
166
  }
167
+
138
168
  cy.visit(`${Cypress.config().baseUrl}`)
139
169
  .fixture(`users/${jsonName}.json`)
140
170
  .then((credential) => {
141
- cy.getByLabel({ label: 'Alias', tag: 'input' }).type(credential.login);
171
+ cy.getByLabel({ label: 'Alias', tag: 'input' }).type(
172
+ `{selectAll}{backspace}${credential.login}`
173
+ );
142
174
  cy.getByLabel({ label: 'Password', tag: 'input' }).type(
143
- credential.password
175
+ `{selectAll}{backspace}${credential.password}`
144
176
  );
145
177
  })
146
178
  .getByLabel({ label: 'Connect', tag: 'button' })
@@ -210,9 +242,20 @@ interface StartContainerProps {
210
242
  Cypress.Commands.add(
211
243
  'startContainer',
212
244
  ({ name, image, portBindings }: StartContainerProps): Cypress.Chainable => {
213
- return cy
214
- .exec(`docker image inspect ${image} || docker pull ${image}`)
215
- .task('startContainer', { image, name, portBindings });
245
+ cy.log(`Starting container ${name} from image ${image}`);
246
+
247
+ return cy.task(
248
+ 'startContainer',
249
+ { image, name, portBindings },
250
+ { timeout: 600000 } // 10 minutes because docker pull can be very slow
251
+ );
252
+ }
253
+ );
254
+
255
+ Cypress.Commands.add(
256
+ 'createDirectory',
257
+ (directoryPath: string): Cypress.Chainable => {
258
+ return cy.task('createDirectory', directoryPath);
216
259
  }
217
260
  );
218
261
 
@@ -227,7 +270,7 @@ Cypress.Commands.add(
227
270
  'startWebContainer',
228
271
  ({
229
272
  name = Cypress.env('dockerName'),
230
- os = 'alma9',
273
+ os = Cypress.env('WEB_IMAGE_OS'),
231
274
  useSlim = true,
232
275
  version = Cypress.env('WEB_IMAGE_VERSION')
233
276
  }: StartWebContainerProps = {}): Cypress.Chainable => {
@@ -242,12 +285,13 @@ Cypress.Commands.add(
242
285
  portBindings: [{ destination: 4000, source: 80 }]
243
286
  })
244
287
  .then(() => {
245
- const baseUrl = 'http://0.0.0.0:4000';
288
+ const baseUrl = 'http://127.0.0.1:4000';
246
289
 
247
290
  Cypress.config('baseUrl', baseUrl);
248
291
 
249
- return cy.exec(
250
- `npx wait-on ${baseUrl}/centreon/api/latest/platform/installation/status`
292
+ return cy.task(
293
+ 'waitOn',
294
+ `${baseUrl}/centreon/api/latest/platform/installation/status`
251
295
  );
252
296
  })
253
297
  .visit('/') // this is necessary to refresh browser cause baseUrl has changed (flash appears in video)
@@ -264,7 +308,7 @@ Cypress.Commands.add(
264
308
  ({
265
309
  name = Cypress.env('dockerName')
266
310
  }: StopWebContainerProps = {}): Cypress.Chainable => {
267
- const logDirectory = `cypress/results/logs/${Cypress.spec.name.replace(
311
+ const logDirectory = `results/logs/${Cypress.spec.name.replace(
268
312
  artifactIllegalCharactersMatcher,
269
313
  '_'
270
314
  )}/${Cypress.currentTest.title.replace(
@@ -274,25 +318,41 @@ Cypress.Commands.add(
274
318
 
275
319
  return cy
276
320
  .visitEmptyPage()
277
- .exec(`mkdir -p "${logDirectory}"`)
321
+ .createDirectory(logDirectory)
278
322
  .copyFromContainer({
279
323
  destination: `${logDirectory}/broker`,
324
+ name,
280
325
  source: '/var/log/centreon-broker'
281
326
  })
282
327
  .copyFromContainer({
283
328
  destination: `${logDirectory}/engine`,
329
+ name,
284
330
  source: '/var/log/centreon-engine'
285
331
  })
286
- .execInContainer({
287
- command: `bash -e <<EOF
288
- chmod 777 /var/log/centreon/centreon-web.log > /dev/null 2>&1 || :
289
- EOF`,
290
- name
291
- })
292
332
  .copyFromContainer({
293
333
  destination: `${logDirectory}/centreon`,
334
+ name,
294
335
  source: '/var/log/centreon'
295
336
  })
337
+ .then(() => {
338
+ if (Cypress.env('WEB_IMAGE_OS').includes('alma')) {
339
+ return cy.copyFromContainer({
340
+ destination: `${logDirectory}/php`,
341
+ name,
342
+ source: '/var/log/php-fpm'
343
+ });
344
+ }
345
+
346
+ return cy.copyFromContainer(
347
+ {
348
+ destination: `${logDirectory}/php8.1-fpm-centreon-error.log`,
349
+ name,
350
+ source: '/var/log/php8.1-fpm-centreon-error.log'
351
+ },
352
+ { failOnNonZeroExit: false }
353
+ );
354
+ })
355
+ .exec(`chmod -R 755 "${logDirectory}"`)
296
356
  .stopContainer({ name });
297
357
  }
298
358
  );
@@ -304,6 +364,8 @@ interface StopContainerProps {
304
364
  Cypress.Commands.add(
305
365
  'stopContainer',
306
366
  ({ name }: StopContainerProps): Cypress.Chainable => {
367
+ cy.log(`Stopping container ${name}`);
368
+
307
369
  cy.exec(`docker logs ${name}`).then(({ stdout }) => {
308
370
  cy.writeFile(
309
371
  `cypress/results/logs/${Cypress.spec.name.replace(
@@ -321,21 +383,128 @@ Cypress.Commands.add(
321
383
  }
322
384
  );
323
385
 
386
+ interface Dashboard {
387
+ description?: string;
388
+ name: string;
389
+ }
390
+
391
+ Cypress.Commands.add(
392
+ 'insertDashboardList',
393
+ (fixtureFile: string): Cypress.Chainable => {
394
+ return cy.fixture(fixtureFile).then((dashboardList) => {
395
+ cy.wrap(
396
+ Promise.all(
397
+ dashboardList.map((dashboardBody: Dashboard) =>
398
+ cy.insertDashboard({ ...dashboardBody })
399
+ )
400
+ )
401
+ );
402
+ });
403
+ }
404
+ );
405
+
406
+ Cypress.Commands.add(
407
+ 'insertDashboard',
408
+ (dashboardBody: Dashboard): Cypress.Chainable => {
409
+ return cy.request({
410
+ body: {
411
+ ...dashboardBody
412
+ },
413
+ method: 'POST',
414
+ url: '/centreon/api/latest/configuration/dashboards'
415
+ });
416
+ }
417
+ );
418
+
419
+ interface ShareDashboardToUserProps {
420
+ dashboardName: string;
421
+ role: string;
422
+ userName: string;
423
+ }
424
+
425
+ interface ListingRequestResult {
426
+ body: {
427
+ result: Array<{
428
+ id: number;
429
+ }>;
430
+ };
431
+ }
432
+
433
+ Cypress.Commands.add(
434
+ 'shareDashboardToUser',
435
+ ({ dashboardName, userName, role }: ShareDashboardToUserProps): void => {
436
+ Promise.all([
437
+ cy.request({
438
+ method: 'GET',
439
+ url: `/centreon/api/latest/configuration/users?search={"name":"${userName}"}`
440
+ }),
441
+ cy.request({
442
+ method: 'GET',
443
+ url: `/centreon/api/latest/configuration/dashboards?search={"name":"${dashboardName}"}`
444
+ })
445
+ ]).then(
446
+ ([retrievedUser, retrievedDashboard]: [
447
+ ListingRequestResult,
448
+ ListingRequestResult
449
+ ]) => {
450
+ const userId = retrievedUser.body.result[0].id;
451
+ const dashboardId = retrievedDashboard.body.result[0].id;
452
+
453
+ cy.request({
454
+ body: {
455
+ id: userId,
456
+ role: `${role}`
457
+ },
458
+ method: 'POST',
459
+ url: `/centreon/api/latest/configuration/dashboards/${dashboardId}/access_rights/contacts`
460
+ });
461
+ }
462
+ );
463
+ }
464
+ );
465
+
466
+ Cypress.Commands.add('getTimeFromHeader', (): Cypress.Chainable => {
467
+ return cy
468
+ .get('header div[data-cy="clock"]', { timeout: 10000 })
469
+ .should('be.visible')
470
+ .then(($time) => {
471
+ const headerTime = $time.children()[1].textContent;
472
+ if (headerTime?.match(/\d+:\d+/)) {
473
+ cy.log(`header time is : ${headerTime}`);
474
+
475
+ return cy.wrap(headerTime);
476
+ }
477
+
478
+ throw new Error(`header time is not displayed`);
479
+ });
480
+ });
481
+
324
482
  declare global {
325
483
  namespace Cypress {
326
484
  interface Chainable {
327
- copyFromContainer: (props: CopyFromContainerProps) => Cypress.Chainable;
328
- copyToContainer: (props: CopyToContainerProps) => Cypress.Chainable;
485
+ clickSubRootMenuItem: (page: string) => Cypress.Chainable;
486
+ copyFromContainer: (
487
+ props: CopyFromContainerProps,
488
+ options?: Partial<Cypress.ExecOptions>
489
+ ) => Cypress.Chainable;
490
+ copyToContainer: (
491
+ props: CopyToContainerProps,
492
+ options?: Partial<Cypress.ExecOptions>
493
+ ) => Cypress.Chainable;
494
+ createDirectory: (directoryPath: string) => Cypress.Chainable;
329
495
  execInContainer: ({
330
496
  command,
331
497
  name
332
498
  }: ExecInContainerProps) => Cypress.Chainable;
333
499
  getIframeBody: () => Cypress.Chainable;
500
+ getTimeFromHeader: () => Cypress.Chainable;
334
501
  getWebVersion: () => Cypress.Chainable;
335
502
  hoverRootMenuItem: (rootItemNumber: number) => Cypress.Chainable;
503
+ insertDashboard: (dashboard: Dashboard) => Cypress.Chainable;
504
+ insertDashboardList: (fixtureFile: string) => Cypress.Chainable;
336
505
  loginByTypeOfUser: ({
337
- jsonName = 'admin',
338
- loginViaApi = false
506
+ jsonName,
507
+ loginViaApi
339
508
  }: LoginByTypeOfUserProps) => Cypress.Chainable;
340
509
  moveSortableElement: (direction: string) => Cypress.Chainable;
341
510
  navigateTo: ({
@@ -343,6 +512,11 @@ declare global {
343
512
  rootItemNumber,
344
513
  subMenu
345
514
  }: NavigateToProps) => Cypress.Chainable;
515
+ shareDashboardToUser: ({
516
+ dashboardName,
517
+ userName,
518
+ role
519
+ }: ShareDashboardToUserProps) => Cypress.Chainable;
346
520
  startContainer: ({
347
521
  name,
348
522
  image
@@ -4,8 +4,11 @@
4
4
  import { execSync } from 'child_process';
5
5
 
6
6
  import { defineConfig } from 'cypress';
7
+ import installLogsPrinter from 'cypress-terminal-report/src/installLogsPrinter';
7
8
 
8
- import setupNodeEvents from './plugins';
9
+ import esbuildPreprocessor from './esbuild-preprocessor';
10
+ import plugins from './plugins';
11
+ import tasks from './tasks';
9
12
 
10
13
  interface ConfigurationOptions {
11
14
  cypressFolder?: string;
@@ -22,9 +25,7 @@ export default ({
22
25
  dockerName,
23
26
  env
24
27
  }: ConfigurationOptions): Cypress.ConfigOptions => {
25
- const resultsFolder = `${cypressFolder || 'cypress'}/results${
26
- isDevelopment ? '/dev' : ''
27
- }`;
28
+ const resultsFolder = `${cypressFolder || '.'}/results`;
28
29
 
29
30
  const webImageVersion = execSync('git rev-parse --abbrev-ref HEAD')
30
31
  .toString('utf8')
@@ -35,8 +36,20 @@ export default ({
35
36
  defaultCommandTimeout: 6000,
36
37
  e2e: {
37
38
  excludeSpecPattern: ['*.js', '*.ts', '*.md'],
38
- setupNodeEvents,
39
- specPattern
39
+ fixturesFolder: 'fixtures',
40
+ reporter: require.resolve('cypress-multi-reporters'),
41
+ reporterOptions: {
42
+ configFile: `${__dirname}/reporter-config.js`
43
+ },
44
+ setupNodeEvents: async (on, config) => {
45
+ installLogsPrinter(on);
46
+ await esbuildPreprocessor(on, config);
47
+ tasks(on);
48
+
49
+ return plugins(on, config);
50
+ },
51
+ specPattern,
52
+ supportFile: 'support/e2e.{js,jsx,ts,tsx}'
40
53
  },
41
54
  env: {
42
55
  ...env,
@@ -45,34 +58,12 @@ export default ({
45
58
  WEB_IMAGE_VERSION: webImageVersion,
46
59
  dockerName: dockerName || 'centreon-dev'
47
60
  },
48
- execTimeout: 120000,
49
- reporter: 'mochawesome',
50
- reporterOptions: {
51
- html: false,
52
- json: true,
53
- overwrite: true,
54
- reportDir: `${resultsFolder}/reports`,
55
- reportFilename: '[name]-report.json'
56
- },
61
+ execTimeout: 60000,
57
62
  requestTimeout: 10000,
58
63
  retries: 0,
59
64
  screenshotsFolder: `${resultsFolder}/screenshots`,
60
- setupNodeEvents: (on, config) => {
61
- on('before:browser:launch', (browser, launchOptions) => {
62
- if (browser.name === 'chrome' && browser.isHeadless) {
63
- launchOptions.args = launchOptions.args.map((arg) => {
64
- if (arg === '--headless') {
65
- return '--headless=new';
66
- }
67
-
68
- return arg;
69
- });
70
- }
71
-
72
- return launchOptions;
73
- });
74
- },
75
65
  video: true,
66
+ videoCompression: 0,
76
67
  videosFolder: `${resultsFolder}/videos`
77
68
  });
78
69
  };