@jahia/cypress 7.0.0 → 7.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.
@@ -1,7 +1,8 @@
1
+ import { ApolloOptions } from '../support';
1
2
  declare type Workspace = 'EDIT' | 'LIVE';
2
- export declare const setNodeProperty: (pathOrId: string, property: string, value: string | Array<string>, language: string) => Cypress.Chainable;
3
- export declare const deleteNode: (pathOrId: string, workspace?: Workspace) => Cypress.Chainable;
4
- export declare const deleteNodeProperty: (pathOrId: string, property: string, language: string) => Cypress.Chainable;
3
+ export declare const setNodeProperty: (pathOrId: string, property: string, value: string | Array<string>, language: string, apolloOptions?: ApolloOptions) => Cypress.Chainable;
4
+ export declare const deleteNode: (pathOrId: string, workspace?: Workspace, apolloOptions?: ApolloOptions) => Cypress.Chainable;
5
+ export declare const deleteNodeProperty: (pathOrId: string, property: string, language: string, apolloOptions?: ApolloOptions) => Cypress.Chainable;
5
6
  export declare const addNode: (variables: {
6
7
  parentPathOrId: string;
7
8
  primaryNodeType: string;
@@ -9,14 +10,15 @@ export declare const addNode: (variables: {
9
10
  properties?: any[];
10
11
  children?: any[];
11
12
  mixins?: string[];
12
- }) => Cypress.Chainable;
13
- export declare const addMixins: (pathOrId: string, mixins: string[]) => Cypress.Chainable;
14
- export declare const getNodeByPath: (path: string, properties?: string[], language?: string, childrenTypes?: string[], workspace?: Workspace) => Cypress.Chainable;
15
- export declare const getNodeAcl: (path: string) => Cypress.Chainable;
16
- export declare const moveNode: (pathOrId: string, destParentPathOrId: string, destName?: string) => Cypress.Chainable;
17
- export declare const getNodeTypes: (filter?: {}) => Cypress.Chainable;
18
- export declare const markForDeletion: (pathOrId: string) => Cypress.Chainable;
13
+ }, apolloOptions?: ApolloOptions) => Cypress.Chainable;
14
+ export declare const addMixins: (pathOrId: string, mixins: string[], apolloOptions?: ApolloOptions) => Cypress.Chainable;
15
+ export declare const removeMixins: (pathOrId: string, mixins: string[], apolloOptions?: ApolloOptions) => Cypress.Chainable;
16
+ export declare const getNodeByPath: (path: string, properties?: string[], language?: string, childrenTypes?: string[], workspace?: Workspace, apolloOptions?: ApolloOptions) => Cypress.Chainable;
17
+ export declare const getNodeAcl: (path: string, apolloOptions?: ApolloOptions) => Cypress.Chainable;
18
+ export declare const moveNode: (pathOrId: string, destParentPathOrId: string, destName?: string, apolloOptions?: ApolloOptions) => Cypress.Chainable;
19
+ export declare const getNodeTypes: (filter?: {}, apolloOptions?: ApolloOptions) => Cypress.Chainable;
20
+ export declare const markForDeletion: (pathOrId: string, apolloOptions?: ApolloOptions) => Cypress.Chainable;
19
21
  export declare const uploadFile: (fixturePath: string, parentPathOrId: string, name: string, mimeType: string) => Cypress.Chainable;
20
- export declare const lockNode: (pathOrId: string) => Cypress.Chainable;
21
- export declare const unlockNode: (pathOrId: string) => Cypress.Chainable;
22
+ export declare const lockNode: (pathOrId: string, apolloOptions?: ApolloOptions) => Cypress.Chainable;
23
+ export declare const unlockNode: (pathOrId: string, apolloOptions?: ApolloOptions) => Cypress.Chainable;
22
24
  export {};
@@ -1,111 +1,108 @@
1
1
  "use strict";
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
+ };
2
13
  exports.__esModule = true;
