@jahia/cypress 3.31.0 → 3.33.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.
@@ -8,5 +8,7 @@ export declare class Menu extends BaseComponent {
8
8
  shouldNotHaveItem(item: string): void;
9
9
  select(item: string): Menu;
10
10
  selectByRole(item: string): Menu;
11
+ /** Can be used for choicelist dropdown menu */
12
+ selectByValue(value: string): Menu;
11
13
  close(): Chainable<unknown>;
12
14
  }
@@ -44,6 +44,12 @@ var Menu = /** @class */ (function (_super) {
44
44
  this.get().find(".moonstone-menuItem[data-sel-role=\"" + item + "\"]").trigger('click');
45
45
  return this;
46
46
  };
47
+ /** Can be used for choicelist dropdown menu */
48
+ Menu.prototype.selectByValue = function (value) {
49
+ this.get().find(".moonstone-menuItem[data-value=\"" + value + "\"]").scrollIntoView().should('be.visible');
50
+ this.get().find(".moonstone-menuItem[data-value=\"" + value + "\"]").trigger('click');
51
+ return this;
52
+ };
47
53
  Menu.prototype.close = function () {
48
54
  return cy.get(Menu.overlaySelector).click('topRight');
49
55
  };
@@ -1 +1,3 @@
1
1
  export declare const getJahiaVersion: () => Cypress.Chainable;
2
+ export declare const getStartedModulesVersion: () => Cypress.Chainable;
3
+ export declare const getStartedModuleVersion: (moduleId: string) => Cypress.Chainable;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.getJahiaVersion = void 0;
3
+ exports.getStartedModuleVersion = exports.getStartedModulesVersion = exports.getJahiaVersion = void 0;
4
4
  var getJahiaVersion = function () {
5
5
  return cy.apollo({
6
6
  fetchPolicy: 'no-cache',
@@ -11,3 +11,20 @@ var getJahiaVersion = function () {
11
11
  });
12
12
  };
13
13
  exports.getJahiaVersion = getJahiaVersion;
14
+ var getStartedModulesVersion = function () {
15
+ return cy.apollo({
16
+ fetchPolicy: 'no-cache',
17
+ queryFile: 'graphql/jcr/query/getStartedModulesVersion.graphql'
18
+ }).then(function (result) {
19
+ var _a;
20
+ return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.dashboard.modules;
21
+ });
22
+ };
23
+ exports.getStartedModulesVersion = getStartedModulesVersion;
24
+ var getStartedModuleVersion = function (moduleId) {
25
+ return exports.getStartedModulesVersion().then(function (modules) {
26
+ var _a;
27
+ return (_a = modules.find(function (module) { return module.id === moduleId; })) === null || _a === void 0 ? void 0 : _a.version;
28
+ });
29
+ };
30
+ exports.getStartedModuleVersion = getStartedModuleVersion;
@@ -2,22 +2,25 @@ import Chainable = Cypress.Chainable;
2
2
  /**
3
3
  * Simple health check query
4
4
  * @param severity the severity of the health check, default is MEDIUM
5
- * @param probeHealthFilter the filter for the health check probes, default is GREEN
5
+ * @param probeHealthFilter return only probes with health status matching or above, default is null
6
+ * @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
6
7
  */
7
- export declare const healthCheck: (severity?: string, probeHealthFilter?: string) => Chainable<any>;
8
+ export declare const healthCheck: (severity?: string, probeHealthFilter?: any, probeNamesFilter?: string[]) => Chainable<any>;
8
9
  /**
9
10
  * Wait until the health check returns the expected health
10
11
  * @param expectedHealth the expected health status
11
12
  * @param severity the severity of the health check, default is MEDIUM
12
- * @param probeHealthFilter the filter for the health check probes, default is GREEN
13
+ * @param probeHealthFilter return only probes with health status matching or above, default is null
14
+ * @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
13
15
  * @param timeout the timeout in milliseconds, default is 60000
14
16
  * @param interval the interval in milliseconds, default is 500
15
17
  * @param statusMatchCount the number of consecutive status matches before the waitUntil resolves, default is 3
16
18
  */
17
- export declare const waitUntilSAMStatus: ({ expectedHealth, severity, probeHealthFilter, timeout, interval, statusMatchCount }: {
19
+ export declare const waitUntilSAMStatus: ({ expectedHealth, severity, probeHealthFilter, probeNamesFilter, timeout, interval, statusMatchCount }: {
18
20
  expectedHealth: any;
19
21
  severity?: string;
20
- probeHealthFilter?: string;
22
+ probeHealthFilter?: any;
23
+ probeNamesFilter?: any;
21
24
  timeout?: number;
22
25
  interval?: number;
23
26
  statusMatchCount?: number;
@@ -4,18 +4,21 @@ exports.waitUntilSAMStatusGreen = exports.waitUntilSAMStatus = exports.healthChe
4
4
  /**
5
5
  * Simple health check query
6
6
  * @param severity the severity of the health check, default is MEDIUM
7
- * @param probeHealthFilter the filter for the health check probes, default is GREEN
7
+ * @param probeHealthFilter return only probes with health status matching or above, default is null
8
+ * @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
8
9
  */
9
- var healthCheck = function (severity, probeHealthFilter) {
10
+ var healthCheck = function (severity, probeHealthFilter, probeNamesFilter) {
10
11
  if (severity === void 0) { severity = 'MEDIUM'; }
11
- if (probeHealthFilter === void 0) { probeHealthFilter = 'GREEN'; }
12
+ if (probeHealthFilter === void 0) { probeHealthFilter = null; }
13
+ if (probeNamesFilter === void 0) { probeNamesFilter = null; }
12
14
  return cy
13
15
  .apollo({
14
16
  fetchPolicy: 'no-cache',
15
17
  queryFile: 'graphql/sam/healthStatus.graphql',
16
18
  variables: {
17
19
  severity: severity,
18
- probeHealthFilter: probeHealthFilter
20
+ probeHealthFilter: probeHealthFilter,
21
+ probeNamesFilter: probeNamesFilter
19
22
  }
20
23
  })
21
24
  .then(function (response) {
@@ -28,17 +31,18 @@ exports.healthCheck = healthCheck;
28
31
  * Wait until the health check returns the expected health
29
32
  * @param expectedHealth the expected health status
30
33
  * @param severity the severity of the health check, default is MEDIUM
31
- * @param probeHealthFilter the filter for the health check probes, default is GREEN
34
+ * @param probeHealthFilter return only probes with health status matching or above, default is null
35
+ * @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
32
36
  * @param timeout the timeout in milliseconds, default is 60000
33
37
  * @param interval the interval in milliseconds, default is 500
34
38
  * @param statusMatchCount the number of consecutive status matches before the waitUntil resolves, default is 3
35
39
  */
36
40
  var waitUntilSAMStatus = function (_a) {
37
- var expectedHealth = _a.expectedHealth, _b = _a.severity, severity = _b === void 0 ? 'MEDIUM' : _b, _c = _a.probeHealthFilter, probeHealthFilter = _c === void 0 ? 'GREEN' : _c, _d = _a.timeout, timeout = _d === void 0 ? 60000 : _d, _e = _a.interval, interval = _e === void 0 ? 500 : _e, _f = _a.statusMatchCount, statusMatchCount = _f === void 0 ? 3 : _f;
41
+ var expectedHealth = _a.expectedHealth, _b = _a.severity, severity = _b === void 0 ? 'MEDIUM' : _b, _c = _a.probeHealthFilter, probeHealthFilter = _c === void 0 ? null : _c, _d = _a.probeNamesFilter, probeNamesFilter = _d === void 0 ? null : _d, _e = _a.timeout, timeout = _e === void 0 ? 60000 : _e, _f = _a.interval, interval = _f === void 0 ? 500 : _f, _g = _a.statusMatchCount, statusMatchCount = _g === void 0 ? 3 : _g;
38
42
  var statusCount = 0;
39
43
  var lastGraphqlResponse = {};
40
44
  cy.waitUntil(function () {
41
- return exports.healthCheck(severity, probeHealthFilter).then(function (result) {
45
+ return exports.healthCheck(severity, probeHealthFilter, probeNamesFilter).then(function (result) {
42
46
  lastGraphqlResponse = result;
43
47
  var healthStatus = result === null || result === void 0 ? void 0 : result.status;
44
48
  if (healthStatus) {
@@ -0,0 +1,8 @@
1
+ query getStartedModulesVersion {
2
+ dashboard {
3
+ modules {
4
+ id
5
+ version
6
+ }
7
+ }
8
+ }
@@ -1,7 +1,7 @@
1
- query($severity: GqlProbeSeverity, $probeHealthFilter: GqlProbeHealth) {
1
+ query($severity: GqlProbeSeverity, $probeHealthFilter: GqlProbeHealth, $probeNamesFilter: [String!]) {
2
2
  admin {
3
3
  jahia {
4
- healthCheck(severity: $severity) {
4
+ healthCheck(severity: $severity, includes: $probeNamesFilter) {
5
5
  status {
6
6
  health
7
7
  message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/cypress",
3
- "version": "3.31.0",
3
+ "version": "3.33.0",
4
4
  "scripts": {
5
5
  "build": "tsc",
6
6
  "lint": "eslint src -c .eslintrc.json --ext .ts"
@@ -32,6 +32,13 @@ export class Menu extends BaseComponent {
32
32
  return this;
33
33
  }
34
34
 
35
+ /** Can be used for choicelist dropdown menu */
36
+ selectByValue(value: string): Menu {
37
+ this.get().find(`.moonstone-menuItem[data-value="${value}"]`).scrollIntoView().should('be.visible');
38
+ this.get().find(`.moonstone-menuItem[data-value="${value}"]`).trigger('click');
39
+ return this;
40
+ }
41
+
35
42
  close(): Chainable<unknown> {
36
43
  return cy.get(Menu.overlaySelector).click('topRight');
37
44
  }
@@ -6,3 +6,18 @@ export const getJahiaVersion = (): Cypress.Chainable => {
6
6
  return result?.data?.admin.jahia.version;
7
7
  });
8
8
  };
9
+
10
+ export const getStartedModulesVersion = (): Cypress.Chainable => {
11
+ return cy.apollo({
12
+ fetchPolicy: 'no-cache',
13
+ queryFile: 'graphql/jcr/query/getStartedModulesVersion.graphql'
14
+ }).then(result => {
15
+ return result?.data?.dashboard.modules;
16
+ });
17
+ };
18
+
19
+ export const getStartedModuleVersion = (moduleId: string): Cypress.Chainable => {
20
+ return getStartedModulesVersion().then(modules => {
21
+ return modules.find(module => module.id === moduleId)?.version;
22
+ });
23
+ };
@@ -4,16 +4,18 @@ import Chainable = Cypress.Chainable
4
4
  /**
5
5
  * Simple health check query
6
6
  * @param severity the severity of the health check, default is MEDIUM
7
- * @param probeHealthFilter the filter for the health check probes, default is GREEN
7
+ * @param probeHealthFilter return only probes with health status matching or above, default is null
8
+ * @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
8
9
  */
9
- export const healthCheck = (severity = 'MEDIUM', probeHealthFilter = 'GREEN'): Chainable<any> => {
10
+ export const healthCheck = (severity = 'MEDIUM', probeHealthFilter = null, probeNamesFilter: string[] = null): Chainable<any> => {
10
11
  return cy
11
12
  .apollo({
12
13
  fetchPolicy: 'no-cache',
13
14
  queryFile: 'graphql/sam/healthStatus.graphql',
14
15
  variables: {
15
16
  severity,
16
- probeHealthFilter
17
+ probeHealthFilter,
18
+ probeNamesFilter
17
19
  }
18
20
  })
19
21
  .then((response: any) => {
@@ -25,16 +27,17 @@ export const healthCheck = (severity = 'MEDIUM', probeHealthFilter = 'GREEN'): C
25
27
  * Wait until the health check returns the expected health
26
28
  * @param expectedHealth the expected health status
27
29
  * @param severity the severity of the health check, default is MEDIUM
28
- * @param probeHealthFilter the filter for the health check probes, default is GREEN
30
+ * @param probeHealthFilter return only probes with health status matching or above, default is null
31
+ * @param probeNamesFilter return and calculate health status only for the probes with the given names, default is null
29
32
  * @param timeout the timeout in milliseconds, default is 60000
30
33
  * @param interval the interval in milliseconds, default is 500
31
34
  * @param statusMatchCount the number of consecutive status matches before the waitUntil resolves, default is 3
32
35
  */
33
- export const waitUntilSAMStatus = ({expectedHealth, severity = 'MEDIUM', probeHealthFilter = 'GREEN', timeout = 60000, interval = 500, statusMatchCount = 3}) : void => {
36
+ export const waitUntilSAMStatus = ({expectedHealth, severity = 'MEDIUM', probeHealthFilter = null, probeNamesFilter = null, timeout = 60000, interval = 500, statusMatchCount = 3}) : void => {
34
37
  let statusCount = 0;
35
38
  let lastGraphqlResponse = {};
36
39
  cy.waitUntil(() =>
37
- healthCheck(severity, probeHealthFilter).then(result => {
40
+ healthCheck(severity, probeHealthFilter, probeNamesFilter).then(result => {
38
41
  lastGraphqlResponse = result;
39
42
  const healthStatus = result?.status;
40
43
  if (healthStatus) {