@jahia/cypress 3.19.4 → 3.20.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.
@@ -1,5 +1,6 @@
1
+ declare type Workspace = 'EDIT' | 'LIVE';
1
2
  export declare const setNodeProperty: (pathOrId: string, property: string, value: string | Array<string>, language: string) => Cypress.Chainable;
2
- export declare const deleteNode: (pathOrId: string) => Cypress.Chainable;
3
+ export declare const deleteNode: (pathOrId: string, workspace?: Workspace) => Cypress.Chainable;
3
4
  export declare const deleteNodeProperty: (pathOrId: string, property: string, language: string) => Cypress.Chainable;
4
5
  export declare const addNode: (variables: {
5
6
  parentPathOrId: string;
@@ -9,7 +10,8 @@ export declare const addNode: (variables: {
9
10
  children?: any[];
10
11
  mixins?: any[];
11
12
  }) => Cypress.Chainable;
12
- export declare const getNodeByPath: (path: string, properties?: string[], language?: string, childrenTypes?: string[], workspace?: 'EDIT' | 'LIVE') => Cypress.Chainable;
13
+ export declare const getNodeByPath: (path: string, properties?: string[], language?: string, childrenTypes?: string[], workspace?: Workspace) => Cypress.Chainable;
13
14
  export declare const getNodeAcl: (path: string) => Cypress.Chainable;
14
15
  export declare const moveNode: (pathOrId: string, destParentPathOrId: string, destName?: string) => Cypress.Chainable;
15
16
  export declare const getNodeTypes: (filter?: {}) => Cypress.Chainable;
17
+ export {};
@@ -17,10 +17,12 @@ var setNodeProperty = function (pathOrId, property, value, language) {
17
17
  });
18
18
  };
19
19
  exports.setNodeProperty = setNodeProperty;
