@jahia/cypress 7.4.0 → 8.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +69 -2
  3. package/dist/index.js +6 -2
  4. package/dist/injections/bash-data.d.ts +1 -0
  5. package/dist/injections/bash-data.js +57 -0
  6. package/dist/injections/chars-data.d.ts +1 -0
  7. package/dist/injections/chars-data.js +25 -0
  8. package/dist/injections/htmlentities-data.d.ts +1 -0
  9. package/dist/injections/htmlentities-data.js +22 -0
  10. package/dist/injections/numbers-data.d.ts +1 -0
  11. package/dist/injections/numbers-data.js +66 -0
  12. package/dist/injections/sql-data.d.ts +1 -0
  13. package/dist/injections/sql-data.js +82 -0
  14. package/dist/injections/xss-data.d.ts +1 -0
  15. package/dist/injections/xss-data.js +740 -0
  16. package/dist/page-object/baseComponent.d.ts +1 -2
  17. package/dist/page-object/baseComponent.js +10 -6
  18. package/dist/page-object/basePage.js +1 -1
  19. package/dist/page-object/html/iframe.d.ts +0 -1
  20. package/dist/page-object/html/iframe.js +2 -2
  21. package/dist/page-object/html/index.js +6 -2
  22. package/dist/page-object/index.js +6 -2
  23. package/dist/page-object/material/index.js +6 -2
  24. package/dist/page-object/material/muiinput.d.ts +0 -1
  25. package/dist/page-object/material/muiinput.js +1 -1
  26. package/dist/page-object/material/muiradio.js +1 -1
  27. package/dist/page-object/moonstone/accordion.d.ts +0 -1
  28. package/dist/page-object/moonstone/accordion.js +2 -2
  29. package/dist/page-object/moonstone/button.js +1 -1
  30. package/dist/page-object/moonstone/collapsible.js +1 -1
  31. package/dist/page-object/moonstone/dropdown.js +2 -2
  32. package/dist/page-object/moonstone/index.js +6 -2
  33. package/dist/page-object/moonstone/menu.js +9 -9
  34. package/dist/page-object/moonstone/pagination.js +3 -3
  35. package/dist/page-object/moonstone/primaryNav.js +2 -2
  36. package/dist/page-object/moonstone/secondaryNav.js +1 -1
  37. package/dist/page-object/moonstone/table.d.ts +0 -1
  38. package/dist/page-object/moonstone/table.js +5 -5
  39. package/dist/page-object/utils.d.ts +0 -1
  40. package/dist/page-object/utils.js +11 -12
  41. package/dist/plugins/env.js +2 -2
  42. package/dist/plugins/index.js +6 -2
  43. package/dist/plugins/registerPlugins.js +2 -2
  44. package/dist/support/apollo/apollo.d.ts +5 -4
  45. package/dist/support/apollo/apollo.js +80 -18
  46. package/dist/support/apollo/apolloClient.d.ts +1 -2
  47. package/dist/support/apollo/apolloClient.js +7 -7
  48. package/dist/support/apollo/index.js +6 -2
  49. package/dist/support/apollo/links.d.ts +1 -1
  50. package/dist/support/apollo/links.js +5 -6
  51. package/dist/support/browserHelper.d.ts +10 -0
  52. package/dist/support/browserHelper.js +167 -0
  53. package/dist/support/commands.js +1 -1
  54. package/dist/support/fixture.d.ts +1 -1
  55. package/dist/support/fixture.js +11 -7
  56. package/dist/support/index.d.ts +3 -0
  57. package/dist/support/index.js +9 -2
  58. package/dist/support/jfaker.d.ts +60 -0
  59. package/dist/support/jfaker.js +241 -0
  60. package/dist/support/jsErrorsLogger.js +13 -9
  61. package/dist/support/login.d.ts +0 -1
  62. package/dist/support/login.js +2 -2
  63. package/dist/support/logout.d.ts +0 -1
  64. package/dist/support/logout.js +1 -1
  65. package/dist/support/modSince.d.ts +52 -0
  66. package/dist/support/modSince.js +180 -0
  67. package/dist/support/provisioning/executeGroovy.d.ts +1 -1
  68. package/dist/support/provisioning/executeGroovy.js +42 -3
  69. package/dist/support/provisioning/index.js +6 -2
  70. package/dist/support/provisioning/installConfig.d.ts +0 -1
  71. package/dist/support/provisioning/installConfig.js +3 -3
  72. package/dist/support/provisioning/installModule.d.ts +0 -1
  73. package/dist/support/provisioning/installModule.js +1 -1
  74. package/dist/support/provisioning/runProvisioningScript.d.ts +4 -5
  75. package/dist/support/provisioning/runProvisioningScript.js +86 -9
  76. package/dist/support/provisioning/uninstallModule.d.ts +0 -1
  77. package/dist/support/provisioning/uninstallModule.js +1 -1
  78. package/dist/support/registerSupport.js +35 -1
  79. package/dist/support/repeatUntil.d.ts +1 -2
  80. package/dist/support/repeatUntil.js +2 -2
  81. package/dist/support/testStep.js +2 -2
  82. package/dist/utils/ClusterHelper.js +1 -1
  83. package/dist/utils/ExportHelper.d.ts +2 -2
  84. package/dist/utils/ExportHelper.js +14 -10
  85. package/dist/utils/GraphQLHelper.js +21 -17
  86. package/dist/utils/JCRHelper.d.ts +1 -1
  87. package/dist/utils/JCRHelper.js +1 -1
  88. package/dist/utils/JahiaPlatformHelper.js +2 -2
  89. package/dist/utils/Logger.js +6 -6
  90. package/dist/utils/PublicationAndWorkflowHelper.js +3 -3
  91. package/dist/utils/SAMHelper.d.ts +1 -1
  92. package/dist/utils/SAMHelper.js +4 -4
  93. package/dist/utils/SiteHelper.js +2 -2
  94. package/dist/utils/UsersHelper.js +2 -2
  95. package/dist/utils/VanityUrlHelper.js +1 -1
  96. package/dist/utils/index.js +6 -2
  97. package/docs/browser-helper.md +158 -0
  98. package/docs/jfaker.md +450 -0
  99. package/package.json +13 -10
  100. package/src/injections/bash-data.ts +54 -0
  101. package/src/injections/chars-data.ts +22 -0
  102. package/src/injections/htmlentities-data.ts +19 -0
  103. package/src/injections/numbers-data.ts +63 -0
  104. package/src/injections/sql-data.ts +79 -0
  105. package/src/injections/xss-data.ts +737 -0
  106. package/src/page-object/baseComponent.ts +6 -6
  107. package/src/page-object/html/iframe.ts +3 -3
  108. package/src/page-object/material/muiinput.ts +1 -1
  109. package/src/page-object/material/muiradio.ts +1 -1
  110. package/src/page-object/moonstone/accordion.ts +1 -1
  111. package/src/page-object/moonstone/button.ts +1 -1
  112. package/src/page-object/moonstone/collapsible.ts +1 -1
  113. package/src/page-object/moonstone/dropdown.ts +1 -1
  114. package/src/page-object/moonstone/menu.ts +1 -1
  115. package/src/page-object/moonstone/pagination.ts +1 -1
  116. package/src/page-object/moonstone/primaryNav.ts +1 -1
  117. package/src/page-object/moonstone/secondaryNav.ts +1 -1
  118. package/src/page-object/moonstone/table.ts +2 -2
  119. package/src/support/apollo/apollo.ts +74 -11
  120. package/src/support/apollo/links.ts +1 -2
  121. package/src/support/browserHelper.ts +186 -0
  122. package/src/support/index.ts +3 -0
  123. package/src/support/jfaker.ts +245 -0
  124. package/src/support/modSince.ts +222 -0
  125. package/src/support/provisioning/executeGroovy.md +7 -1
  126. package/src/support/provisioning/executeGroovy.ts +46 -2
  127. package/src/support/provisioning/runProvisioningScript.ts +89 -12
  128. package/src/support/registerSupport.ts +29 -0
  129. package/tests/cypress/e2e/jfaker.spec.ts +411 -0
  130. package/tests/cypress/e2e/modSince.spec.ts +306 -0
  131. package/tests/cypress.config.ts +23 -0
  132. package/tests/package.json +41 -0
  133. package/tests/reporter-config.json +13 -0
  134. package/tests/yarn.lock +8578 -0
  135. package/tsconfig.json +3 -0
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.installConfig = void 0;
5
5
  /// <reference types="cypress" />
