@centreon/js-config 24.10.2 → 24.10.3
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/component/commands.tsx +22 -82
- package/cypress/component/configuration.js +16 -39
- package/cypress/component/enableVisualTesting.ts +1 -1
- package/cypress/e2e/commands/configuration.ts +1 -330
- package/cypress/e2e/commands.ts +175 -623
- package/cypress/e2e/configuration.ts +40 -46
- package/cypress/e2e/plugins.ts +114 -52
- package/eslint/base.typescript.eslintrc.js +3 -15
- package/jest/index.js +2 -5
- package/package.json +45 -57
- package/tsconfig/index.json +4 -5
- package/webpack/base/index.js +130 -0
- package/webpack/patch/dev.js +24 -0
- package/{rspack → webpack}/patch/devServer.js +8 -4
- package/webpack/patch/module.js +46 -0
- package/biome/base.json +0 -224
- package/cypress/component/disableCssTransitions.ts +0 -19
- package/cypress/component/excludeNodeModulesFromCoverage.js +0 -36
- package/cypress/e2e/commands/monitoring.ts +0 -225
- package/cypress/e2e/esbuild-preprocessor.ts +0 -26
- package/cypress/e2e/reporter-config.js +0 -13
- package/cypress/e2e/tasks.ts +0 -259
- package/eslint/lambda/typescript.eslintrc.js +0 -48
- package/jest/lambda/typescript.js +0 -49
- package/rspack/base/globalConfig.js +0 -71
- package/rspack/base/index.js +0 -89
- package/rspack/patch/dev.js +0 -12
- package/rspack/patch/module.js +0 -13
- package/rspack/plugins/TransformPreloadScript.js +0 -37
- package/rspack/plugins/WriteRemoteEntryNameToModuleFederation.js +0 -30
- package/tsconfig/lambda/node20.tsconfig.json +0 -12
- package/tsconfig/lambda/tsconfig.json +0 -14
- package/tsconfig.json +0 -21
|
@@ -4,29 +4,17 @@ import React from 'react';
|
|
|
4
4
|
import { mount } from 'cypress/react18';
|
|
5
5
|
import { equals, isNil } from 'ramda';
|
|
6
6
|
|
|
7
|
-
import { Box
|
|
7
|
+
import { Box } 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
|
-
import 'cypress-real-events';
|
|
14
|
-
|
|
15
|
-
import disableMotion from './disableCssTransitions';
|
|
16
13
|
|
|
17
14
|
interface MountProps {
|
|
18
15
|
Component: React.ReactNode;
|
|
19
16
|
options?: object;
|
|
20
17
|
}
|
|
21
|
-
interface Resolution {
|
|
22
|
-
height: number;
|
|
23
|
-
width: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface MakeSnapshotWithCustomResolution {
|
|
27
|
-
resolution: Resolution;
|
|
28
|
-
title: string;
|
|
29
|
-
}
|
|
30
18
|
|
|
31
19
|
export enum Method {
|
|
32
20
|
DELETE = 'DELETE',
|
|
@@ -36,7 +24,7 @@ export enum Method {
|
|
|
36
24
|
PUT = 'PUT'
|
|
37
25
|
}
|
|
38
26
|
|
|
39
|
-
Cypress.Commands.add('mount', ({ Component, options
|
|
27
|
+
Cypress.Commands.add('mount', ({ Component, options }) => {
|
|
40
28
|
const wrapped = (
|
|
41
29
|
<ThemeProvider>
|
|
42
30
|
<Box
|
|
@@ -48,10 +36,11 @@ Cypress.Commands.add('mount', ({ Component, options = {} }) => {
|
|
|
48
36
|
>
|
|
49
37
|
{Component}
|
|
50
38
|
</Box>
|
|
51
|
-
<CssBaseline />
|
|
52
39
|
</ThemeProvider>
|
|
53
40
|
);
|
|
54
41
|
|
|
42
|
+
document.getElementsByTagName('body')[0].setAttribute('style', 'margin:0px');
|
|
43
|
+
|
|
55
44
|
return mount(wrapped, options);
|
|
56
45
|
});
|
|
57
46
|
|
|
@@ -62,7 +51,6 @@ interface Query {
|
|
|
62
51
|
|
|
63
52
|
export interface InterceptAPIRequestProps<T> {
|
|
64
53
|
alias: string;
|
|
65
|
-
delay?: number;
|
|
66
54
|
method: Method;
|
|
67
55
|
path: string;
|
|
68
56
|
query?: Query;
|
|
@@ -78,25 +66,23 @@ Cypress.Commands.add(
|
|
|
78
66
|
response,
|
|
79
67
|
alias,
|
|
80
68
|
query,
|
|
81
|
-
statusCode = 200
|
|
82
|
-
delay = 500
|
|
69
|
+
statusCode = 200
|
|
83
70
|
}: InterceptAPIRequestProps<T>): void => {
|
|
84
71
|
cy.interceptRequest(
|
|
85
72
|
method,
|
|
86
73
|
path.replace('./', '**'),
|
|
87
74
|
(req, res, ctx) => {
|
|
88
75
|
const getQuery = req?.url?.searchParams?.get(query?.name);
|
|
89
|
-
|
|
90
76
|
if (query && equals(query.value, getQuery)) {
|
|
91
77
|
return res(
|
|
92
|
-
ctx.delay(
|
|
78
|
+
ctx.delay(500),
|
|
93
79
|
ctx.json(response),
|
|
94
80
|
ctx.status(statusCode)
|
|
95
81
|
);
|
|
96
82
|
}
|
|
97
83
|
if (!getQuery && isNil(query)) {
|
|
98
84
|
return res(
|
|
99
|
-
ctx.delay(
|
|
85
|
+
ctx.delay(500),
|
|
100
86
|
ctx.json(response),
|
|
101
87
|
ctx.status(statusCode)
|
|
102
88
|
);
|
|
@@ -109,32 +95,20 @@ Cypress.Commands.add(
|
|
|
109
95
|
}
|
|
110
96
|
);
|
|
111
97
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
element: Cypress.Chainable<JQuery<HTMLElement>>;
|
|
115
|
-
times?: number;
|
|
116
|
-
}
|
|
98
|
+
Cypress.Commands.add('moveSortableElement', ({ element, direction }): void => {
|
|
99
|
+
const key = `{${direction}arrow}`;
|
|
117
100
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
element.eq(-1).type(key, {
|
|
130
|
-
scrollBehavior: false
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
element.eq(-1).type(' ', {
|
|
134
|
-
scrollBehavior: false
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
);
|
|
101
|
+
element.type(' ', {
|
|
102
|
+
force: true,
|
|
103
|
+
scrollBehavior: false
|
|
104
|
+
});
|
|
105
|
+
element.eq(-1).type(key, {
|
|
106
|
+
scrollBehavior: false
|
|
107
|
+
});
|
|
108
|
+
element.eq(-1).type(' ', {
|
|
109
|
+
scrollBehavior: false
|
|
110
|
+
});
|
|
111
|
+
});
|
|
138
112
|
|
|
139
113
|
Cypress.Commands.add(
|
|
140
114
|
'moveSortableElementUsingAriaLabel',
|
|
@@ -154,49 +128,15 @@ Cypress.Commands.add(
|
|
|
154
128
|
}
|
|
155
129
|
);
|
|
156
130
|
|
|
157
|
-
Cypress.Commands.add('adjustViewport', () => cy.viewport(1280, 590));
|
|
158
|
-
|
|
159
|
-
Cypress.Commands.add('makeSnapshot', (title?: string) => {
|
|
160
|
-
cy.adjustViewport();
|
|
161
|
-
cy.matchImageSnapshot(title);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
Cypress.Commands.add(
|
|
165
|
-
'makeSnapshotWithCustomResolution',
|
|
166
|
-
({ title, resolution }: MakeSnapshotWithCustomResolution) => {
|
|
167
|
-
const { width, height } = resolution;
|
|
168
|
-
cy.viewport(width, height);
|
|
169
|
-
cy.matchImageSnapshot(title);
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
Cypress.Commands.add('cssDisableMotion', (): void => {
|
|
174
|
-
Cypress.on('window:before:load', (cyWindow) => {
|
|
175
|
-
disableMotion(cyWindow);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
|
|
179
131
|
declare global {
|
|
180
132
|
namespace Cypress {
|
|
181
133
|
interface Chainable {
|
|
182
|
-
adjustViewport: () => Cypress.Chainable;
|
|
183
|
-
cssDisableMotion: () => Cypress.Chainable;
|
|
184
|
-
getRequestCalls: (alias) => Cypress.Chainable;
|
|
185
134
|
interceptAPIRequest: <T extends object>(
|
|
186
135
|
props: InterceptAPIRequestProps<T>
|
|
187
136
|
) => Cypress.Chainable;
|
|
188
137
|
interceptRequest: (method, path, mock, alias) => Cypress.Chainable;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
title,
|
|
192
|
-
resolution
|
|
193
|
-
}: MakeSnapshotWithCustomResolution) => Cypress.Chainable;
|
|
194
|
-
mount: ({ Component, options }: MountProps) => Cypress.Chainable;
|
|
195
|
-
moveSortableElement: ({
|
|
196
|
-
element,
|
|
197
|
-
direction,
|
|
198
|
-
times
|
|
199
|
-
}: MoveSortableElementProps) => void;
|
|
138
|
+
mount: ({ Component, options = {} }: MountProps) => Cypress.Chainable;
|
|
139
|
+
moveSortableElement: ({ ariaLabel, direction }) => void;
|
|
200
140
|
moveSortableElementUsingAriaLabel: ({ ariaLabel, direction }) => void;
|
|
201
141
|
waitForRequest: (alias) => Cypress.Chainable;
|
|
202
142
|
}
|
|
@@ -1,44 +1,32 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
const { devServer } = require('cypress-rspack-dev-server');
|
|
3
2
|
const { defineConfig } = require('cypress');
|
|
4
3
|
const {
|
|
5
4
|
addMatchImageSnapshotPlugin
|
|
6
5
|
} = require('@simonsmith/cypress-image-snapshot/plugin');
|
|
7
|
-
const cypressCodeCoverageTask = require('@cypress/code-coverage/task');
|
|
8
6
|
|
|
9
|
-
module.exports = ({
|
|
10
|
-
rspackConfig,
|
|
11
|
-
cypressFolder,
|
|
12
|
-
specPattern,
|
|
13
|
-
env,
|
|
14
|
-
excludeSpecPattern
|
|
15
|
-
}) => {
|
|
7
|
+
module.exports = ({ webpackConfig, cypressFolder, specPattern, env }) => {
|
|
16
8
|
const mainCypressFolder = cypressFolder || 'cypress';
|
|
17
9
|
|
|
18
10
|
return defineConfig({
|
|
19
11
|
component: {
|
|
20
|
-
devServer:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}),
|
|
26
|
-
excludeSpecPattern,
|
|
12
|
+
devServer: {
|
|
13
|
+
bundler: 'webpack',
|
|
14
|
+
framework: 'react',
|
|
15
|
+
webpackConfig
|
|
16
|
+
},
|
|
27
17
|
setupNodeEvents: (on, config) => {
|
|
28
18
|
addMatchImageSnapshotPlugin(on, config);
|
|
29
19
|
|
|
30
|
-
cypressCodeCoverageTask(on, config);
|
|
31
|
-
on('task', {
|
|
32
|
-
coverageReport: () => {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
20
|
on('before:browser:launch', (browser, launchOptions) => {
|
|
38
21
|
if (browser.name === 'chrome' && browser.isHeadless) {
|
|
39
|
-
launchOptions.args.push('--headless=new');
|
|
40
|
-
launchOptions.args.push('--force-color-profile=srgb');
|
|
41
22
|
launchOptions.args.push('--window-size=1400,1200');
|
|
23
|
+
launchOptions.args = launchOptions.args.map((arg) => {
|
|
24
|
+
if (arg === '--headless') {
|
|
25
|
+
return '--headless=new';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return arg;
|
|
29
|
+
});
|
|
42
30
|
}
|
|
43
31
|
|
|
44
32
|
return launchOptions;
|
|
@@ -48,17 +36,8 @@ module.exports = ({
|
|
|
48
36
|
supportFile: `${mainCypressFolder}/support/component.tsx`
|
|
49
37
|
},
|
|
50
38
|
env: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
exclude: [
|
|
54
|
-
'cypress/**/*.*',
|
|
55
|
-
'packages/**',
|
|
56
|
-
'node_modules',
|
|
57
|
-
'**/*.js',
|
|
58
|
-
'**/*.spec.tsx'
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
...env
|
|
39
|
+
...env,
|
|
40
|
+
baseUrl: 'http://localhost:9092'
|
|
62
41
|
},
|
|
63
42
|
reporter: 'mochawesome',
|
|
64
43
|
reporterOptions: {
|
|
@@ -69,8 +48,6 @@ module.exports = ({
|
|
|
69
48
|
reportFilename: '[name]-report.json'
|
|
70
49
|
},
|
|
71
50
|
video: true,
|
|
72
|
-
videosFolder: `${mainCypressFolder}/results/videos
|
|
73
|
-
viewportHeight: 590,
|
|
74
|
-
viewportWidth: 1280
|
|
51
|
+
videosFolder: `${mainCypressFolder}/results/videos`
|
|
75
52
|
});
|
|
76
53
|
};
|
|
@@ -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:
|
|
16
|
+
failureThreshold: 0.06,
|
|
17
17
|
failureThresholdType: 'percent'
|
|
18
18
|
});
|
|
19
19
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
2
|
|
|
3
|
-
import { Action } from 'e2e/features/ACLs/commands';
|
|
4
|
-
|
|
5
3
|
const apiBase = '/centreon/api';
|
|
6
4
|
const apiActionV1 = `${apiBase}/index.php`;
|
|
7
5
|
|
|
@@ -140,109 +138,12 @@ Cypress.Commands.add(
|
|
|
140
138
|
}
|
|
141
139
|
);
|
|
142
140
|
|
|
143
|
-
interface Contact {
|
|
144
|
-
GUIAccess?: boolean;
|
|
145
|
-
admin?: boolean;
|
|
146
|
-
alias?: string | null;
|
|
147
|
-
authenticationType?: 'local' | 'ldap';
|
|
148
|
-
email: string;
|
|
149
|
-
enableNotifications?: boolean;
|
|
150
|
-
language?: string;
|
|
151
|
-
name: string;
|
|
152
|
-
password: string;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
Cypress.Commands.add(
|
|
156
|
-
'addContact',
|
|
157
|
-
({
|
|
158
|
-
admin = true,
|
|
159
|
-
alias = null,
|
|
160
|
-
authenticationType = 'local',
|
|
161
|
-
email,
|
|
162
|
-
enableNotifications = true,
|
|
163
|
-
GUIAccess = true,
|
|
164
|
-
language = 'en_US',
|
|
165
|
-
name,
|
|
166
|
-
password
|
|
167
|
-
}: Contact): Cypress.Chainable => {
|
|
168
|
-
const contactAdmin = admin ? 1 : 0;
|
|
169
|
-
const contactAlias = alias === null ? name : alias;
|
|
170
|
-
const contactEnableNotifications = enableNotifications ? 1 : 0;
|
|
171
|
-
const contactGUIAccess = GUIAccess ? 1 : 0;
|
|
172
|
-
|
|
173
|
-
return cy
|
|
174
|
-
.executeActionViaClapi({
|
|
175
|
-
bodyContent: {
|
|
176
|
-
action: 'ADD',
|
|
177
|
-
object: 'CONTACT',
|
|
178
|
-
values: `${name};${contactAlias};${email};${password};${contactAdmin};${contactGUIAccess};${language};${authenticationType}`
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
.then(() => {
|
|
182
|
-
const contactParams = {
|
|
183
|
-
enable_notifications: contactEnableNotifications
|
|
184
|
-
};
|
|
185
|
-
Object.entries(contactParams).map(([paramName, paramValue]) => {
|
|
186
|
-
if (paramValue === null) {
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return cy.executeActionViaClapi({
|
|
191
|
-
bodyContent: {
|
|
192
|
-
action: 'SETPARAM',
|
|
193
|
-
object: 'CONTACT',
|
|
194
|
-
values: `${name};${paramName};${paramValue}`
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
return cy.wrap(null);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
interface ContactGroup {
|
|
205
|
-
alias?: string | null;
|
|
206
|
-
contacts: Array<string>;
|
|
207
|
-
name: string;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
Cypress.Commands.add(
|
|
211
|
-
'addContactGroup',
|
|
212
|
-
({ alias = null, contacts, name }: ContactGroup): Cypress.Chainable => {
|
|
213
|
-
const contactGroupAlias = alias === null ? name : alias;
|
|
214
|
-
|
|
215
|
-
return cy
|
|
216
|
-
.executeActionViaClapi({
|
|
217
|
-
bodyContent: {
|
|
218
|
-
action: 'ADD',
|
|
219
|
-
object: 'CG',
|
|
220
|
-
values: `${name};${contactGroupAlias}`
|
|
221
|
-
}
|
|
222
|
-
})
|
|
223
|
-
.then(() => {
|
|
224
|
-
contacts.map((contact) => {
|
|
225
|
-
return cy.executeActionViaClapi({
|
|
226
|
-
bodyContent: {
|
|
227
|
-
action: 'ADDCONTACT',
|
|
228
|
-
object: 'CG',
|
|
229
|
-
values: `${name};${contact}`
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
return cy.wrap(null);
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
|
|
239
141
|
interface Host {
|
|
240
142
|
activeCheckEnabled?: boolean;
|
|
241
143
|
address?: string;
|
|
242
144
|
alias?: string | null;
|
|
243
145
|
checkCommand?: string | null;
|
|
244
146
|
checkPeriod?: string | null;
|
|
245
|
-
hostGroup?: string;
|
|
246
147
|
maxCheckAttempts?: number | null;
|
|
247
148
|
name: string;
|
|
248
149
|
passiveCheckEnabled?: boolean;
|
|
@@ -258,7 +159,6 @@ Cypress.Commands.add(
|
|
|
258
159
|
alias = null,
|
|
259
160
|
checkCommand = null,
|
|
260
161
|
checkPeriod = null,
|
|
261
|
-
hostGroup = '',
|
|
262
162
|
maxCheckAttempts = 1,
|
|
263
163
|
name,
|
|
264
164
|
passiveCheckEnabled = true,
|
|
@@ -276,7 +176,7 @@ Cypress.Commands.add(
|
|
|
276
176
|
bodyContent: {
|
|
277
177
|
action: 'ADD',
|
|
278
178
|
object: 'HOST',
|
|
279
|
-
values: `${name};${hostAlias};${address};${template};${poller}
|
|
179
|
+
values: `${name};${hostAlias};${address};${template};${poller};`
|
|
280
180
|
}
|
|
281
181
|
})
|
|
282
182
|
.then(() => {
|
|
@@ -306,26 +206,6 @@ Cypress.Commands.add(
|
|
|
306
206
|
}
|
|
307
207
|
);
|
|
308
208
|
|
|
309
|
-
interface HostGroup {
|
|
310
|
-
alias?: string | null;
|
|
311
|
-
name: string;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
Cypress.Commands.add(
|
|
315
|
-
'addHostGroup',
|
|
316
|
-
({ alias = null, name }: HostGroup): Cypress.Chainable => {
|
|
317
|
-
const hostGroupAlias = alias === null ? name : alias;
|
|
318
|
-
|
|
319
|
-
return cy.executeActionViaClapi({
|
|
320
|
-
bodyContent: {
|
|
321
|
-
action: 'ADD',
|
|
322
|
-
object: 'HG',
|
|
323
|
-
values: `${name};${hostGroupAlias}`
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
);
|
|
328
|
-
|
|
329
209
|
interface ServiceTemplate {
|
|
330
210
|
activeCheckEnabled?: boolean;
|
|
331
211
|
checkCommand?: string | null;
|
|
@@ -447,45 +327,6 @@ Cypress.Commands.add(
|
|
|
447
327
|
}
|
|
448
328
|
);
|
|
449
329
|
|
|
450
|
-
interface ServiceGroup {
|
|
451
|
-
alias?: string | null;
|
|
452
|
-
hostsAndServices: Array<Array<string>>;
|
|
453
|
-
name: string;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
Cypress.Commands.add(
|
|
457
|
-
'addServiceGroup',
|
|
458
|
-
({
|
|
459
|
-
alias = null,
|
|
460
|
-
hostsAndServices,
|
|
461
|
-
name
|
|
462
|
-
}: ServiceGroup): Cypress.Chainable => {
|
|
463
|
-
const serviceGroupAlias = alias === null ? name : alias;
|
|
464
|
-
|
|
465
|
-
return cy
|
|
466
|
-
.executeActionViaClapi({
|
|
467
|
-
bodyContent: {
|
|
468
|
-
action: 'ADD',
|
|
469
|
-
object: 'SG',
|
|
470
|
-
values: `${name};${serviceGroupAlias}`
|
|
471
|
-
}
|
|
472
|
-
})
|
|
473
|
-
.then(() => {
|
|
474
|
-
hostsAndServices.map((hostAndService) => {
|
|
475
|
-
return cy.executeActionViaClapi({
|
|
476
|
-
bodyContent: {
|
|
477
|
-
action: 'ADDSERVICE',
|
|
478
|
-
object: 'SG',
|
|
479
|
-
values: `${name};${hostAndService[0]},${hostAndService[1]}`
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
return cy.wrap(null);
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
);
|
|
488
|
-
|
|
489
330
|
Cypress.Commands.add(
|
|
490
331
|
'applyPollerConfiguration',
|
|
491
332
|
(pollerName = 'Central'): Cypress.Chainable => {
|
|
@@ -498,182 +339,12 @@ Cypress.Commands.add(
|
|
|
498
339
|
}
|
|
499
340
|
);
|
|
500
341
|
|
|
501
|
-
interface ACLGroup {
|
|
502
|
-
alias?: string | null;
|
|
503
|
-
contactGroups?: Array<string>;
|
|
504
|
-
contacts?: Array<string>;
|
|
505
|
-
name: string;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
Cypress.Commands.add(
|
|
509
|
-
'addACLGroup',
|
|
510
|
-
({
|
|
511
|
-
alias = null,
|
|
512
|
-
contacts = [],
|
|
513
|
-
contactGroups = [],
|
|
514
|
-
name
|
|
515
|
-
}: ACLGroup): Cypress.Chainable => {
|
|
516
|
-
const ACLGroupALias = alias === null ? name : alias;
|
|
517
|
-
|
|
518
|
-
return cy
|
|
519
|
-
.executeActionViaClapi({
|
|
520
|
-
bodyContent: {
|
|
521
|
-
action: 'ADD',
|
|
522
|
-
object: 'ACLGROUP',
|
|
523
|
-
values: `${name};${ACLGroupALias}`
|
|
524
|
-
}
|
|
525
|
-
})
|
|
526
|
-
.then(() => {
|
|
527
|
-
if (contacts) {
|
|
528
|
-
contacts.forEach((contact) => {
|
|
529
|
-
cy.executeActionViaClapi({
|
|
530
|
-
bodyContent: {
|
|
531
|
-
action: 'ADDCONTACT',
|
|
532
|
-
object: 'ACLGROUP',
|
|
533
|
-
values: `${name};${contact}`
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
if (contactGroups) {
|
|
539
|
-
contactGroups.forEach((contactGroup) => {
|
|
540
|
-
cy.executeActionViaClapi({
|
|
541
|
-
bodyContent: {
|
|
542
|
-
action: 'ADDCONTACTGROUP',
|
|
543
|
-
object: 'ACLGROUP',
|
|
544
|
-
values: `${name};${contactGroup}`
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
);
|
|
552
|
-
|
|
553
|
-
interface ACLMenu {
|
|
554
|
-
alias?: string | null;
|
|
555
|
-
includeChildren?: boolean;
|
|
556
|
-
name: string;
|
|
557
|
-
readOnly?: boolean;
|
|
558
|
-
rule?: Array<string>;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
Cypress.Commands.add(
|
|
562
|
-
'addACLMenu',
|
|
563
|
-
({
|
|
564
|
-
name,
|
|
565
|
-
rule = [],
|
|
566
|
-
alias = null,
|
|
567
|
-
includeChildren = true,
|
|
568
|
-
readOnly = false
|
|
569
|
-
}: ACLMenu): Cypress.Chainable => {
|
|
570
|
-
const ACLMenuAlias = alias === null ? name : alias;
|
|
571
|
-
const action = readOnly ? 'GRANTRO' : 'GRANTRW';
|
|
572
|
-
const children = includeChildren ? '1' : '0';
|
|
573
|
-
|
|
574
|
-
return cy
|
|
575
|
-
.executeActionViaClapi({
|
|
576
|
-
bodyContent: {
|
|
577
|
-
action: 'ADD',
|
|
578
|
-
object: 'ACLMENU',
|
|
579
|
-
values: `${name};${ACLMenuAlias}`
|
|
580
|
-
}
|
|
581
|
-
})
|
|
582
|
-
.then(() => {
|
|
583
|
-
if (rule.length === 0) {
|
|
584
|
-
return cy.wrap(null);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
let ruleCommand = '';
|
|
588
|
-
rule.forEach((rulePage, index) => {
|
|
589
|
-
ruleCommand += rulePage + (index == rule.length - 1 ? '' : ';');
|
|
590
|
-
});
|
|
591
|
-
cy.executeActionViaClapi({
|
|
592
|
-
bodyContent: {
|
|
593
|
-
action,
|
|
594
|
-
object: 'ACLMENU',
|
|
595
|
-
values: `${name};${children};${ruleCommand}`
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
|
|
599
|
-
return cy.wrap(null);
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
);
|
|
603
|
-
|
|
604
|
-
interface ACLAction {
|
|
605
|
-
actions?: Array<Action>;
|
|
606
|
-
description: string;
|
|
607
|
-
name: string;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
Cypress.Commands.add(
|
|
611
|
-
'addACLAction',
|
|
612
|
-
({ name, description, actions = [] }: ACLAction): Cypress.Chainable => {
|
|
613
|
-
return cy
|
|
614
|
-
.executeActionViaClapi({
|
|
615
|
-
bodyContent: {
|
|
616
|
-
action: 'ADD',
|
|
617
|
-
object: 'ACLACTION',
|
|
618
|
-
values: `${name};${description}`
|
|
619
|
-
}
|
|
620
|
-
})
|
|
621
|
-
.then(() => {
|
|
622
|
-
if (actions.length === 0) {
|
|
623
|
-
return cy.wrap(null);
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
let actionCommand = '';
|
|
627
|
-
actions.forEach((action, index) => {
|
|
628
|
-
actionCommand += action + (index == actions.length - 1 ? '' : '|');
|
|
629
|
-
});
|
|
630
|
-
cy.executeActionViaClapi({
|
|
631
|
-
bodyContent: {
|
|
632
|
-
action: 'GRANT',
|
|
633
|
-
object: 'ACLACTION',
|
|
634
|
-
values: `${name};${actionCommand}`
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
|
|
638
|
-
return cy.wrap(null);
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
);
|
|
642
|
-
|
|
643
|
-
interface ACLResource {
|
|
644
|
-
alias?: string | null;
|
|
645
|
-
name: string;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
Cypress.Commands.add(
|
|
649
|
-
'addACLResource',
|
|
650
|
-
({ name, alias = null }: ACLResource): Cypress.Chainable => {
|
|
651
|
-
const ACLResourcesAlias = alias === null ? name : alias;
|
|
652
|
-
|
|
653
|
-
return cy.executeActionViaClapi({
|
|
654
|
-
bodyContent: {
|
|
655
|
-
action: 'ADD',
|
|
656
|
-
object: 'ACLRESOURCE',
|
|
657
|
-
values: `${name};${ACLResourcesAlias}`
|
|
658
|
-
}
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
);
|
|
662
|
-
|
|
663
342
|
declare global {
|
|
664
343
|
namespace Cypress {
|
|
665
344
|
interface Chainable {
|
|
666
|
-
addACLAction: (props: ACLAction) => Cypress.Chainable;
|
|
667
|
-
addACLGroup: (props: ACLGroup) => Cypress.Chainable;
|
|
668
|
-
addACLMenu: (props: ACLMenu) => Cypress.Chainable;
|
|
669
|
-
addACLResource: (props: ACLResource) => Cypress.Chainable;
|
|
670
345
|
addCheckCommand: (props: CheckCommand) => Cypress.Chainable;
|
|
671
|
-
addContact: (props: Contact) => Cypress.Chainable;
|
|
672
|
-
addContactGroup: (props: ContactGroup) => Cypress.Chainable;
|
|
673
346
|
addHost: (props: Host) => Cypress.Chainable;
|
|
674
|
-
addHostGroup: (props: HostGroup) => Cypress.Chainable;
|
|
675
347
|
addService: (props: Service) => Cypress.Chainable;
|
|
676
|
-
addServiceGroup: (props: ServiceGroup) => Cypress.Chainable;
|
|
677
348
|
addServiceTemplate: (props: ServiceTemplate) => Cypress.Chainable;
|
|
678
349
|
addTimePeriod: (props: TimePeriod) => Cypress.Chainable;
|
|
679
350
|
applyPollerConfiguration: (props?: string) => Cypress.Chainable;
|