@centreon/js-config 23.10.12 → 23.10.14

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,6 +4,8 @@ import './commands/configuration';
4
4
 
5
5
  const apiLoginV2 = '/centreon/authentication/providers/configurations/local';
6
6
 
7
+ const artifactIllegalCharactersMatcher = /[,\s/|<>*?:"]/g;
8
+
7
9
  Cypress.Commands.add('getWebVersion', (): Cypress.Chainable => {
8
10
  return cy
9
11
  .exec(
@@ -90,29 +92,35 @@ Cypress.Commands.add(
90
92
 
91
93
  interface CopyFromContainerProps {
92
94
  destination: string;
95
+ name?: string;
93
96
  source: string;
94
97
  }
95
98
 
96
99
  Cypress.Commands.add(
97
100
  'copyFromContainer',
98
- ({ source, destination }: CopyFromContainerProps) => {
99
- return cy.exec(
100
- `docker cp ${Cypress.env('dockerName')}:${source} "${destination}"`
101
- );
101
+ ({
102
+ name = Cypress.env('dockerName'),
103
+ source,
104
+ destination
105
+ }: CopyFromContainerProps) => {
106
+ return cy.exec(`docker cp ${name}:${source} "${destination}"`);
102
107
  }
103
108
  );
104
109
 
105
110
  interface CopyToContainerProps {
106
111
  destination: string;
112
+ name?: string;
107
113
  source: string;
108
114
  }
109
115
 
110
116
  Cypress.Commands.add(
111
117
  'copyToContainer',
112
- ({ source, destination }: CopyToContainerProps) => {
113
- return cy.exec(
114
- `docker cp ${source} ${Cypress.env('dockerName')}:${destination}`
115
- );
118
+ ({
119
+ name = Cypress.env('dockerName'),
120
+ source,
121
+ destination
122
+ }: CopyToContainerProps) => {
123
+ return cy.exec(`docker cp ${source} ${name}:${destination}`);
116
124
  }
117
125
  );
118
126
 
@@ -258,25 +266,47 @@ Cypress.Commands.add(
258
266
  ({
259
267
  name = Cypress.env('dockerName')
260
268
  }: StopWebContainerProps = {}): Cypress.Chainable => {
261
- const logDirectory = `cypress/results/logs/${
262
- Cypress.spec.name
263
- }/${Cypress.currentTest.title.replace(/,|\s|\//g, '_')}`;
269
+ const logDirectory = `cypress/results/logs/${Cypress.spec.name.replace(
270
+ artifactIllegalCharactersMatcher,
271
+ '_'
272
+ )}/${Cypress.currentTest.title.replace(
273
+ artifactIllegalCharactersMatcher,
274
+ '_'
275
+ )}`;
264
276
 
265
277
  return cy
266
278
  .visitEmptyPage()
267
279
  .exec(`mkdir -p "${logDirectory}"`)
268
280
  .copyFromContainer({
269
281
  destination: `${logDirectory}/broker`,
282
+ name,
270
283
  source: '/var/log/centreon-broker'
271
284
  })
272
285
  .copyFromContainer({
273
286
  destination: `${logDirectory}/engine`,
287
+ name,
274
288
  source: '/var/log/centreon-engine'
275
289
  })
276
290
  .copyFromContainer({
277
291
  destination: `${logDirectory}/centreon`,
292
+ name,
278
293
  source: '/var/log/centreon'
279
294
  })
295
+ .then(() => {
296
+ if (Cypress.env('WEB_IMAGE_OS').includes('alma')) {
297
+ return cy.copyFromContainer({
298
+ destination: `${logDirectory}/php`,
299
+ name,
300
+ source: '/var/log/php-fpm'
301
+ });
302
+ }
303
+
304
+ return cy.copyFromContainer({
305
+ destination: `${logDirectory}/php8.1-fpm-centreon-error.log`,
306
+ name,
307
+ source: '/var/log/php8.1-fpm-centreon-error.log'
308
+ });
309
+ })
280
310
  .stopContainer({ name });
281
311
  }
282
312
  );
@@ -290,10 +320,11 @@ Cypress.Commands.add(
290
320
  ({ name }: StopContainerProps): Cypress.Chainable => {
291
321
  cy.exec(`docker logs ${name}`).then(({ stdout }) => {
292
322
  cy.writeFile(
293
- `cypress/results/logs/${
294
- Cypress.spec.name
295
- }/${Cypress.currentTest.title.replace(
296
- /,|\s|\//g,
323
+ `cypress/results/logs/${Cypress.spec.name.replace(
324
+ artifactIllegalCharactersMatcher,
325
+ '_'
326
+ )}/${Cypress.currentTest.title.replace(
327
+ artifactIllegalCharactersMatcher,
297
328
  '_'
298
329
  )}/container-${name}.log`,
299
330
  stdout
@@ -338,10 +369,15 @@ Cypress.Commands.add(
338
369
  );
339
370
 
340
371
  Cypress.Commands.add('getTimeFromHeader', (): Cypress.Chainable => {
341
- return cy.get('header div[data-cy="clock"]').then(($time) => {
342
- const localTime = $time.children()[1].textContent;
372
+ return cy.waitUntil(() => {
373
+ return cy.get('header div[data-cy="clock"]').then(($time) => {
374
+ const headerTime = $time.children()[1].textContent;
375
+ if (headerTime?.match(/\d+:\d+/)) {
376
+ return headerTime;
377
+ }
343
378
 
344
- return localTime;
379
+ return false;
380
+ });
345
381
  });
346
382
  });
347
383
 
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.12",
4
+ "version": "23.10.14",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"