@centreon/js-config 23.10.22 → 23.10.24
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 +41 -0
- package/cypress/e2e/plugins.ts +6 -3
- package/package.json +1 -1
package/cypress/e2e/commands.ts
CHANGED
|
@@ -401,6 +401,42 @@ Cypress.Commands.add(
|
|
|
401
401
|
}
|
|
402
402
|
);
|
|
403
403
|
|
|
404
|
+
interface ShareDashboardToUserProps {
|
|
405
|
+
dashboardName: string;
|
|
406
|
+
role: string;
|
|
407
|
+
userName: string;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
Cypress.Commands.add(
|
|
411
|
+
'shareDashboardToUser',
|
|
412
|
+
({ dashboardName, userName, role }: ShareDashboardToUserProps): void => {
|
|
413
|
+
Promise.all([
|
|
414
|
+
cy.request({
|
|
415
|
+
method: 'GET',
|
|
416
|
+
url: `/centreon/api/latest/configuration/users?search={"name":"${userName}"}`
|
|
417
|
+
}),
|
|
418
|
+
cy.request({
|
|
419
|
+
method: 'GET',
|
|
420
|
+
url: `/centreon/api/latest/configuration/dashboards?search={"name":"${dashboardName}"}`
|
|
421
|
+
})
|
|
422
|
+
])
|
|
423
|
+
.then(([retrievedUser, retrievedDashboard]) => {
|
|
424
|
+
const userId = retrievedUser.body.result[0].id;
|
|
425
|
+
const dashboardId = retrievedDashboard.body.result[0].id;
|
|
426
|
+
|
|
427
|
+
cy.request({
|
|
428
|
+
body: {
|
|
429
|
+
id: userId,
|
|
430
|
+
role: `${role}`
|
|
431
|
+
},
|
|
432
|
+
method: 'POST',
|
|
433
|
+
url: `/centreon/api/latest/configuration/dashboards/${dashboardId}/access_rights/contacts`
|
|
434
|
+
});
|
|
435
|
+
})
|
|
436
|
+
.catch((error) => console.log(error));
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
|
|
404
440
|
Cypress.Commands.add('getTimeFromHeader', (): Cypress.Chainable => {
|
|
405
441
|
return cy.waitUntil(() => {
|
|
406
442
|
return cy.get('header div[data-cy="clock"]').then(($time) => {
|
|
@@ -440,6 +476,11 @@ declare global {
|
|
|
440
476
|
rootItemNumber,
|
|
441
477
|
subMenu
|
|
442
478
|
}: NavigateToProps) => Cypress.Chainable;
|
|
479
|
+
shareDashboardToUser: ({
|
|
480
|
+
dashboardName,
|
|
481
|
+
userName,
|
|
482
|
+
role
|
|
483
|
+
}: ShareDashboardToUserProps) => Cypress.Chainable;
|
|
443
484
|
startContainer: ({
|
|
444
485
|
name,
|
|
445
486
|
image
|
package/cypress/e2e/plugins.ts
CHANGED
|
@@ -51,10 +51,13 @@ export default async (on, config): Promise<void> => {
|
|
|
51
51
|
|
|
52
52
|
on('before:browser:launch', (browser = {}, launchOptions) => {
|
|
53
53
|
if ((browser as { name }).name === 'chrome') {
|
|
54
|
+
// flags description : https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
|
|
54
55
|
launchOptions.args.push('--disable-gpu');
|
|
55
|
-
launchOptions.args
|
|
56
|
-
|
|
57
|
-
);
|
|
56
|
+
launchOptions.args.push('--auto-open-devtools-for-tabs');
|
|
57
|
+
launchOptions.args.push('--disable-extensions');
|
|
58
|
+
launchOptions.args.push('--hide-scrollbars');
|
|
59
|
+
launchOptions.args.push('--mute-audio');
|
|
60
|
+
launchOptions.args.push('--hide-scrollbars');
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
return launchOptions;
|
package/package.json
CHANGED