@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.
- package/cypress/e2e/commands.ts +54 -18
- package/package.json +1 -1
package/cypress/e2e/commands.ts
CHANGED
|
@@ -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
|
-
({
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
({
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
263
|
-
|
|
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
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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.
|
|
342
|
-
|
|
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
|
-
|
|
379
|
+
return false;
|
|
380
|
+
});
|
|
345
381
|
});
|
|
346
382
|
});
|
|
347
383
|
|
package/package.json
CHANGED