@jahia/cypress 1.0.6 → 1.0.10
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/.graphqlconfig +16 -0
- package/README.md +2 -0
- package/dist/page-object/baseComponent.d.ts +2 -0
- package/dist/page-object/baseComponent.js +14 -0
- package/dist/page-object/moonstone/menu.js +5 -1
- package/dist/plugins/env.js +14 -4
- package/dist/support/fixture.js +6 -2
- package/dist/support/index.d.ts +1 -0
- package/dist/support/index.js +1 -0
- package/dist/support/provisioning/runProvisioningScript.js +17 -21
- package/dist/support/registerSupport.js +2 -0
- package/dist/support/reloadUntil.d.ts +15 -0
- package/dist/support/reloadUntil.js +50 -0
- package/dist/support/repeatUntil.d.ts +15 -0
- package/dist/support/repeatUntil.js +52 -0
- package/dist/support/waitUntil.d.ts +15 -0
- package/dist/support/waitUntil.js +44 -0
- package/fixtures/graphql/jcr/addNode.graphql +16 -0
- package/fixtures/graphql/jcr/deleteNode.graphql +5 -0
- package/fixtures/graphql/jcr/mutateNode.graphql +13 -0
- package/fixtures/groovy/admin/createSite.groovy +14 -0
- package/fixtures/groovy/admin/deleteSite.groovy +6 -0
- package/package.json +1 -1
- package/schema.graphql +2874 -0
- package/src/page-object/baseComponent.ts +5 -0
- package/src/page-object/moonstone/menu.ts +5 -1
- package/src/plugins/env.ts +13 -4
- package/src/support/fixture.ts +5 -2
- package/src/support/index.ts +1 -0
- package/src/support/provisioning/runProvisioningScript.ts +15 -19
- package/src/support/registerSupport.ts +2 -0
- package/src/support/repeatUntil.md +40 -0
- package/src/support/repeatUntil.ts +59 -0
- package/fixtures/test.json +0 -0
package/.graphqlconfig
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Untitled GraphQL Schema",
|
|
3
|
+
"schemaPath": "schema.graphql",
|
|
4
|
+
"extensions": {
|
|
5
|
+
"endpoints": {
|
|
6
|
+
"Default GraphQL Endpoint": {
|
|
7
|
+
"url": "http://localhost:8080/modules/graphql",
|
|
8
|
+
"headers": {
|
|
9
|
+
"user-agent": "JS GraphQL",
|
|
10
|
+
"Authorization": "Basic cm9vdDpyb290MTIzNA=="
|
|
11
|
+
},
|
|
12
|
+
"introspect": true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/README.md
CHANGED
|
@@ -5,10 +5,12 @@ export declare type ComponentType<Component> = {
|
|
|
5
5
|
defaultSelector: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class BaseComponent {
|
|
8
|
+
static defaultSelector: string;
|
|
8
9
|
static count: number;
|
|
9
10
|
element: Chainable<JQuery>;
|
|
10
11
|
id: number;
|
|
11
12
|
assertion?: (s: JQuery) => void;
|
|
12
13
|
constructor(element: Chainable<JQuery>, assertion?: (s: JQuery) => void);
|
|
13
14
|
get(): Chainable<JQuery>;
|
|
15
|
+
should(arg: any, ...others: any[]): Chainable<JQuery<HTMLElement>>;
|
|
14
16
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
3
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
4
|
+
to[j] = from[i];
|
|
5
|
+
return to;
|
|
6
|
+
};
|
|
2
7
|
exports.__esModule = true;
|
|
3
8
|
exports.BaseComponent = void 0;
|
|
4
9
|
var BaseComponent = /** @class */ (function () {
|
|
@@ -13,6 +18,15 @@ var BaseComponent = /** @class */ (function () {
|
|
|
13
18
|
}
|
|
14
19
|
return cy.get('@component' + this.id, { log: false });
|
|
15
20
|
};
|
|
21
|
+
BaseComponent.prototype.should = function (arg) {
|
|
22
|
+
var _a;
|
|
23
|
+
var others = [];
|
|
24
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
25
|
+
others[_i - 1] = arguments[_i];
|
|
26
|
+
}
|
|
27
|
+
return (_a = cy.get('@component' + this.id, { log: false })).should.apply(_a, __spreadArray([arg], others));
|
|
28
|
+
};
|
|
29
|
+
BaseComponent.defaultSelector = '';
|
|
16
30
|
BaseComponent.count = 0;
|
|
17
31
|
return BaseComponent;
|
|
18
32
|
}());
|
|
@@ -23,14 +23,18 @@ var Menu = /** @class */ (function (_super) {
|
|
|
23
23
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
24
|
}
|
|
25
25
|
Menu.prototype.select = function (item) {
|
|
26
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
27
|
+
cy.wait(500);
|
|
26
28
|
this.get().find(".moonstone-menuItem").should("contain", item).contains(item).trigger('click');
|
|
27
29
|
return this;
|
|
28
30
|
};
|
|
29
31
|
Menu.prototype.selectByRole = function (item) {
|
|
32
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
33
|
+
cy.wait(500);
|
|
30
34
|
this.get().find(".moonstone-menuItem[data-sel-role=\"" + item + "\"]").trigger('click');
|
|
31
35
|
return this;
|
|
32
36
|
};
|
|
33
|
-
Menu.defaultSelector = '.moonstone-menu';
|
|
37
|
+
Menu.defaultSelector = '.moonstone-menu:visible';
|
|
34
38
|
return Menu;
|
|
35
39
|
}(baseComponent_1.BaseComponent));
|
|
36
40
|
exports.Menu = Menu;
|
package/dist/plugins/env.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
3
|
var env = function (on, config) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
if (!process.env.JAHIA_URL && !process.env.SUPER_USER_PASSWORD) {
|
|
5
|
+
console.warn('No environment set, will use default values');
|
|
6
|
+
config.baseUrl = 'http://localhost:8080';
|
|
7
|
+
config.env.JAHIA_URL = 'http://localhost:8080';
|
|
8
|
+
config.env.SUPER_USER_PASSWORD = 'root1234';
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
console.log('Setting environment');
|
|
12
|
+
config.baseUrl = process.env.JAHIA_URL;
|
|
13
|
+
config.env.JAHIA_URL = process.env.JAHIA_URL;
|
|
14
|
+
config.env.SUPER_USER_PASSWORD = process.env.SUPER_USER_PASSWORD;
|
|
15
|
+
}
|
|
16
|
+
console.log('JAHIA_URL =', config.env.JAHIA_URL);
|
|
17
|
+
console.log('SUPER_USER_PASSWORD =', config.env.SUPER_USER_PASSWORD);
|
|
8
18
|
return config;
|
|
9
19
|
};
|
|
10
20
|
exports["default"] = env;
|
package/dist/support/fixture.js
CHANGED
|
@@ -16,7 +16,6 @@ var fixture = function (originalCommand, fixture) {
|
|
|
16
16
|
return originalCommand.apply(void 0, __spreadArray([fixture], args)).then(function (f) {
|
|
17
17
|
return f;
|
|
18
18
|
})["catch"](function (err) {
|
|
19
|
-
console.log(err);
|
|
20
19
|
return null;
|
|
21
20
|
});
|
|
22
21
|
}).then(function (file) {
|
|
@@ -25,7 +24,12 @@ var fixture = function (originalCommand, fixture) {
|
|
|
25
24
|
if (typeof args[0] === 'string') {
|
|
26
25
|
encoding = args[0];
|
|
27
26
|
}
|
|
28
|
-
|
|
27
|
+
try {
|
|
28
|
+
cy.readFile('./node_modules/@jahia/cypress/fixtures/' + fixture, encoding, { log: false, timeout: 0 });
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
console.log(e);
|
|
32
|
+
}
|
|
29
33
|
}
|
|
30
34
|
});
|
|
31
35
|
};
|
package/dist/support/index.d.ts
CHANGED
package/dist/support/index.js
CHANGED
|
@@ -11,33 +11,29 @@ function processContent(formFile) {
|
|
|
11
11
|
formFile.fileContent = content;
|
|
12
12
|
return Cypress.Blob.binaryStringToBlob(content, formFile.type);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
});
|
|
14
|
+
function append(formFile, formData, key) {
|
|
15
|
+
if (formFile.fileContent) {
|
|
16
|
+
formData.append(key, processContent(formFile), formFile.fileName);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
cy.fixture(formFile.fileName, (formFile.encoding ? formFile.encoding : 'binary')).then(function (content) {
|
|
20
|
+
if (typeof content === 'object') {
|
|
21
|
+
formFile.fileContent = JSON.stringify(content);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
formFile.fileContent = content;
|
|
25
|
+
}
|
|
26
|
+
formData.append(key, processContent(formFile), formFile.fileName);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
31
29
|
}
|
|
32
30
|
var runProvisioningScript = function (script, files, options) {
|
|
33
31
|
if (options === void 0) { options = { log: true }; }
|
|
34
32
|
var formData = new FormData();
|
|
35
|
-
|
|
33
|
+
append(script, formData, "script");
|
|
36
34
|
if (files) {
|
|
37
35
|
files.forEach(function (f) {
|
|
38
|
-
|
|
39
|
-
formData.append("file", blob, f.fileName);
|
|
40
|
-
});
|
|
36
|
+
append(f, formData, "file");
|
|
41
37
|
});
|
|
42
38
|
}
|
|
43
39
|
var response;
|
|
@@ -10,6 +10,7 @@ var login_1 = require("./login");
|
|
|
10
10
|
var logout_1 = require("./logout");
|
|
11
11
|
var installLogsCollector_1 = __importDefault(require("cypress-terminal-report/src/installLogsCollector"));
|
|
12
12
|
var fixture_1 = require("./fixture");
|
|
13
|
+
var repeatUntil_1 = require("./repeatUntil");
|
|
13
14
|
var registerSupport = function () {
|
|
14
15
|
Cypress.Commands.add('apolloClient', apollo_1.apolloClient);
|
|
15
16
|
Cypress.Commands.add('apollo', { prevSubject: 'optional' }, apollo_1.apollo);
|
|
@@ -17,6 +18,7 @@ var registerSupport = function () {
|
|
|
17
18
|
Cypress.Commands.add('executeGroovy', provisioning_1.executeGroovy);
|
|
18
19
|
Cypress.Commands.add('login', login_1.login);
|
|
19
20
|
Cypress.Commands.add('logout', logout_1.logout);
|
|
21
|
+
Cypress.Commands.add('repeatUntil', repeatUntil_1.repeatUntil);
|
|
20
22
|
Cypress.Commands.overwrite('fixture', fixture_1.fixture);
|
|
21
23
|
installLogsCollector_1["default"]();
|
|
22
24
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
declare type ReloadUntilOptions = {
|
|
3
|
+
attempts: number;
|
|
4
|
+
reloadCallback: () => void;
|
|
5
|
+
delay: number;
|
|
6
|
+
};
|
|
7
|
+
declare global {
|
|
8
|
+
namespace Cypress {
|
|
9
|
+
interface Chainable<Subject> {
|
|
10
|
+
reloadUntil(selector: string, options: Partial<ReloadUntilOptions>): Chainable<Cypress.Response<any>>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare const reloadUntil: (selector: string, options: Partial<ReloadUntilOptions>) => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
exports.__esModule = true;
|
|
15
|
+
exports.reloadUntil = void 0;
|
|
16
|
+
var defaultOptions = {
|
|
17
|
+
attempts: 10,
|
|
18
|
+
reloadCallback: function () { return cy.reload({ log: false }); },
|
|
19
|
+
delay: 1000
|
|
20
|
+
};
|
|
21
|
+
var reloadUntil = function (selector, options) {
|
|
22
|
+
options = __assign(__assign({}, defaultOptions), options);
|
|
23
|
+
var log = Cypress.log({
|
|
24
|
+
name: 'reloadUntil',
|
|
25
|
+
message: "Reload until " + selector + ", remaining attempts : " + options.attempts,
|
|
26
|
+
consoleProps: function () {
|
|
27
|
+
return {
|
|
28
|
+
attempts: options.attempts
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var items = Cypress.$(selector);
|
|
33
|
+
if (items.length) {
|
|
34
|
+
log.set({ $el: items });
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (options.attempts > 1) {
|
|
38
|
+
log.end();
|
|
39
|
+
options.reloadCallback();
|
|
40
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
41
|
+
cy.wait(options.delay);
|
|
42
|
+
cy.reloadUntil(selector, __assign(__assign({}, options), { attempts: options.attempts - 1 }));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
var err = Error('Items not found.');
|
|
46
|
+
log.error(err);
|
|
47
|
+
throw err;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.reloadUntil = reloadUntil;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
declare type RepeatUntilOptions = {
|
|
3
|
+
attempts: number;
|
|
4
|
+
callback: () => void;
|
|
5
|
+
delay: number;
|
|
6
|
+
};
|
|
7
|
+
declare global {
|
|
8
|
+
namespace Cypress {
|
|
9
|
+
interface Chainable<Subject> {
|
|
10
|
+
repeatUntil(selector: string, options?: Partial<RepeatUntilOptions>): Chainable<JQuery>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare const repeatUntil: (selector: string, options?: Partial<RepeatUntilOptions>) => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
exports.__esModule = true;
|
|
15
|
+
exports.repeatUntil = void 0;
|
|
16
|
+
var defaultOptions = {
|
|
17
|
+
attempts: 10,
|
|
18
|
+
callback: function () { return cy.reload({ log: false }); },
|
|
19
|
+
delay: 1000
|
|
20
|
+
};
|
|
21
|
+
var repeatUntil = function (selector, options) {
|
|
22
|
+
if (options === void 0) { options = {}; }
|
|
23
|
+
options = __assign(__assign({}, defaultOptions), options);
|
|
24
|
+
var log = Cypress.log({
|
|
25
|
+
name: 'repeatUntil',
|
|
26
|
+
message: "Reload until " + selector + ", remaining attempts : " + options.attempts,
|
|
27
|
+
consoleProps: function () {
|
|
28
|
+
return {
|
|
29
|
+
attempts: options.attempts
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var items = Cypress.$(selector);
|
|
34
|
+
if (items.length) {
|
|
35
|
+
log.set({ $el: items });
|
|
36
|
+
cy.wrap(items, { log: false });
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (options.attempts > 1) {
|
|
40
|
+
log.end();
|
|
41
|
+
options.callback();
|
|
42
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
43
|
+
cy.wait(options.delay);
|
|
44
|
+
cy.repeatUntil(selector, __assign(__assign({}, options), { attempts: options.attempts - 1 }));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
var err = Error('Items not found.');
|
|
48
|
+
log.error(err);
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.repeatUntil = repeatUntil;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
declare type ReloadUntilOptions = {
|
|
3
|
+
attempts: number;
|
|
4
|
+
reloadCallback: () => void;
|
|
5
|
+
delay: number;
|
|
6
|
+
};
|
|
7
|
+
declare global {
|
|
8
|
+
namespace Cypress {
|
|
9
|
+
interface Chainable<Subject> {
|
|
10
|
+
reloadUntil(selector: string, options: Partial<ReloadUntilOptions>): Chainable<Cypress.Response<any>>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare const reloadUntil: (selector: string, options: Partial<ReloadUntilOptions>) => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
exports.__esModule = true;
|
|
15
|
+
exports.reloadUntil = void 0;
|
|
16
|
+
var defaultOptions = {
|
|
17
|
+
attempts: 10,
|
|
18
|
+
reloadCallback: function () { return cy.reload({ log: false }); },
|
|
19
|
+
delay: 1000
|
|
20
|
+
};
|
|
21
|
+
var reloadUntil = function (selector, options) {
|
|
22
|
+
options = __assign(__assign({}, defaultOptions), options);
|
|
23
|
+
var log = Cypress.log({
|
|
24
|
+
name: 'reloadUntil',
|
|
25
|
+
message: "Reload until " + selector + ", remaining attempts : " + options.attempts
|
|
26
|
+
});
|
|
27
|
+
var $items = Cypress.$(selector);
|
|
28
|
+
if ($items.length) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (options.attempts > 1) {
|
|
32
|
+
log.finish();
|
|
33
|
+
options.reloadCallback();
|
|
34
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
35
|
+
cy.wait(1000, { log: false });
|
|
36
|
+
cy.reloadUntil(selector, __assign(__assign({}, options), { attempts: options.attempts - 1 }));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
var err = Error('Items not found.');
|
|
40
|
+
log.error(err);
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.reloadUntil = reloadUntil;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
mutation($parentPathOrId: String!, $nodeName: String!, $nodeType: String!, $children: [InputJCRNode] = [],
|
|
2
|
+
$properties: [InputJCRProperty]) {
|
|
3
|
+
jcr(workspace: EDIT) {
|
|
4
|
+
addNode(
|
|
5
|
+
parentPathOrId: $parentPathOrId,
|
|
6
|
+
name: $nodeName,
|
|
7
|
+
primaryNodeType: $nodeType,
|
|
8
|
+
properties: $properties,
|
|
9
|
+
) {
|
|
10
|
+
addChildrenBatch(nodes: $children){
|
|
11
|
+
uuid
|
|
12
|
+
}
|
|
13
|
+
uuid
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
mutation($pathOrId: String!, $children: [InputJCRNode] = [], $properties: [InputJCRProperty] = []) {
|
|
2
|
+
jcr(workspace: EDIT) {
|
|
3
|
+
mutateNode(pathOrId: $pathOrId) {
|
|
4
|
+
setPropertiesBatch(properties: $properties) {
|
|
5
|
+
path
|
|
6
|
+
}
|
|
7
|
+
addChildrenBatch(nodes: $children){
|
|
8
|
+
uuid
|
|
9
|
+
}
|
|
10
|
+
uuid
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import org.jahia.services.sites.JahiaSite
|
|
2
|
+
import org.jahia.services.sites.JahiaSitesService
|
|
3
|
+
import org.jahia.services.sites.SiteCreationInfo
|
|
4
|
+
|
|
5
|
+
JahiaSitesService sitesService = JahiaSitesService.getInstance();
|
|
6
|
+
if (sitesService.getSiteByKey("SITEKEY") == null) {
|
|
7
|
+
JahiaSite site = sitesService.addSite(SiteCreationInfo.builder().
|
|
8
|
+
siteKey("SITEKEY").
|
|
9
|
+
serverName("localhost").
|
|
10
|
+
title("SITEKEY").
|
|
11
|
+
templateSet("TEMPLATES_SET").
|
|
12
|
+
locale("en").build())
|
|
13
|
+
}
|
|
14
|
+
|