@jahia/cypress 2.0.0 → 3.0.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/LICENSE +21 -0
- package/README.md +10 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/page-object/html/iframe.d.ts +1 -1
- package/dist/page-object/material/muiinput.d.ts +1 -1
- package/dist/page-object/material/muiradio.d.ts +1 -1
- package/dist/page-object/moonstone/accordion.d.ts +1 -1
- package/dist/page-object/moonstone/button.d.ts +1 -1
- package/dist/page-object/moonstone/collapsible.d.ts +1 -1
- package/dist/page-object/moonstone/dropdown.d.ts +1 -1
- package/dist/page-object/moonstone/menu.d.ts +1 -1
- package/dist/page-object/moonstone/menu.js +1 -1
- package/dist/page-object/moonstone/pagination.d.ts +1 -1
- package/dist/page-object/moonstone/primaryNav.d.ts +1 -1
- package/dist/page-object/moonstone/primaryNav.js +1 -1
- package/dist/page-object/moonstone/secondaryNav.d.ts +1 -1
- package/dist/page-object/moonstone/table.d.ts +2 -2
- package/dist/page-object/utils.d.ts +2 -2
- package/dist/support/apollo/apollo.js +39 -41
- package/dist/support/apollo/apolloClient.js +1 -1
- package/dist/support/apollo/links.js +3 -5
- package/dist/support/commands.d.ts +1 -0
- package/dist/support/commands.js +3 -0
- package/dist/support/fixture.js +1 -1
- package/dist/support/logout.js +1 -1
- package/dist/support/provisioning/runProvisioningScript.js +6 -4
- package/dist/utils/Utils.d.ts +12 -0
- package/dist/utils/Utils.js +79 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +13 -0
- package/fixtures/graphql/jcr/mutation/addNode.graphql +18 -0
- package/fixtures/graphql/jcr/{deleteNode.graphql → mutation/deleteNode.graphql} +1 -1
- package/fixtures/graphql/jcr/mutation/grantRoles.graphql +16 -0
- package/fixtures/graphql/jcr/mutation/setProperty.graphql +9 -0
- package/fixtures/graphql/jcr/query/getJobsWithStatus.graphql +13 -0
- package/fixtures/graphql/jcr/query/getNodeByPath.graphql +15 -0
- package/package.json +6 -1
- package/schema.graphql +941 -76
- package/src/custom.d.ts +1 -1
- package/src/index.ts +4 -3
- package/src/page-object/baseComponent.ts +7 -7
- package/src/page-object/basePage.ts +1 -1
- package/src/page-object/html/iframe.ts +12 -13
- package/src/page-object/html/index.ts +1 -1
- package/src/page-object/index.ts +6 -6
- package/src/page-object/material/index.ts +2 -2
- package/src/page-object/material/muiinput.ts +5 -7
- package/src/page-object/material/muiradio.ts +3 -5
- package/src/page-object/moonstone/accordion.ts +7 -8
- package/src/page-object/moonstone/button.ts +3 -5
- package/src/page-object/moonstone/collapsible.ts +9 -10
- package/src/page-object/moonstone/dropdown.ts +6 -8
- package/src/page-object/moonstone/index.ts +9 -9
- package/src/page-object/moonstone/menu.ts +8 -8
- package/src/page-object/moonstone/pagination.ts +8 -9
- package/src/page-object/moonstone/primaryNav.ts +5 -5
- package/src/page-object/moonstone/secondaryNav.ts +3 -3
- package/src/page-object/moonstone/table.ts +9 -10
- package/src/page-object/utils.ts +12 -10
- package/src/plugins/env.ts +13 -12
- package/src/plugins/index.ts +1 -1
- package/src/plugins/registerPlugins.ts +3 -3
- package/src/support/apollo/apollo.ts +47 -49
- package/src/support/apollo/apolloClient.ts +18 -18
- package/src/support/apollo/index.ts +2 -2
- package/src/support/apollo/links.ts +38 -37
- package/src/support/commands.ts +1 -0
- package/src/support/fixture.ts +8 -8
- package/src/support/index.ts +5 -5
- package/src/support/login.ts +8 -10
- package/src/support/logout.ts +7 -8
- package/src/support/provisioning/executeGroovy.ts +3 -5
- package/src/support/provisioning/index.ts +3 -3
- package/src/support/provisioning/installBundle.ts +3 -5
- package/src/support/provisioning/runProvisioningScript.ts +34 -33
- package/src/support/registerSupport.ts +16 -16
- package/src/support/repeatUntil.ts +19 -19
- package/src/utils/Utils.ts +75 -0
- package/src/utils/index.ts +1 -0
- package/fixtures/graphql/jcr/addNode.graphql +0 -16
- /package/fixtures/graphql/jcr/{mutateNode.graphql → mutation/mutateNode.graphql} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2023 Jahia Forge - Code Repository
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
<a href="https://www.jahia.com/">
|
|
3
|
+
<img src="https://www.jahia.com/modules/jahiacom-templates/images/jahia-3x.png" alt="Jahia logo" title="Jahia" align="right" height="60" />
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
@jahia/cypress
|
|
7
|
+
======================
|
|
2
8
|
|
|
3
9
|
## Commands
|
|
4
10
|
|
|
@@ -94,3 +100,6 @@ module.exports = (on, config) => {
|
|
|
94
100
|
return config;
|
|
95
101
|
};
|
|
96
102
|
```
|
|
103
|
+
## Open-Source
|
|
104
|
+
|
|
105
|
+
This is an Open-Source codebase, you can find more details about Open-Source @ Jahia [in this repository](https://github.com/Jahia/open-source)
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="cypress" />
|
|
2
|
-
import { BaseComponent } from
|
|
2
|
+
import { BaseComponent } from '../baseComponent';
|
|
3
3
|
import TypeOptions = Cypress.TypeOptions;
|
|
4
4
|
export declare class MUIInput extends BaseComponent {
|
|
5
5
|
static defaultSelector: string;
|
|
@@ -25,7 +25,7 @@ var Menu = /** @class */ (function (_super) {
|
|
|
25
25
|
Menu.prototype.select = function (item) {
|
|
26
26
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
27
27
|
cy.wait(500);
|
|
28
|
-
this.get().find(
|
|
28
|
+
this.get().find('.moonstone-menuItem').should('contain', item).contains(item).trigger('click');
|
|
29
29
|
return this;
|
|
30
30
|
};
|
|
31
31
|
Menu.prototype.selectByRole = function (item) {
|
|
@@ -27,7 +27,7 @@ var PrimaryNav = /** @class */ (function (_super) {
|
|
|
27
27
|
};
|
|
28
28
|
PrimaryNav.prototype.listItems = function () {
|
|
29
29
|
return this.get().find('.moonstone-primaryNavItem').then(function (items) {
|
|
30
|
-
return Array.prototype.slice.call(items, 0).map(function (i) { return i.attributes
|
|
30
|
+
return Array.prototype.slice.call(items, 0).map(function (i) { return i.attributes.role ? i.attributes.role.value : null; }).filter(function (i) { return i !== null; });
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
PrimaryNav.defaultSelector = '.moonstone-primaryNav';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="cypress" />
|
|
2
|
-
import { BaseComponent } from
|
|
3
|
-
import { Menu } from
|
|
2
|
+
import { BaseComponent } from '../baseComponent';
|
|
3
|
+
import { Menu } from './menu';
|
|
4
4
|
export declare class Table extends BaseComponent {
|
|
5
5
|
static defaultSelector: string;
|
|
6
6
|
getRows(assertion?: (s: JQuery) => void): TableRow;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="cypress" />
|
|
2
|
-
import { Table } from
|
|
3
|
-
import { BaseComponent, ComponentType } from
|
|
2
|
+
import { Table } from './moonstone';
|
|
3
|
+
import { BaseComponent, ComponentType } from './baseComponent';
|
|
4
4
|
import Chainable = Cypress.Chainable;
|
|
5
5
|
export declare function getElement(selector: string, parent?: BaseComponent, assertion?: (s: JQuery) => void): Chainable<JQuery>;
|
|
6
6
|
export declare function getComponentBySelector<Component>(C: ComponentType<Component>, selector: string, parent?: BaseComponent, assertion?: (s: JQuery) => void): Component;
|
|
@@ -43,53 +43,51 @@ var apollo = function (apollo, options) {
|
|
|
43
43
|
}
|
|
44
44
|
var result;
|
|
45
45
|
var logger;
|
|
46
|
-
var optionsWithDefaultCache = __assign({ fetchPolicy:
|
|
46
|
+
var optionsWithDefaultCache = __assign({ fetchPolicy: 'no-cache' }, options);
|
|
47
47
|
if (!apollo) {
|
|
48
48
|
cy.apolloClient().apollo(optionsWithDefaultCache);
|
|
49
49
|
}
|
|
50
|
+
else if (isQueryFile(optionsWithDefaultCache)) {
|
|
51
|
+
var queryFile = optionsWithDefaultCache.queryFile, apolloOptions_1 = __rest(optionsWithDefaultCache, ["queryFile"]);
|
|
52
|
+
cy.fixture(queryFile).then(function (content) {
|
|
53
|
+
cy.apollo(__assign({ query: graphql_tag_1["default"](content) }, apolloOptions_1));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else if (isMutationFile(optionsWithDefaultCache)) {
|
|
57
|
+
var mutationFile = optionsWithDefaultCache.mutationFile, apolloOptions_2 = __rest(optionsWithDefaultCache, ["mutationFile"]);
|
|
58
|
+
cy.fixture(mutationFile).then(function (content) {
|
|
59
|
+
cy.apollo(__assign({ mutation: graphql_tag_1["default"](content) }, apolloOptions_2));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
50
62
|
else {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
var _a = optionsWithDefaultCache.log, log = _a === void 0 ? true : _a, apolloOptions_3 = __rest(optionsWithDefaultCache, ["log"]);
|
|
64
|
+
if (log) {
|
|
65
|
+
logger = Cypress.log({
|
|
66
|
+
autoEnd: false,
|
|
67
|
+
name: 'apollo',
|
|
68
|
+
displayName: 'apollo',
|
|
69
|
+
message: isQuery(apolloOptions_3) ? "Execute Graphql Query: " + apolloOptions_3.query.loc.source.body : "Execute Graphql Mutation: " + apolloOptions_3.mutation.loc.source.body,
|
|
70
|
+
consoleProps: function () {
|
|
71
|
+
return {
|
|
72
|
+
Options: apolloOptions_3,
|
|
73
|
+
Yielded: result
|
|
74
|
+
};
|
|
75
|
+
}
|
|
55
76
|
});
|
|
56
77
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
cy.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
message: isQuery(apolloOptions_3) ? "Execute Graphql Query: " + apolloOptions_3.query.loc.source.body : "Execute Graphql Mutation: " + apolloOptions_3.mutation.loc.source.body,
|
|
71
|
-
consoleProps: function () {
|
|
72
|
-
return {
|
|
73
|
-
Options: apolloOptions_3,
|
|
74
|
-
Yielded: result
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
cy.wrap({}, { log: false })
|
|
80
|
-
.then(function () { return (isQuery(optionsWithDefaultCache) ? apollo.query(optionsWithDefaultCache)["catch"](function (error) {
|
|
81
|
-
cy.log("Caught Graphql Query Error: " + JSON.stringify(error));
|
|
82
|
-
return error;
|
|
83
|
-
}) : apollo.mutate(optionsWithDefaultCache)["catch"](function (error) {
|
|
84
|
-
cy.log("Caught Graphql Mutation Error: " + JSON.stringify(error));
|
|
85
|
-
return error;
|
|
86
|
-
}))
|
|
87
|
-
.then(function (r) {
|
|
88
|
-
result = r;
|
|
89
|
-
logger === null || logger === void 0 ? void 0 : logger.end();
|
|
90
|
-
return r;
|
|
91
|
-
}); });
|
|
92
|
-
}
|
|
78
|
+
cy.wrap({}, { log: true })
|
|
79
|
+
.then(function () { return (isQuery(optionsWithDefaultCache) ? apollo.query(optionsWithDefaultCache)["catch"](function (error) {
|
|
80
|
+
cy.log("Caught Graphql Query Error: " + JSON.stringify(error));
|
|
81
|
+
return error;
|
|
82
|
+
}) : apollo.mutate(optionsWithDefaultCache)["catch"](function (error) {
|
|
83
|
+
cy.log("Caught Graphql Mutation Error: " + JSON.stringify(error));
|
|
84
|
+
return error;
|
|
85
|
+
}))
|
|
86
|
+
.then(function (r) {
|
|
87
|
+
result = r;
|
|
88
|
+
logger === null || logger === void 0 ? void 0 : logger.end();
|
|
89
|
+
return r;
|
|
90
|
+
}); });
|
|
93
91
|
}
|
|
94
92
|
};
|
|
95
93
|
exports.apollo = apollo;
|
|
@@ -33,7 +33,7 @@ var apolloClient = function (authMethod, options) {
|
|
|
33
33
|
Cypress.log({
|
|
34
34
|
name: 'apolloClient',
|
|
35
35
|
displayName: 'apClient',
|
|
36
|
-
message:
|
|
36
|
+
message: 'Create new apollo client',
|
|
37
37
|
consoleProps: function () {
|
|
38
38
|
return {
|
|
39
39
|
Auth: authMethod,
|
|
@@ -65,9 +65,7 @@ exports.uploadLink = context_1.setContext(function (operation, _a) {
|
|
|
65
65
|
fetchOptions: __assign(__assign({}, fetchOptions), { formData: formData })
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
}
|
|
68
|
+
return {
|
|
69
|
+
fetchOptions: __assign({}, fetchOptions)
|
|
70
|
+
};
|
|
73
71
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'cypress-wait-until';
|
package/dist/support/fixture.js
CHANGED
|
@@ -15,7 +15,7 @@ var fixture = function (originalCommand, fixture) {
|
|
|
15
15
|
return cy.wrap({}, { log: false }).then(function () {
|
|
16
16
|
return originalCommand.apply(void 0, __spreadArray([fixture], args)).then(function (f) {
|
|
17
17
|
return f;
|
|
18
|
-
})["catch"](function (
|
|
18
|
+
})["catch"](function () {
|
|
19
19
|
return null;
|
|
20
20
|
});
|
|
21
21
|
}).then(function (file) {
|
package/dist/support/logout.js
CHANGED
|
@@ -4,7 +4,9 @@ exports.runProvisioningScript = void 0;
|
|
|
4
4
|
function processContent(formFile) {
|
|
5
5
|
var content = formFile.fileContent;
|
|
6
6
|
if (formFile.replacements) {
|
|
7
|
-
Object.keys(formFile.replacements).forEach(function (k) {
|
|
7
|
+
Object.keys(formFile.replacements).forEach(function (k) {
|
|
8
|
+
content = content.replaceAll(k, formFile.replacements[k]);
|
|
9
|
+
});
|
|
8
10
|
}
|
|
9
11
|
formFile.fileContent = content;
|
|
10
12
|
return Cypress.Blob.binaryStringToBlob(content, formFile.type);
|
|
@@ -38,17 +40,17 @@ var runProvisioningScript = function (script, files, jahiaServer, options, timeo
|
|
|
38
40
|
if (options === void 0) { options = { log: true }; }
|
|
39
41
|
var formData = new FormData();
|
|
40
42
|
if (isFormFile(script)) {
|
|
41
|
-
append(script, formData,
|
|
43
|
+
append(script, formData, 'script');
|
|
42
44
|
}
|
|
43
45
|
else {
|
|
44
46
|
append({
|
|
45
47
|
fileContent: JSON.stringify(script),
|
|
46
48
|
type: 'application/json'
|
|
47
|
-
}, formData,
|
|
49
|
+
}, formData, 'script');
|
|
48
50
|
}
|
|
49
51
|
if (files) {
|
|
50
52
|
files.forEach(function (f) {
|
|
51
|
-
append(f, formData,
|
|
53
|
+
append(f, formData, 'file');
|
|
52
54
|
});
|
|
53
55
|
}
|
|
54
56
|
var response;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const setNodeProperty: (pathOrId: string, property: string, value: string, language: string) => Cypress.Chainable;
|
|
2
|
+
export declare const deleteNode: (pathOrId: string) => Cypress.Chainable;
|
|
3
|
+
export declare const grantRoles: (pathOrId: string, roleNames: Array<string>, principalName: string, principalType: string) => Cypress.Chainable;
|
|
4
|
+
export declare const waitAllJobsFinished: (errorMessage?: string, timeout?: number) => void;
|
|
5
|
+
export declare const addNode: (variables: {
|
|
6
|
+
parentPathOrId: string;
|
|
7
|
+
primaryNodeType: string;
|
|
8
|
+
name: string;
|
|
9
|
+
properties?: any[];
|
|
10
|
+
children?: any[];
|
|
11
|
+
}) => Cypress.Chainable;
|
|
12
|
+
export declare const getNodeByPath: (path: string) => Cypress.Chainable;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.getNodeByPath = exports.addNode = exports.waitAllJobsFinished = exports.grantRoles = exports.deleteNode = exports.setNodeProperty = void 0;
|
|
4
|
+
var setNodeProperty = function (pathOrId, property, value, language) {
|
|
5
|
+
return cy.apollo({
|
|
6
|
+
variables: {
|
|
7
|
+
pathOrId: pathOrId,
|
|
8
|
+
property: property,
|
|
9
|
+
value: value,
|
|
10
|
+
language: language
|
|
11
|
+
},
|
|
12
|
+
mutationFile: 'graphql/jcr/mutation/setProperty.graphql'
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
exports.setNodeProperty = setNodeProperty;
|
|
16
|
+
var deleteNode = function (pathOrId) {
|
|
17
|
+
return cy.apollo({
|
|
18
|
+
variables: {
|
|
19
|
+
pathOrId: pathOrId
|
|
20
|
+
},
|
|
21
|
+
mutationFile: 'graphql/jcr/mutation/deleteNode.graphql'
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
exports.deleteNode = deleteNode;
|
|
25
|
+
var grantRoles = function (pathOrId, roleNames, principalName, principalType) {
|
|
26
|
+
cy.log('Grant role(s) ' + roleNames + ' with principal type ' + principalType + ' to ' + principalName + ' on node ' + pathOrId);
|
|
27
|
+
return cy.apollo({
|
|
28
|
+
variables: {
|
|
29
|
+
pathOrId: pathOrId,
|
|
30
|
+
roleNames: roleNames,
|
|
31
|
+
principalName: principalName,
|
|
32
|
+
principalType: principalType
|
|
33
|
+
},
|
|
34
|
+
mutationFile: 'graphql/jcr/mutation/grantRoles.graphql'
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.grantRoles = grantRoles;
|
|
38
|
+
var waitAllJobsFinished = function (errorMessage, timeout) {
|
|
39
|
+
if (timeout === void 0) { timeout = 60000; }
|
|
40
|
+
cy.waitUntil(function () {
|
|
41
|
+
return cy
|
|
42
|
+
.apollo({
|
|
43
|
+
fetchPolicy: 'no-cache',
|
|
44
|
+
queryFile: 'graphql/jcr/query/getJobsWithStatus.graphql'
|
|
45
|
+
})
|
|
46
|
+
.then(function (response) {
|
|
47
|
+
var _a, _b, _c, _d;
|
|
48
|
+
var jobs = (_d = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.admin) === null || _b === void 0 ? void 0 : _b.jahia) === null || _c === void 0 ? void 0 : _c.scheduler) === null || _d === void 0 ? void 0 : _d.jobs;
|
|
49
|
+
var publicationJobs = jobs.filter(function (job) { return job.group === 'PublicationJob'; });
|
|
50
|
+
var hasActivePublicationJobs = publicationJobs.some(function (job) { return job.jobStatus === 'EXECUTING'; });
|
|
51
|
+
return !hasActivePublicationJobs;
|
|
52
|
+
});
|
|
53
|
+
}, {
|
|
54
|
+
errorMsg: errorMessage ? errorMessage : 'Jobs are still running before the end of timeout',
|
|
55
|
+
timeout: timeout,
|
|
56
|
+
verbose: true,
|
|
57
|
+
interval: 1000
|
|
58
|
+
});
|
|
59
|
+
// Wait 2 seconds for server sync after publication
|
|
60
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
61
|
+
cy.wait(2000);
|
|
62
|
+
};
|
|
63
|
+
exports.waitAllJobsFinished = waitAllJobsFinished;
|
|
64
|
+
var addNode = function (variables) {
|
|
65
|
+
return cy.apollo({
|
|
66
|
+
variables: variables,
|
|
67
|
+
mutationFile: 'graphql/jcr/mutation/addNode.graphql'
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
exports.addNode = addNode;
|
|
71
|
+
var getNodeByPath = function (path) {
|
|
72
|
+
return cy.apollo({
|
|
73
|
+
variables: {
|
|
74
|
+
path: path
|
|
75
|
+
},
|
|
76
|
+
queryFile: 'graphql/jcr/query/getNodeByPath.graphql'
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
exports.getNodeByPath = getNodeByPath;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Utils';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
exports.__esModule = true;
|
|
13
|
+
__exportStar(require("./Utils"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
mutation addNode($parentPathOrId: String!, $name: String!, $primaryNodeType: String!, $children: [InputJCRNode] = [], $properties: [InputJCRProperty]) {
|
|
2
|
+
jcr(workspace: EDIT) {
|
|
3
|
+
addNode(
|
|
4
|
+
parentPathOrId: $parentPathOrId,
|
|
5
|
+
name: $name,
|
|
6
|
+
primaryNodeType: $primaryNodeType,
|
|
7
|
+
properties: $properties,
|
|
8
|
+
) {
|
|
9
|
+
addChildrenBatch(nodes: $children){
|
|
10
|
+
uuid
|
|
11
|
+
}
|
|
12
|
+
uuid
|
|
13
|
+
node {
|
|
14
|
+
name
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
mutation grantRoles(
|
|
2
|
+
$pathOrId: String!
|
|
3
|
+
$roleNames: [String]!
|
|
4
|
+
$principalName: String!
|
|
5
|
+
$principalType: PrincipalType!
|
|
6
|
+
) {
|
|
7
|
+
jcr {
|
|
8
|
+
mutateNode(pathOrId: $pathOrId) {
|
|
9
|
+
grantRoles(
|
|
10
|
+
roleNames: $roleNames
|
|
11
|
+
principalType: $principalType
|
|
12
|
+
principalName: $principalName
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jahia/cypress",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "tsc",
|
|
6
6
|
"lint": "eslint src -c .eslintrc.json --ext .ts"
|
|
@@ -9,12 +9,17 @@
|
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"devDependencies": {
|
|
12
|
+
"@jahia/eslint-config": "^1.1.0",
|
|
12
13
|
"@typescript-eslint/eslint-plugin": "^4.29.3",
|
|
13
14
|
"@typescript-eslint/parser": "^4.29.3",
|
|
14
15
|
"cypress": "^12.2.0",
|
|
16
|
+
"cypress-wait-until": "^1.7.2",
|
|
15
17
|
"eslint": "^7.32.0",
|
|
16
18
|
"eslint-plugin-cypress": "^2.11.3",
|
|
17
19
|
"cross-fetch": "^3.1.5",
|
|
20
|
+
"eslint-plugin-jest": "^27.2.1",
|
|
21
|
+
"eslint-plugin-react": "^7.32.2",
|
|
22
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
18
23
|
"typescript": "^4.3.5"
|
|
19
24
|
},
|
|
20
25
|
"dependencies": {
|