@centreon/js-config 26.12.1 → 26.12.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.
@@ -24,16 +24,18 @@ Cypress.Commands.add(
24
24
  method = 'POST',
25
25
  failOnError = true
26
26
  }: ExecuteActionViaClapiProps): Cypress.Chainable => {
27
- return cy.request({
28
- body: bodyContent,
29
- failOnStatusCode: failOnError,
30
- headers: {
31
- 'Content-Type': 'application/json',
32
- 'centreon-auth-token': window.localStorage.getItem('userTokenApiV1')
33
- },
34
- method,
35
- url: `${apiActionV1}?action=action&object=centreon_clapi`
36
- });
27
+ return cy.ensureUserTokenApiV1().then(() =>
28
+ cy.request({
29
+ body: bodyContent,
30
+ failOnStatusCode: failOnError,
31
+ headers: {
32
+ 'Content-Type': 'application/json',
33
+ 'centreon-auth-token': window.localStorage.getItem('userTokenApiV1')
34
+ },
35
+ method,
36
+ url: `${apiActionV1}?action=action&object=centreon_clapi`
37
+ })
38
+ );
37
39
  }
38
40
  );
39
41
 
@@ -150,17 +150,20 @@ Cypress.Commands.add(
150
150
  updatetime
151
151
  };
152
152
 
153
- cy.request({
154
- body: {
155
- results: [result]
156
- },
157
- headers: {
158
- 'Content-Type': 'application/json',
159
- 'centreon-auth-token': window.localStorage.getItem('userTokenApiV1')
160
- },
161
- method: 'POST',
162
- url: `${apiActionV1}?action=submit&object=centreon_submit_results`
163
- });
153
+ cy.ensureUserTokenApiV1().then(() =>
154
+ cy.request({
155
+ body: {
156
+ results: [result]
157
+ },
158
+ headers: {
159
+ 'Content-Type': 'application/json',
160
+ 'centreon-auth-token':
161
+ window.localStorage.getItem('userTokenApiV1')
162
+ },
163
+ method: 'POST',
164
+ url: `${apiActionV1}?action=submit&object=centreon_submit_results`
165
+ })
166
+ );
164
167
  }
165
168
  );
166
169
 
@@ -499,6 +499,16 @@ Cypress.Commands.add(
499
499
  }
500
500
  );
501
501
 
502
+ // The token is set once in the feature's before(), so it is missing when a
503
+ // test is retried: get it again only in that case.
504
+ Cypress.Commands.add('ensureUserTokenApiV1', (): Cypress.Chainable => {
505
+ if (window.localStorage.getItem('userTokenApiV1')) {
506
+ return cy.wrap(null);
507
+ }
508
+
509
+ return cy.setUserTokenApiV1();
510
+ });
511
+
502
512
  interface PortBinding {
503
513
  destination: number;
504
514
  source: number;
@@ -1000,6 +1010,7 @@ declare global {
1000
1010
  ) => Cypress.Chainable;
1001
1011
  copyWebContainerLogs: (props: CopyWebContainerLogsProps) => Cypress.Chainable;
1002
1012
  createDirectory: (directoryPath: string) => Cypress.Chainable;
1013
+ ensureUserTokenApiV1: () => Cypress.Chainable;
1003
1014
  execInContainer: (
1004
1015
  props: ExecInContainerProps,
1005
1016
  options?: ExecInContainerOptions
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": "26.12.1",
4
+ "version": "26.12.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/centreon/centreon.git"
@@ -94,9 +94,6 @@ const getBaseConfiguration = ({
94
94
  ].filter(Boolean),
95
95
  resolve: {
96
96
  alias: {
97
- '@centreon/ui/fonts': path.resolve(
98
- './node_modules/@centreon/ui/public/fonts'
99
- ),
100
97
  react: path.resolve('./node_modules/react')
101
98
  },
102
99
  extensions: ['.js', '.jsx', '.ts', '.tsx']