@jahia/cypress 3.14.7 → 3.14.8

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.
@@ -6,3 +6,6 @@ export declare const createSite: (siteKey: string, config?: {
6
6
  }) => void;
7
7
  export declare const deleteSite: (siteKey: string) => void;
8
8
  export declare const enableModule: (moduleName: string, siteKey: string) => void;
9
+ export declare const editSite: (siteKey: string, config?: {
10
+ serverName: string;
11
+ }) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.enableModule = exports.deleteSite = exports.createSite = void 0;
3
+ exports.editSite = exports.enableModule = exports.deleteSite = exports.createSite = void 0;
4
4
  var createSite = function (siteKey, config) {
5
5
  if (config === void 0) { config = { templateSet: 'dx-base-demo-templates', serverName: 'localhost', locale: 'en' }; }
6
6
  cy.executeGroovy('groovy/admin/createSite.groovy', {
@@ -25,3 +25,11 @@ var enableModule = function (moduleName, siteKey) {
25
25
  });
26
26
  };
27
27
  exports.enableModule = enableModule;
28
+ var editSite = function (siteKey, config) {
29
+ if (config === void 0) { config = { serverName: 'localhost' }; }
30
+ cy.executeGroovy('groovy/admin/editSite.groovy', {
31
+ SITEKEY: siteKey,
32
+ SERVERNAME: config.serverName
33
+ });
34
+ };
35
+ exports.editSite = editSite;
@@ -0,0 +1,20 @@
1
+ import org.jahia.api.Constants
2
+ import org.jahia.services.content.JCRTemplate
3
+ import org.jahia.services.content.decorator.JCRSiteNode
4
+ import org.jahia.services.sites.JahiaSite
5
+ import org.jahia.services.sites.JahiaSitesService
6
+ import org.jahia.services.sites.SiteCreationInfo
7
+ import org.jahia.services.usermanager.JahiaUserManagerService
8
+ import java.util.stream.Collectors
9
+
10
+ JahiaSitesService sitesService = JahiaSitesService.getInstance();
11
+ if (sitesService.getSiteByKey("SITEKEY") != null) {
12
+
13
+ JCRTemplate.instance.doExecuteWithSystemSessionAsUser(JahiaUserManagerService.instance.lookupUser("root").jahiaUser,
14
+ Constants.EDIT_WORKSPACE, Locale.ENGLISH, jcrsession -> {
15
+ JCRSiteNode siteByKey = sitesService.getSiteByKey("SITEKEY", jcrsession)
16
+ siteByKey.setServerName("SERVERNAME")
17
+ jcrsession.save()
18
+ return null
19
+ })
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/cypress",
3
- "version": "3.14.7",
3
+ "version": "3.14.8",
4
4
  "scripts": {
5
5
  "build": "tsc",
6
6
  "lint": "eslint src -c .eslintrc.json --ext .ts"
@@ -21,3 +21,10 @@ export const enableModule = (moduleName: string, siteKey: string): void => {
21
21
  type: 'application/yaml'
22
22
  });
23
23
  };
24
+
25
+ export const editSite = (siteKey: string, config: {serverName: string} = {serverName: 'localhost'}): void => {
26
+ cy.executeGroovy('groovy/admin/editSite.groovy', {
27
+ SITEKEY: siteKey,
28
+ SERVERNAME: config.serverName
29
+ });
30
+ };