@jahia/cypress 2.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/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 +13 -0
- package/dist/utils/Utils.js +90 -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/fixtures/groovy/admin/createSite.groovy +14 -3
- 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 +86 -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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export const setNodeProperty = (pathOrId: string, property: string, value: string, language: string): Cypress.Chainable => {
|
|
2
|
+
return cy.apollo({
|
|
3
|
+
variables: {
|
|
4
|
+
pathOrId: pathOrId,
|
|
5
|
+
property: property,
|
|
6
|
+
value: value,
|
|
7
|
+
language: language
|
|
8
|
+
},
|
|
9
|
+
mutationFile: 'graphql/jcr/mutation/setProperty.graphql'
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const deleteNode = (pathOrId: string): Cypress.Chainable => {
|
|
14
|
+
return cy.apollo({
|
|
15
|
+
variables: {
|
|
16
|
+
pathOrId: pathOrId
|
|
17
|
+
},
|
|
18
|
+
mutationFile: 'graphql/jcr/mutation/deleteNode.graphql'
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const grantRoles = (pathOrId: string, roleNames: Array<string>, principalName: string, principalType: string): Cypress.Chainable => {
|
|
23
|
+
cy.log('Grant role(s) ' + roleNames + ' with principal type ' + principalType + ' to ' + principalName + ' on node ' + pathOrId);
|
|
24
|
+
return cy.apollo({
|
|
25
|
+
variables: {
|
|
26
|
+
pathOrId: pathOrId,
|
|
27
|
+
roleNames: roleNames,
|
|
28
|
+
principalName: principalName,
|
|
29
|
+
principalType: principalType
|
|
30
|
+
},
|
|
31
|
+
mutationFile: 'graphql/jcr/mutation/grantRoles.graphql'
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const waitAllJobsFinished = (errorMessage?: string, timeout = 60000): void => {
|
|
36
|
+
cy.waitUntil(
|
|
37
|
+
() =>
|
|
38
|
+
cy
|
|
39
|
+
.apollo({
|
|
40
|
+
fetchPolicy: 'no-cache',
|
|
41
|
+
queryFile: 'graphql/jcr/query/getJobsWithStatus.graphql'
|
|
42
|
+
})
|
|
43
|
+
.then(response => {
|
|
44
|
+
const jobs = response?.data?.admin?.jahia?.scheduler?.jobs;
|
|
45
|
+
const publicationJobs = jobs.filter(job => job.group === 'PublicationJob');
|
|
46
|
+
const hasActivePublicationJobs = publicationJobs.some(job => job.jobStatus === 'EXECUTING');
|
|
47
|
+
return !hasActivePublicationJobs;
|
|
48
|
+
}),
|
|
49
|
+
{
|
|
50
|
+
errorMsg: errorMessage ? errorMessage : 'Jobs are still running before the end of timeout',
|
|
51
|
+
timeout: timeout,
|
|
52
|
+
verbose: true,
|
|
53
|
+
interval: 1000
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
// Wait 2 seconds for server sync after publication
|
|
57
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
58
|
+
cy.wait(2000);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const addNode = (variables: {parentPathOrId: string, primaryNodeType: string, name: string, properties?: any[], children?: any[]}): Cypress.Chainable => {
|
|
62
|
+
return cy.apollo({
|
|
63
|
+
variables: variables,
|
|
64
|
+
mutationFile: 'graphql/jcr/mutation/addNode.graphql'
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const getNodeByPath = (path: string): Cypress.Chainable => {
|
|
69
|
+
return cy.apollo({
|
|
70
|
+
variables: {
|
|
71
|
+
path: path
|
|
72
|
+
},
|
|
73
|
+
queryFile: 'graphql/jcr/query/getNodeByPath.graphql'
|
|
74
|
+
});
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Utils';
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|
|
File without changes
|