@jahia/cypress 3.21.2 → 3.22.0

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.
@@ -17,6 +17,7 @@ var waitUntilSAMStatusGreen = function (severity, timeout, interval, greenMatchC
17
17
  if (interval === void 0) { interval = 500; }
18
18
  if (greenMatchCount === void 0) { greenMatchCount = 10; }
19
19
  var greenCount = 0;
20
+ var lastGraphqlResponse = {};
20
21
  cy.waitUntil(function () {
21
22
  return cy.apollo({
22
23
  fetchPolicy: 'no-cache',
@@ -25,15 +26,16 @@ var waitUntilSAMStatusGreen = function (severity, timeout, interval, greenMatchC
25
26
  severity: severity
26
27
  }
27
28
  }).then(function (result) {
28
- var _a, _b, _c, _d;
29
+ var _a, _b, _c, _d, _e, _f, _g;
29
30
  var healthStatus = (_d = (_c = (_b = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.admin) === null || _b === void 0 ? void 0 : _b.jahia) === null || _c === void 0 ? void 0 : _c.healthCheck) === null || _d === void 0 ? void 0 : _d.status;
31
+ lastGraphqlResponse = (_g = (_f = (_e = result === null || result === void 0 ? void 0 : result.data) === null || _e === void 0 ? void 0 : _e.admin) === null || _f === void 0 ? void 0 : _f.jahia) === null || _g === void 0 ? void 0 : _g.healthCheck;
30
32
  if (healthStatus) {
31
33
  greenCount = healthStatus.health === 'GREEN' ? greenCount + 1 : 0;
32
34
  return greenCount >= greenMatchCount;
33
35
  }
34
36
  });
35
37
  }, {
36
- errorMsg: "Timeout waiting for SAM to be green for severity: " + severity,
38
+ errorMsg: "Timeout waiting for SAM to be green for severity: " + severity + ". Last GraphQL response: " + JSON.stringify(lastGraphqlResponse),
37
39
  timeout: timeout,
38
40
  verbose: true,
39
41
  interval: interval
@@ -6,6 +6,13 @@ query($severity: GqlProbeSeverity) {
6
6
  health
7
7
  message
8
8
  }
9
+ probes(health: YELLOW) {
10
+ name
11
+ status {
12
+ health
13
+ message
14
+ }
15
+ }
9
16
  }
10
17
  }
11
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/cypress",
3
- "version": "3.21.2",
3
+ "version": "3.22.0",
4
4
  "scripts": {
5
5
  "build": "tsc",
6
6
  "lint": "eslint src -c .eslintrc.json --ext .ts"
@@ -10,6 +10,7 @@
10
10
  */
11
11
  export const waitUntilSAMStatusGreen = (severity = 'MEDIUM', timeout = 60000, interval = 500, greenMatchCount = 10) : void => {
12
12
  let greenCount = 0;
13
+ let lastGraphqlResponse = {};
13
14
  cy.waitUntil(() =>
14
15
  cy.apollo({
15
16
  fetchPolicy: 'no-cache',
@@ -19,13 +20,14 @@ export const waitUntilSAMStatusGreen = (severity = 'MEDIUM', timeout = 60000, in
19
20
  }
20
21
  }).then(result => {
21
22
  const healthStatus = result?.data?.admin?.jahia?.healthCheck?.status;
23
+ lastGraphqlResponse = result?.data?.admin?.jahia?.healthCheck;
22
24
  if (healthStatus) {
23
25
  greenCount = healthStatus.health === 'GREEN' ? greenCount + 1 : 0;
24
26
  return greenCount >= greenMatchCount;
25
27
  }
26
28
  }),
27
29
  {
28
- errorMsg: `Timeout waiting for SAM to be green for severity: ${severity}`,
30
+ errorMsg: `Timeout waiting for SAM to be green for severity: ${severity}. Last GraphQL response: ${JSON.stringify(lastGraphqlResponse)}`,
29
31
  timeout: timeout,
30
32
  verbose: true,
31
33
  interval: interval