@jahia/cypress 3.14.9 → 3.16.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/ci.build.sh +1 -1
- package/dist/utils/JCRHelper.d.ts +1 -0
- package/dist/utils/PublicationAndWorkflowHelper.d.ts +2 -0
- package/dist/utils/PublicationAndWorkflowHelper.js +15 -1
- package/dist/utils/UsersHelper.d.ts +1 -0
- package/dist/utils/UsersHelper.js +9 -1
- package/fixtures/graphql/jcr/mutation/addNode.graphql +2 -1
- package/fixtures/graphql/jcr/mutation/unpublishNode.graphql +7 -0
- package/fixtures/groovy/admin/abortWorkflows.groovy +12 -0
- package/fixtures/groovy/admin/addUserToGroup.groovy +17 -0
- package/package.json +1 -1
- package/src/utils/JCRHelper.ts +1 -1
- package/src/utils/PublicationAndWorkflowHelper.ts +14 -0
- package/src/utils/UsersHelper.ts +8 -0
package/ci.build.sh
CHANGED
|
@@ -23,7 +23,7 @@ if [ -d ./jahia-module ]; then
|
|
|
23
23
|
cd jahia-module
|
|
24
24
|
if [ -e "pom.xml" ]; then
|
|
25
25
|
mvn clean install
|
|
26
|
-
|
|
26
|
+
find . -type f -name "*-SNAPSHOT.jar" -exec cp {} ../artifacts/ \;
|
|
27
27
|
elif [ -e "package.json" ]; then
|
|
28
28
|
rm ./*-SNAPSHOT.tgz
|
|
29
29
|
yarn set version stable && yarn install && yarn build && yarn jahia-pack
|
|
@@ -7,6 +7,7 @@ export declare const addNode: (variables: {
|
|
|
7
7
|
name: string;
|
|
8
8
|
properties?: any[];
|
|
9
9
|
children?: any[];
|
|
10
|
+
mixins?: any[];
|
|
10
11
|
}) => Cypress.Chainable;
|
|
11
12
|
export declare const getNodeByPath: (path: string, properties?: string[], language?: string, childrenTypes?: string[], workspace?: 'EDIT' | 'LIVE') => Cypress.Chainable;
|
|
12
13
|
export declare const getNodeAcl: (path: string) => Cypress.Chainable;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const publishAndWaitJobEnding: (path: string, languages?: string[]) => void;
|
|
2
|
+
export declare const unpublishNode: (path: string, languages: string) => void;
|
|
2
3
|
export declare const startWorkflow: (pathOrId: string, definition: string, language: string) => Cypress.Chainable;
|
|
3
4
|
export declare const validateAllWorkflows: () => void;
|
|
5
|
+
export declare const abortAllWorkflows: () => void;
|
|
4
6
|
export declare const waitAllJobsFinished: (errorMessage?: string, timeout?: number) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.waitAllJobsFinished = exports.validateAllWorkflows = exports.startWorkflow = exports.publishAndWaitJobEnding = void 0;
|
|
3
|
+
exports.waitAllJobsFinished = exports.abortAllWorkflows = exports.validateAllWorkflows = exports.startWorkflow = exports.unpublishNode = exports.publishAndWaitJobEnding = void 0;
|
|
4
4
|
var publishAndWaitJobEnding = function (path, languages) {
|
|
5
5
|
if (languages === void 0) { languages = ['en']; }
|
|
6
6
|
cy.apollo({
|
|
@@ -15,6 +15,16 @@ var publishAndWaitJobEnding = function (path, languages) {
|
|
|
15
15
|
exports.waitAllJobsFinished('Publication timeout for node: ' + path, 60000);
|
|
16
16
|
};
|
|
17
17
|
exports.publishAndWaitJobEnding = publishAndWaitJobEnding;
|
|
18
|
+
var unpublishNode = function (path, languages) {
|
|
19
|
+
cy.apollo({
|
|
20
|
+
variables: {
|
|
21
|
+
pathOrId: path,
|
|
22
|
+
languages: languages
|
|
23
|
+
},
|
|
24
|
+
mutationFile: 'graphql/jcr/mutation/unpublishNode.graphql'
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
exports.unpublishNode = unpublishNode;
|
|
18
28
|
var startWorkflow = function (pathOrId, definition, language) {
|
|
19
29
|
return cy.apollo({
|
|
20
30
|
variables: {
|
|
@@ -31,6 +41,10 @@ var validateAllWorkflows = function () {
|
|
|
31
41
|
exports.waitAllJobsFinished('All workflows validated but some jobs are still running after a minute', 60000);
|
|
32
42
|
};
|
|
33
43
|
exports.validateAllWorkflows = validateAllWorkflows;
|
|
44
|
+
var abortAllWorkflows = function () {
|
|
45
|
+
cy.executeGroovy('groovy/admin/abortWorkflows.groovy');
|
|
46
|
+
};
|
|
47
|
+
exports.abortAllWorkflows = abortAllWorkflows;
|
|
34
48
|
var waitAllJobsFinished = function (errorMessage, timeout) {
|
|
35
49
|
if (timeout === void 0) { timeout = 60000; }
|
|
36
50
|
cy.waitUntil(function () {
|
|
@@ -4,3 +4,4 @@ export declare const createUser: (userName: string, password: string, properties
|
|
|
4
4
|
value: string;
|
|
5
5
|
}[]) => void;
|
|
6
6
|
export declare const deleteUser: (userName: string) => void;
|
|
7
|
+
export declare const addUserToGroup: (userName: string, groupName: string, siteKey?: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.deleteUser = exports.createUser = exports.grantRoles = void 0;
|
|
3
|
+
exports.addUserToGroup = exports.deleteUser = exports.createUser = exports.grantRoles = void 0;
|
|
4
4
|
var grantRoles = function (pathOrId, roleNames, principalName, principalType) {
|
|
5
5
|
cy.log('Grant role(s) ' + roleNames + ' with principal type ' + principalType + ' to ' + principalName + ' on node ' + pathOrId);
|
|
6
6
|
return cy.apollo({
|
|
@@ -32,3 +32,11 @@ var deleteUser = function (userName) {
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
exports.deleteUser = deleteUser;
|
|
35
|
+
var addUserToGroup = function (userName, groupName, siteKey) {
|
|
36
|
+
cy.executeGroovy('groovy/admin/addUserToGroup.groovy', {
|
|
37
|
+
USER_NAME: userName,
|
|
38
|
+
GROUP_NAME: groupName,
|
|
39
|
+
SITE_KEY: siteKey ? "\"" + siteKey + "\"" : 'null'
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
exports.addUserToGroup = addUserToGroup;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
mutation addNode($parentPathOrId: String!, $name: String!, $primaryNodeType: String!, $children: [InputJCRNode] = [], $properties: [InputJCRProperty]) {
|
|
1
|
+
mutation addNode($parentPathOrId: String!, $name: String!, $primaryNodeType: String!, $children: [InputJCRNode] = [], $properties: [InputJCRProperty], $mixins: [String] = []) {
|
|
2
2
|
jcr(workspace: EDIT) {
|
|
3
3
|
addNode(
|
|
4
4
|
parentPathOrId: $parentPathOrId,
|
|
5
5
|
name: $name,
|
|
6
6
|
primaryNodeType: $primaryNodeType,
|
|
7
7
|
properties: $properties,
|
|
8
|
+
mixins: $mixins
|
|
8
9
|
) {
|
|
9
10
|
addChildrenBatch(nodes: $children){
|
|
10
11
|
uuid
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import org.jahia.services.usermanager.JahiaUser
|
|
2
|
+
import org.jahia.services.usermanager.JahiaUserManagerService
|
|
3
|
+
import org.jahia.services.workflow.Workflow
|
|
4
|
+
import org.jahia.services.workflow.WorkflowService
|
|
5
|
+
import org.jahia.services.workflow.WorkflowTask
|
|
6
|
+
|
|
7
|
+
final JahiaUser user = JahiaUserManagerService.getInstance().lookupRootUser().getJahiaUser();
|
|
8
|
+
List<WorkflowTask> tasks = WorkflowService.getInstance().getTasksForUser(user, Locale.ENGLISH);
|
|
9
|
+
for (WorkflowTask task : tasks) {
|
|
10
|
+
Workflow w = WorkflowService.getInstance().getWorkflow(task.getProvider(), task.getProcessId(), Locale.ENGLISH);
|
|
11
|
+
WorkflowService.getInstance().abortProcess(w.getId(), w.getProvider());
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import org.jahia.services.content.JCRTemplate
|
|
2
|
+
import org.jahia.services.usermanager.JahiaGroupManagerService
|
|
3
|
+
import org.jahia.services.usermanager.JahiaUserManagerService
|
|
4
|
+
import org.jahia.services.content.decorator.JCRGroupNode
|
|
5
|
+
import org.jahia.services.content.decorator.JCRUserNode
|
|
6
|
+
|
|
7
|
+
log.info("Add user USER_NAME to group GROUP_NAME")
|
|
8
|
+
JCRTemplate.getInstance().doExecuteWithSystemSession(session -> {
|
|
9
|
+
JahiaUserManagerService userManagerService = JahiaUserManagerService.getInstance()
|
|
10
|
+
JahiaGroupManagerService groupManagerService = JahiaGroupManagerService.getInstance()
|
|
11
|
+
JCRGroupNode groupNode = groupManagerService.lookupGroup(SITE_KEY, "GROUP_NAME", session)
|
|
12
|
+
JCRUserNode userNode = userManagerService.lookupUser("USER_NAME")
|
|
13
|
+
if (!groupNode.isMember(userNode)) {
|
|
14
|
+
groupNode.addMember(userNode)
|
|
15
|
+
}
|
|
16
|
+
session.save()
|
|
17
|
+
})
|
package/package.json
CHANGED
package/src/utils/JCRHelper.ts
CHANGED
|
@@ -36,7 +36,7 @@ export const deleteNodeProperty = (pathOrId: string, property: string, language:
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
export const addNode = (variables: { parentPathOrId: string, primaryNodeType: string, name: string, properties?: any[], children?: any[] }): Cypress.Chainable => {
|
|
39
|
+
export const addNode = (variables: { parentPathOrId: string, primaryNodeType: string, name: string, properties?: any[], children?: any[], mixins?: any[] }): Cypress.Chainable => {
|
|
40
40
|
return cy.apollo({
|
|
41
41
|
variables: variables,
|
|
42
42
|
mutationFile: 'graphql/jcr/mutation/addNode.graphql'
|
|
@@ -12,6 +12,16 @@ export const publishAndWaitJobEnding = (path: string, languages: string[] = ['en
|
|
|
12
12
|
waitAllJobsFinished('Publication timeout for node: ' + path, 60000);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
export const unpublishNode = (path: string, languages: string): void => {
|
|
16
|
+
cy.apollo({
|
|
17
|
+
variables: {
|
|
18
|
+
pathOrId: path,
|
|
19
|
+
languages: languages
|
|
20
|
+
},
|
|
21
|
+
mutationFile: 'graphql/jcr/mutation/unpublishNode.graphql'
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
15
25
|
export const startWorkflow = (pathOrId: string, definition: string, language: string): Cypress.Chainable => {
|
|
16
26
|
return cy.apollo({
|
|
17
27
|
variables: {
|
|
@@ -28,6 +38,10 @@ export const validateAllWorkflows = (): void => {
|
|
|
28
38
|
waitAllJobsFinished('All workflows validated but some jobs are still running after a minute', 60000);
|
|
29
39
|
};
|
|
30
40
|
|
|
41
|
+
export const abortAllWorkflows = (): void => {
|
|
42
|
+
cy.executeGroovy('groovy/admin/abortWorkflows.groovy');
|
|
43
|
+
};
|
|
44
|
+
|
|
31
45
|
export const waitAllJobsFinished = (errorMessage?: string, timeout = 60000): void => {
|
|
32
46
|
cy.waitUntil(
|
|
33
47
|
() =>
|
package/src/utils/UsersHelper.ts
CHANGED
|
@@ -28,3 +28,11 @@ export const deleteUser = (userName: string): void => {
|
|
|
28
28
|
USER_NAME: userName
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
+
|
|
32
|
+
export const addUserToGroup = (userName: string, groupName: string, siteKey?: string): void => {
|
|
33
|
+
cy.executeGroovy('groovy/admin/addUserToGroup.groovy', {
|
|
34
|
+
USER_NAME: userName,
|
|
35
|
+
GROUP_NAME: groupName,
|
|
36
|
+
SITE_KEY: siteKey ? `"${siteKey}"` : 'null'
|
|
37
|
+
});
|
|
38
|
+
};
|