3
- exports.unlockNode = exports.lockNode = exports.uploadFile = exports.markForDeletion = exports.getNodeTypes = exports.moveNode = exports.getNodeAcl = exports.getNodeByPath = exports.addMixins = exports.addNode = exports.deleteNodeProperty = exports.deleteNode = exports.setNodeProperty = void 0;
4
- var setNodeProperty = function (pathOrId, property, value, language) {
14
+ 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
+ // eslint-disable-next-line max-params
16
+ var setNodeProperty = function (pathOrId, property, value, language, apolloOptions) {
17
+ if (apolloOptions === void 0) { apolloOptions = {}; }
5
18
  var mutationFile = 'graphql/jcr/mutation/setProperty.graphql';
6
19
  if (value instanceof Array) {
7
20
  mutationFile = 'graphql/jcr/mutation/setPropertyValues.graphql';
8
21
  }
9
- return cy.apollo({
10
- variables: {
22
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: {
11
23
  pathOrId: pathOrId,
12
24
  property: property,
13
25
  language: language,
14
26
  value: value
15
- },
16
- mutationFile: mutationFile
17
- });
27
+ }, mutationFile: mutationFile }));
18
28
  };
19
29
  exports.setNodeProperty = setNodeProperty;
20
- var deleteNode = function (pathOrId, workspace) {
30
+ var deleteNode = function (pathOrId, workspace, apolloOptions) {
21
31
  if (workspace === void 0) { workspace = 'EDIT'; }
22
- return cy.apollo({
23
- variables: {
32
+ if (apolloOptions === void 0) { apolloOptions = {}; }
33
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: {
24
34
  pathOrId: pathOrId,
25
35
  workspace: workspace
26
- },
27
- mutationFile: 'graphql/jcr/mutation/deleteNode.graphql'
28
- });
36
+ }, mutationFile: 'graphql/jcr/mutation/deleteNode.graphql' }));
29
37
  };
30
38
  exports.deleteNode = deleteNode;
31
- var deleteNodeProperty = function (pathOrId, property, language) {
32
- return cy.apollo({
33
- variables: {
39
+ var deleteNodeProperty = function (pathOrId, property, language, apolloOptions) {
40
+ if (apolloOptions === void 0) { apolloOptions = {}; }
41
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: {
34
42
  pathOrId: pathOrId,
35
43
  property: property,
36
44
  language: language
37
- },
38
- mutationFile: 'graphql/jcr/mutation/deleteNodeProperty.graphql'
39
- });
45
+ }, mutationFile: 'graphql/jcr/mutation/deleteNodeProperty.graphql' }));
40
46
  };
41
47
  exports.deleteNodeProperty = deleteNodeProperty;
42
- var addNode = function (variables) {
43
- return cy.apollo({
44
- variables: variables,
45
- mutationFile: 'graphql/jcr/mutation/addNode.graphql'
46
- });
48
+ var addNode = function (variables, apolloOptions) {
49
+ if (apolloOptions === void 0) { apolloOptions = {}; }
50
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: variables, mutationFile: 'graphql/jcr/mutation/addNode.graphql' }));
47
51
  };
48
52
  exports.addNode = addNode;
49
- var addMixins = function (pathOrId, mixins) {
50
- return cy.apollo({
51
- variables: { pathOrId: pathOrId, mixins: mixins },
52
- mutationFile: 'graphql/jcr/mutation/addMixins.graphql'
53
- });
53
+ var addMixins = function (pathOrId, mixins, apolloOptions) {
54
+ if (apolloOptions === void 0) { apolloOptions = {}; }
55
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: { pathOrId: pathOrId, mixins: mixins }, mutationFile: 'graphql/jcr/mutation/addMixins.graphql' }));
54
56
  };
55
57
  exports.addMixins = addMixins;
58
+ var removeMixins = function (pathOrId, mixins, apolloOptions) {
59
+ if (apolloOptions === void 0) { apolloOptions = {}; }
60
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: { pathOrId: pathOrId, mixins: mixins }, mutationFile: 'graphql/jcr/mutation/removeMixins.graphql' }));
61
+ };
62
+ exports.removeMixins = removeMixins;
56
63
  // eslint-disable-next-line max-params
