@centreon/js-config 23.10.1-remove-video-compression.0 → 23.10.1-sync-dev-23-10-x-develop-oss.0

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.
@@ -24,6 +24,14 @@ module.exports = ({
24
24
  excludeSpecPattern,
25
25
  setupNodeEvents: (on, config) => {
26
26
  addMatchImageSnapshotPlugin(on, config);
27
+
28
+ on('before:browser:launch', (browser, launchOptions) => {
29
+ if (browser.name === 'chrome' && browser.isHeadless) {
30
+ launchOptions.args.push('--headless=new');
31
+ }
32
+
33
+ return launchOptions;
34
+ });
27
35
  },
28
36
  specPattern,
29
37
  supportFile: `${mainCypressFolder}/support/component.tsx`
@@ -3,6 +3,10 @@
3
3
  import './commands/configuration';
4
4
  import './commands/monitoring';
5
5
 
6
+ import installLogsCollector from 'cypress-terminal-report/src/installLogsCollector';
7
+
8
+ installLogsCollector();
9
+
6
10
  const apiLoginV2 = '/centreon/authentication/providers/configurations/local';
7
11
 
8
12
  const artifactIllegalCharactersMatcher = /[,\s/|<>*?:"]/g;
@@ -225,7 +229,18 @@ interface StartContainerProps {
225
229
  Cypress.Commands.add(
226
230
  'startContainer',
227
231
  ({ name, image, portBindings }: StartContainerProps): Cypress.Chainable => {
228
- return cy.task('startContainer', { image, name, portBindings });
232
+ return cy.task(
233
+ 'startContainer',
234
+ { image, name, portBindings },
235
+ { timeout: 600000 } // 10 minutes because docker pull can be very slow
236
+ );
237
+ }
238
+ );
239
+
240
+ Cypress.Commands.add(
241
+ 'createDirectory',
242
+ (directoryPath: string): Cypress.Chainable => {
243
+ return cy.task('createDirectory', directoryPath);
229
244
  }
230
245
  );
231
246
 
@@ -288,7 +303,7 @@ Cypress.Commands.add(
288
303
 
289
304
  return cy
290
305
  .visitEmptyPage()
291
- .exec(`mkdir -p "${logDirectory}"`)
306
+ .createDirectory(logDirectory)
292
307
  .copyFromContainer({
293
308
  destination: `${logDirectory}/broker`,
294
309
  name,
@@ -459,6 +474,7 @@ declare global {
459
474
  props: CopyToContainerProps,
460
475
  options?: Partial<Cypress.ExecOptions>
461
476
  ) => Cypress.Chainable;
477
+ createDirectory: (directoryPath: string) => Cypress.Chainable;
462
478
  execInContainer: ({
463
479
  command,
464
480
  name
@@ -4,6 +4,7 @@
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
9
  import esbuildPreprocessor from './esbuild-preprocessor';
9
10
  import plugins from './plugins';
@@ -24,7 +25,7 @@ export default ({
24
25
  dockerName,
25
26
  env
26
27
  }: ConfigurationOptions): Cypress.ConfigOptions => {
27
- const resultsFolder = `${cypressFolder || 'cypress'}/results`;
28
+ const resultsFolder = `${cypressFolder || '.'}/results`;
28
29
 
29
30
  const webImageVersion = execSync('git rev-parse --abbrev-ref HEAD')
30
31
  .toString('utf8')
@@ -35,13 +36,20 @@ export default ({
35
36
  defaultCommandTimeout: 6000,
36
37
  e2e: {
37
38
  excludeSpecPattern: ['*.js', '*.ts', '*.md'],
39
+ fixturesFolder: 'fixtures',
40
+ reporter: require.resolve('cypress-multi-reporters'),
41
+ reporterOptions: {
42
+ configFile: `${__dirname}/reporter-config.js`
43
+ },
38
44
  setupNodeEvents: async (on, config) => {
45
+ installLogsPrinter(on);
39
46
  await esbuildPreprocessor(on, config);
40
47
  tasks(on);
41
48
 
42
49
  return plugins(on, config);
43
50
  },
44
- specPattern
51
+ specPattern,
52
+ supportFile: 'support/e2e.{js,jsx,ts,tsx}'
45
53
  },
46
54
  env: {
47
55
  ...env,
@@ -51,14 +59,6 @@ export default ({
51
59
  dockerName: dockerName || 'centreon-dev'
52
60
  },
53
61
  execTimeout: 60000,
54
- reporter: 'mochawesome',
55
- reporterOptions: {
56
- html: false,
57
- json: true,
58
- overwrite: true,
59
- reportDir: `${resultsFolder}/reports`,
60
- reportFilename: '[name]-report.json'
61
- },
62
62
  requestTimeout: 10000,
63
63
  retries: 0,
64
64
  screenshotsFolder: `${resultsFolder}/screenshots`,
@@ -11,16 +11,20 @@ export default (
11
11
  const width = 1920;
12
12
  const height = 1080;
13
13
 
14
- if ((browser as { name }).name === 'chrome') {
14
+ if (browser.name === 'chrome') {
15
+ if (browser.isHeadless) {
16
+ launchOptions.args.push('--headless=new');
17
+ }
18
+
15
19
  // flags description : https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
16
20
  launchOptions.args.push('--disable-gpu');
17
21
  launchOptions.args.push('--auto-open-devtools-for-tabs');
18
22
  launchOptions.args.push('--disable-extensions');
19
23
  launchOptions.args.push('--hide-scrollbars');
20
24
  launchOptions.args.push('--mute-audio');
21
- launchOptions.args.push('--hide-scrollbars');
22
25
 
23
26
  launchOptions.args.push(`--window-size=${width},${height}`);
27
+
24
28
  // force screen to be non-retina and just use our given resolution
25
29
  launchOptions.args.push('--force-device-scale-factor=1');
26
30
  }
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ mochawesomeReporterOptions: {
3
+ consoleReporter: 'none',
4
+ html: false,
5
+ json: true,
6
+ overwrite: true,
7
+ reportDir: 'results/reports',
8
+ reportFilename: '[name]-report.json'
9
+ },
10
+ reporterEnabled: `mochawesome,${require.resolve(
11
+ '@badeball/cypress-cucumber-preprocessor/pretty-reporter'
12
+ )}`
13
+ };
@@ -1,4 +1,5 @@
1
1
  import { execSync } from 'child_process';
2
+ import { existsSync, mkdirSync } from 'fs';
2
3
 
3
4
  import Docker from 'dockerode';
4
5
 
@@ -21,6 +22,13 @@ export default (on: Cypress.PluginEvents): void => {
21
22
  }
22
23
 
23
24
  on('task', {
25
+ createDirectory: async (directoryPath: string) => {
26
+ if (!existsSync(directoryPath)) {
27
+ mkdirSync(directoryPath, { recursive: true });
28
+ }
29
+
30
+ return null;
31
+ },
24
32
  startContainer: async ({
25
33
  image,
26
34
  name,
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.1-remove-video-compression.0",
4
+ "version": "23.10.1-sync-dev-23-10-x-develop-oss.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"
@@ -16,15 +16,7 @@
16
16
  "url": "https://github.com/centreon/centreon-frontend/issues"
17
17
  },
18
18
  "devDependencies": {
19
- "@badeball/cypress-cucumber-preprocessor": "^18.0.5",
20
- "@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
21
- "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
22
- "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
23
19
  "@tsconfig/node16": "^16.1.1",
24
- "@types/cypress-cucumber-preprocessor": "^4.0.2",
25
- "@types/dockerode": "^3.3.19",
26
- "dockerode": "^3.3.5",
27
- "esbuild": "^0.19.3",
28
20
  "eslint": "^8.17.0",
29
21
  "eslint-config-airbnb": "19.0.4",
30
22
  "eslint-config-prettier": "^8.5.0",
@@ -50,5 +42,18 @@
50
42
  "tsconfig",
51
43
  "webpack",
52
44
  "cypress"
53
- ]
45
+ ],
46
+ "dependencies": {
47
+ "@badeball/cypress-cucumber-preprocessor": "^18.0.6",
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.2",
52
+ "@types/dockerode": "^3.3.19",
53
+ "cypress-multi-reporters": "^1.6.3",
54
+ "cypress-terminal-report": "^5.3.6",
55
+ "dockerode": "^3.3.5",
56
+ "esbuild": "^0.19.3",
57
+ "mochawesome": "^7.1.3"
58
+ }
54
59
  }