6
6
  var installConfig = function (configFile) {
7
7
  cy.runProvisioningScript({
8
- script: { fileContent: "- installConfiguration: \"" + configFile + "\"", type: 'application/yaml' },
8
+ script: { fileContent: "- installConfiguration: \"".concat(configFile, "\""), type: 'application/yaml' },
9
9
  files: [{
10
- fileName: "" + configFile,
10
+ fileName: "".concat(configFile),
11
11
  type: 'text/plain'
12
12
  }]
13
13
  });
@@ -1,4 +1,3 @@
1
- /// <reference types="cypress" />
2
1
  declare global {
3
2
  namespace Cypress {
4
3
  interface Chainable<Subject> {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.installAndStartModule = exports.installModule = void 0;
5
5
  /// <reference types="cypress" />
6
6
  var installModule = function (moduleFile) {
@@ -1,4 +1,3 @@
1
- /// <reference types="cypress" />
2
1
  import RequestOptions = Cypress.RequestOptions;
3
2
  declare global {
4
3
  namespace Cypress {
@@ -15,19 +14,19 @@ export interface RunProvisioningScriptParams {
15
14
  options?: Cypress.Loggable;
16
15
  requestOptions?: Partial<RequestOptions>;
17
16
  }
18
- export declare type StringDictionary = {
17
+ export type StringDictionary = {
19
18
  [key: string]: string;
20
19
  };
21
- export declare type FormFile = {
20
+ export type FormFile = {
22
21
  fileName?: string;
23
22
  fileContent?: string;
24
23
  type?: string;
25
24
  encoding?: Cypress.Encodings;
26
25
  replacements?: StringDictionary;
27
26
  };
28
- export declare type JahiaServer = {
27
+ export type JahiaServer = {
29
28
  url: string;
30
29
  username: string;
31
30
  password: string;
32
31
  };
33
- export declare const runProvisioningScript: ({ script, files, jahiaServer, options, requestOptions }: RunProvisioningScriptParams) => void;
32
+ export declare const runProvisioningScript: (paramsOrScript: RunProvisioningScriptParams | FormFile | StringDictionary[], ...rest: any[]) => void;
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.runProvisioningScript = void 0;
15
15
  function processContent(formFile) {
16
16
  var content = formFile.fileContent;
@@ -52,10 +52,71 @@ var serverDefaults = {
52
52
  password: Cypress.env('SUPER_USER_PASSWORD')
53
53
  };
54
54
  function isFormFile(script) {
55
- return Boolean(script.fileContent || script.fileName);
55
+ return Boolean((script === null || script === void 0 ? void 0 : script.fileContent) || (script === null || script === void 0 ? void 0 : script.fileName));
56
56
  }
57
- var runProvisioningScript = function (_a) {
58
- var script = _a.script, files = _a.files, _b = _a.jahiaServer, jahiaServer = _b === void 0 ? serverDefaults : _b, _c = _a.options, options = _c === void 0 ? { log: true } : _c, _d = _a.requestOptions, requestOptions = _d === void 0 ? {} : _d;
57
+ function getScriptSummary(script) {
58
+ if (isFormFile(script)) {
59
+ if (script.fileName) {
60
+ return script.fileName;
61
+ }
62
+ if (script.fileContent) {
63
+ // Parse first operation and its value from YAML list: "- operationName: value"
64
+ var yamlMatch = script.fileContent.match(/^\s*-\s+(\w+)\s*:\s*"?([^"\n]+)"?/m);
65
+ if (yamlMatch) {
66
+ return "".concat(yamlMatch[1], ": ").concat(yamlMatch[2].trim());
67
+ }
68
+ // Parse first operation name from JSON array: [{"operationName": ...}]
69
+ try {
70
+ var parsed = JSON.parse(script.fileContent);
71
+ if (Array.isArray(parsed) && parsed.length > 0) {
72
+ var ops_1 = parsed.map(function (op) { var _a; return (_a = Object.keys(op)[0]) !== null && _a !== void 0 ? _a : 'unknown'; });
73
+ return ops_1.length === 1 ? ops_1[0] : "[".concat(ops_1.join(', '), "]");
74
+ }
75
+ }
76
+ catch (_a) {
77
+ // Not valid JSON, fall through
78
+ }
79
+ }
80
+ return 'inline script';
81
+ }
82
+ if (!script || script.length === 0) {
83
+ return 'empty script';
84
+ }
85
+ var ops = script.map(function (op) { var _a; return (_a = Object.keys(op)[0]) !== null && _a !== void 0 ? _a : 'unknown'; });
86
+ return ops.length === 1 ? ops[0] : "[".concat(ops.join(', '), "]");
87
+ }
88
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
+ var runProvisioningScript = function (paramsOrScript) {
90
+ var _a, _b, _c, _d, _e;
91
+ var rest = [];
92
+ for (var _i = 1; _i < arguments.length; _i++) {
93
+ rest[_i - 1] = arguments[_i];
94
+ }
95
+ // Backward-compatible: support old positional signature
96
+ // runProvisioningScript(script, files, jahiaServer, options, timeout)
97
+ var script;
98
+ var files;
99
+ var jahiaServer;
100
+ var options;
101
+ var requestOptions;
102
+ var isLegacyCall = Array.isArray(paramsOrScript) ||
103
+ paramsOrScript.fileContent !== undefined ||
104
+ paramsOrScript.fileName !== undefined;
105
+ if (isLegacyCall) {
106
+ script = paramsOrScript;
107
+ files = rest[0];
108
+ jahiaServer = (_a = rest[1]) !== null && _a !== void 0 ? _a : serverDefaults;
109
+ options = (_b = rest[2]) !== null && _b !== void 0 ? _b : { log: true };
110
+ requestOptions = {};
111
+ }
112
+ else {
113
+ var params = paramsOrScript;
114
+ script = params.script;
115
+ files = params.files;
116
+ jahiaServer = (_c = params.jahiaServer) !== null && _c !== void 0 ? _c : serverDefaults;
117
+ options = (_d = params.options) !== null && _d !== void 0 ? _d : { log: true };
118
+ requestOptions = (_e = params.requestOptions) !== null && _e !== void 0 ? _e : {};
119
+ }
59
120
  var formData = new FormData();
60
121
  if (isFormFile(script)) {
61
122
  append(script, formData, 'script');
@@ -76,23 +137,33 @@ var runProvisioningScript = function (_a) {
76
137
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
138
  var result;
78
139
  var logger;
140
+ var scriptSummary = getScriptSummary(script);
141
+ var replacementsFromFiles = files === null || files === void 0 ? void 0 : files.filter(function (f) { return f.replacements && Object.keys(f.replacements).length > 0; }).map(function (f) { return "".concat(f.fileName, ": ").concat(JSON.stringify(f.replacements)); });
79
142
  if (options.log) {
80
143
  logger = Cypress.log({
81
144
  autoEnd: false,
82
145
  name: 'runProvisioningScript',
83
146
  displayName: 'provScript',
84
- message: "Run " + (isFormFile(script) && script.fileName ? script.fileName : 'inline script') + " towards server: " + jahiaServer.url,
147
+ message: "".concat(scriptSummary, " @ ").concat(jahiaServer.url),
85
148
  consoleProps: function () {
149
+ var _a;
86
150
  return {
87
151
  Script: script,
88
- Files: files,
89
- Response: response,
90
- Yielded: result
152
+ Operations: isFormFile(script) ?
153
+ undefined :
154
+ script === null || script === void 0 ? void 0 : script.map(function (op) { return "".concat(Object.keys(op)[0], ": ").concat(Object.values(op)[0]); }),
155
+ Files: (_a = files === null || files === void 0 ? void 0 : files.map(function (f) { var _a; return (_a = f.fileName) !== null && _a !== void 0 ? _a : 'inline file'; })) !== null && _a !== void 0 ? _a : [],
156
+ Replacements: (replacementsFromFiles === null || replacementsFromFiles === void 0 ? void 0 : replacementsFromFiles.length) > 0 ? replacementsFromFiles : undefined,
157
+ Server: jahiaServer.url,
158
+ 'HTTP Status': response ? "".concat(response.status, " ").concat(response.statusText) : 'pending',
159
+ Duration: response ? "".concat(response.duration, "ms") : 'pending',
160
+ Result: result,
161
+ Response: response
91
162
  };
92
163
  }
93
164
  });
94
165
  }
95
- var request = __assign({ url: jahiaServer.url + "/modules/api/provisioning", method: 'POST', auth: {
166
+ var request = __assign({ url: "".concat(jahiaServer.url, "/modules/api/provisioning"), method: 'POST', auth: {
96
167
  user: jahiaServer.username,
97
168
  pass: jahiaServer.password,
98
169
  sendImmediately: true
@@ -113,6 +184,12 @@ var runProvisioningScript = function (_a) {
113
184
  result = res;
114
185
  }
115
186
  logger === null || logger === void 0 ? void 0 : logger.end();
187
+ if (logger) {
188
+ var hasFailed = res.status !== 200 ||
189
+ (Array.isArray(result) && result.some(function (r) { return typeof r === 'string' && r.includes('.failed'); })); // eslint-disable-line @typescript-eslint/no-explicit-any
190
+ var prefix = hasFailed ? '❌ ' : '✅ ';
191
+ logger.set('message', "".concat(prefix).concat(scriptSummary, " @ ").concat(jahiaServer.url));
192
+ }
116
193
  return result;
117
194
  });
118
195
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="cypress" />
2
1
  declare global {
3
2
  namespace Cypress {
4
3
  interface Chainable<Subject> {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-namespace */
3
- exports.__esModule = true;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.uninstallModule = void 0;
5
5
  /// <reference types="cypress" />
6
6
  var uninstallModule = function (moduleSymbolicName) {
@@ -1,5 +1,16 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.registerSupport = void 0;
4
15
  var apollo_1 = require("./apollo");
5
16
  var provisioning_1 = require("./provisioning");
@@ -8,6 +19,8 @@ var logout_1 = require("./logout");
8
19
  var fixture_1 = require("./fixture");
9
20
  var repeatUntil_1 = require("./repeatUntil");
10
21
  var testStep_1 = require("./testStep");
22
+ var jfaker_1 = require("./jfaker");
23
+ var modSince_1 = require("./modSince");
11
24
  var registerSupport = function () {
12
25
  Cypress.Commands.add('apolloClient', apollo_1.apolloClient);
13
26
  Cypress.Commands.add('apollo', { prevSubject: 'optional' }, apollo_1.apollo);
@@ -22,5 +35,26 @@ var registerSupport = function () {
22
35
  Cypress.Commands.add('repeatUntil', repeatUntil_1.repeatUntil);
23
36
  Cypress.Commands.overwrite('fixture', fixture_1.fixture);
24
37
  Cypress.Commands.add('step', testStep_1.step);
38
+ // Register it.since()/describe.since()
39
+ modSince_1.modSince.enable();
40
+ /**
41
+ * Override Cypress `type()` command to interpret special characters (e.g., {, }, etc.) either literally or as commands.
42
+ * The behavior is controlled by the `parseSpecialCharSequences` option, which can be set to `true`
43
+ * to enable command parsing or `false` to treat special characters as literal input.
44
+ *
45
+ * Since Cypress `clear()` command is an alias for `.type('{selectall}{del}')`,
46
+ * such case has to be handled to ensure that the special character sequences are properly interpreted when clearing the input.
47
+ * Also cover older Cypress versions which were using {backspace} was used instead of {del} .
48
+ */
49
+ Cypress.Commands.overwrite('type', function (originalFn, element, text, options) {
50
+ if (options === void 0) { options = {}; }
51
+ // Check if this is Cypress `.clear() call
52
+ var isCypressClearSequence = ['{selectall}{del}', '{selectall}{backspace}'].includes(text.toString());
53
+ // Do not override if this is `.clear()` call or data type is `faker`
54
+ var parseSpecialCharSequences = isCypressClearSequence || jfaker_1.jfaker.getDataType() === 'faker';
55
+ // Merge options with passed ones (if any)
56
+ var newOptions = __assign({ parseSpecialCharSequences: parseSpecialCharSequences }, options);
57
+ return originalFn(element, text, newOptions);
58
+ });
25
59
  };
26
60
  exports.registerSupport = registerSupport;
@@ -1,5 +1,4 @@
1
- /// <reference types="cypress" />
2
- export declare type RepeatUntilOptions = {
1
+ export type RepeatUntilOptions = {
3
2
  attempts: number;
4
3
  callback: () => void;
5
4
  delay: number;
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  return __assign.apply(this, arguments);
13
13
  };
14
- exports.__esModule = true;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.repeatUntil = void 0;
16
16
  var defaultOptions = {
17
17
  attempts: 10,
@@ -23,7 +23,7 @@ var repeatUntil = function (selector, options) {
23
23
  options = __assign(__assign({}, defaultOptions), options);
24
24
  var log = Cypress.log({
25
25
  name: 'repeatUntil',
26
- message: "Reload until " + selector + ", remaining attempts : " + options.attempts,
26
+ message: "Reload until ".concat(selector, ", remaining attempts : ").concat(options.attempts),
27
27
  consoleProps: function () {
28
28
  return {
29
29
  attempts: options.attempts
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.step = void 0;
4
4
  var step = function (message, func) {
5
5
  cy.then(function () {
6
6
  // @ts-ignore
7
- Cypress.log({ groupStart: true, displayName: '[ STEP ]', message: "" + message });
7
+ Cypress.log({ groupStart: true, displayName: '[ STEP ]', message: "".concat(message) });
8
8
  }).then(function () {
9
9
  func();
10
10
  }).then(function () {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.waitUntilJournalSync = void 0;
4
4
  var waitUntilJournalSync = function (predicate, timeout, interval) {
5
5
  if (timeout === void 0) { timeout = 60000; }
@@ -1,5 +1,5 @@
1
1
  import { JahiaServer } from '../support';
2
- export declare type ExportParameters = {
2
+ export type ExportParameters = {
3
3
  viewContent?: boolean;
4
4
  viewVersion?: boolean;
5
5
  viewAcl?: boolean;
@@ -16,7 +16,7 @@ export declare type ExportParameters = {
16
16
  cleanup?: 'template' | 'simple';
17
17
  filesToZip?: string;
18
18
  };
19
- declare type ExportContentParams = {
19
+ type ExportContentParams = {
20
20
  workspace?: string;
21
21
  nodePath?: string;
22
22
  exportFormat?: string;
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  // Utility methods to call import/export Jahia API
3
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
4
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
5
- to[j] = from[i];
6
- return to;
3
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
5
+ if (ar || !(i in from)) {
6
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
7
+ ar[i] = from[i];
8
+ }
9
+ }
10
+ return to.concat(ar || Array.prototype.slice.call(from));
7
11
  };
8
- exports.__esModule = true;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
9
13
  exports.exportContent = void 0;
10
14
  var API_NAME = '/cms/export';
11
15
  var serverDefaults = {
@@ -22,13 +26,13 @@ var exportContent = function (_a) {
22
26
  } : _g, _h = _a.jahiaServer, jahiaServer = _h === void 0 ? serverDefaults : _h;
23
27
  var queryStringParams = Object.keys(params)
24
28
  .filter(function (key) { return !['paths', 'sitebox'].includes(key); })
25
- .map(function (key) { return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]); }) || [];
26
- var sitebox = ((_b = params.sitebox) === null || _b === void 0 ? void 0 : _b.map(function (sb) { return "sitebox=" + encodeURIComponent(sb); })) || [];
27
- var paths = ((_c = params.paths) === null || _c === void 0 ? void 0 : _c.map(function (path) { return "path=" + encodeURIComponent(path); })) || [];
28
- var qs = __spreadArray(__spreadArray(__spreadArray([], queryStringParams), sitebox), paths).join('&');
29
+ .map(function (key) { return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(params[key])); }) || [];
30
+ var sitebox = ((_b = params.sitebox) === null || _b === void 0 ? void 0 : _b.map(function (sb) { return "sitebox=".concat(encodeURIComponent(sb)); })) || [];
31
+ var paths = ((_c = params.paths) === null || _c === void 0 ? void 0 : _c.map(function (path) { return "path=".concat(encodeURIComponent(path)); })) || [];
32
+ var qs = __spreadArray(__spreadArray(__spreadArray([], queryStringParams, true), sitebox, true), paths, true).join('&');
29
33
  // It is not possible to use the "qs" field of RequestOptions for querystring as it does not support multiple parameters with the same name (path or sitebox)
30
34
  cy.request({
31
- url: "" + jahiaServer.url + API_NAME + "/" + workspace + nodePath + "." + exportFormat + "?" + qs,
35
+ url: "".concat(jahiaServer.url).concat(API_NAME, "/").concat(workspace).concat(nodePath, ".").concat(exportFormat, "?").concat(qs),
32
36
  method: 'GET',
33
37
  auth: {
34
38
  user: jahiaServer.username,
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  /* eslint max-depth: ["error", 5] */
3
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
4
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
5
- to[j] = from[i];
6
- return to;
3
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
5
+ if (ar || !(i in from)) {
6
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
7
+ ar[i] = from[i];
8
+ }
9
+ }
10
+ return to.concat(ar || Array.prototype.slice.call(from));
7
11
  };
8
- exports.__esModule = true;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
9
13
  exports.getDescriptions = void 0;
10
14
  // The type name to be used for further introspection can be located either in
11
15
  // the type object itself or in the ofType object
@@ -56,7 +60,7 @@ var execIntrospection = function (typeName, descriptions, nodePath) {
56
60
  if (responseDataType.fields) {
57
61
  for (var _i = 0, _b = responseDataType.fields; _i < _b.length; _i++) {
58
62
  var graphqlField = _b[_i];
59
- var fieldPath = __spreadArray(__spreadArray([], nodePath), [graphqlField.name]);
63
+ var fieldPath = __spreadArray(__spreadArray([], nodePath, true), [graphqlField.name], false);
60
64
  descriptions.push({
61
65
  name: graphqlField.name,
62
66
  description: graphqlField.description,
@@ -66,11 +70,11 @@ var execIntrospection = function (typeName, descriptions, nodePath) {
66
70
  deprecationReason: graphqlField.deprecationReason,
67
71
  nodePath: fieldPath
68
72
  });
69
- fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1), addTypes(graphqlField.type, fieldPath));
73
+ fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1, true), addTypes(graphqlField.type, fieldPath), true);
70
74
  if (graphqlField.args) {
71
75
  for (var _c = 0, _d = graphqlField.args; _c < _d.length; _c++) {
72
76
  var graphQLInputValue = _d[_c];
73
- var inputValuePath = __spreadArray(__spreadArray([], fieldPath), [graphQLInputValue.name]);
77
+ var inputValuePath = __spreadArray(__spreadArray([], fieldPath, true), [graphQLInputValue.name], false);
74
78
  descriptions.push({
75
79
  name: graphQLInputValue.name,
76
80
  description: graphQLInputValue.description,
@@ -80,7 +84,7 @@ var execIntrospection = function (typeName, descriptions, nodePath) {
80
84
  deprecationReason: graphQLInputValue.deprecationReason,
81
85
  nodePath: inputValuePath
82
86
  });
83
- fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1), addTypes(graphQLInputValue.type, inputValuePath));
87
+ fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1, true), addTypes(graphQLInputValue.type, inputValuePath), true);
84
88
  }
85
89
  }
86
90
  }
@@ -95,13 +99,13 @@ var execIntrospection = function (typeName, descriptions, nodePath) {
95
99
  schemaNode: graphQLInterfaceType,
96
100
  nodePath: nodePath
97
101
  });
98
- fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1), addTypes(graphQLInterfaceType, nodePath));
102
+ fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1, true), addTypes(graphQLInterfaceType, nodePath), true);
99
103
  }
100
104
  }
101
105
  if (responseDataType.possibleTypes) {
102
106
  for (var _g = 0, _h = responseDataType.possibleTypes; _g < _h.length; _g++) {
103
107
  var graphQLType = _h[_g];
104
- var fieldPath = __spreadArray(__spreadArray([], nodePath), [responseDataType.name, graphQLType.name]);
108
+ var fieldPath = __spreadArray(__spreadArray([], nodePath, true), [responseDataType.name, graphQLType.name], false);
105
109
  descriptions.push({
106
110
  name: graphQLType.name,
107
111
  description: graphQLType.description,
@@ -109,13 +113,13 @@ var execIntrospection = function (typeName, descriptions, nodePath) {
109
113
  schemaNode: graphQLType,
110
114
  nodePath: fieldPath
111
115
  });
112
- fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1), addTypes(graphQLType, fieldPath));
116
+ fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1, true), addTypes(graphQLType, fieldPath), true);
113
117
  }
114
118
  }
115
119
  if (responseDataType.enumValues) {
116
120
  for (var _j = 0, _k = responseDataType.enumValues; _j < _k.length; _j++) {
117
121
  var graphQLEnumValue = _k[_j];
118
- var enumPath = __spreadArray(__spreadArray([], nodePath), [responseDataType.name, graphQLEnumValue.name]);
122
+ var enumPath = __spreadArray(__spreadArray([], nodePath, true), [responseDataType.name, graphQLEnumValue.name], false);
119
123
  descriptions.push({
120
124
  name: graphQLEnumValue.name,
121
125
  description: graphQLEnumValue.description,
@@ -130,7 +134,7 @@ var execIntrospection = function (typeName, descriptions, nodePath) {
130
134
  if (responseDataType.inputFields) {
131
135
  for (var _l = 0, _m = responseDataType.inputFields; _l < _m.length; _l++) {
132
136
  var graphQLInputValue = _m[_l];
133
- var inputValuePath = __spreadArray(__spreadArray([], nodePath), [responseDataType.name, graphQLInputValue.name]);
137
+ var inputValuePath = __spreadArray(__spreadArray([], nodePath, true), [responseDataType.name, graphQLInputValue.name], false);
134
138
  descriptions.push({
135
139
  name: graphQLInputValue.name,
136
140
  description: graphQLInputValue.description,
@@ -138,11 +142,11 @@ var execIntrospection = function (typeName, descriptions, nodePath) {
138
142
  schemaNode: graphQLInputValue,
139
143
  nodePath: inputValuePath
140
144
  });
141
- fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1), addTypes(graphQLInputValue.type, inputValuePath));
145
+ fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1, true), addTypes(graphQLInputValue.type, inputValuePath), true);
142
146
  }
143
147
  }
144
148
  if (responseDataType.ofType) {
145
- fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1), addTypes(responseDataType.ofType, nodePath));
149
+ fetchSubTypes_1 = __spreadArray(__spreadArray([], fetchSubTypes_1, true), addTypes(responseDataType.ofType, nodePath), true);
146
150
  }
147
151
  var uniqueSubTypes = fetchSubTypes_1
148
152
  // Filter out duplicate types to ensure we don't introspect the same type multiple times
@@ -156,7 +160,7 @@ var execIntrospection = function (typeName, descriptions, nodePath) {
156
160
  return descriptions;
157
161
  }
158
162
  return Cypress.Promise.each(uniqueSubTypes, function (subType) {
159
- return execIntrospection(subType.typeName, descriptions, __spreadArray(__spreadArray([], subType.atPath), [subType.typeName]));
163
+ return execIntrospection(subType.typeName, descriptions, __spreadArray(__spreadArray([], subType.atPath, true), [subType.typeName], false));
160
164
  }).then(function () { return descriptions; }); // Return descriptions after all recursive calls have completed
161
165
  }
162
166
  });
@@ -1,5 +1,5 @@
1
1
  import { ApolloOptions } from '../support';
2
- declare type Workspace = 'EDIT' | 'LIVE';
2
+ type Workspace = 'EDIT' | 'LIVE';
3
3
  export declare const setNodeProperty: (pathOrId: string, property: string, value: string | Array<string>, language: string, apolloOptions?: ApolloOptions) => Cypress.Chainable;
4
4
  export declare const deleteNode: (pathOrId: string, workspace?: Workspace, apolloOptions?: ApolloOptions) => Cypress.Chainable;
5
5
  export declare const deleteNodeProperty: (pathOrId: string, property: string, language: string, apolloOptions?: ApolloOptions) => Cypress.Chainable;
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- exports.__esModule = true;
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.copyNode = exports.unlockNode = exports.lockNode = exports.uploadFile = exports.markForDeletion = exports.getNodeTypes = exports.moveNode = exports.getNodeAcl = exports.getNodeByPath = exports.removeMixins = exports.addMixins = exports.addNode = exports.deleteNodeProperty = exports.deleteNode = exports.setNodeProperty = void 0;
15
15
  // eslint-disable-next-line max-params
16
16
  var setNodeProperty = function (pathOrId, property, value, language, apolloOptions) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStartedModuleVersion = exports.getStartedModulesVersion = exports.getJahiaVersion = void 0;
4
4
  var getJahiaVersion = function () {
5
5
  return cy.apollo({
@@ -22,7 +22,7 @@ var getStartedModulesVersion = function () {
22
22
  };
23
23
  exports.getStartedModulesVersion = getStartedModulesVersion;
24
24
  var getStartedModuleVersion = function (moduleId) {
25
- return exports.getStartedModulesVersion().then(function (modules) {
25
+ return (0, exports.getStartedModulesVersion)().then(function (modules) {
26
26
  var _a;
27
27
  return (_a = modules.find(function (module) { return module.id === moduleId; })) === null || _a === void 0 ? void 0 : _a.version;
28
28
  });
@@ -13,7 +13,7 @@
13
13
  * @note The log verbosity can be set by calling `Log.setVerbosity(Log.LEVELS.DEBUG)` in the code (default is `INFO`).
14
14
  * It tells the logger to log only messages with the given level and above.
15
15
  */
16
- exports.__esModule = true;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.Log = void 0;
18
18
  /**
19
19
  * ENV variable to store the logging verbosity level
@@ -50,7 +50,7 @@ function hex2rgb(hex) {
50
50
  var r = parseInt(hex.slice(1, 3), 16);
51
51
  var g = parseInt(hex.slice(3, 5), 16);
52
52
  var b = parseInt(hex.slice(5, 7), 16);
53
- return r + " " + g + " " + b;
53
+ return "".concat(r, " ").concat(g, " ").concat(b);
54
54
  }
55
55
  /**
56
56
  * Creates a custom logger styles and attaches them to the document head.
@@ -58,7 +58,7 @@ function hex2rgb(hex) {
58
58
  */
59
59
  function attachLoggerStyles() {
60
60
  // Check if style tag with the corresponding attribute exists in the document head to avoid duplicating styles
61
- if (Cypress.$(window.top.document.head).find("style[data-id=\"" + LOGGER_STYLE_ID + "\"]").length > 0) {
61
+ if (Cypress.$(window.top.document.head).find("style[data-id=\"".concat(LOGGER_STYLE_ID, "\"]")).length > 0) {
62
62
  return;
63
63
  }
64
64
  // Create style element
@@ -69,7 +69,7 @@ function attachLoggerStyles() {
69
69
  LOGGER_COLORS.forEach(function (logger) {
70
70
  var name = logger.name.toLowerCase();
71
71
  var color = hex2rgb(logger.color);
72
- styleSheet.textContent += "\n .command.command-name-ptf-" + name + " span.command-method {\n margin-right: 0.5rem;\n border-radius: 0.125rem;\n border-width: 1px;\n padding: 0.125rem 0.375rem;\n text-transform: uppercase;\n\n border-color: rgb(" + color + " / 1);\n background-color: rgb(" + color + " / 0.2);\n color: rgb(" + color + " / 1) !important;\n }\n\n .command.command-name-ptf-" + name + " span.command-message {\n color: rgb(" + color + " / 1);\n font-weight: normal;\n }\n\n .command.command-name-ptf-" + name + " span.command-message strong,\n .command.command-name-ptf-" + name + " span.command-message em { \n color: rgb(" + color + " / 1);\n }\n ";
72
+ styleSheet.textContent += "\n .command.command-name-ptf-".concat(name, " span.command-method {\n margin-right: 0.5rem;\n border-radius: 0.125rem;\n border-width: 1px;\n padding: 0.125rem 0.375rem;\n text-transform: uppercase;\n\n border-color: rgb(").concat(color, " / 1);\n background-color: rgb(").concat(color, " / 0.2);\n color: rgb(").concat(color, " / 1) !important;\n }\n\n .command.command-name-ptf-").concat(name, " span.command-message {\n color: rgb(").concat(color, " / 1);\n font-weight: normal;\n }\n\n .command.command-name-ptf-").concat(name, " span.command-message strong,\n .command.command-name-ptf-").concat(name, " span.command-message em { \n color: rgb(").concat(color, " / 1);\n }\n ");
73
73
  });
74
74
  // Attach styles to the document head
75
75
  Cypress.$(window.top.document.head).append(styleSheet);
@@ -138,7 +138,7 @@ function json(level, text) {
138
138
  function _send_(level, message) {
139
139
  // Check if the log level is valid
140
140
  if (!Object.values(exports.Log.LEVEL).includes(level)) {
141
- throw new Error("Log level \"" + level + "\" is not supported. Supported levels are: " + exports.Log.LEVEL);
141
+ throw new Error("Log level \"".concat(level, "\" is not supported. Supported levels are: ").concat(exports.Log.LEVEL));
142
142
  }
143
143
  // Attach logger styles to the document head (done only once)
144
144
  attachLoggerStyles();
@@ -150,7 +150,7 @@ function _send_(level, message) {
150
150
  // use cy.then() to ensure that the log message is sent in the correct order
151
151
  // and use cy.wrap() to return the Cypress chainable object
152
152
  return cy.then(function () {
153
- Cypress.log({ name: "ptf-" + exports.Log.LEVEL[level].toLowerCase(), displayName: "" + exports.Log.LEVEL[level].toUpperCase(), message: "" + message });
153
+ Cypress.log({ name: "ptf-".concat(exports.Log.LEVEL[level].toLowerCase()), displayName: "".concat(exports.Log.LEVEL[level].toUpperCase()), message: "".concat(message) });
154
154
  }).then(function () { return cy.wrap(null, { log: false }); });
155
155
  }
156
156
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- exports.__esModule = true;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.waitAllJobsFinished = exports.abortAllWorkflows = exports.validateAllWorkflows = exports.startWorkflow = exports.unpublishNode = exports.publishAndWaitJobEnding = void 0;
4
4
  var publishAndWaitJobEnding = function (path, languages) {
5
5
  if (languages === void 0) { languages = ['en']; }
@@ -12,7 +12,7 @@ var publishAndWaitJobEnding = function (path, languages) {
12
12
  },
13
13
  mutationFile: 'graphql/jcr/mutation/publishNode.graphql'
14
14
  });
15
- exports.waitAllJobsFinished('Publication timeout for node: ' + path, 60000);
15
+ (0, exports.waitAllJobsFinished)('Publication timeout for node: ' + path, 60000);
16
16
  };
17
17
  exports.publishAndWaitJobEnding = publishAndWaitJobEnding;
18
18
  var unpublishNode = function (path, languages) {
@@ -38,7 +38,7 @@ var startWorkflow = function (pathOrId, definition, language) {
38
38
  exports.startWorkflow = startWorkflow;
39
39
  var validateAllWorkflows = function () {
40
40
  cy.executeGroovy('groovy/admin/completeWorkflows.groovy');
41
- exports.waitAllJobsFinished('All workflows validated but some jobs are still running after a minute', 60000);
41
+ (0, exports.waitAllJobsFinished)('All workflows validated but some jobs are still running after a minute', 60000);
42
42
  };
43
43
  exports.validateAllWorkflows = validateAllWorkflows;
44
44
  var abortAllWorkflows = function () {
@@ -6,7 +6,7 @@ import Chainable = Cypress.Chainable;
6
6
  * @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
7
7
  */
8
8
  export declare const healthCheck: (severity?: string, probeHealthFilter?: any, probeNamesFilter?: string[]) => Chainable<any>;
9
- declare type WaitUntilSAMStatusParams = {
9
+ type WaitUntilSAMStatusParams = {
10
10
  expectedHealth: string;
11
11
  severity?: string;
12
12
  probeHealthFilter?: any;