@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.
Files changed (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -1
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +1 -0
  5. package/dist/page-object/html/iframe.d.ts +1 -1
  6. package/dist/page-object/material/muiinput.d.ts +1 -1
  7. package/dist/page-object/material/muiradio.d.ts +1 -1
  8. package/dist/page-object/moonstone/accordion.d.ts +1 -1
  9. package/dist/page-object/moonstone/button.d.ts +1 -1
  10. package/dist/page-object/moonstone/collapsible.d.ts +1 -1
  11. package/dist/page-object/moonstone/dropdown.d.ts +1 -1
  12. package/dist/page-object/moonstone/menu.d.ts +1 -1
  13. package/dist/page-object/moonstone/menu.js +1 -1
  14. package/dist/page-object/moonstone/pagination.d.ts +1 -1
  15. package/dist/page-object/moonstone/primaryNav.d.ts +1 -1
  16. package/dist/page-object/moonstone/primaryNav.js +1 -1
  17. package/dist/page-object/moonstone/secondaryNav.d.ts +1 -1
  18. package/dist/page-object/moonstone/table.d.ts +2 -2
  19. package/dist/page-object/utils.d.ts +2 -2
  20. package/dist/support/apollo/apollo.js +39 -41
  21. package/dist/support/apollo/apolloClient.js +1 -1
  22. package/dist/support/apollo/links.js +3 -5
  23. package/dist/support/commands.d.ts +1 -0
  24. package/dist/support/commands.js +3 -0
  25. package/dist/support/fixture.js +1 -1
  26. package/dist/support/logout.js +1 -1
  27. package/dist/support/provisioning/runProvisioningScript.js +6 -4
  28. package/dist/utils/Utils.d.ts +12 -0
  29. package/dist/utils/Utils.js +79 -0
  30. package/dist/utils/index.d.ts +1 -0
  31. package/dist/utils/index.js +13 -0
  32. package/fixtures/graphql/jcr/mutation/addNode.graphql +18 -0
  33. package/fixtures/graphql/jcr/{deleteNode.graphql → mutation/deleteNode.graphql} +1 -1
  34. package/fixtures/graphql/jcr/mutation/grantRoles.graphql +16 -0
  35. package/fixtures/graphql/jcr/mutation/setProperty.graphql +9 -0
  36. package/fixtures/graphql/jcr/query/getJobsWithStatus.graphql +13 -0
  37. package/fixtures/graphql/jcr/query/getNodeByPath.graphql +15 -0
  38. package/package.json +6 -1
  39. package/schema.graphql +941 -76
  40. package/src/custom.d.ts +1 -1
  41. package/src/index.ts +4 -3
  42. package/src/page-object/baseComponent.ts +7 -7
  43. package/src/page-object/basePage.ts +1 -1
  44. package/src/page-object/html/iframe.ts +12 -13
  45. package/src/page-object/html/index.ts +1 -1
  46. package/src/page-object/index.ts +6 -6
  47. package/src/page-object/material/index.ts +2 -2
  48. package/src/page-object/material/muiinput.ts +5 -7
  49. package/src/page-object/material/muiradio.ts +3 -5
  50. package/src/page-object/moonstone/accordion.ts +7 -8
  51. package/src/page-object/moonstone/button.ts +3 -5
  52. package/src/page-object/moonstone/collapsible.ts +9 -10
  53. package/src/page-object/moonstone/dropdown.ts +6 -8
  54. package/src/page-object/moonstone/index.ts +9 -9
  55. package/src/page-object/moonstone/menu.ts +8 -8
  56. package/src/page-object/moonstone/pagination.ts +8 -9
  57. package/src/page-object/moonstone/primaryNav.ts +5 -5
  58. package/src/page-object/moonstone/secondaryNav.ts +3 -3
  59. package/src/page-object/moonstone/table.ts +9 -10
  60. package/src/page-object/utils.ts +12 -10
  61. package/src/plugins/env.ts +13 -12
  62. package/src/plugins/index.ts +1 -1
  63. package/src/plugins/registerPlugins.ts +3 -3
  64. package/src/support/apollo/apollo.ts +47 -49
  65. package/src/support/apollo/apolloClient.ts +18 -18
  66. package/src/support/apollo/index.ts +2 -2
  67. package/src/support/apollo/links.ts +38 -37
  68. package/src/support/commands.ts +1 -0
  69. package/src/support/fixture.ts +8 -8
  70. package/src/support/index.ts +5 -5
  71. package/src/support/login.ts +8 -10
  72. package/src/support/logout.ts +7 -8
  73. package/src/support/provisioning/executeGroovy.ts +3 -5
  74. package/src/support/provisioning/index.ts +3 -3
  75. package/src/support/provisioning/installBundle.ts +3 -5
  76. package/src/support/provisioning/runProvisioningScript.ts +34 -33
  77. package/src/support/registerSupport.ts +16 -16
  78. package/src/support/repeatUntil.ts +19 -19
  79. package/src/utils/Utils.ts +75 -0
  80. package/src/utils/index.ts +1 -0
  81. package/fixtures/graphql/jcr/addNode.graphql +0 -16
  82. /package/fixtures/graphql/jcr/{mutateNode.graphql → mutation/mutateNode.graphql} +0 -0
@@ -0,0 +1,75 @@
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
+ };
@@ -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
- }