20
- var deleteNode = function (pathOrId) {
20
+ var deleteNode = function (pathOrId, workspace) {
21
+ if (workspace === void 0) { workspace = 'EDIT'; }
21
22
  return cy.apollo({
22
23
  variables: {
23
- pathOrId: pathOrId
24
+ pathOrId: pathOrId,
25
+ workspace: workspace
24
26
  },
25
27
  mutationFile: 'graphql/jcr/mutation/deleteNode.graphql'
26
28
  });
@@ -0,0 +1 @@
1
+ export declare const waitUntilSAMStatusGreen: (severity?: string, timeout?: number, interval?: number) => void;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.waitUntilSAMStatusGreen = void 0;
4
+ var waitUntilSAMStatusGreen = function (severity, timeout, interval) {
5
+ if (severity === void 0) { severity = 'MEDIUM'; }
6
+ if (timeout === void 0) { timeout = 60000; }
7
+ if (interval === void 0) { interval = 1000; }
8
+ cy.waitUntil(function () {
9
+ return cy.apollo({
10
+ fetchPolicy: 'no-cache',
11
+ queryFile: 'graphql/sam/healthStatus.graphql',
12
+ variables: {
13
+ severity: severity
14
+ }
15
+ }).then(function (result) {
16
+ var _a, _b, _c, _d;
17
+ var healthStatus = (_d = (_c = (_b = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.admin) === null || _b === void 0 ? void 0 : _b.jahia) === null || _c === void 0 ? void 0 : _c.healthCheck) === null || _d === void 0 ? void 0 : _d.status;
18
+ if (healthStatus) {
19
+ return healthStatus.health === 'GREEN';
20
+ }
21
+ });
22
+ }, {
23
+ errorMsg: "Timeout waiting for SAM to be green for severity: " + severity,
24
+ timeout: timeout,
25
+ verbose: true,
26
+ interval: interval
27
+ });
28
+ };
29
+ exports.waitUntilSAMStatusGreen = waitUntilSAMStatusGreen;
@@ -6,3 +6,4 @@ export * from './VanityUrlHelper';
6
6
  export * from './ClusterHelper';
7
7
  export * from './JahiaPlatformHelper';
8
8
  export * from './GraphQLHelper';
9
+ export * from './SAMHelper';
@@ -18,3 +18,4 @@ __exportStar(require("./VanityUrlHelper"), exports);
18
18
  __exportStar(require("./ClusterHelper"), exports);
19
19
  __exportStar(require("./JahiaPlatformHelper"), exports);
20
20
  __exportStar(require("./GraphQLHelper"), exports);
21
+ __exportStar(require("./SAMHelper"), exports);
@@ -1,5 +1,5 @@
1
- mutation deleteNode($pathOrId: String!) {
2
- jcr(workspace: EDIT) {
1
+ mutation deleteNode($pathOrId: String!, $workspace: Workspace!) {
2
+ jcr(workspace: $workspace) {
3
3
  deleteNode(pathOrId: $pathOrId)
4
4
  }
5
5
  }
@@ -0,0 +1,12 @@
1
+ query($severity: GqlProbeSeverity) {
2
+ admin {
3
+ jahia {
4
+ healthCheck(severity: $severity) {
5
+ status {
6
+ health
7
+ message
8
+ }
9
+ }
10
+ }
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/cypress",
3
- "version": "3.19.4",
3
+ "version": "3.20.0",
4
4
  "scripts": {
5
5
  "build": "tsc",
6
6
  "lint": "eslint src -c .eslintrc.json --ext .ts"
@@ -1,3 +1,5 @@
1
+ type Workspace = 'EDIT' | 'LIVE';
2
+
1
3
  export const setNodeProperty = (pathOrId: string, property: string, value: string | Array<string>, language: string): Cypress.Chainable => {
2
4
  let mutationFile = 'graphql/jcr/mutation/setProperty.graphql';
3
5
  if (value instanceof Array) {
@@ -15,10 +17,11 @@ export const setNodeProperty = (pathOrId: string, property: string, value: strin
15
17
  });
16
18
  };
17
19
 
18
- export const deleteNode = (pathOrId: string): Cypress.Chainable => {
20
+ export const deleteNode = (pathOrId: string, workspace: Workspace = 'EDIT'): Cypress.Chainable => {
19
21
  return cy.apollo({
20
22
  variables: {
21
- pathOrId: pathOrId
23
+ pathOrId: pathOrId,
24
+ workspace
22
25
  },
23
26
  mutationFile: 'graphql/jcr/mutation/deleteNode.graphql'
24
27
  });
@@ -43,7 +46,7 @@ export const addNode = (variables: { parentPathOrId: string, primaryNodeType: st
43
46
  });
44
47
  };
45
48
 
46
- export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace: 'EDIT' | 'LIVE' = 'EDIT'): Cypress.Chainable => {
49
+ export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace: Workspace = 'EDIT'): Cypress.Chainable => {
47
50
  return cy.apollo({
48
51
  variables: {
49
52
  path: path,
@@ -0,0 +1,22 @@
1
+ export const waitUntilSAMStatusGreen = (severity = 'MEDIUM', timeout = 60000, interval = 1000) : void => {
2
+ cy.waitUntil(() =>
3
+ cy.apollo({
4
+ fetchPolicy: 'no-cache',
5
+ queryFile: 'graphql/sam/healthStatus.graphql',
6
+ variables: {
7
+ severity: severity
8
+ }
9
+ }).then(result => {
10
+ const healthStatus = result?.data?.admin?.jahia?.healthCheck?.status;
11
+ if (healthStatus) {
12
+ return healthStatus.health === 'GREEN';
13
+ }
14
+ }),
15
+ {
16
+ errorMsg: `Timeout waiting for SAM to be green for severity: ${severity}`,
17
+ timeout: timeout,
18
+ verbose: true,
19
+ interval: interval
20
+ });
21
+ };
22
+
@@ -6,3 +6,4 @@ export * from './VanityUrlHelper';
6
6
  export * from './ClusterHelper';
7
7
  export * from './JahiaPlatformHelper';
8
8
  export * from './GraphQLHelper';
9
+ export * from './SAMHelper';