@centreon/js-config 24.4.8 → 24.4.9
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 +19 -53
- package/cypress/component/configuration.js +12 -28
- package/cypress/component/enableVisualTesting.ts +1 -1
- package/cypress/e2e/commands/configuration.ts +1 -3
- package/cypress/e2e/commands.ts +59 -298
- package/cypress/e2e/configuration.ts +32 -30
- package/cypress/e2e/plugins.ts +119 -21
- package/eslint/base.typescript.eslintrc.js +3 -15
- package/jest/index.js +2 -5
- package/package.json +45 -61
- package/tsconfig/index.json +4 -5
- package/webpack/base/index.js +59 -20
- package/cypress/component/disableCssTransitions.ts +0 -19
- package/cypress/e2e/commands/monitoring.ts +0 -75
- package/cypress/e2e/esbuild-preprocessor.ts +0 -26
- package/cypress/e2e/reporter-config.js +0 -13
- package/cypress/e2e/tasks.ts +0 -105
- package/eslint/lambda/typescript.eslintrc.js +0 -48
- package/jest/lambda/typescript.js +0 -49
- package/tsconfig/lambda/node20.tsconfig.json +0 -12
- package/tsconfig/lambda/tsconfig.json +0 -14
- package/webpack/base/globalConfig.js +0 -76
|
@@ -4,15 +4,13 @@ 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
13
|
|
|
14
|
-
import disableMotion from './disableCssTransitions';
|
|
15
|
-
|
|
16
14
|
interface MountProps {
|
|
17
15
|
Component: React.ReactNode;
|
|
18
16
|
options?: object;
|
|
@@ -26,7 +24,7 @@ export enum Method {
|
|
|
26
24
|
PUT = 'PUT'
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
Cypress.Commands.add('mount', ({ Component, options
|
|
27
|
+
Cypress.Commands.add('mount', ({ Component, options }) => {
|
|
30
28
|
const wrapped = (
|
|
31
29
|
<ThemeProvider>
|
|
32
30
|
<Box
|
|
@@ -38,10 +36,11 @@ Cypress.Commands.add('mount', ({ Component, options = {} }) => {
|
|
|
38
36
|
>
|
|
39
37
|
{Component}
|
|
40
38
|
</Box>
|
|
41
|
-
<CssBaseline />
|
|
42
39
|
</ThemeProvider>
|
|
43
40
|
);
|
|
44
41
|
|
|
42
|
+
document.getElementsByTagName('body')[0].setAttribute('style', 'margin:0px');
|
|
43
|
+
|
|
45
44
|
return mount(wrapped, options);
|
|
46
45
|
});
|
|
47
46
|
|
|
@@ -96,32 +95,20 @@ Cypress.Commands.add(
|
|
|
96
95
|
}
|
|
97
96
|
);
|
|
98
97
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
element: Cypress.Chainable<JQuery<HTMLElement>>;
|
|
102
|
-
times?: number;
|
|
103
|
-
}
|
|
98
|
+
Cypress.Commands.add('moveSortableElement', ({ element, direction }): void => {
|
|
99
|
+
const key = `{${direction}arrow}`;
|
|
104
100
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
element.eq(-1).type(key, {
|
|
117
|
-
scrollBehavior: false
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
element.eq(-1).type(' ', {
|
|
121
|
-
scrollBehavior: false
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
);
|
|
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
|
+
});
|
|
125
112
|
|
|
126
113
|
Cypress.Commands.add(
|
|
127
114
|
'moveSortableElementUsingAriaLabel',
|
|
@@ -141,36 +128,15 @@ Cypress.Commands.add(
|
|
|
141
128
|
}
|
|
142
129
|
);
|
|
143
130
|
|
|
144
|
-
Cypress.Commands.add('adjustViewport', () => cy.viewport(1280, 590));
|
|
145
|
-
|
|
146
|
-
Cypress.Commands.add('makeSnapshot', (title?: string) => {
|
|
147
|
-
cy.adjustViewport();
|
|
148
|
-
cy.matchImageSnapshot(title);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
Cypress.Commands.add('cssDisableMotion', (): void => {
|
|
152
|
-
Cypress.on('window:before:load', (cyWindow) => {
|
|
153
|
-
disableMotion(cyWindow);
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
131
|
declare global {
|
|
158
132
|
namespace Cypress {
|
|
159
133
|
interface Chainable {
|
|
160
|
-
adjustViewport: () => Cypress.Chainable;
|
|
161
|
-
cssDisableMotion: () => Cypress.Chainable;
|
|
162
|
-
getRequestCalls: (alias) => Cypress.Chainable;
|
|
163
134
|
interceptAPIRequest: <T extends object>(
|
|
164
135
|
props: InterceptAPIRequestProps<T>
|
|
165
136
|
) => Cypress.Chainable;
|
|
166
137
|
interceptRequest: (method, path, mock, alias) => Cypress.Chainable;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
moveSortableElement: ({
|
|
170
|
-
element,
|
|
171
|
-
direction,
|
|
172
|
-
times
|
|
173
|
-
}: MoveSortableElementProps) => void;
|
|
138
|
+
mount: ({ Component, options = {} }: MountProps) => Cypress.Chainable;
|
|
139
|
+
moveSortableElement: ({ ariaLabel, direction }) => void;
|
|
174
140
|
moveSortableElementUsingAriaLabel: ({ ariaLabel, direction }) => void;
|
|
175
141
|
waitForRequest: (alias) => Cypress.Chainable;
|
|
176
142
|
}
|
|
@@ -3,34 +3,29 @@ const { defineConfig } = require('cypress');
|
|
|
3
3
|
const {
|
|
4
4
|
addMatchImageSnapshotPlugin
|
|
5
5
|
} = require('@simonsmith/cypress-image-snapshot/plugin');
|
|
6
|
-
const cypressCodeCoverageTask = require('@cypress/code-coverage/task');
|
|
7
6
|
|
|
8
|
-
module.exports = ({
|
|
9
|
-
webpackConfig,
|
|
10
|
-
cypressFolder,
|
|
11
|
-
specPattern,
|
|
12
|
-
env,
|
|
13
|
-
useVite = false,
|
|
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
12
|
devServer: {
|
|
21
|
-
bundler:
|
|
13
|
+
bundler: 'webpack',
|
|
22
14
|
framework: 'react',
|
|
23
15
|
webpackConfig
|
|
24
16
|
},
|
|
25
|
-
excludeSpecPattern,
|
|
26
17
|
setupNodeEvents: (on, config) => {
|
|
27
18
|
addMatchImageSnapshotPlugin(on, config);
|
|
28
19
|
|
|
29
|
-
cypressCodeCoverageTask(on, config);
|
|
30
|
-
|
|
31
20
|
on('before:browser:launch', (browser, launchOptions) => {
|
|
32
21
|
if (browser.name === 'chrome' && browser.isHeadless) {
|
|
33
|
-
launchOptions.args.
|
|
22
|
+
launchOptions.args = launchOptions.args.map((arg) => {
|
|
23
|
+
if (arg === '--headless') {
|
|
24
|
+
return '--headless=new';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return arg;
|
|
28
|
+
});
|
|
34
29
|
}
|
|
35
30
|
|
|
36
31
|
return launchOptions;
|
|
@@ -40,17 +35,8 @@ module.exports = ({
|
|
|
40
35
|
supportFile: `${mainCypressFolder}/support/component.tsx`
|
|
41
36
|
},
|
|
42
37
|
env: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
exclude: [
|
|
46
|
-
'cypress/**/*.*',
|
|
47
|
-
'packages/**',
|
|
48
|
-
'node_modules',
|
|
49
|
-
'**/*.js',
|
|
50
|
-
'**/*.spec.tsx'
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
...env
|
|
38
|
+
...env,
|
|
39
|
+
baseUrl: 'http://localhost:9092'
|
|
54
40
|
},
|
|
55
41
|
reporter: 'mochawesome',
|
|
56
42
|
reporterOptions: {
|
|
@@ -61,8 +47,6 @@ module.exports = ({
|
|
|
61
47
|
reportFilename: '[name]-report.json'
|
|
62
48
|
},
|
|
63
49
|
video: true,
|
|
64
|
-
videosFolder: `${mainCypressFolder}/results/videos
|
|
65
|
-
viewportHeight: 590,
|
|
66
|
-
viewportWidth: 1280
|
|
50
|
+
videosFolder: `${mainCypressFolder}/results/videos`
|
|
67
51
|
});
|
|
68
52
|
};
|
|
@@ -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: 0.
|
|
16
|
+
failureThreshold: 0.06,
|
|
17
17
|
failureThresholdType: 'percent'
|
|
18
18
|
});
|
|
19
19
|
};
|
|
@@ -144,7 +144,6 @@ interface Host {
|
|
|
144
144
|
alias?: string | null;
|
|
145
145
|
checkCommand?: string | null;
|
|
146
146
|
checkPeriod?: string | null;
|
|
147
|
-
hostGroup?: string;
|
|
148
147
|
maxCheckAttempts?: number | null;
|
|
149
148
|
name: string;
|
|
150
149
|
passiveCheckEnabled?: boolean;
|
|
@@ -160,7 +159,6 @@ Cypress.Commands.add(
|
|
|
160
159
|
alias = null,
|
|
161
160
|
checkCommand = null,
|
|
162
161
|
checkPeriod = null,
|
|
163
|
-
hostGroup = '',
|
|
164
162
|
maxCheckAttempts = 1,
|
|
165
163
|
name,
|
|
166
164
|
passiveCheckEnabled = true,
|
|
@@ -178,7 +176,7 @@ Cypress.Commands.add(
|
|
|
178
176
|
bodyContent: {
|
|
179
177
|
action: 'ADD',
|
|
180
178
|
object: 'HOST',
|
|
181
|
-
values: `${name};${hostAlias};${address};${template};${poller}
|
|
179
|
+
values: `${name};${hostAlias};${address};${template};${poller};`
|
|
182
180
|
}
|
|
183
181
|
})
|
|
184
182
|
.then(() => {
|