57
- var getNodeByPath = function (path, properties, language, childrenTypes, workspace) {
64
+ var getNodeByPath = function (path, properties, language, childrenTypes, workspace, apolloOptions) {
58
65
  if (childrenTypes === void 0) { childrenTypes = []; }
59
66
  if (workspace === void 0) { workspace = 'EDIT'; }
60
- return cy.apollo({
61
- variables: {
67
+ if (apolloOptions === void 0) { apolloOptions = {}; }
68
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: {
62
69
  path: path,
63
70
  properties: properties,
64
71
  language: language,
65
72
  childrenTypes: childrenTypes || [],
66
73
  workspace: workspace || 'EDIT'
67
- },
68
- queryFile: 'graphql/jcr/query/getNodeByPath.graphql'
69
- });
74
+ }, queryFile: 'graphql/jcr/query/getNodeByPath.graphql' }));
70
75
  };
71
76
  exports.getNodeByPath = getNodeByPath;
72
- var getNodeAcl = function (path) {
73
- return cy.apollo({
74
- variables: {
77
+ var getNodeAcl = function (path, apolloOptions) {
78
+ if (apolloOptions === void 0) { apolloOptions = {}; }
79
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: {
75
80
  path: path
76
- },
77
- queryFile: 'graphql/jcr/query/getNodeAcl.graphql'
78
- });
81
+ }, queryFile: 'graphql/jcr/query/getNodeAcl.graphql' }));
79
82
  };
80
83
  exports.getNodeAcl = getNodeAcl;
81
- var moveNode = function (pathOrId, destParentPathOrId, destName) {
82
- return cy.apollo({
83
- variables: {
84
+ var moveNode = function (pathOrId, destParentPathOrId, destName, apolloOptions) {
85
+ if (apolloOptions === void 0) { apolloOptions = {}; }
86
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: {
84
87
  pathOrId: pathOrId,
85
88
  destParentPathOrId: destParentPathOrId,
86
89
  destName: destName
87
- },
88
- mutationFile: 'graphql/jcr/mutation/moveNode.graphql'
89
- });
90
+ }, mutationFile: 'graphql/jcr/mutation/moveNode.graphql' }));
90
91
  };
91
92
  exports.moveNode = moveNode;
92
- var getNodeTypes = function (filter) {
93
+ var getNodeTypes = function (filter, apolloOptions) {
93
94
  if (filter === void 0) { filter = {}; }
94
- return cy.apollo({
95
- variables: {
95
+ if (apolloOptions === void 0) { apolloOptions = {}; }
96
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: {
96
97
  filter: filter
97
- },
98
- queryFile: 'graphql/jcr/query/getNodeTypes.graphql'
99
- });
98
+ }, queryFile: 'graphql/jcr/query/getNodeTypes.graphql' }));
100
99
  };
101
100
  exports.getNodeTypes = getNodeTypes;
102
- var markForDeletion = function (pathOrId) {
103
- return cy.apollo({
104
- variables: {
101
+ var markForDeletion = function (pathOrId, apolloOptions) {
102
+ if (apolloOptions === void 0) { apolloOptions = {}; }
103
+ return cy.apollo(__assign(__assign({}, apolloOptions), { variables: {
105
104
  pathOrId: pathOrId
106
- },
107
- mutationFile: 'graphql/jcr/mutation/markForDeletion.graphql'
108
- });
105
+ }, mutationFile: 'graphql/jcr/mutation/markForDeletion.graphql' }));
109
106
  };
110
107
  exports.markForDeletion = markForDeletion;
111
108
  var uploadFile = function (fixturePath, parentPathOrId, name, mimeType) {
@@ -125,21 +122,17 @@ var uploadFile = function (fixturePath, parentPathOrId, name, mimeType) {
125
122
  });
126
123
  };
127
124
  exports.uploadFile = uploadFile;
