@jahia/cypress 3.0.0 → 3.1.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/utils/Utils.d.ts
CHANGED
|
@@ -10,3 +10,4 @@ export declare const addNode: (variables: {
|
|
|
10
10
|
children?: any[];
|
|
11
11
|
}) => Cypress.Chainable;
|
|
12
12
|
export declare const getNodeByPath: (path: string) => Cypress.Chainable;
|
|
13
|
+
export declare const createSite: (siteKey: string, templateSet?: string, serverName?: string, locale?: string, languages?: string) => void;
|
package/dist/utils/Utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.getNodeByPath = exports.addNode = exports.waitAllJobsFinished = exports.grantRoles = exports.deleteNode = exports.setNodeProperty = void 0;
|
|
3
|
+
exports.createSite = exports.getNodeByPath = exports.addNode = exports.waitAllJobsFinished = exports.grantRoles = exports.deleteNode = exports.setNodeProperty = void 0;
|
|
4
4
|
var setNodeProperty = function (pathOrId, property, value, language) {
|
|
5
5
|
return cy.apollo({
|
|
6
6
|
variables: {
|
|
@@ -77,3 +77,14 @@ var getNodeByPath = function (path) {
|
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
79
|
exports.getNodeByPath = getNodeByPath;
|
|
80
|
+
var createSite = function (siteKey, templateSet, serverName, locale, languages) {
|
|
81
|
+
var definedLocale = locale ? locale : 'en';
|
|
82
|
+
cy.executeGroovy('groovy/admin/createSite.groovy', {
|
|
83
|
+
SITEKEY: siteKey,
|
|
84
|
+
TEMPLATES_SET: templateSet ? templateSet : 'dx-base-demo-templates',
|
|
85
|
+
SERVERNAME: serverName ? serverName : 'localhost',
|
|
86
|
+
LOCALE: definedLocale,
|
|
87
|
+
LANGUAGES: languages ? "Arrays.asList(" + languages + ")" : "Arrays.asList(\"" + definedLocale + "\")"
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
exports.createSite = createSite;
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
+
import org.jahia.api.Constants
|
|
2
|
+
import org.jahia.services.content.JCRTemplate
|
|
3
|
+
import org.jahia.services.content.decorator.JCRSiteNode
|
|
1
4
|
import org.jahia.services.sites.JahiaSite
|
|
2
5
|
import org.jahia.services.sites.JahiaSitesService
|
|
3
6
|
import org.jahia.services.sites.SiteCreationInfo
|
|
7
|
+
import org.jahia.services.usermanager.JahiaUserManagerService
|
|
4
8
|
|
|
5
9
|
JahiaSitesService sitesService = JahiaSitesService.getInstance();
|
|
6
10
|
if (sitesService.getSiteByKey("SITEKEY") == null) {
|
|
7
11
|
JahiaSite site = sitesService.addSite(SiteCreationInfo.builder().
|
|
8
12
|
siteKey("SITEKEY").
|
|
9
|
-
serverName("
|
|
13
|
+
serverName("SERVERNAME").
|
|
10
14
|
title("SITEKEY").
|
|
11
15
|
templateSet("TEMPLATES_SET").
|
|
12
|
-
locale("
|
|
13
|
-
}
|
|
16
|
+
locale("LOCALE").build())
|
|
14
17
|
|
|
18
|
+
JCRTemplate.instance.doExecuteWithSystemSessionAsUser(JahiaUserManagerService.instance.lookupUser("root").jahiaUser,
|
|
19
|
+
Constants.EDIT_WORKSPACE, Locale.ENGLISH, jcrsession -> {
|
|
20
|
+
JCRSiteNode siteByKey = sitesService.getSiteByKey("SITEKEY", jcrsession)
|
|
21
|
+
siteByKey.setLanguages(new HashSet<String>(LANGUAGES))
|
|
22
|
+
jcrsession.save()
|
|
23
|
+
return null
|
|
24
|
+
})
|
|
25
|
+
}
|
package/package.json
CHANGED
package/src/utils/Utils.ts
CHANGED
|
@@ -73,3 +73,14 @@ export const getNodeByPath = (path: string): Cypress.Chainable => {
|
|
|
73
73
|
queryFile: 'graphql/jcr/query/getNodeByPath.graphql'
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
|
+
|
|
77
|
+
export const createSite = (siteKey: string, templateSet?: string, serverName?: string, locale?: string, languages?: string) => {
|
|
78
|
+
const definedLocale = locale ? locale : 'en';
|
|
79
|
+
cy.executeGroovy('groovy/admin/createSite.groovy', {
|
|
80
|
+
SITEKEY: siteKey,
|
|
81
|
+
TEMPLATES_SET: templateSet ? templateSet : 'dx-base-demo-templates',
|
|
82
|
+
SERVERNAME: serverName ? serverName : 'localhost',
|
|
83
|
+
LOCALE: definedLocale,
|
|
84
|
+
LANGUAGES: languages ? `Arrays.asList(${languages})` : `Arrays.asList("${definedLocale}")`
|
|
85
|
+
});
|
|
86
|
+
};
|