@centreon/js-config 23.4.21 → 23.4.22-1
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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const { defineConfig } = require('cypress');
|
|
3
3
|
const {
|
|
4
4
|
addMatchImageSnapshotPlugin
|
|
5
|
-
} = require('cypress-image-snapshot/plugin');
|
|
5
|
+
} = require('@simonsmith/cypress-image-snapshot/plugin');
|
|
6
6
|
|
|
7
7
|
module.exports = ({ webpackConfig, cypressFolder, specPattern, env }) => {
|
|
8
8
|
const mainCypressFolder = cypressFolder || 'cypress';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';
|
|
1
|
+
import { addMatchImageSnapshotCommand } from '@simonsmith/cypress-image-snapshot/command';
|
|
2
2
|
|
|
3
3
|
const enableVisualTesting = (cypressFolder = 'cypress'): void => {
|
|
4
4
|
if (Cypress.config('isInteractive')) {
|
|
@@ -11,7 +11,7 @@ const enableVisualTesting = (cypressFolder = 'cypress'): void => {
|
|
|
11
11
|
|
|
12
12
|
addMatchImageSnapshotCommand({
|
|
13
13
|
capture: 'viewport',
|
|
14
|
-
customDiffConfig: { threshold: 0.
|
|
14
|
+
customDiffConfig: { threshold: 0.01 },
|
|
15
15
|
customSnapshotsDir: `${cypressFolder}/visual-testing-snapshots`,
|
|
16
16
|
failureThreshold: 0.06,
|
|
17
17
|
failureThresholdType: 'percent'
|
package/cypress/e2e/commands.ts
CHANGED
|
@@ -15,7 +15,10 @@ Cypress.Commands.add('getIframeBody', (): Cypress.Chainable => {
|
|
|
15
15
|
Cypress.Commands.add(
|
|
16
16
|
'hoverRootMenuItem',
|
|
17
17
|
(rootItemNumber: number): Cypress.Chainable => {
|
|
18
|
-
return cy
|
|
18
|
+
return cy
|
|
19
|
+
.get('div[data-testid="sidebar"] li')
|
|
20
|
+
.eq(rootItemNumber)
|
|
21
|
+
.trigger('mouseover');
|
|
19
22
|
}
|
|
20
23
|
);
|
|
21
24
|
|
|
@@ -172,6 +175,36 @@ Cypress.Commands.add(
|
|
|
172
175
|
}
|
|
173
176
|
);
|
|
174
177
|
|
|
178
|
+
Cypress.Commands.add('waitForContainerAndSetToken', (): Cypress.Chainable => {
|
|
179
|
+
return cy
|
|
180
|
+
.exec(`npx wait-on ${Cypress.config().baseUrl}`)
|
|
181
|
+
.then(() => cy.setUserTokenApiV1());
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
interface StartContainerProps {
|
|
185
|
+
name: string;
|
|
186
|
+
os: string;
|
|
187
|
+
version: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
Cypress.Commands.add(
|
|
191
|
+
'startContainer',
|
|
192
|
+
({ name, os, version }: StartContainerProps): Cypress.Chainable => {
|
|
193
|
+
return cy.exec(
|
|
194
|
+
`docker run -p 4000:80 -d --name ${name} docker.centreon.com/centreon/centreon-web-${os}:${version}`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
Cypress.Commands.add(
|
|
200
|
+
'stopContainer',
|
|
201
|
+
(containerName: string): Cypress.Chainable => {
|
|
202
|
+
return cy.exec(
|
|
203
|
+
`docker stop ${containerName} && docker rm ${containerName}`
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
|
|
175
208
|
declare global {
|
|
176
209
|
namespace Cypress {
|
|
177
210
|
interface Chainable {
|
|
@@ -192,6 +225,9 @@ declare global {
|
|
|
192
225
|
rootItemNumber,
|
|
193
226
|
subMenu
|
|
194
227
|
}: NavigateToProps) => Cypress.Chainable;
|
|
228
|
+
startContainer: () => Cypress.Chainable;
|
|
229
|
+
stopContainer: (containerName: string) => Cypress.Chainable;
|
|
230
|
+
waitForContainerAndSetToken: () => Cypress.Chainable;
|
|
195
231
|
}
|
|
196
232
|
}
|
|
197
233
|
}
|
package/package.json
CHANGED