@jahia/cypress 3.19.4 → 3.20.1
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/utils/JCRHelper.d.ts +4 -2
- package/dist/utils/JCRHelper.js +4 -2
- package/dist/utils/SAMHelper.d.ts +1 -0
- package/dist/utils/SAMHelper.js +42 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/fixtures/graphql/jcr/mutation/deleteNode.graphql +2 -2
- package/fixtures/graphql/sam/healthStatus.graphql +12 -0
- package/package.json +1 -1
- package/src/utils/JCRHelper.ts +6 -3
- package/src/utils/SAMHelper.ts +34 -0
- package/src/utils/index.ts +1 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
declare type Workspace = 'EDIT' | 'LIVE';
|
|
1
2
|
export declare const setNodeProperty: (pathOrId: string, property: string, value: string | Array<string>, language: string) => Cypress.Chainable;
|
|
2
|
-
export declare const deleteNode: (pathOrId: string) => Cypress.Chainable;
|
|
3
|
+
export declare const deleteNode: (pathOrId: string, workspace?: Workspace) => Cypress.Chainable;
|
|
3
4
|
export declare const deleteNodeProperty: (pathOrId: string, property: string, language: string) => Cypress.Chainable;
|
|
4
5
|
export declare const addNode: (variables: {
|
|
5
6
|
parentPathOrId: string;
|
|
@@ -9,7 +10,8 @@ export declare const addNode: (variables: {
|
|
|
9
10
|
children?: any[];
|
|
10
11
|
mixins?: any[];
|
|
11
12
|
}) => Cypress.Chainable;
|
|
12
|
-
export declare const getNodeByPath: (path: string, properties?: string[], language?: string, childrenTypes?: string[], workspace?:
|
|
13
|
+
export declare const getNodeByPath: (path: string, properties?: string[], language?: string, childrenTypes?: string[], workspace?: Workspace) => Cypress.Chainable;
|
|
13
14
|
export declare const getNodeAcl: (path: string) => Cypress.Chainable;
|
|
14
15
|
export declare const moveNode: (pathOrId: string, destParentPathOrId: string, destName?: string) => Cypress.Chainable;
|
|
15
16
|
export declare const getNodeTypes: (filter?: {}) => Cypress.Chainable;
|
|
17
|
+
export {};
|
package/dist/utils/JCRHelper.js
CHANGED
|
@@ -17,10 +17,12 @@ var setNodeProperty = function (pathOrId, property, value, language) {
|
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
exports.setNodeProperty = setNodeProperty;
|
|
20
|
-
var deleteNode = function (pathOrId) {
|
|
20
|
+
var deleteNode = function (pathOrId, workspace) {
|
|
21
|
+
if (workspace === void 0) { workspace = 'EDIT'; }
|
|
21
22
|
return cy.apollo({
|
|
22
23
|
variables: {
|
|
23
|
-
pathOrId: pathOrId
|
|
24
|
+
pathOrId: pathOrId,
|
|
25
|
+
workspace: workspace
|
|
24
26
|
},
|
|
25
27
|
mutationFile: 'graphql/jcr/mutation/deleteNode.graphql'
|
|
26
28
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const waitUntilSAMStatusGreen: (severity?: string, timeout?: number, interval?: number, greenMatchCount?: number) => void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.waitUntilSAMStatusGreen = void 0;
|
|
4
|
+
/*
|
|
5
|
+
When Jahia is starting or performing provisioning operations
|
|
6
|
+
it is expected for the SAM probe to alternate beween GREEN, YELLOW and RED statuses.
|
|
7
|
+
|
|
8
|
+
The primary use of this method is to wait until a Jahia platform stabilizes after a startup or
|
|
9
|
+
provisioning operation.
|
|
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) {
|
|
15
|
+
if (severity === void 0) { severity = 'MEDIUM'; }
|
|
16
|
+
if (timeout === void 0) { timeout = 60000; }
|
|
17
|
+
if (interval === void 0) { interval = 500; }
|
|
18
|
+
if (greenMatchCount === void 0) { greenMatchCount = 10; }
|
|
19
|
+
var greenCount = 0;
|
|
20
|
+
cy.waitUntil(function () {
|
|
21
|
+
return cy.apollo({
|
|
22
|
+
fetchPolicy: 'no-cache',
|
|
23
|
+
queryFile: 'graphql/sam/healthStatus.graphql',
|
|
24
|
+
variables: {
|
|
25
|
+
severity: severity
|
|
26
|
+
}
|
|
27
|
+
}).then(function (result) {
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
|
+
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;
|
|
30
|
+
if (healthStatus) {
|
|
31
|
+
greenCount = healthStatus.health === 'GREEN' ? greenCount + 1 : 0;
|
|
32
|
+
return greenCount >= greenMatchCount;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}, {
|
|
36
|
+
errorMsg: "Timeout waiting for SAM to be green for severity: " + severity,
|
|
37
|
+
timeout: timeout,
|
|
38
|
+
verbose: true,
|
|
39
|
+
interval: interval
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
exports.waitUntilSAMStatusGreen = waitUntilSAMStatusGreen;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
package/src/utils/JCRHelper.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
type Workspace = 'EDIT' | 'LIVE';
|
|
2
|
+
|
|
1
3
|
export const setNodeProperty = (pathOrId: string, property: string, value: string | Array<string>, language: string): Cypress.Chainable => {
|
|
2
4
|
let mutationFile = 'graphql/jcr/mutation/setProperty.graphql';
|
|
3
5
|
if (value instanceof Array) {
|
|
@@ -15,10 +17,11 @@ export const setNodeProperty = (pathOrId: string, property: string, value: strin
|
|
|
15
17
|
});
|
|
16
18
|
};
|
|
17
19
|
|
|
18
|
-
export const deleteNode = (pathOrId: string): Cypress.Chainable => {
|
|
20
|
+
export const deleteNode = (pathOrId: string, workspace: Workspace = 'EDIT'): Cypress.Chainable => {
|
|
19
21
|
return cy.apollo({
|
|
20
22
|
variables: {
|
|
21
|
-
pathOrId: pathOrId
|
|
23
|
+
pathOrId: pathOrId,
|
|
24
|
+
workspace
|
|
22
25
|
},
|
|
23
26
|
mutationFile: 'graphql/jcr/mutation/deleteNode.graphql'
|
|
24
27
|
});
|
|
@@ -43,7 +46,7 @@ export const addNode = (variables: { parentPathOrId: string, primaryNodeType: st
|
|
|
43
46
|
});
|
|
44
47
|
};
|
|
45
48
|
|
|
46
|
-
export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace:
|
|
49
|
+
export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace: Workspace = 'EDIT'): Cypress.Chainable => {
|
|
47
50
|
return cy.apollo({
|
|
48
51
|
variables: {
|
|
49
52
|
path: path,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
When Jahia is starting or performing provisioning operations
|
|
3
|
+
it is expected for the SAM probe to alternate beween GREEN, YELLOW and RED statuses.
|
|
4
|
+
|
|
5
|
+
The primary use of this method is to wait until a Jahia platform stabilizes after a startup or
|
|
6
|
+
provisioning operation.
|
|
7
|
+
|
|
8
|
+
Instead of waiting only for one occurence of a GREEN status, this function will wait until the a
|
|
9
|
+
GREEN status was returned a number of consecutive times (greenMatchCount).
|
|
10
|
+
*/
|
|
11
|
+
export const waitUntilSAMStatusGreen = (severity = 'MEDIUM', timeout = 60000, interval = 500, greenMatchCount = 10) : void => {
|
|
12
|
+
let greenCount = 0;
|
|
13
|
+
cy.waitUntil(() =>
|
|
14
|
+
cy.apollo({
|
|
15
|
+
fetchPolicy: 'no-cache',
|
|
16
|
+
queryFile: 'graphql/sam/healthStatus.graphql',
|
|
17
|
+
variables: {
|
|
18
|
+
severity: severity
|
|
19
|
+
}
|
|
20
|
+
}).then(result => {
|
|
21
|
+
const healthStatus = result?.data?.admin?.jahia?.healthCheck?.status;
|
|
22
|
+
if (healthStatus) {
|
|
23
|
+
greenCount = healthStatus.health === 'GREEN' ? greenCount + 1 : 0;
|
|
24
|
+
return greenCount >= greenMatchCount;
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
{
|
|
28
|
+
errorMsg: `Timeout waiting for SAM to be green for severity: ${severity}`,
|
|
29
|
+
timeout: timeout,
|
|
30
|
+
verbose: true,
|
|
31
|
+
interval: interval
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
package/src/utils/index.ts
CHANGED