@jahia/cypress 3.30.0 → 3.32.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.
|
@@ -2,22 +2,25 @@ import Chainable = Cypress.Chainable;
|
|
|
2
2
|
/**
|
|
3
3
|
* Simple health check query
|
|
4
4
|
* @param severity the severity of the health check, default is MEDIUM
|
|
5
|
-
* @param probeHealthFilter
|
|
5
|
+
* @param probeHealthFilter return only probes with health status matching or above, default is null
|
|
6
|
+
* @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
|
|
6
7
|
*/
|
|
7
|
-
export declare const healthCheck: (severity?: string, probeHealthFilter?: string) => Chainable<any>;
|
|
8
|
+
export declare const healthCheck: (severity?: string, probeHealthFilter?: any, probeNamesFilter?: string[]) => Chainable<any>;
|
|
8
9
|
/**
|
|
9
10
|
* Wait until the health check returns the expected health
|
|
10
11
|
* @param expectedHealth the expected health status
|
|
11
12
|
* @param severity the severity of the health check, default is MEDIUM
|
|
12
|
-
* @param probeHealthFilter
|
|
13
|
+
* @param probeHealthFilter return only probes with health status matching or above, default is null
|
|
14
|
+
* @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
|
|
13
15
|
* @param timeout the timeout in milliseconds, default is 60000
|
|
14
16
|
* @param interval the interval in milliseconds, default is 500
|
|
15
17
|
* @param statusMatchCount the number of consecutive status matches before the waitUntil resolves, default is 3
|
|
16
18
|
*/
|
|
17
|
-
export declare const waitUntilSAMStatus: ({ expectedHealth, severity, probeHealthFilter, timeout, interval, statusMatchCount }: {
|
|
19
|
+
export declare const waitUntilSAMStatus: ({ expectedHealth, severity, probeHealthFilter, probeNamesFilter, timeout, interval, statusMatchCount }: {
|
|
18
20
|
expectedHealth: any;
|
|
19
21
|
severity?: string;
|
|
20
|
-
probeHealthFilter?:
|
|
22
|
+
probeHealthFilter?: any;
|
|
23
|
+
probeNamesFilter?: any;
|
|
21
24
|
timeout?: number;
|
|
22
25
|
interval?: number;
|
|
23
26
|
statusMatchCount?: number;
|
package/dist/utils/SAMHelper.js
CHANGED
|
@@ -4,18 +4,21 @@ exports.waitUntilSAMStatusGreen = exports.waitUntilSAMStatus = exports.healthChe
|
|
|
4
4
|
/**
|
|
5
5
|
* Simple health check query
|
|
6
6
|
* @param severity the severity of the health check, default is MEDIUM
|
|
7
|
-
* @param probeHealthFilter
|
|
7
|
+
* @param probeHealthFilter return only probes with health status matching or above, default is null
|
|
8
|
+
* @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
|
|
8
9
|
*/
|
|
9
|
-
var healthCheck = function (severity, probeHealthFilter) {
|
|
10
|
+
var healthCheck = function (severity, probeHealthFilter, probeNamesFilter) {
|
|
10
11
|
if (severity === void 0) { severity = 'MEDIUM'; }
|
|
11
|
-
if (probeHealthFilter === void 0) { probeHealthFilter =
|
|
12
|
+
if (probeHealthFilter === void 0) { probeHealthFilter = null; }
|
|
13
|
+
if (probeNamesFilter === void 0) { probeNamesFilter = null; }
|
|
12
14
|
return cy
|
|
13
15
|
.apollo({
|
|
14
16
|
fetchPolicy: 'no-cache',
|
|
15
17
|
queryFile: 'graphql/sam/healthStatus.graphql',
|
|
16
18
|
variables: {
|
|
17
19
|
severity: severity,
|
|
18
|
-
probeHealthFilter: probeHealthFilter
|
|
20
|
+
probeHealthFilter: probeHealthFilter,
|
|
21
|
+
probeNamesFilter: probeNamesFilter
|
|
19
22
|
}
|
|
20
23
|
})
|
|
21
24
|
.then(function (response) {
|
|
@@ -28,17 +31,18 @@ exports.healthCheck = healthCheck;
|
|
|
28
31
|
* Wait until the health check returns the expected health
|
|
29
32
|
* @param expectedHealth the expected health status
|
|
30
33
|
* @param severity the severity of the health check, default is MEDIUM
|
|
31
|
-
* @param probeHealthFilter
|
|
34
|
+
* @param probeHealthFilter return only probes with health status matching or above, default is null
|
|
35
|
+
* @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
|
|
32
36
|
* @param timeout the timeout in milliseconds, default is 60000
|
|
33
37
|
* @param interval the interval in milliseconds, default is 500
|
|
34
38
|
* @param statusMatchCount the number of consecutive status matches before the waitUntil resolves, default is 3
|
|
35
39
|
*/
|
|
36
40
|
var waitUntilSAMStatus = function (_a) {
|
|
37
|
-
var expectedHealth = _a.expectedHealth, _b = _a.severity, severity = _b === void 0 ? 'MEDIUM' : _b, _c = _a.probeHealthFilter, probeHealthFilter = _c === void 0 ?
|
|
41
|
+
var expectedHealth = _a.expectedHealth, _b = _a.severity, severity = _b === void 0 ? 'MEDIUM' : _b, _c = _a.probeHealthFilter, probeHealthFilter = _c === void 0 ? null : _c, _d = _a.probeNamesFilter, probeNamesFilter = _d === void 0 ? null : _d, _e = _a.timeout, timeout = _e === void 0 ? 60000 : _e, _f = _a.interval, interval = _f === void 0 ? 500 : _f, _g = _a.statusMatchCount, statusMatchCount = _g === void 0 ? 3 : _g;
|
|
38
42
|
var statusCount = 0;
|
|
39
43
|
var lastGraphqlResponse = {};
|
|
40
44
|
cy.waitUntil(function () {
|
|
41
|
-
return exports.healthCheck(severity, probeHealthFilter).then(function (result) {
|
|
45
|
+
return exports.healthCheck(severity, probeHealthFilter, probeNamesFilter).then(function (result) {
|
|
42
46
|
lastGraphqlResponse = result;
|
|
43
47
|
var healthStatus = result === null || result === void 0 ? void 0 : result.status;
|
|
44
48
|
if (healthStatus) {
|
|
@@ -47,7 +51,9 @@ var waitUntilSAMStatus = function (_a) {
|
|
|
47
51
|
}
|
|
48
52
|
});
|
|
49
53
|
}, {
|
|
50
|
-
errorMsg:
|
|
54
|
+
errorMsg: function () {
|
|
55
|
+
return "Timeout waiting for SAM to be " + expectedHealth + " for severity: " + severity + " and probeHealthFilter: " + probeHealthFilter + ". Last GraphQL response: " + JSON.stringify(lastGraphqlResponse);
|
|
56
|
+
},
|
|
51
57
|
timeout: timeout,
|
|
52
58
|
verbose: true,
|
|
53
59
|
interval: interval
|
package/env.run.sh
CHANGED
|
@@ -48,7 +48,7 @@ fi
|
|
|
48
48
|
|
|
49
49
|
echo "$(date +'%d %B %Y - %k:%M') == Running Cypress with configuration file ${CYPRESS_CONFIGURATION_FILE} =="
|
|
50
50
|
|
|
51
|
-
yarn e2e:ci --config-file "${CYPRESS_CONFIGURATION_FILE}"
|
|
51
|
+
NO_COLOR=1 yarn e2e:ci --config-file "${CYPRESS_CONFIGURATION_FILE}"
|
|
52
52
|
|
|
53
53
|
if [[ $? -eq 0 ]]; then
|
|
54
54
|
echo "$(date +'%d %B %Y - %k:%M') == Full execution successful =="
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
query($severity: GqlProbeSeverity, $probeHealthFilter: GqlProbeHealth) {
|
|
1
|
+
query($severity: GqlProbeSeverity, $probeHealthFilter: GqlProbeHealth, $probeNamesFilter: [String!]) {
|
|
2
2
|
admin {
|
|
3
3
|
jahia {
|
|
4
|
-
healthCheck(severity: $severity) {
|
|
4
|
+
healthCheck(severity: $severity, includes: $probeNamesFilter) {
|
|
5
5
|
status {
|
|
6
6
|
health
|
|
7
7
|
message
|
package/package.json
CHANGED
package/src/utils/SAMHelper.ts
CHANGED
|
@@ -4,16 +4,18 @@ import Chainable = Cypress.Chainable
|
|
|
4
4
|
/**
|
|
5
5
|
* Simple health check query
|
|
6
6
|
* @param severity the severity of the health check, default is MEDIUM
|
|
7
|
-
* @param probeHealthFilter
|
|
7
|
+
* @param probeHealthFilter return only probes with health status matching or above, default is null
|
|
8
|
+
* @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
|
|
8
9
|
*/
|
|
9
|
-
export const healthCheck = (severity = 'MEDIUM', probeHealthFilter =
|
|
10
|
+
export const healthCheck = (severity = 'MEDIUM', probeHealthFilter = null, probeNamesFilter: string[] = null): Chainable<any> => {
|
|
10
11
|
return cy
|
|
11
12
|
.apollo({
|
|
12
13
|
fetchPolicy: 'no-cache',
|
|
13
14
|
queryFile: 'graphql/sam/healthStatus.graphql',
|
|
14
15
|
variables: {
|
|
15
16
|
severity,
|
|
16
|
-
probeHealthFilter
|
|
17
|
+
probeHealthFilter,
|
|
18
|
+
probeNamesFilter
|
|
17
19
|
}
|
|
18
20
|
})
|
|
19
21
|
.then((response: any) => {
|
|
@@ -25,16 +27,17 @@ export const healthCheck = (severity = 'MEDIUM', probeHealthFilter = 'GREEN'): C
|
|
|
25
27
|
* Wait until the health check returns the expected health
|
|
26
28
|
* @param expectedHealth the expected health status
|
|
27
29
|
* @param severity the severity of the health check, default is MEDIUM
|
|
28
|
-
* @param probeHealthFilter
|
|
30
|
+
* @param probeHealthFilter return only probes with health status matching or above, default is null
|
|
31
|
+
* @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
|
|
29
32
|
* @param timeout the timeout in milliseconds, default is 60000
|
|
30
33
|
* @param interval the interval in milliseconds, default is 500
|
|
31
34
|
* @param statusMatchCount the number of consecutive status matches before the waitUntil resolves, default is 3
|
|
32
35
|
*/
|
|
33
|
-
export const waitUntilSAMStatus = ({expectedHealth, severity = 'MEDIUM', probeHealthFilter =
|
|
36
|
+
export const waitUntilSAMStatus = ({expectedHealth, severity = 'MEDIUM', probeHealthFilter = null, probeNamesFilter = null, timeout = 60000, interval = 500, statusMatchCount = 3}) : void => {
|
|
34
37
|
let statusCount = 0;
|
|
35
38
|
let lastGraphqlResponse = {};
|
|
36
39
|
cy.waitUntil(() =>
|
|
37
|
-
healthCheck(severity, probeHealthFilter).then(result => {
|
|
40
|
+
healthCheck(severity, probeHealthFilter, probeNamesFilter).then(result => {
|
|
38
41
|
lastGraphqlResponse = result;
|
|
39
42
|
const healthStatus = result?.status;
|
|
40
43
|
if (healthStatus) {
|
|
@@ -43,7 +46,9 @@ export const waitUntilSAMStatus = ({expectedHealth, severity = 'MEDIUM', probeHe
|
|
|
43
46
|
}
|
|
44
47
|
}),
|
|
45
48
|
{
|
|
46
|
-
errorMsg:
|
|
49
|
+
errorMsg: () => {
|
|
50
|
+
return `Timeout waiting for SAM to be ${expectedHealth} for severity: ${severity} and probeHealthFilter: ${probeHealthFilter}. Last GraphQL response: ${JSON.stringify(lastGraphqlResponse)}`;
|
|
51
|
+
},
|
|
47
52
|
timeout: timeout,
|
|
48
53
|
verbose: true,
|
|
49
54
|
interval: interval
|