@centreon/js-config 23.10.43 → 23.10.45

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.
@@ -11,6 +11,8 @@ import { ThemeProvider } from '@centreon/ui';
11
11
  import '@testing-library/cypress/add-commands';
12
12
  import 'cypress-msw-interceptor';
13
13
 
14
+ import disableMotion from './disableCssTransitions';
15
+
14
16
  interface MountProps {
15
17
  Component: React.ReactNode;
16
18
  options?: object;
@@ -132,9 +134,16 @@ Cypress.Commands.add('makeSnapshot', (title?: string) => {
132
134
  cy.matchImageSnapshot(title);
133
135
  });
134
136
 
137
+ Cypress.Commands.add('cssDisableMotion', (): void => {
138
+ Cypress.on('window:before:load', (cyWindow) => {
139
+ disableMotion(cyWindow);
140
+ });
141
+ });
142
+
135
143
  declare global {
136
144
  namespace Cypress {
137
145
  interface Chainable {
146
+ cssDisableMotion: () => Cypress.Chainable;
138
147
  interceptAPIRequest: <T extends object>(
139
148
  props: InterceptAPIRequestProps<T>
140
149
  ) => Cypress.Chainable;
@@ -0,0 +1,19 @@
1
+ const disableMotion = (win): void => {
2
+ const injectedStyleEl = win.document.getElementById('__cy_disable_motion__');
3
+ if (injectedStyleEl) {
4
+ return;
5
+ }
6
+ win.document.head.insertAdjacentHTML(
7
+ 'beforeend',
8
+ `
9
+ <style id="__cy_disable_motion__">
10
+ /* Disable CSS transitions. */
11
+ *, *::before, *::after { -webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; -ms-transition: none !important; transition: none !important; }
12
+ /* Disable CSS animations. */
13
+ *, *::before, *::after { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; -ms-animation: none !important; animation: none !important; }
14
+ </style>
15
+ `.trim()
16
+ );
17
+ };
18
+
19
+ export default disableMotion;
@@ -211,7 +211,20 @@ interface ExecInContainerProps {
211
211
  Cypress.Commands.add(
212
212
  'execInContainer',
213
213
  ({ command, name }: ExecInContainerProps): Cypress.Chainable => {
214
- return cy.exec(`docker exec -i ${name} ${command}`);
214
+ return cy
215
+ .exec(`docker exec -i ${name} ${command}`, { failOnNonZeroExit: false })
216
+ .then((result) => {
217
+ if (result.code) {
218
+ // output will not be truncated
219
+ throw new Error(`
220
+ Execution of "${command}" failed
221
+ Exit code: ${result.code}
222
+ Stdout:\n${result.stdout}
223
+ Stderr:\n${result.stderr}`);
224
+ }
225
+
226
+ return cy.wrap(result);
227
+ });
215
228
  }
216
229
  );
217
230
 
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.43",
4
+ "version": "23.10.45",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon-frontend.git"