@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
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
- # @jahia/cypress
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
@@ -1,3 +1,4 @@
1
1
  export * from './page-object';
2
2
  export * from './plugins';
3
3
  export * from './support';
4
+ export * from './utils';
package/dist/index.js CHANGED
@@ -13,3 +13,4 @@ exports.__esModule = true;
13
13
  __exportStar(require("./page-object"), exports);
14
14
  __exportStar(require("./plugins"), exports);
15
15
  __exportStar(require("./support"), exports);
16
+ __exportStar(require("./utils"), exports);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="cypress" />
2
- import { BaseComponent } from "../baseComponent";
2
+ import { BaseComponent } from '../baseComponent';
3
3
  import Chainable = Cypress.Chainable;
4
4
  export declare class IFrame extends BaseComponent {
5
5
  static defaultSelector: string;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="cypress" />
2
- import { BaseComponent } from "../baseComponent";
2
+ import { BaseComponent } from '../baseComponent';
3
3
  import TypeOptions = Cypress.TypeOptions;
4
4
  export declare class MUIInput extends BaseComponent {
5
5
  static defaultSelector: string;
@@ -1,4 +1,4 @@
1
- import { BaseComponent } from "../baseComponent";
1
+ import { BaseComponent } from '../baseComponent';
2
2
  export declare class MUIRadio extends BaseComponent {
3
3
  static defaultSelector: string;
4
4
  click(): MUIRadio;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="cypress" />
2
- import { BaseComponent } from "../baseComponent";
2
+ import { BaseComponent } from '../baseComponent';
3
3
  import Chainable = Cypress.Chainable;
4
4
  export declare class Accordion extends BaseComponent {
5
5
  static defaultSelector: string;
@@ -1,4 +1,4 @@
1
- import { BaseComponent } from "../baseComponent";
1
+ import { BaseComponent } from '../baseComponent';
2
2
  export declare class Button extends BaseComponent {
3
3
  static defaultSelector: string;
4
4
  click(): Button;
@@ -1,4 +1,4 @@
1
- import { BaseComponent } from "../baseComponent";
1
+ import { BaseComponent } from '../baseComponent';
2
2
  export declare class Collapsible extends BaseComponent {
3
3
  static defaultSelector: string;
4
4
  collapse(): Collapsible;
@@ -1,4 +1,4 @@
1
- import { BaseComponent } from "../baseComponent";
1
+ import { BaseComponent } from '../baseComponent';
2
2
  export declare class Dropdown extends BaseComponent {
3
3
  static defaultSelector: string;
4
4
  select(item: string): Dropdown;
@@ -1,4 +1,4 @@
1
- import { BaseComponent } from "../baseComponent";
1
+ import { BaseComponent } from '../baseComponent';
2
2
  export declare class Menu extends BaseComponent {
3
3
  static defaultSelector: string;
4
4
  select(item: string): Menu;
@@ -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(".moonstone-menuItem").should("contain", item).contains(item).trigger('click');
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) {
@@ -1,4 +1,4 @@
1
- import { BaseComponent } from "../baseComponent";
1
+ import { BaseComponent } from '../baseComponent';
2
2
  import Chainable = Cypress.Chainable;
3
3
  export declare class Pagination extends BaseComponent {
4
4
  static defaultSelector: string;
@@ -1,4 +1,4 @@
1
- import { BaseComponent } from "../baseComponent";
1
+ import { BaseComponent } from '../baseComponent';
2
2
  import Chainable = Cypress.Chainable;
3
3
  export declare class PrimaryNav extends BaseComponent {
4
4
  static defaultSelector: string;
@@ -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['role'] ? i.attributes['role'].value : null; }).filter(function (i) { return i !== null; });
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,4 +1,4 @@
1
- import { BaseComponent } from "../baseComponent";
1
+ import { BaseComponent } from '../baseComponent';
2
2
  export declare class SecondaryNav extends BaseComponent {
3
3
  static defaultSelector: string;
4
4
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="cypress" />
2
- import { BaseComponent } from "../baseComponent";
3
- import { Menu } from "./menu";
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 "./moonstone";
3
- import { BaseComponent, ComponentType } from "./baseComponent";
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: "no-cache" }, options);
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
- if (isQueryFile(optionsWithDefaultCache)) {
52
- var queryFile = optionsWithDefaultCache.queryFile, apolloOptions_1 = __rest(optionsWithDefaultCache, ["queryFile"]);
53
- cy.fixture(queryFile).then(function (content) {
54
- cy.apollo(__assign({ query: graphql_tag_1["default"](content) }, apolloOptions_1));
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
- else if (isMutationFile(optionsWithDefaultCache)) {
58
- var mutationFile = optionsWithDefaultCache.mutationFile, apolloOptions_2 = __rest(optionsWithDefaultCache, ["mutationFile"]);
59
- cy.fixture(mutationFile).then(function (content) {
60
- cy.apollo(__assign({ mutation: graphql_tag_1["default"](content) }, apolloOptions_2));
61
- });
62
- }
63
- else {
64
- var _a = optionsWithDefaultCache.log, log = _a === void 0 ? true : _a, apolloOptions_3 = __rest(optionsWithDefaultCache, ["log"]);
65
- if (log) {
66
- logger = Cypress.log({
67
- autoEnd: false,
68
- name: 'apollo',
69
- displayName: 'apollo',
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: "Create new apollo client",
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
- else {
69
- return {
70
- fetchOptions: __assign({}, fetchOptions)
71
- };
72
- }
68
+ return {
69
+ fetchOptions: __assign({}, fetchOptions)
70
+ };
73
71
  });
@@ -0,0 +1 @@
1
+ import 'cypress-wait-until';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ require("cypress-wait-until");
@@ -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 (err) {
18
+ })["catch"](function () {
19
19
  return null;
20
20
  });
21
21
  }).then(function (file) {
@@ -6,7 +6,7 @@ exports.logout = void 0;
6
6
  var logout = function () {
7
7
  Cypress.log({
8
8
  name: 'logout',
9
- message: "Logout",
9
+ message: 'Logout',
10
10
  consoleProps: function () {
11
11
  return {};
12
12
  }
@@ -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) { return content = content.replaceAll(k, formFile.replacements[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, "script");
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, "script");
49
+ }, formData, 'script');
48
50
  }
49
51
  if (files) {
50
52
  files.forEach(function (f) {
51
- append(f, formData, "file");
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
+ }
@@ -1,4 +1,4 @@
1
- mutation($pathOrId: String!) {
1
+ mutation deleteNode($pathOrId: String!) {
2
2
  jcr(workspace: EDIT) {
3
3
  deleteNode(pathOrId: $pathOrId)
4
4
  }
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ mutation setProperty($pathOrId: String!, $property: String!, $value: String!, $language: String!){
2
+ jcr{
3
+ mutateNode(pathOrId: $pathOrId){
4
+ mutateProperty(name: $property){
5
+ setValue(value: $value, language: $language)
6
+ }
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,13 @@
1
+ query getJobsWithStatus{
2
+ admin {
3
+ jahia {
4
+ scheduler{
5
+ jobs {
6
+ siteKey
7
+ group
8
+ jobStatus
9
+ }
10
+ }
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ query getNodeByPath($path: String!, $properties: [String]=[]) {
2
+ jcr {
3
+ nodeByPath(path: $path) {
4
+ uuid
5
+ name
6
+ properties(names: $properties){
7
+ name
8
+ value
9
+ }
10
+ primaryNodeType {
11
+ name
12
+ }
13
+ }
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/cypress",
3
- "version": "2.0.0",
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": {