@centreon/js-config 23.10.26 → 23.10.28

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.
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import { mount } from 'cypress/react18';
5
5
  import { equals, isNil } from 'ramda';
6
6
 
7
- import { Box } from '@mui/material';
7
+ import { Box, CssBaseline } from '@mui/material';
8
8
 
9
9
  import { ThemeProvider } from '@centreon/ui';
10
10
 
@@ -36,11 +36,10 @@ Cypress.Commands.add('mount', ({ Component, options = {} }) => {
36
36
  >
37
37
  {Component}
38
38
  </Box>
39
+ <CssBaseline />
39
40
  </ThemeProvider>
40
41
  );
41
42
 
42
- document.getElementsByTagName('body')[0].setAttribute('style', 'margin:0px');
43
-
44
43
  return mount(wrapped, options);
45
44
  });
46
45
 
@@ -128,6 +127,11 @@ Cypress.Commands.add(
128
127
  }
129
128
  );
130
129
 
130
+ Cypress.Commands.add('makeSnapshot', (title?: string) => {
131
+ cy.viewport(1280, 590);
132
+ cy.matchImageSnapshot(title);
133
+ });
134
+
131
135
  declare global {
132
136
  namespace Cypress {
133
137
  interface Chainable {
@@ -135,6 +139,7 @@ declare global {
135
139
  props: InterceptAPIRequestProps<T>
136
140
  ) => Cypress.Chainable;
137
141
  interceptRequest: (method, path, mock, alias) => Cypress.Chainable;
142
+ makeSnapshot: (title?: string) => void;
138
143
  mount: ({ Component, options }: MountProps) => Cypress.Chainable;
139
144
  moveSortableElement: ({ element, direction }) => void;
140
145
  moveSortableElementUsingAriaLabel: ({ ariaLabel, direction }) => void;
@@ -225,29 +225,7 @@ interface StartContainerProps {
225
225
  Cypress.Commands.add(
226
226
  'startContainer',
227
227
  ({ name, image, portBindings }: StartContainerProps): Cypress.Chainable => {
228
- return cy
229
- .exec('docker image list --format "{{.Repository}}:{{.Tag}}"')
230
- .then(({ stdout }) => {
231
- if (
232
- stdout.match(
233
- new RegExp(
234
- `^${image.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}`,
235
- 'm'
236
- )
237
- )
238
- ) {
239
- cy.log(`Local docker image found : ${image}`);
240
-
241
- return cy.wrap(image);
242
- }
243
-
244
- cy.log(`Pulling remote docker image : ${image}`);
245
-
246
- return cy.exec(`docker pull ${image}`).then(() => cy.wrap(image));
247
- })
248
- .then((imageName) =>
249
- cy.task('startContainer', { image: imageName, name, portBindings })
250
- );
228
+ return cy.task('startContainer', { image, name, portBindings });
251
229
  }
252
230
  );
253
231
 
@@ -3,6 +3,8 @@
3
3
  /* eslint-disable @typescript-eslint/no-var-requires */
4
4
  /* eslint-disable no-param-reassign */
5
5
 
6
+ import { execSync } from 'child_process';
7
+
6
8
  import Docker from 'dockerode';
7
9
  import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
8
10
  import webpackPreprocessor from '@cypress/webpack-preprocessor';
@@ -91,6 +93,21 @@ export default async (on, config): Promise<void> => {
91
93
  name,
92
94
  portBindings = []
93
95
  }: StartContainerProps) => {
96
+ const imageList = execSync(
97
+ 'docker image list --format "{{.Repository}}:{{.Tag}}"'
98
+ ).toString('utf8');
99
+
100
+ if (
101
+ !imageList.match(
102
+ new RegExp(
103
+ `^${image.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}`,
104
+ 'm'
105
+ )
106
+ )
107
+ ) {
108
+ execSync(`docker pull ${image}`);
109
+ }
110
+
94
111
  const webContainers = await docker.listContainers({
95
112
  all: true,
96
113
  filters: { name: [name] }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@centreon/js-config",
3
3
  "description": "Centreon Frontend shared build configuration",
4
- "version": "23.10.26",
4
+ "version": "23.10.28",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "moduleResolution": "nodenext",
4
3
  "downlevelIteration": true,
5
- "module": "esnext",
4
+ "module": "ESNext",
6
5
  "target": "es2018",
7
6
  "jsx": "react-jsx",
8
7
  "strict": true,