128
- var lockNode = function (pathOrId) {
129
- return cy.apollo({
130
- mutationFile: 'graphql/jcr/mutation/lockNode.graphql',
131
- variables: {
125
+ var lockNode = function (pathOrId, apolloOptions) {
126
+ if (apolloOptions === void 0) { apolloOptions = {}; }
127
+ return cy.apollo(__assign(__assign({}, apolloOptions), { mutationFile: 'graphql/jcr/mutation/lockNode.graphql', variables: {
132
128
  pathOrId: pathOrId
133
- }
134
- });
129
+ } }));
135
130
  };
136
131
  exports.lockNode = lockNode;
137
- var unlockNode = function (pathOrId) {
138
- return cy.apollo({
139
- mutationFile: 'graphql/jcr/mutation/unlockNode.graphql',
140
- variables: {
132
+ var unlockNode = function (pathOrId, apolloOptions) {
133
+ if (apolloOptions === void 0) { apolloOptions = {}; }
134
+ return cy.apollo(__assign(__assign({}, apolloOptions), { mutationFile: 'graphql/jcr/mutation/unlockNode.graphql', variables: {
141
135
  pathOrId: pathOrId
142
- }
143
- });
136
+ } }));
144
137
  };
145
138
  exports.unlockNode = unlockNode;
@@ -0,0 +1,8 @@
1
+ mutation removeMixins($pathOrId: String!, $mixins: [String]! = []) {
2
+ jcr(workspace: EDIT) {
3
+ mutateNode(pathOrId: $pathOrId) {
4
+ removeMixins(mixins: $mixins)
5
+ uuid
6
+ }
7
+ }
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/cypress",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "scripts": {
5
5
  "build": "tsc",
6
6
  "lint": "eslint src -c .eslintrc.json --ext .ts --max-warnings=0"
@@ -1,12 +1,16 @@
1
+ import {ApolloOptions} from '../support';
2
+
1
3
  type Workspace = 'EDIT' | 'LIVE';
2
4
 
3
- export const setNodeProperty = (pathOrId: string, property: string, value: string | Array<string>, language: string): Cypress.Chainable => {
5
+ // eslint-disable-next-line max-params
6
+ export const setNodeProperty = (pathOrId: string, property: string, value: string | Array<string>, language: string, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
4
7
  let mutationFile = 'graphql/jcr/mutation/setProperty.graphql';
5
8
  if (value instanceof Array) {
6
9
  mutationFile = 'graphql/jcr/mutation/setPropertyValues.graphql';
7
10
  }
8
11
 
9
12
  return cy.apollo({
13
+ ...apolloOptions,
10
14
  variables: {
11
15
  pathOrId: pathOrId,
12
16
  property: property,
@@ -17,8 +21,9 @@ export const setNodeProperty = (pathOrId: string, property: string, value: strin
17
21
  });
18
22
  };
19
23
 
20
- export const deleteNode = (pathOrId: string, workspace: Workspace = 'EDIT'): Cypress.Chainable => {
24
+ export const deleteNode = (pathOrId: string, workspace: Workspace = 'EDIT', apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
21
25
  return cy.apollo({
26
+ ...apolloOptions,
22
27
  variables: {
23
28
  pathOrId: pathOrId,
24
29
  workspace
@@ -27,8 +32,9 @@ export const deleteNode = (pathOrId: string, workspace: Workspace = 'EDIT'): Cyp
27
32
  });
28
33
  };
29
34
 
30
- export const deleteNodeProperty = (pathOrId: string, property: string, language: string): Cypress.Chainable => {
35
+ export const deleteNodeProperty = (pathOrId: string, property: string, language: string, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
31
36
  return cy.apollo({
37
+ ...apolloOptions,
32
38
  variables: {
33
39
  pathOrId: pathOrId,
34
40
  property: property,
@@ -47,23 +53,34 @@ export const addNode = (variables: {
47
53
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
54
  children?: any [],
49
55
  mixins?: string []
50
- }): Cypress.Chainable => {
56
+ }, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
51
57
  return cy.apollo({
58
+ ...apolloOptions,
52
59
  variables: variables,
53
60
  mutationFile: 'graphql/jcr/mutation/addNode.graphql'
54
61
  });
55
62
  };
56
63
 
57
- export const addMixins = (pathOrId: string, mixins: string[]): Cypress.Chainable => {
64
+ export const addMixins = (pathOrId: string, mixins: string[], apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
58
65
  return cy.apollo({
66
+ ...apolloOptions,
59
67
  variables: {pathOrId: pathOrId, mixins: mixins},
60
68
  mutationFile: 'graphql/jcr/mutation/addMixins.graphql'
61
69
  });
62
70
  };
63
71
 
72
+ export const removeMixins = (pathOrId: string, mixins: string[], apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
73
+ return cy.apollo({
74
+ ...apolloOptions,
75
+ variables: {pathOrId: pathOrId, mixins: mixins},
76
+ mutationFile: 'graphql/jcr/mutation/removeMixins.graphql'
77
+ });
78
+ };
79
+
64
80
  // eslint-disable-next-line max-params
65
- export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace: Workspace = 'EDIT'): Cypress.Chainable => {
81
+ export const getNodeByPath = (path: string, properties?: string[], language?: string, childrenTypes: string[] = [], workspace: Workspace = 'EDIT', apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
66
82
  return cy.apollo({
83
+ ...apolloOptions,
67
84
  variables: {
68
85
  path: path,
69
86
  properties: properties,
@@ -75,8 +92,9 @@ export const getNodeByPath = (path: string, properties?: string[], language?: st
75
92
  });
76
93
  };
77
94
 
78
- export const getNodeAcl = (path: string): Cypress.Chainable => {
95
+ export const getNodeAcl = (path: string, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
79
96
  return cy.apollo({
97
+ ...apolloOptions,
80
98
  variables: {
81
99
  path: path
82
100
  },
@@ -84,8 +102,9 @@ export const getNodeAcl = (path: string): Cypress.Chainable => {
84
102
  });
85
103
  };
86
104
 
87
- export const moveNode = (pathOrId: string, destParentPathOrId: string, destName?: string): Cypress.Chainable => {
105
+ export const moveNode = (pathOrId: string, destParentPathOrId: string, destName?: string, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
88
106
  return cy.apollo({
107
+ ...apolloOptions,
89
108
  variables: {
90
109
  pathOrId: pathOrId,
91
110
  destParentPathOrId: destParentPathOrId,
@@ -95,8 +114,9 @@ export const moveNode = (pathOrId: string, destParentPathOrId: string, destName?
95
114
  });
96
115
  };
97
116
 
98
- export const getNodeTypes = (filter = {}): Cypress.Chainable => {
117
+ export const getNodeTypes = (filter = {}, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
99
118
  return cy.apollo({
119
+ ...apolloOptions,
100
120
  variables: {
101
121
  filter: filter
102
122
  },
@@ -104,15 +124,14 @@ export const getNodeTypes = (filter = {}): Cypress.Chainable => {
104
124
  });
105
125
  };
106
126
 
107
- export const markForDeletion = (pathOrId: string): Cypress.Chainable => {
108
- return cy.apollo(
109
- {
110
- variables: {
111
- pathOrId: pathOrId
112
- },
113
- mutationFile: 'graphql/jcr/mutation/markForDeletion.graphql'
114
- }
115
- );
127
+ export const markForDeletion = (pathOrId: string, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
128
+ return cy.apollo({
129
+ ...apolloOptions,
130
+ variables: {
131
+ pathOrId: pathOrId
132
+ },
133
+ mutationFile: 'graphql/jcr/mutation/markForDeletion.graphql'
134
+ });
116
135
  };
117
136
 
118
137
  export const uploadFile = (fixturePath: string, parentPathOrId: string, name: string, mimeType: string): Cypress.Chainable => {
@@ -132,8 +151,9 @@ export const uploadFile = (fixturePath: string, parentPathOrId: string, name: st
132
151
  });
133
152
  };
134
153
 
135
- export const lockNode = (pathOrId: string): Cypress.Chainable => {
154
+ export const lockNode = (pathOrId: string, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
136
155
  return cy.apollo({
156
+ ...apolloOptions,
137
157
  mutationFile: 'graphql/jcr/mutation/lockNode.graphql',
138
158
  variables: {
139
159
  pathOrId: pathOrId
@@ -141,8 +161,9 @@ export const lockNode = (pathOrId: string): Cypress.Chainable => {
141
161
  });
142
162
  };
143
163
 
144
- export const unlockNode = (pathOrId: string): Cypress.Chainable => {
164
+ export const unlockNode = (pathOrId: string, apolloOptions: ApolloOptions = {}): Cypress.Chainable => {
145
165
  return cy.apollo({
166
+ ...apolloOptions,
146
167
  mutationFile: 'graphql/jcr/mutation/unlockNode.graphql',
147
168
  variables: {
148
169
  pathOrId: pathOrId