@jahia/cypress 1.0.9 → 1.1.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/.graphqlconfig +16 -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/support/fixture.js +6 -2
- package/dist/support/provisioning/executeGroovy.d.ts +8 -2
- package/dist/support/provisioning/executeGroovy.js +8 -2
- package/dist/support/provisioning/runProvisioningScript.d.ts +7 -2
- package/dist/support/provisioning/runProvisioningScript.js +11 -5
- 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 +2 -2
- package/schema.graphql +2874 -0
- package/src/page-object/baseComponent.ts +5 -0
- package/src/page-object/moonstone/menu.ts +5 -1
- package/src/support/fixture.ts +5 -2
- package/src/support/provisioning/executeGroovy.md +9 -0
- package/src/support/provisioning/executeGroovy.ts +15 -3
- package/src/support/provisioning/runProvisioningScript.md +9 -0
- package/src/support/provisioning/runProvisioningScript.ts +18 -6
- package/workflows/npm_publish.yml +18 -0
- package/.idea/jahia-cypress.iml +0 -9
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/sonarlint/issuestore/8/9/8995cd54601f633e8bca96b4e0b06ae4272afe02 +0 -3
- package/.idea/sonarlint/issuestore/index.pb +0 -3
- package/.idea/vcs.xml +0 -6
- package/dist/page-object/iframe.d.ts +0 -10
- package/dist/page-object/iframe.js +0 -46
- package/dist/page-object/moonstone/muiinput.d.ts +0 -8
- package/dist/page-object/moonstone/muiinput.js +0 -36
- package/dist/page-object/moonstone/muiradio.d.ts +0 -5
- package/dist/page-object/moonstone/muiradio.js +0 -32
- package/dist/support/reloadUntil.d.ts +0 -15
- package/dist/support/reloadUntil.js +0 -50
- package/dist/support/waitUntil.d.ts +0 -15
- package/dist/support/waitUntil.js +0 -44
- package/fixtures/test.json +0 -0
- package/yalc.lock +0 -9
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
|
+
}
|
|
@@ -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/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
|
};
|
|
@@ -3,10 +3,16 @@ declare global {
|
|
|
3
3
|
interface Chainable<Subject> {
|
|
4
4
|
executeGroovy(scriptFile: string, replacements?: {
|
|
5
5
|
[key: string]: string;
|
|
6
|
-
}): Chainable<any>;
|
|
6
|
+
}, jahiaServer?: JahiaServer): Chainable<any>;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
+
declare type JahiaServer = {
|
|
11
|
+
url: string;
|
|
12
|
+
username: string;
|
|
13
|
+
password: string;
|
|
14
|
+
};
|
|
10
15
|
export declare const executeGroovy: (scriptFile: string, replacements?: {
|
|
11
16
|
[key: string]: string;
|
|
12
|
-
}) => void;
|
|
17
|
+
}, jahiaServer?: JahiaServer) => void;
|
|
18
|
+
export {};
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.executeGroovy = void 0;
|
|
5
5
|
/// <reference types="cypress" />
|
|
6
|
-
var
|
|
6
|
+
var serverDefaults = {
|
|
7
|
+
url: Cypress.config().baseUrl,
|
|
8
|
+
username: 'root',
|
|
9
|
+
password: Cypress.env('SUPER_USER_PASSWORD')
|
|
10
|
+
};
|
|
11
|
+
var executeGroovy = function (scriptFile, replacements, jahiaServer) {
|
|
12
|
+
if (jahiaServer === void 0) { jahiaServer = serverDefaults; }
|
|
7
13
|
cy.runProvisioningScript({
|
|
8
14
|
fileContent: '- executeScript: "' + scriptFile + '"',
|
|
9
15
|
type: 'application/yaml'
|
|
@@ -11,6 +17,6 @@ var executeGroovy = function (scriptFile, replacements) {
|
|
|
11
17
|
fileName: scriptFile,
|
|
12
18
|
replacements: replacements,
|
|
13
19
|
type: 'text/plain'
|
|
14
|
-
}]).then(function (r) { return r[0]; });
|
|
20
|
+
}], jahiaServer).then(function (r) { return r[0]; });
|
|
15
21
|
};
|
|
16
22
|
exports.executeGroovy = executeGroovy;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
declare global {
|
|
3
3
|
namespace Cypress {
|
|
4
4
|
interface Chainable<Subject> {
|
|
5
|
-
runProvisioningScript(script: FormFile, files?: FormFile[]): Chainable<any>;
|
|
5
|
+
runProvisioningScript(script: FormFile, files?: FormFile[], jahiaServer?: JahiaServer): Chainable<any>;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -15,5 +15,10 @@ declare type FormFile = {
|
|
|
15
15
|
[key: string]: string;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
declare type JahiaServer = {
|
|
19
|
+
url: string;
|
|
20
|
+
username: string;
|
|
21
|
+
password: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const runProvisioningScript: (script: FormFile, files?: FormFile[], jahiaServer?: JahiaServer, options?: Cypress.Loggable) => void;
|
|
19
24
|
export {};
|
|
@@ -27,7 +27,13 @@ function append(formFile, formData, key) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var serverDefaults = {
|
|
31
|
+
url: Cypress.config().baseUrl,
|
|
32
|
+
username: 'root',
|
|
33
|
+
password: Cypress.env('SUPER_USER_PASSWORD')
|
|
34
|
+
};
|
|
35
|
+
var runProvisioningScript = function (script, files, jahiaServer, options) {
|
|
36
|
+
if (jahiaServer === void 0) { jahiaServer = serverDefaults; }
|
|
31
37
|
if (options === void 0) { options = { log: true }; }
|
|
32
38
|
var formData = new FormData();
|
|
33
39
|
append(script, formData, "script");
|
|
@@ -44,7 +50,7 @@ var runProvisioningScript = function (script, files, options) {
|
|
|
44
50
|
autoEnd: false,
|
|
45
51
|
name: 'runProvisioningScript',
|
|
46
52
|
displayName: 'provScript',
|
|
47
|
-
message: "Run " + (script.fileName ? script.fileName : 'inline script'),
|
|
53
|
+
message: "Run " + (script.fileName ? script.fileName : 'inline script') + " towards server: " + jahiaServer.url,
|
|
48
54
|
consoleProps: function () {
|
|
49
55
|
return {
|
|
50
56
|
Script: script,
|
|
@@ -56,11 +62,11 @@ var runProvisioningScript = function (script, files, options) {
|
|
|
56
62
|
});
|
|
57
63
|
}
|
|
58
64
|
cy.request({
|
|
59
|
-
url:
|
|
65
|
+
url: jahiaServer.url + "/modules/api/provisioning",
|
|
60
66
|
method: 'POST',
|
|
61
67
|
auth: {
|
|
62
|
-
user:
|
|
63
|
-
pass:
|
|
68
|
+
user: jahiaServer.username,
|
|
69
|
+
pass: jahiaServer.password,
|
|
64
70
|
sendImmediately: true
|
|
65
71
|
},
|
|
66
72
|
body: formData,
|
|
@@ -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
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jahia/cypress",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "tsc",
|
|
6
6
|
"lint": "eslint src -c .eslintrc.json --ext .ts"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@apollo/client": "^3.4.9",
|
|
21
|
-
"cypress-terminal-report": "^3.
|
|
21
|
+
"cypress-terminal-report": "^3.4.2",
|
|
22
22
|
"graphql": "^15.5.0",
|
|
23
23
|
"graphql-tag": "^2.11.0"
|
|
24
24
|
}
|