@jahia/cypress 3.24.0 → 3.26.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.
- package/dist/page-object/moonstone/menu.d.ts +3 -0
- package/dist/page-object/moonstone/menu.js +4 -0
- package/dist/utils/JCRHelper.d.ts +1 -0
- package/dist/utils/JCRHelper.js +18 -1
- package/dist/utils/SAMHelper.d.ts +34 -0
- package/dist/utils/SAMHelper.js +60 -29
- package/env.run.sh +16 -1
- package/fixtures/graphql/jcr/mutation/uploadFile.graphql +11 -0
- package/fixtures/graphql/sam/healthStatus.graphql +5 -3
- package/package.json +5 -4
- package/schema.graphql +808 -128
- package/src/page-object/moonstone/menu.ts +6 -0
- package/src/utils/JCRHelper.ts +17 -0
- package/src/utils/SAMHelper.ts +52 -21
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { BaseComponent } from '../baseComponent';
|
|
2
|
+
import Chainable = Cypress.Chainable;
|
|
2
3
|
export declare class Menu extends BaseComponent {
|
|
3
4
|
static defaultSelector: string;
|
|
5
|
+
static overlaySelector: string;
|
|
4
6
|
submenu(item: string, menu: string): Menu;
|
|
5
7
|
shouldHaveItem(item: string): void;
|
|
6
8
|
shouldNotHaveItem(item: string): void;
|
|
7
9
|
select(item: string): Menu;
|
|
8
10
|
selectByRole(item: string): Menu;
|
|
11
|
+
close(): Chainable<unknown>;
|
|
9
12
|
}
|
|
@@ -44,7 +44,11 @@ var Menu = /** @class */ (function (_super) {
|
|
|
44
44
|
this.get().find(".moonstone-menuItem[data-sel-role=\"" + item + "\"]").trigger('click');
|
|
45
45
|
return this;
|
|
46
46
|
};
|
|
47
|
+
Menu.prototype.close = function () {
|
|
48
|
+
return cy.get(Menu.overlaySelector).click('topRight');
|
|
49
|
+
};
|
|
47
50
|
Menu.defaultSelector = '.moonstone-menu:not(.moonstone-hidden)';
|
|
51
|
+
Menu.overlaySelector = '.moonstone-menu_overlay';
|
|
48
52
|
return Menu;
|
|
49
53
|
}(baseComponent_1.BaseComponent));
|
|
50
54
|
exports.Menu = Menu;
|
|
@@ -14,4 +14,5 @@ export declare const getNodeByPath: (path: string, properties?: string[], langua
|
|
|
14
14
|
export declare const getNodeAcl: (path: string) => Cypress.Chainable;
|
|
15
15
|
export declare const moveNode: (pathOrId: string, destParentPathOrId: string, destName?: string) => Cypress.Chainable;
|
|
16
16
|
export declare const getNodeTypes: (filter?: {}) => Cypress.Chainable;
|
|
17
|
+
export declare const uploadFile: (fixturePath: string, parentPathOrId: string, name: string, mimeType: string) => Cypress.Chainable;
|
|
17
18
|
export {};
|
package/dist/utils/JCRHelper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.getNodeTypes = exports.moveNode = exports.getNodeAcl = exports.getNodeByPath = exports.addNode = exports.deleteNodeProperty = exports.deleteNode = exports.setNodeProperty = void 0;
|
|
3
|
+
exports.uploadFile = exports.getNodeTypes = exports.moveNode = exports.getNodeAcl = exports.getNodeByPath = exports.addNode = exports.deleteNodeProperty = exports.deleteNode = exports.setNodeProperty = void 0;
|
|
4
4
|
var setNodeProperty = function (pathOrId, property, value, language) {
|
|
5
5
|
var mutationFile = 'graphql/jcr/mutation/setProperty.graphql';
|
|
6
6
|
if (value instanceof Array) {
|
|
@@ -92,3 +92,20 @@ var getNodeTypes = function (filter) {
|
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
94
|
exports.getNodeTypes = getNodeTypes;
|
|
95
|
+
var uploadFile = function (fixturePath, parentPathOrId, name, mimeType) {
|
|
96
|
+
return cy.fixture(fixturePath, 'binary')
|
|
97
|
+
.then(function (image) {
|
|
98
|
+
var blob = Cypress.Blob.binaryStringToBlob(image, mimeType);
|
|
99
|
+
var file = new File([blob], name, { type: blob.type });
|
|
100
|
+
return cy.apollo({
|
|
101
|
+
mutationFile: 'graphql/jcr/mutation/uploadFile.graphql',
|
|
102
|
+
variables: {
|
|
103
|
+
parentPathOrId: parentPathOrId,
|
|
104
|
+
name: name,
|
|
105
|
+
mimeType: mimeType,
|
|
106
|
+
file: file
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
exports.uploadFile = uploadFile;
|
|
@@ -1 +1,35 @@
|
|
|
1
|
+
import Chainable = Cypress.Chainable;
|
|
2
|
+
/**
|
|
3
|
+
* Simple health check query
|
|
4
|
+
* @param severity the severity of the health check, default is MEDIUM
|
|
5
|
+
* @param probeHealthFilter the filter for the health check probes, default is GREEN
|
|
6
|
+
*/
|
|
7
|
+
export declare const healthCheck: (severity?: string, probeHealthFilter?: string) => Chainable<any>;
|
|
8
|
+
/**
|
|
9
|
+
* Wait until the health check returns the expected health
|
|
10
|
+
* @param expectedHealth the expected health status
|
|
11
|
+
* @param severity the severity of the health check, default is MEDIUM
|
|
12
|
+
* @param probeHealthFilter the filter for the health check probes, default is GREEN
|
|
13
|
+
* @param timeout the timeout in milliseconds, default is 60000
|
|
14
|
+
* @param interval the interval in milliseconds, default is 500
|
|
15
|
+
* @param statusMatchCount the number of consecutive status matches before the waitUntil resolves, default is 1
|
|
16
|
+
*/
|
|
17
|
+
export declare const waitUntilSAMStatus: ({ expectedHealth, severity, probeHealthFilter, timeout, interval, statusMatchCount }: {
|
|
18
|
+
expectedHealth: any;
|
|
19
|
+
severity?: string;
|
|
20
|
+
probeHealthFilter?: string;
|
|
21
|
+
timeout?: number;
|
|
22
|
+
interval?: number;
|
|
23
|
+
statusMatchCount?: number;
|
|
24
|
+
}) => void;
|
|
25
|
+
/**
|
|
26
|
+
When Jahia is starting or performing provisioning operations
|
|
27
|
+
it is expected for the SAM probe to alternate beween GREEN, YELLOW and RED statuses.
|
|
28
|
+
|
|
29
|
+
The primary use of this method is to wait until a Jahia platform stabilizes after a startup or
|
|
30
|
+
provisioning operation.
|
|
31
|
+
|
|
32
|
+
Instead of waiting only for one occurence of a GREEN status, this function will wait until the a
|
|
33
|
+
GREEN status was returned a number of consecutive times (greenMatchCount).
|
|
34
|
+
*/
|
|
1
35
|
export declare const waitUntilSAMStatusGreen: (severity?: string, timeout?: number, interval?: number, greenMatchCount?: number) => void;
|
package/dist/utils/SAMHelper.js
CHANGED
|
@@ -1,44 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.waitUntilSAMStatusGreen = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Instead of waiting only for one occurence of a GREEN status, this function will wait until the a
|
|
12
|
-
GREEN status was returned a number of consecutive times (greenMatchCount).
|
|
13
|
-
*/
|
|
14
|
-
var waitUntilSAMStatusGreen = function (severity, timeout, interval, greenMatchCount) {
|
|
3
|
+
exports.waitUntilSAMStatusGreen = exports.waitUntilSAMStatus = exports.healthCheck = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Simple health check query
|
|
6
|
+
* @param severity the severity of the health check, default is MEDIUM
|
|
7
|
+
* @param probeHealthFilter the filter for the health check probes, default is GREEN
|
|
8
|
+
*/
|
|
9
|
+
var healthCheck = function (severity, probeHealthFilter) {
|
|
15
10
|
if (severity === void 0) { severity = 'MEDIUM'; }
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
if (probeHealthFilter === void 0) { probeHealthFilter = 'GREEN'; }
|
|
12
|
+
return cy
|
|
13
|
+
.apollo({
|
|
14
|
+
fetchPolicy: 'no-cache',
|
|
15
|
+
queryFile: 'graphql/sam/healthStatus.graphql',
|
|
16
|
+
variables: {
|
|
17
|
+
severity: severity,
|
|
18
|
+
probeHealthFilter: probeHealthFilter
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
.then(function (response) {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
return (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.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;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.healthCheck = healthCheck;
|
|
27
|
+
/**
|
|
28
|
+
* Wait until the health check returns the expected health
|
|
29
|
+
* @param expectedHealth the expected health status
|
|
30
|
+
* @param severity the severity of the health check, default is MEDIUM
|
|
31
|
+
* @param probeHealthFilter the filter for the health check probes, default is GREEN
|
|
32
|
+
* @param timeout the timeout in milliseconds, default is 60000
|
|
33
|
+
* @param interval the interval in milliseconds, default is 500
|
|
34
|
+
* @param statusMatchCount the number of consecutive status matches before the waitUntil resolves, default is 1
|
|
35
|
+
*/
|
|
36
|
+
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 ? 'GREEN' : _c, _d = _a.timeout, timeout = _d === void 0 ? 60000 : _d, _e = _a.interval, interval = _e === void 0 ? 500 : _e, _f = _a.statusMatchCount, statusMatchCount = _f === void 0 ? 1 : _f;
|
|
38
|
+
var statusCount = 0;
|
|
20
39
|
var lastGraphqlResponse = {};
|
|
21
40
|
cy.waitUntil(function () {
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
variables: {
|
|
26
|
-
severity: severity
|
|
27
|
-
}
|
|
28
|
-
}).then(function (result) {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
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;
|
|
41
|
+
return exports.healthCheck(severity, probeHealthFilter).then(function (result) {
|
|
42
|
+
lastGraphqlResponse = result;
|
|
43
|
+
var healthStatus = result === null || result === void 0 ? void 0 : result.status;
|
|
32
44
|
if (healthStatus) {
|
|
33
|
-
|
|
34
|
-
return
|
|
45
|
+
statusCount = healthStatus.health === expectedHealth ? statusCount + 1 : 0;
|
|
46
|
+
return statusCount >= statusMatchCount;
|
|
35
47
|
}
|
|
36
48
|
});
|
|
37
49
|
}, {
|
|
38
|
-
errorMsg: "Timeout waiting for SAM to be
|
|
50
|
+
errorMsg: "Timeout waiting for SAM to be " + expectedHealth + " for severity: " + severity + " and probeHealthFilter: " + probeHealthFilter + ". Last GraphQL response: " + JSON.stringify(lastGraphqlResponse),
|
|
39
51
|
timeout: timeout,
|
|
40
52
|
verbose: true,
|
|
41
53
|
interval: interval
|
|
42
54
|
});
|
|
43
55
|
};
|
|
56
|
+
exports.waitUntilSAMStatus = waitUntilSAMStatus;
|
|
57
|
+
/**
|
|
58
|
+
When Jahia is starting or performing provisioning operations
|
|
59
|
+
it is expected for the SAM probe to alternate beween GREEN, YELLOW and RED statuses.
|
|
60
|
+
|
|
61
|
+
The primary use of this method is to wait until a Jahia platform stabilizes after a startup or
|
|
62
|
+
provisioning operation.
|
|
63
|
+
|
|
64
|
+
Instead of waiting only for one occurence of a GREEN status, this function will wait until the a
|
|
65
|
+
GREEN status was returned a number of consecutive times (greenMatchCount).
|
|
66
|
+
*/
|
|
67
|
+
var waitUntilSAMStatusGreen = function (severity, timeout, interval, greenMatchCount) {
|
|
68
|
+
if (severity === void 0) { severity = 'MEDIUM'; }
|
|
69
|
+
if (timeout === void 0) { timeout = 60000; }
|
|
70
|
+
if (interval === void 0) { interval = 500; }
|
|
71
|
+
if (greenMatchCount === void 0) { greenMatchCount = 10; }
|
|
72
|
+
// We use YELLOW as the probeHealthFilter because we are not interested in potential GREEN probes in the response
|
|
73
|
+
exports.waitUntilSAMStatus({ expectedHealth: 'GREEN', severity: severity, probeHealthFilter: 'YELLOW', timeout: timeout, interval: interval, statusMatchCount: greenMatchCount });
|
|
74
|
+
};
|
|
44
75
|
exports.waitUntilSAMStatusGreen = waitUntilSAMStatusGreen;
|
package/env.run.sh
CHANGED
|
@@ -10,6 +10,11 @@ source $BASEDIR/set-env.sh
|
|
|
10
10
|
|
|
11
11
|
echo "$(date +'%d %B %Y - %k:%M') == env.run.sh == Printing the most important environment variables"
|
|
12
12
|
echo "$(date +'%d %B %Y - %k:%M') == NEXUS_USERNAME: ${NEXUS_USERNAME:0:3}***${NEXUS_USERNAME:(-6)}"
|
|
13
|
+
echo "$(date +'%d %B %Y - %k:%M') == DEBUG: ${DEBUG}"
|
|
14
|
+
|
|
15
|
+
if [[ "${DEBUG}" == "true" ]]; then
|
|
16
|
+
touch /tmp/debug
|
|
17
|
+
fi
|
|
13
18
|
|
|
14
19
|
echo "$(date +'%d %B %Y - %k:%M') == Fetching the list of installed modules =="
|
|
15
20
|
bash -c "unset npm_config_package; npx --yes @jahia/jahia-reporter@latest utils:modules \
|
|
@@ -49,10 +54,20 @@ if [[ $? -eq 0 ]]; then
|
|
|
49
54
|
echo "$(date +'%d %B %Y - %k:%M') == Full execution successful =="
|
|
50
55
|
echo "success" > ./results/test_success
|
|
51
56
|
yarn report:merge; yarn report:html
|
|
52
|
-
exit 0
|
|
53
57
|
else
|
|
54
58
|
echo "$(date +'%d %B %Y - %k:%M') == One or more failed tests =="
|
|
55
59
|
echo "failure" > ./results/test_failure
|
|
56
60
|
yarn report:merge; yarn report:html
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
WAIT_DURATION=0
|
|
64
|
+
while [[ -e /tmp/debug ]]; do
|
|
65
|
+
echo "Debug file present - $(( ++ WAIT_DURATION ))s - waiting for file removal or expiration of GitHub Actions timeout..."
|
|
66
|
+
sleep 1;
|
|
67
|
+
done
|
|
68
|
+
|
|
69
|
+
if [[ -e ./results/test_success ]]; then
|
|
70
|
+
exit 0
|
|
71
|
+
else
|
|
57
72
|
exit 1
|
|
58
73
|
fi
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
mutation uploadFile($name: String!, $parentPathOrId: String!, $mimeType: String!, $file: String!) {
|
|
2
|
+
jcr {
|
|
3
|
+
addNode(name: $name, parentPathOrId: $parentPathOrId, primaryNodeType: "jnt:file") {
|
|
4
|
+
addChild(name: "jcr:content", primaryNodeType: "jnt:resource") {
|
|
5
|
+
content: mutateProperty(name: "jcr:data") { setValue(type: BINARY, value: $file)}
|
|
6
|
+
contentType: mutateProperty(name: "jcr:mimeType") { setValue(value: $mimeType)}
|
|
7
|
+
}
|
|
8
|
+
uuid
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
query($severity: GqlProbeSeverity) {
|
|
1
|
+
query($severity: GqlProbeSeverity, $probeHealthFilter: GqlProbeHealth) {
|
|
2
2
|
admin {
|
|
3
3
|
jahia {
|
|
4
4
|
healthCheck(severity: $severity) {
|
|
@@ -6,13 +6,15 @@ query($severity: GqlProbeSeverity) {
|
|
|
6
6
|
health
|
|
7
7
|
message
|
|
8
8
|
}
|
|
9
|
-
probes(health:
|
|
9
|
+
probes(health: $probeHealthFilter) {
|
|
10
10
|
name
|
|
11
|
+
severity
|
|
12
|
+
description
|
|
11
13
|
status {
|
|
12
14
|
health
|
|
13
15
|
message
|
|
14
16
|
}
|
|
15
|
-
}
|
|
17
|
+
}
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jahia/cypress",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "tsc",
|
|
6
6
|
"lint": "eslint src -c .eslintrc.json --ext .ts"
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"bin": {
|
|
9
9
|
"ci.build": "./ci.build.sh",
|
|
10
10
|
"ci.startup": "./ci.startup.sh",
|
|
11
|
-
"env.
|
|
12
|
-
"env.
|
|
11
|
+
"env.debug": "./env.debug.sh",
|
|
12
|
+
"env.run": "./env.run.sh"
|
|
13
13
|
},
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"types": "dist/index.d.ts",
|
|
@@ -33,5 +33,6 @@
|
|
|
33
33
|
"cypress-real-events": "^1.11.0",
|
|
34
34
|
"graphql": "^15.5.0",
|
|
35
35
|
"graphql-tag": "^2.11.0"
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"packageManager": "yarn@4.5.0"
|
|
37
38
|
}
|