Vinyeh commited on
Commit
85ad5bf
·
verified ·
1 Parent(s): bcbb570

Add pinned source: camunda-dmn-examples (part 23)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c.files.sha256.json +0 -0
  2. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/deployments.js +365 -0
  3. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/index.js +35 -0
  4. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/repository-view.js +28 -0
  5. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/resource.js +75 -0
  6. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/resources.js +69 -0
  7. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/tabs/definitions-tab.js +43 -0
  8. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/tabs/drd-table.js +38 -0
  9. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/sidebar-information.js +112 -0
  10. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/table.js +71 -0
  11. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/tasks/index.js +35 -0
  12. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/tasks/open-tasks-statistics.js +84 -0
  13. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/tasks/tasks-plugin.js +30 -0
  14. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/dashboard-setup.js +199 -0
  15. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/dashboard-spec.js +122 -0
  16. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/decision-definition-spec.js +269 -0
  17. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/decision-instance-spec.js +290 -0
  18. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/decision-setup.js +245 -0
  19. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/decisions-spec.js +102 -0
  20. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/header-spec.js +23 -0
  21. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/process-definition-filter-spec.js +179 -0
  22. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/process-definition-spec.js +298 -0
  23. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/process-instance-spec.js +651 -0
  24. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/process-setup.js +277 -0
  25. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/processes-spec.js +168 -0
  26. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/reports-spec.js +41 -0
  27. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/repository-setup.js +173 -0
  28. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/repository-spec.js +639 -0
  29. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/sideba-spec.js +102 -0
  30. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/suspension-setup.js +54 -0
  31. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/suspension-spec.js +136 -0
  32. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/task-setup.js +64 -0
  33. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/tasks-spec.js +101 -0
  34. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/variable-spec.js +526 -0
  35. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/images/favicon.ico +0 -0
  36. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/lib/jquery.js +18 -0
  37. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/directives/breadcrumbs.html +81 -0
  38. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/directives/breadcrumbs.js +81 -0
  39. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/directives/date.js +69 -0
  40. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-pagination.html +13 -0
  41. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-pagination.js +32 -0
  42. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-searchable-area.html +28 -0
  43. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-searchable-area.js +42 -0
  44. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-tabs.html +15 -0
  45. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-tabs.js +34 -0
  46. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-toolbar.html +9 -0
  47. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-toolbar.js +31 -0
  48. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/controllers/cam-pagination-search-integration.js +244 -0
  49. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/controllers/cam-pagination.js +36 -0
  50. source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/controllers/cam-tabs.js +85 -0
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c.files.sha256.json ADDED
The diff for this file is too large to render. See raw diff
 
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/deployments.js ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Page = require('./repository-view');
21
+
22
+ module.exports = Page.extend({
23
+ formElement: function() {
24
+ return element(by.css('section.deployments'));
25
+ },
26
+
27
+ // deployments ///////////////////////////////////////////
28
+
29
+ deploymentList: function() {
30
+ return this.formElement().all(
31
+ by.repeater('(delta, deployment) in deployments')
32
+ );
33
+ },
34
+
35
+ deploymentName: function(idx) {
36
+ return this.deploymentList()
37
+ .get(idx)
38
+ .element(by.css('.name'))
39
+ .getText();
40
+ },
41
+
42
+ deploymentNameElement: function(idx) {
43
+ return this.deploymentList()
44
+ .get(idx)
45
+ .element(by.binding('deployment.name'));
46
+ },
47
+
48
+ deploymentSource: function(idx) {
49
+ return this.deploymentList()
50
+ .get(idx)
51
+ .element(by.css('.source'))
52
+ .getText();
53
+ },
54
+
55
+ deploymentTenantId: function(idx) {
56
+ return this.deploymentList()
57
+ .get(idx)
58
+ .element(by.css('.tenant-id'))
59
+ .getText();
60
+ },
61
+
62
+ selectDeployment: function(idxOrName) {
63
+ var that = this;
64
+ function callPageObject(idx) {
65
+ that
66
+ .deploymentList()
67
+ .get(idx)
68
+ .click();
69
+ that.waitForElementToBeVisible(
70
+ element(by.css('[cam-resources] .resources'))
71
+ );
72
+ }
73
+
74
+ if (typeof idxOrName === 'number') {
75
+ callPageObject(idxOrName);
76
+ } else {
77
+ this.getDeploymentIndex(idxOrName).then(callPageObject);
78
+ }
79
+ },
80
+
81
+ getDeploymentIndex: function(deploymentName) {
82
+ return this.findElementIndexInRepeater(
83
+ '(delta, deployment) in deployments',
84
+ by.css('.deployment .name'),
85
+ deploymentName
86
+ ).then(function(idx) {
87
+ return idx;
88
+ });
89
+ },
90
+
91
+ deploymentStatus: function(idx) {
92
+ return this.deploymentList()
93
+ .get(idx)
94
+ .getAttribute('class');
95
+ },
96
+
97
+ isDeploymentSelected: function(idx) {
98
+ return this.deploymentStatus(idx).then(function(matcher) {
99
+ if (matcher.indexOf('active') !== -1) {
100
+ return true;
101
+ }
102
+ return false;
103
+ });
104
+ },
105
+
106
+ focusDeployment: function(idx) {
107
+ return browser
108
+ .actions()
109
+ .mouseMove(this.deploymentList().get(idx))
110
+ .perform();
111
+ },
112
+
113
+ // sorting //////////////////////////////////////////////
114
+
115
+ sortingElement: function() {
116
+ return this.formElement().element(
117
+ by.css('[cam-deployments-sorting-choices]')
118
+ );
119
+ },
120
+
121
+ sortingBy: function() {
122
+ return this.sortingElement()
123
+ .element(by.css('.sort-by'))
124
+ .getText();
125
+ },
126
+
127
+ changeSortingBy: function(sortBy) {
128
+ var self = this;
129
+ this.sortingElement()
130
+ .element(by.css('.dropdown'))
131
+ .click()
132
+ .then(function() {
133
+ self
134
+ .sortingElement()
135
+ .element(by.cssContainingText('.sort-by-choice', sortBy))
136
+ .click();
137
+ });
138
+ },
139
+
140
+ changeSortingDirection: function() {
141
+ this.sortingElement()
142
+ .element(by.css('[ng-click="changeOrder()"]'))
143
+ .click();
144
+ },
145
+
146
+ sortingDirection: function() {
147
+ return this.sortingElement()
148
+ .element(by.css('.sort-direction'))
149
+ .getAttribute('class');
150
+ },
151
+
152
+ isSortingDescending: function() {
153
+ return this.sortingDirection().then(function(matcher) {
154
+ if (matcher.indexOf('-down') !== -1) {
155
+ return true;
156
+ }
157
+ return false;
158
+ });
159
+ },
160
+
161
+ isSortingAscending: function() {
162
+ return this.sortingDirection().then(function(matcher) {
163
+ if (matcher.indexOf('-up') !== -1) {
164
+ return true;
165
+ }
166
+ return false;
167
+ });
168
+ },
169
+
170
+ // search ////////////////////////////////////////////////
171
+
172
+ searchElement: function() {
173
+ return this.formElement().element(by.css('[cam-widget-search]'));
174
+ },
175
+
176
+ searchList: function() {
177
+ return this.searchElement().all(by.repeater('search in searches'));
178
+ },
179
+
180
+ searchInputField: function() {
181
+ return this.searchElement().element(by.css('.main-field'));
182
+ },
183
+
184
+ searchTypeDropdown: function(type) {
185
+ return this.searchElement().element(by.cssContainingText('ul > li', type));
186
+ },
187
+
188
+ createSearch: function(type, operator, value, isDateValue) {
189
+ var arity = arguments.length;
190
+ if (arity <= 3) {
191
+ operator = false;
192
+ value = arguments[1];
193
+ isDateValue = arguments[2];
194
+ }
195
+ this.searchElement()
196
+ .element(by.css('.main-field'))
197
+ .click();
198
+ this.searchTypeDropdown(type).click();
199
+
200
+ if (value) {
201
+ if (isDateValue) {
202
+ element(
203
+ by.css('.cam-widget-inline-field > button[ng-click="changeType()"]')
204
+ ).click();
205
+ }
206
+ this.searchList()
207
+ .last()
208
+ .element(by.model('editValue'))
209
+ .sendKeys(value, protractor.Key.ENTER);
210
+ }
211
+
212
+ if (operator) {
213
+ this.searchList()
214
+ .last()
215
+ .element(by.css('[value="operator.value"]'))
216
+ .click();
217
+ this.searchList()
218
+ .last()
219
+ .element(
220
+ by.cssContainingText(
221
+ '[value="operator.value"] .dropdown-menu li',
222
+ operator
223
+ )
224
+ )
225
+ .click();
226
+ }
227
+ },
228
+
229
+ deleteSearch: function(index) {
230
+ this.searchList()
231
+ .get(index)
232
+ .element(by.css('.remove-search'))
233
+ .click();
234
+ },
235
+
236
+ getType: function(index) {
237
+ return this.searchList()
238
+ .get(index)
239
+ .element(by.css('[cam-widget-inline-field][value="type.value"]'))
240
+ .getText();
241
+ },
242
+
243
+ changeType: function(index, type) {
244
+ this.searchList()
245
+ .get(index)
246
+ .element(by.css('[cam-widget-inline-field][value="type.value"]'))
247
+ .click();
248
+ this.searchList()
249
+ .get(index)
250
+ .element(by.cssContainingText('ul > li', type))
251
+ .click();
252
+ },
253
+
254
+ getOperator: function(index) {
255
+ return this.searchList()
256
+ .get(index)
257
+ .element(by.css('[cam-widget-inline-field][value="operator.value"]'))
258
+ .getText();
259
+ },
260
+
261
+ changeOperator: function(index, operator) {
262
+ this.searchList()
263
+ .get(index)
264
+ .element(by.css('[cam-widget-inline-field][value="operator.value"]'))
265
+ .click();
266
+ this.searchList()
267
+ .get(index)
268
+ .element(by.cssContainingText('ul > li', operator))
269
+ .click();
270
+ },
271
+
272
+ getValue: function(index) {
273
+ return this.searchList()
274
+ .get(index)
275
+ .element(by.css('[cam-widget-inline-field][value="value.value"]'))
276
+ .getText();
277
+ },
278
+
279
+ changeValue: function(index, value, isDateValue) {
280
+ this.searchList()
281
+ .get(index)
282
+ .element(by.css('[cam-widget-inline-field][value="value.value"]'))
283
+ .click();
284
+
285
+ if (isDateValue) {
286
+ if (isDateValue) {
287
+ element(
288
+ by.css('.cam-widget-inline-field > button[ng-click="changeType()"]')
289
+ ).click();
290
+ }
291
+ }
292
+
293
+ this.searchList()
294
+ .get(index)
295
+ .element(by.model('editValue'))
296
+ .sendKeys(value, protractor.Key.ENTER);
297
+ },
298
+
299
+ // delete deployment modal ///////////////////////////////////
300
+
301
+ openDeleteDeployment: function(idx) {
302
+ var self = this;
303
+
304
+ this.focusDeployment(idx).then(function() {
305
+ var elem = self
306
+ .deploymentList()
307
+ .get(idx)
308
+ .element(by.css('[ng-click="deleteDeployment($event, deployment)"]'));
309
+ elem.click();
310
+ self.waitForElementToBeVisible(elem, 5000);
311
+ });
312
+ },
313
+
314
+ modalHeader: function() {
315
+ return element(by.css('.modal-header'));
316
+ },
317
+
318
+ modalTitle: function() {
319
+ return this.modalHeader()
320
+ .element(by.css('.modal-title'))
321
+ .getText();
322
+ },
323
+
324
+ modalContent: function() {
325
+ return element(by.css('.modal-body'));
326
+ },
327
+
328
+ modalFooter: function() {
329
+ return element(by.css('.modal-footer'));
330
+ },
331
+
332
+ closeButton: function() {
333
+ return this.modalFooter().element(by.css('[ng-click="$dismiss()"]'));
334
+ },
335
+
336
+ closeModal: function() {
337
+ var theElement = this.modalContent();
338
+ this.closeButton().click();
339
+ this.waitForElementToBeNotPresent(theElement, 5000);
340
+ },
341
+
342
+ deleteButton: function() {
343
+ return this.modalFooter().element(
344
+ by.css('[ng-click="deleteDeployment()"]')
345
+ );
346
+ },
347
+
348
+ deleteDeployment: function() {
349
+ var theElement = this.modalContent();
350
+ this.deleteButton().click();
351
+ this.waitForElementToBeNotPresent(theElement, 5000);
352
+ },
353
+
354
+ infobox: function() {
355
+ return this.modalContent().element(by.css('.alert.alert-info'));
356
+ },
357
+
358
+ cascadeCheckbox: function() {
359
+ return this.modalContent().element(by.css('[name="cascade"'));
360
+ },
361
+
362
+ skipCustomListenersCheckbox: function() {
363
+ return this.modalContent().element(by.css('[name="skipCustomListeners"]'));
364
+ }
365
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/index.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var RepositoryPage = require('./repository-view');
21
+ var DeploymentsPage = require('./deployments');
22
+ var ResourcesPage = require('./resources');
23
+ var ResourcePage = require('./resource');
24
+ var DefinitionTabPage = require('./tabs/definitions-tab');
25
+ var DrdTablePage = require('./tabs/drd-table');
26
+ var AuthenticationPage = require('../../../../common/tests/pages/authentication');
27
+
28
+ module.exports = new RepositoryPage();
29
+ module.exports.deployments = new DeploymentsPage();
30
+ module.exports.resources = new ResourcesPage();
31
+ module.exports.resource = new ResourcePage();
32
+ module.exports.resource.definitions = new DefinitionTabPage();
33
+ module.exports.resource.drdTable = new DrdTablePage();
34
+
35
+ module.exports.authentication = new AuthenticationPage();
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/repository-view.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Page = require('../base');
21
+
22
+ module.exports = Page.extend({
23
+ url: '/camunda/app/cockpit/default/#/repository',
24
+
25
+ tabContent: function() {
26
+ return element(by.css('.ctn-tabbed-content .tab-content'));
27
+ }
28
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/resource.js ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Page = require('./repository-view');
21
+
22
+ module.exports = Page.extend({
23
+ formElement: function() {
24
+ return element(by.css('[cam-resource-wrapper]'));
25
+ },
26
+
27
+ noResourceInfoText: function() {
28
+ return this.formElement()
29
+ .element(by.css('.no-resource'))
30
+ .getText();
31
+ },
32
+
33
+ waitForResourceDetailView: function() {
34
+ var elementToWaitFor = this.resourceName();
35
+ this.waitForElementToBeVisible(elementToWaitFor);
36
+ },
37
+
38
+ resourceName: function() {
39
+ return this.formElement()
40
+ .element(by.css('h2.name'))
41
+ .getText();
42
+ },
43
+
44
+ resourceVersionElement: function() {
45
+ return this.formElement().element(by.css('header .version'));
46
+ },
47
+
48
+ resourceVersion: function() {
49
+ return this.resourceVersionElement().getText();
50
+ },
51
+
52
+ downloadButton: function() {
53
+ return element(by.css('.download-resource'));
54
+ },
55
+
56
+ bpmnDiagramFormElement: function() {
57
+ return element(by.css('[cam-widget-bpmn-viewer]'));
58
+ },
59
+
60
+ dmnDiagramFormElement: function() {
61
+ return element(by.css('[cam-widget-dmn-viewer]'));
62
+ },
63
+
64
+ cmmnDiagramFormElement: function() {
65
+ return element(by.css('[cam-widget-cmmn-viewer]'));
66
+ },
67
+
68
+ imageFormElement: function() {
69
+ return element(by.css('.image-resource'));
70
+ },
71
+
72
+ unkownResourceFormElement: function() {
73
+ return element(by.css('.unkown-resource'));
74
+ }
75
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/resources.js ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Page = require('./repository-view');
21
+
22
+ module.exports = Page.extend({
23
+ formElement: function() {
24
+ return element(by.css('[cam-resources]'));
25
+ },
26
+
27
+ resourceList: function() {
28
+ return this.formElement().all(
29
+ by.repeater('(delta, resource) in resources')
30
+ );
31
+ },
32
+
33
+ getResourceIndex: function(resourceName) {
34
+ return this.findElementIndexInRepeater(
35
+ '(delta, resource) in resources',
36
+ by.css('.name .resource'),
37
+ resourceName
38
+ ).then(function(idx) {
39
+ return idx;
40
+ });
41
+ },
42
+
43
+ selectResource: function(idxOrName) {
44
+ var self = this;
45
+ function callPageObject(idx) {
46
+ self
47
+ .resourceList()
48
+ .get(idx)
49
+ .element(by.css('a'))
50
+ .click();
51
+ self.waitForElementToBeVisible(
52
+ element(by.css('[cam-resource-meta] .name'))
53
+ );
54
+ }
55
+
56
+ if (typeof idxOrName === 'number') {
57
+ callPageObject.call(this, idxOrName);
58
+ } else {
59
+ this.getResourceIndex(idxOrName).then(callPageObject.bind(this));
60
+ }
61
+ },
62
+
63
+ resourceName: function(idx) {
64
+ return this.resourceList()
65
+ .get(idx)
66
+ .element(by.css('a'))
67
+ .getText();
68
+ }
69
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/tabs/definitions-tab.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Table = require('./../../table');
21
+
22
+ module.exports = Table.extend({
23
+ tabRepeater: 'resourceDetailTab in resourceDetailTabs',
24
+ tabIndex: 0,
25
+ tabLabel: 'Definitions',
26
+ tableRepeater: 'definition in definitions',
27
+
28
+ name: function(idx) {
29
+ return this.tableItem(idx, '.name');
30
+ },
31
+
32
+ key: function(idx) {
33
+ return this.tableItem(idx, '.key');
34
+ },
35
+
36
+ version: function(idx) {
37
+ return this.tableItem(idx, '.version');
38
+ },
39
+
40
+ instanceCount: function(idx) {
41
+ return this.tableItem(idx, '.instance-count');
42
+ }
43
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/repository/tabs/drd-table.js ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Page = require('../repository-view');
21
+
22
+ module.exports = Page.extend({
23
+ formElement: function() {
24
+ return element(by.css('.drd-definitions.cam-table tbody'));
25
+ },
26
+
27
+ name: function(idx) {
28
+ return this.formElement().element(by.css('.name'));
29
+ },
30
+
31
+ key: function(idx) {
32
+ return this.formElement().element(by.css('.key'));
33
+ },
34
+
35
+ version: function(idx) {
36
+ return this.formElement().element(by.css('.version'));
37
+ }
38
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/sidebar-information.js ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Base = require('./base');
21
+
22
+ module.exports = Base.extend({
23
+ sidebarTabs: function() {
24
+ return element(by.css('.ctn-sidebar .nav-tabs'));
25
+ },
26
+
27
+ sidebarTabClick: function(name) {
28
+ return this.sidebarTabs()
29
+ .element(by.cssContainingText('a', name))
30
+ .click();
31
+ },
32
+
33
+ listElement: function() {
34
+ return element(by.css('.ctn-sidebar dl'));
35
+ },
36
+
37
+ instanceId: function() {
38
+ return this.listElement()
39
+ .element(by.css('.instance-id'))
40
+ .getText();
41
+ },
42
+
43
+ definitionId: function() {
44
+ return this.listElement()
45
+ .element(by.css('.definition-id'))
46
+ .getText();
47
+ },
48
+
49
+ definitionName: function() {
50
+ return this.listElement()
51
+ .element(by.css('.definition-name'))
52
+ .getText();
53
+ },
54
+
55
+ definitionKey: function() {
56
+ return this.listElement()
57
+ .element(by.css('.definition-key'))
58
+ .getText();
59
+ },
60
+
61
+ definitionVersion: function() {
62
+ return this.listElement()
63
+ .element(by.css('.definition-version'))
64
+ .getText();
65
+ },
66
+
67
+ definitionVersionDropdownButton: function() {
68
+ return this.listElement().element(
69
+ by.css('.definition-version .dropdown-toggle')
70
+ );
71
+ },
72
+
73
+ definitionVersionDropdownButtonText: function() {
74
+ return this.definitionVersionDropdownButton().getText();
75
+ },
76
+
77
+ definitionVersionDropdownOptions: function() {
78
+ return this.listElement().all(
79
+ by.css('.definition-version .dropdown-menu li')
80
+ );
81
+ },
82
+
83
+ definitionInstancesCurrent: function() {
84
+ return this.listElement()
85
+ .element(by.css('.current-version'))
86
+ .getText();
87
+ },
88
+
89
+ definitionInstancesAll: function() {
90
+ return this.listElement()
91
+ .element(by.css('.all-versions'))
92
+ .getText();
93
+ },
94
+
95
+ deploymentId: function() {
96
+ return this.listElement()
97
+ .element(by.css('.deployment-id'))
98
+ .getText();
99
+ },
100
+
101
+ tenantId: function() {
102
+ return this.listElement()
103
+ .element(by.css('.tenant-id'))
104
+ .getText();
105
+ },
106
+
107
+ versionTag: function() {
108
+ return this.listElement()
109
+ .element(by.css('.version-tag'))
110
+ .getText();
111
+ }
112
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/table.js ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Table = require('./base');
21
+
22
+ module.exports = Table.extend({
23
+ tableTabs: function() {
24
+ return element.all(by.repeater(this.tabRepeater));
25
+ },
26
+
27
+ selectTab: function() {
28
+ return this.tableTabs()
29
+ .get(this.tabIndex)
30
+ .click();
31
+ },
32
+
33
+ tabSelectionStatus: function() {
34
+ return this.tableTabs(this.tabRepeater)
35
+ .get(this.tabIndex)
36
+ .getAttribute('class');
37
+ },
38
+
39
+ isTabSelected: function() {
40
+ return this.tabSelectionStatus().then(function(classes) {
41
+ return classes.indexOf('active') !== -1;
42
+ });
43
+ },
44
+
45
+ tabName: function() {
46
+ return this.tableTabs(this.repeater)
47
+ .get(this.tabIndex)
48
+ .element(by.css('[class="ng-binding"]'))
49
+ .getText();
50
+ },
51
+
52
+ table: function() {
53
+ return element(by.css('.ctn-tabbed-content')).all(
54
+ by.repeater(this.tableRepeater)
55
+ );
56
+ },
57
+
58
+ tableItem: function(item, elementSelector) {
59
+ if (arguments.length === 1) {
60
+ return this.table().get(item);
61
+ }
62
+
63
+ if (typeof elementSelector === 'string') {
64
+ elementSelector = by.css(elementSelector);
65
+ }
66
+
67
+ return this.table()
68
+ .get(item)
69
+ .element(elementSelector);
70
+ }
71
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/tasks/index.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Base = require('./../base');
21
+ var OpenTasksStatisticsPage = require('./open-tasks-statistics');
22
+ var AuthenticationPage = require('../../../../common/tests/pages/authentication');
23
+
24
+ var Page = Base.extend({
25
+ url: '/camunda/app/cockpit/default/#/tasks',
26
+
27
+ pluginList: function() {
28
+ return element.all(by.css('.dashboard'));
29
+ }
30
+ });
31
+
32
+ module.exports = new Page();
33
+
34
+ module.exports.openTasksStatistics = new OpenTasksStatisticsPage();
35
+ module.exports.authentication = new AuthenticationPage();
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/tasks/open-tasks-statistics.js ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Base = require('./tasks-plugin');
21
+
22
+ module.exports = Base.extend({
23
+ listObject: function() {
24
+ return element(by.css('.tasks-dashboard'));
25
+ },
26
+
27
+ taskStatisticsTable: function() {
28
+ return this.listObject().element(by.css('#open-task-statistics'));
29
+ },
30
+
31
+ taskGroupTable: function() {
32
+ return this.listObject().element(by.css('#task-group-counts'));
33
+ },
34
+
35
+ taskStatisticsList: function() {
36
+ return this.taskStatisticsTable().all(
37
+ by.repeater('taskStatistic in taskStatistics')
38
+ );
39
+ },
40
+
41
+ taskGroupList: function() {
42
+ return this.taskGroupTable().all(by.repeater('taskGroup in taskGroups'));
43
+ },
44
+
45
+ taskStatisticsTableHeadCount: function() {
46
+ return this.taskStatisticsTable()
47
+ .element(by.binding('{{ openTasksCount }}'))
48
+ .getText();
49
+ },
50
+
51
+ taskStatisticLabel: function(item) {
52
+ return this.taskStatisticsList()
53
+ .get(item)
54
+ .element(by.binding('{{ taskStatistic.label }}'))
55
+ .getText();
56
+ },
57
+
58
+ taskStatisticCount: function(item) {
59
+ return this.taskStatisticsList()
60
+ .get(item)
61
+ .element(by.binding('{{ taskStatistic.count }}'))
62
+ .getText();
63
+ },
64
+
65
+ taskGroupName: function(item) {
66
+ return this.taskGroupList()
67
+ .get(item)
68
+ .element(by.binding('{{ formatGroupName(taskGroup.groupName) }}'))
69
+ .getText();
70
+ },
71
+
72
+ taskGroupCount: function(item) {
73
+ return this.taskGroupList()
74
+ .get(item)
75
+ .element(by.binding('{{ taskGroup.taskCount }}'))
76
+ .getText();
77
+ },
78
+
79
+ multipleGroupsInfo: function() {
80
+ return this.listObject()
81
+ .element(by.css('#multiple-groups-info'))
82
+ .isDisplayed();
83
+ }
84
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/pages/tasks/tasks-plugin.js ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var Base = require('./../dashboard/dashboard-view');
21
+
22
+ module.exports = Base.extend({
23
+ pluginList: function() {
24
+ return element.all(by.css('.dashboard'));
25
+ },
26
+
27
+ pluginObject: function() {
28
+ return this.pluginList().get(0);
29
+ }
30
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/dashboard-setup.js ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var factory = require('../../../common/tests/setup-factory.js'),
21
+ readResource = factory.readResource,
22
+ combine = factory.combine,
23
+ operation = factory.operation;
24
+
25
+ var fragment1 = combine(
26
+ operation('deployment', 'create', [
27
+ {
28
+ deploymentName: 'failing-process',
29
+ files: [
30
+ {
31
+ name: 'failing-process.bpmn',
32
+ content: readResource('failing-process.bpmn')
33
+ }
34
+ ]
35
+ }
36
+ ])
37
+ );
38
+
39
+ var fragment2 = combine(
40
+ operation('process-definition', 'start', [
41
+ {
42
+ key: 'failing-process',
43
+ businessKey: 'Instance1',
44
+ variables: {
45
+ test: {
46
+ value: 1,
47
+ type: 'Integer'
48
+ }
49
+ }
50
+ }
51
+ ])
52
+ );
53
+
54
+ var fragment3 = combine(
55
+ operation('deployment', 'create', [
56
+ {
57
+ deploymentName: 'process-with-subprocess',
58
+ files: [
59
+ {
60
+ name: 'process-with-sub-process.bpmn',
61
+ content: readResource('process-with-sub-process.bpmn')
62
+ }
63
+ ]
64
+ }
65
+ ]),
66
+
67
+ operation('process-definition', 'start', [
68
+ {
69
+ key: 'processWithSubProcess',
70
+ businessKey: 'Instance1',
71
+ variables: {
72
+ test: {
73
+ value: 1,
74
+ type: 'Integer'
75
+ }
76
+ }
77
+ }
78
+ ])
79
+ );
80
+
81
+ var dmnFragment1 = operation('deployment', 'create', [
82
+ {
83
+ deploymentName: 'assign-approver',
84
+ files: [
85
+ {
86
+ name: 'assign-approver-groups.dmn',
87
+ content: readResource('assign-approver-groups.dmn')
88
+ }
89
+ ]
90
+ },
91
+ {
92
+ deploymentName: 'assign-approver',
93
+ files: [
94
+ {
95
+ name: 'assign-approver-groups-changed.dmn',
96
+ content: readResource('assign-approver-groups-changed.dmn')
97
+ }
98
+ ]
99
+ }
100
+ ]);
101
+
102
+ var dmnFragment2 = operation('deployment', 'create', [
103
+ {
104
+ deploymentName: 'dmn-without-name',
105
+ files: [
106
+ {
107
+ name: 'dmn-without-name.dmn',
108
+ content: readResource('dmn-without-name.dmn')
109
+ }
110
+ ]
111
+ }
112
+ ]);
113
+
114
+ var multiTenancyDeployment = combine(
115
+ operation('deployment', 'create', [
116
+ {
117
+ deploymentName: 'processTenantOne',
118
+ tenantId: 'tenant1',
119
+ files: [
120
+ {
121
+ name: 'invoice.bpmn',
122
+ filename: 'invoice-deployment-binding.bpmn',
123
+ content: readResource('invoice-deployment-binding.bpmn')
124
+ },
125
+ {
126
+ name: 'assign-approver-groups.dmn',
127
+ content: readResource('assign-approver-groups.dmn')
128
+ }
129
+ ]
130
+ }
131
+ ]),
132
+
133
+ operation('deployment', 'create', [
134
+ {
135
+ deploymentName: 'processNoTenant',
136
+ files: [
137
+ {
138
+ name: 'invoice.bpmn',
139
+ filename: 'invoice-deployment-binding.bpmn',
140
+ content: readResource('invoice-deployment-binding.bpmn')
141
+ },
142
+ {
143
+ name: 'assign-approver-groups.dmn',
144
+ content: readResource('assign-approver-groups.dmn')
145
+ }
146
+ ]
147
+ }
148
+ ]),
149
+
150
+ operation('process-definition', 'start', [
151
+ {
152
+ key: 'invoice',
153
+ tenantId: 'tenant1',
154
+ variables: {
155
+ creditor: {
156
+ value: 'test',
157
+ type: 'String'
158
+ },
159
+ amount: {
160
+ value: 20.5,
161
+ type: 'Double'
162
+ },
163
+ invoiceCategory: {
164
+ value: 'Travel Expenses',
165
+ type: 'String'
166
+ }
167
+ }
168
+ }
169
+ ]),
170
+
171
+ operation('process-definition', 'start', [
172
+ {
173
+ key: 'invoice',
174
+ variables: {
175
+ creditor: {
176
+ value: 'test',
177
+ type: 'String'
178
+ },
179
+ amount: {
180
+ value: 15.0,
181
+ type: 'Double'
182
+ },
183
+ invoiceCategory: {
184
+ value: 'Travel Expenses',
185
+ type: 'String'
186
+ }
187
+ }
188
+ }
189
+ ])
190
+ );
191
+
192
+ module.exports = {
193
+ setup1: fragment1,
194
+ setup2: fragment2,
195
+ setup3: fragment3,
196
+ setup4: dmnFragment1,
197
+ setup5: dmnFragment2,
198
+ multiTenancySetup: multiTenancyDeployment
199
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/dashboard-spec.js ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var testHelper = require('../../../common/tests/test-helper');
21
+ var setupFile = require('./dashboard-setup');
22
+
23
+ var dashboardPage = require('../pages/dashboard');
24
+
25
+ describe('Cockpit Dashboard Spec', function() {
26
+ before(function() {
27
+ return testHelper(setupFile.setup1, function() {
28
+ dashboardPage.navigateToWebapp('Cockpit');
29
+ dashboardPage.authentication.userLogin('admin', 'admin');
30
+ });
31
+ });
32
+
33
+ it('should display all sections of the page in the header', function() {
34
+ expect(dashboardPage.navbarItem(0).getText()).to.eventually.eql(
35
+ 'Processes'
36
+ );
37
+ expect(dashboardPage.navbarItem(1).getText()).to.eventually.eql(
38
+ 'Decisions'
39
+ );
40
+ expect(dashboardPage.navbarItem(2).getText()).to.eventually.eql(
41
+ 'Human Tasks'
42
+ );
43
+ expect(dashboardPage.navbarItem(3).getText()).to.eventually.eql('More');
44
+
45
+ dashboardPage.navbarDropDown().click();
46
+ expect(dashboardPage.navbarDropDownItem(0).getText()).to.eventually.eql(
47
+ 'Deployments'
48
+ );
49
+ expect(dashboardPage.navbarDropDownItem(1).getText()).to.eventually.eql(
50
+ 'Batches'
51
+ );
52
+ });
53
+
54
+ it('should display information about actual state', function() {
55
+ expect(
56
+ element(by.css('.actual .process-instances .value')).getText()
57
+ ).to.eventually.eql('0');
58
+ expect(
59
+ element(by.css('.actual .open-human-tasks .value')).getText()
60
+ ).to.eventually.eql('0');
61
+ expect(
62
+ element(by.css('.actual .open-incidents .value')).getText()
63
+ ).to.eventually.eql('0');
64
+ });
65
+
66
+ it('should display information about deployed resources', function() {
67
+ expect(
68
+ element(by.css('.deployed .processes .value')).getText()
69
+ ).to.eventually.eql('1');
70
+ expect(
71
+ element(by.css('.deployed .decisions .value')).getText()
72
+ ).to.eventually.eql('0');
73
+ expect(
74
+ element(by.css('.deployed .cases .value')).getText()
75
+ ).to.eventually.eql('0');
76
+ expect(
77
+ element(by.css('.deployed .deployments .value')).getText()
78
+ ).to.eventually.eql('1');
79
+ });
80
+
81
+ describe('section toggle buttons', function() {
82
+ it('can be used to hide a section', function() {
83
+ var section = element(by.css('section.actual'));
84
+ var btn = section.element(by.css('.section-toggle'));
85
+
86
+ expect(section.element(by.css('.stats')).isPresent()).to.eventually.eql(
87
+ true
88
+ );
89
+ expect(btn.isPresent()).to.eventually.eql(true);
90
+
91
+ btn.click();
92
+
93
+ expect(section.element(by.css('.stats')).isPresent()).to.eventually.eql(
94
+ false
95
+ );
96
+ });
97
+
98
+ it('retains the state after page reload', function() {
99
+ browser.refresh();
100
+ var section = element(by.css('section.actual'));
101
+
102
+ expect(section.element(by.css('.stats')).isPresent()).to.eventually.eql(
103
+ false
104
+ );
105
+ });
106
+
107
+ it('can be used to show the sections again', function() {
108
+ var section = element(by.css('section.actual'));
109
+ var btn = section.element(by.css('.section-toggle'));
110
+
111
+ expect(section.element(by.css('.stats')).isPresent()).to.eventually.eql(
112
+ false
113
+ );
114
+
115
+ btn.click();
116
+
117
+ expect(section.element(by.css('.stats')).isPresent()).to.eventually.eql(
118
+ true
119
+ );
120
+ });
121
+ });
122
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/decision-definition-spec.js ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /* jshint ignore:start */
19
+ 'use strict';
20
+
21
+ var testHelper = require('../../../common/tests/test-helper');
22
+ var setupFile = require('./decision-setup');
23
+
24
+ var dashboardPage = require('../pages/dashboard');
25
+ var decisionsPage = require('../pages/decisions');
26
+ var definitionPage = require('../pages/decision-definition');
27
+
28
+ describe('Cockpit Decision Definition Spec', function() {
29
+ describe('page navigation', function() {
30
+ before(function() {
31
+ return testHelper(setupFile.setup1, function() {
32
+ dashboardPage.navigateToWebapp('Cockpit');
33
+ dashboardPage.authentication.userLogin('admin', 'admin');
34
+ dashboardPage.goToSection('Decisions');
35
+ });
36
+ });
37
+
38
+ it('should go to decision definition view', function() {
39
+ // given
40
+ decisionsPage.deployedDecisionsList
41
+ .decisionName(0)
42
+ .then(function(decisionName) {
43
+ // when
44
+ decisionsPage.deployedDecisionsList.selectDecision(0);
45
+
46
+ // then
47
+ expect(definitionPage.information.definitionName()).to.eventually.eql(
48
+ decisionName
49
+ );
50
+ });
51
+ });
52
+ });
53
+
54
+ describe('instance list', function() {
55
+ before(function() {
56
+ return testHelper(setupFile.setup1, function() {
57
+ dashboardPage.navigateToWebapp('Cockpit');
58
+ dashboardPage.authentication.userLogin('admin', 'admin');
59
+ dashboardPage.goToSection('Decisions');
60
+ decisionsPage.deployedDecisionsList.selectDecision(0);
61
+ });
62
+ });
63
+
64
+ it('should display a list of evaluated decision instances', function() {
65
+ expect(
66
+ definitionPage.decisionInstancesTab.table().count()
67
+ ).to.eventually.eql(1);
68
+ });
69
+
70
+ it('should go to the process definition page on click on process definition key', function() {
71
+ definitionPage.decisionInstancesTab.selectProcessDefinitionKey(0);
72
+ expect(browser.getCurrentUrl()).to.eventually.contain(
73
+ '#/process-definition/'
74
+ );
75
+ });
76
+
77
+ it('should go to the process instance page on click on process instance id', function() {
78
+ browser.navigate().back();
79
+ definitionPage.decisionInstancesTab.selectProcessInstanceId(0);
80
+ expect(browser.getCurrentUrl()).to.eventually.contain(
81
+ '#/process-instance/'
82
+ );
83
+ });
84
+ });
85
+
86
+ describe('table interaction', function() {
87
+ before(function() {
88
+ return testHelper(setupFile.setup1, function() {
89
+ dashboardPage.navigateToWebapp('Cockpit');
90
+ dashboardPage.authentication.userLogin('admin', 'admin');
91
+ dashboardPage.goToSection('Decisions');
92
+ decisionsPage.deployedDecisionsList.selectDecision(0);
93
+ });
94
+ });
95
+
96
+ it('should display decision table', function() {
97
+ // then
98
+ expect(definitionPage.table.tableElement().isDisplayed()).to.eventually.be
99
+ .true;
100
+ });
101
+ });
102
+
103
+ describe('search widget', function() {
104
+ before(function() {
105
+ return testHelper(setupFile.setup5, function() {
106
+ dashboardPage.navigateToWebapp('Cockpit');
107
+ dashboardPage.authentication.userLogin('admin', 'admin');
108
+ dashboardPage.goToSection('Decisions');
109
+ decisionsPage.deployedDecisionsList.selectDecision(0);
110
+ });
111
+ });
112
+
113
+ afterEach(function() {
114
+ definitionPage.search.clearSearch();
115
+ });
116
+
117
+ it('should add new filter', function() {
118
+ //when
119
+ definitionPage.search.createSearch('ID', '1.5');
120
+
121
+ //then
122
+ var searchPillsCount = definitionPage.search.searchPills().count();
123
+
124
+ expect(searchPillsCount).to.eventually.eql(1);
125
+ });
126
+
127
+ it('should empty table when non existing value is chosen', function() {
128
+ //when
129
+ definitionPage.search.createSearch('ID', 'ff');
130
+
131
+ //then
132
+ var tableRowsCount = definitionPage.decisionInstancesTab
133
+ .table()
134
+ .all(by.css('tbody > tr'))
135
+ .count();
136
+
137
+ expect(tableRowsCount).to.eventually.eql(0);
138
+ });
139
+
140
+ it('should have after and before operators for Evaluated Date filter', function() {
141
+ //given
142
+ definitionPage.search.createSearch('Evaluated Date');
143
+
144
+ //when
145
+ definitionPage.search
146
+ .searchPills()
147
+ .last()
148
+ .element(by.css('[value="operator.value"]'))
149
+ .click();
150
+
151
+ //then
152
+ expect(isOperatorDisplayed('after')).to.eventually.be.true;
153
+ expect(isOperatorDisplayed('before')).to.eventually.be.true;
154
+
155
+ function isOperatorDisplayed(operator) {
156
+ return definitionPage.search
157
+ .searchPills()
158
+ .last()
159
+ .element(
160
+ by.cssContainingText(
161
+ '[value="operator.value"] .dropdown-menu li',
162
+ operator
163
+ )
164
+ )
165
+ .isDisplayed();
166
+ }
167
+ });
168
+ });
169
+
170
+ describe('version interaction', function() {
171
+ before(function() {
172
+ return testHelper(setupFile.setup2, function() {
173
+ dashboardPage.navigateToWebapp('Cockpit');
174
+ dashboardPage.authentication.userLogin('admin', 'admin');
175
+ dashboardPage.goToSection('Decisions');
176
+ decisionsPage.deployedDecisionsList.selectDecision(0);
177
+ });
178
+ });
179
+
180
+ it('should display the most recent version initially', function() {
181
+ expect(
182
+ definitionPage.information.definitionVersionDropdownButtonText()
183
+ ).to.eventually.eql('2');
184
+ });
185
+
186
+ it('should list all available versions', function() {
187
+ // when
188
+ definitionPage.information.definitionVersionDropdownButton().click();
189
+
190
+ // then
191
+ expect(
192
+ definitionPage.information.definitionVersionDropdownOptions().count()
193
+ ).to.eventually.eql(2);
194
+ });
195
+
196
+ it('should load the requested version on selection', function() {
197
+ // when
198
+ definitionPage.information
199
+ .definitionVersionDropdownOptions()
200
+ .get(0)
201
+ .click();
202
+
203
+ // then
204
+ expect(
205
+ definitionPage.information.definitionVersionDropdownButtonText()
206
+ ).to.eventually.eql('2');
207
+ });
208
+ });
209
+
210
+ describe('multi tenancy', function() {
211
+ before(function() {
212
+ return testHelper(setupFile.multiTenancySetup, function() {
213
+ dashboardPage.navigateToWebapp('Cockpit');
214
+ dashboardPage.authentication.userLogin('admin', 'admin');
215
+ dashboardPage.goToSection('Decisions');
216
+ });
217
+ });
218
+
219
+ describe('decision definition with tenant id', function() {
220
+ before(function() {
221
+ // second decision definition is deployed for tenant with id 'tenant1'
222
+ decisionsPage.deployedDecisionsList.selectDecision(1);
223
+ });
224
+
225
+ it('should display definition tenant id', function() {
226
+ expect(definitionPage.information.tenantId()).to.eventually.contain(
227
+ 'tenant1'
228
+ );
229
+ });
230
+
231
+ it('should display definition version for tenant only', function() {
232
+ expect(
233
+ definitionPage.information.definitionVersion()
234
+ ).to.eventually.contain('1');
235
+ expect(
236
+ definitionPage.information
237
+ .definitionVersionDropdownButton()
238
+ .isPresent()
239
+ ).to.eventually.be.false;
240
+ });
241
+ });
242
+
243
+ describe('decision definition without tenant id', function() {
244
+ before(function() {
245
+ dashboardPage.navigateToWebapp('Cockpit');
246
+ // first decision definition is deployed without tenant id
247
+ dashboardPage.goToSection('Decisions');
248
+ decisionsPage.deployedDecisionsList.selectDecision(0);
249
+ });
250
+
251
+ it('should not display definition tenant id', function() {
252
+ expect(definitionPage.information.tenantId()).to.eventually.contain(
253
+ 'null'
254
+ );
255
+ });
256
+
257
+ it('should display definition version for non-tenant only', function() {
258
+ expect(
259
+ definitionPage.information.definitionVersion()
260
+ ).to.eventually.contain('1');
261
+ expect(
262
+ definitionPage.information
263
+ .definitionVersionDropdownButton()
264
+ .isPresent()
265
+ ).to.eventually.be.false;
266
+ });
267
+ });
268
+ });
269
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/decision-instance-spec.js ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /* jshint ignore:start */
19
+ 'use strict';
20
+
21
+ var testHelper = require('../../../common/tests/test-helper');
22
+ var setupFile = require('./decision-setup');
23
+
24
+ var dashboardPage = require('../pages/dashboard');
25
+ var decisionsPage = require('../pages/decisions');
26
+ var definitionPage = require('../pages/decision-definition');
27
+ var instancePage = require('../pages/decision-instance');
28
+
29
+ describe('Cockpit Decision Instance Spec', function() {
30
+ describe('page navigation', function() {
31
+ before(function() {
32
+ return testHelper(setupFile.setup1, function() {
33
+ dashboardPage.navigateToWebapp('Cockpit');
34
+ dashboardPage.authentication.userLogin('admin', 'admin');
35
+ dashboardPage.goToSection('Decisions');
36
+ });
37
+ });
38
+
39
+ it('should go to decision definition view', function() {
40
+ // given
41
+ decisionsPage.deployedDecisionsList
42
+ .decisionName(0)
43
+ .then(function(decisionName) {
44
+ // when
45
+ decisionsPage.deployedDecisionsList
46
+ .selectDecision(0)
47
+ .then(function() {
48
+ // then
49
+ expect(
50
+ dashboardPage.breadcrumb.activeCrumb().getText()
51
+ ).to.eventually.eql(decisionName);
52
+ });
53
+ });
54
+ });
55
+
56
+ it('should go to process instance view', function() {
57
+ // given
58
+ definitionPage.decisionInstancesTab
59
+ .instanceId(0)
60
+ .then(function(instanceId) {
61
+ // when
62
+ definitionPage.decisionInstancesTab
63
+ .selectInstanceId(0)
64
+ .then(function() {
65
+ // then
66
+ expect(instancePage.information.instanceId()).to.eventually.eql(
67
+ instanceId
68
+ );
69
+ expect(
70
+ dashboardPage.breadcrumb.activeCrumb().getText()
71
+ ).to.eventually.eql(instanceId);
72
+ });
73
+ });
74
+ });
75
+ });
76
+
77
+ describe('table interaction', function() {
78
+ before(function() {
79
+ return testHelper(setupFile.setup1, function() {
80
+ dashboardPage.navigateToWebapp('Cockpit');
81
+ dashboardPage.authentication.userLogin('admin', 'admin');
82
+ dashboardPage.goToSection('Decisions');
83
+ });
84
+ });
85
+
86
+ it('should display decision table', function() {
87
+ // when
88
+ decisionsPage.deployedDecisionsList.selectDecision(0);
89
+ definitionPage.decisionInstancesTab.selectInstanceId(0);
90
+
91
+ // then
92
+ expect(instancePage.table.tableElement().isDisplayed()).to.eventually.be
93
+ .true;
94
+ });
95
+
96
+ it('should highlight fired rules', function() {
97
+ expect(
98
+ instancePage.table.row(0).getAttribute('class')
99
+ ).to.eventually.contain('fired');
100
+ });
101
+
102
+ it('should show the inputs on the table', function() {
103
+ expect(instancePage.table.labelRow().getInputText(0)).to.eventually.eql(
104
+ 'Invoice Amount = 100'
105
+ );
106
+ expect(instancePage.table.labelRow().getInputText(1)).to.eventually.eql(
107
+ 'Invoice Category = travelExpenses'
108
+ );
109
+ });
110
+
111
+ it('should show the outputs on the table', function() {
112
+ expect(instancePage.table.ruleRow(0).getCellText(3)).to.eventually.eql(
113
+ '"accounting" = accounting'
114
+ );
115
+ });
116
+ });
117
+
118
+ describe('in-/outputs', function() {
119
+ before(function() {
120
+ return testHelper(setupFile.setup1, function() {
121
+ dashboardPage.navigateToWebapp('Cockpit');
122
+ dashboardPage.authentication.userLogin('admin', 'admin');
123
+ dashboardPage.goToSection('Decisions');
124
+ });
125
+ });
126
+
127
+ it('should go to decision instance view', function() {
128
+ // when
129
+ decisionsPage.deployedDecisionsList.selectDecision(0);
130
+
131
+ definitionPage.decisionInstancesTab
132
+ .instanceId(0)
133
+ .then(function(instanceId) {
134
+ definitionPage.decisionInstancesTab.selectInstanceId(0);
135
+
136
+ // then
137
+ expect(
138
+ dashboardPage.breadcrumb.activeCrumb().getText()
139
+ ).to.eventually.eql(instanceId);
140
+ });
141
+ });
142
+
143
+ it('show inputs for the decision instance', function() {
144
+ // when
145
+ instancePage.inputsTab.selectTab();
146
+
147
+ // then
148
+ expect(instancePage.inputsTab.variableValue(0)).to.eventually.eql('100');
149
+ });
150
+
151
+ it('show outputs for the decision instance', function() {
152
+ // when
153
+ instancePage.outputsTab.selectTab();
154
+
155
+ // then
156
+ expect(instancePage.outputsTab.variableValue(0)).to.eventually.eql(
157
+ 'accounting'
158
+ );
159
+ });
160
+ });
161
+
162
+ describe('in-/outputs without clause name', function() {
163
+ before(function() {
164
+ return testHelper(setupFile.setup3, function() {
165
+ dashboardPage.navigateToWebapp('Cockpit');
166
+ dashboardPage.authentication.userLogin('admin', 'admin');
167
+ dashboardPage.goToSection('Decisions');
168
+ });
169
+ });
170
+
171
+ it('should go to decision instance view', function() {
172
+ // when
173
+ decisionsPage.deployedDecisionsList.selectDecision(0);
174
+
175
+ definitionPage.decisionInstancesTab
176
+ .instanceId(0)
177
+ .then(function(instanceId) {
178
+ definitionPage.decisionInstancesTab.selectInstanceId(0);
179
+
180
+ // then
181
+ expect(
182
+ dashboardPage.breadcrumb.activeCrumb().getText()
183
+ ).to.eventually.eql(instanceId);
184
+ });
185
+ });
186
+
187
+ it('show inputs clause id', function() {
188
+ // when
189
+ instancePage.inputsTab.selectTab();
190
+
191
+ // then
192
+ expect(instancePage.inputsTab.variableName(0)).to.eventually.eql(
193
+ 'clause1'
194
+ );
195
+ });
196
+
197
+ it('show outputs clause id', function() {
198
+ // when
199
+ instancePage.outputsTab.selectTab();
200
+
201
+ // then
202
+ expect(instancePage.outputsTab.variableName(0)).to.eventually.eql(
203
+ 'clause3'
204
+ );
205
+ });
206
+ });
207
+
208
+ describe('actions', function() {
209
+ describe('navigate to process instance', function() {
210
+ before(function() {
211
+ return testHelper(setupFile.setup1, function() {
212
+ dashboardPage.navigateToWebapp('Cockpit');
213
+ dashboardPage.authentication.userLogin('admin', 'admin');
214
+ dashboardPage.goToSection('Decisions');
215
+ });
216
+ });
217
+
218
+ it('go to decision instance view', function() {
219
+ // when
220
+ decisionsPage.deployedDecisionsList.selectDecision(0);
221
+ definitionPage.decisionInstancesTab.selectInstanceId(0);
222
+ });
223
+
224
+ it('go to the process instance page', function() {
225
+ // when
226
+ instancePage.gotoProcessInstance();
227
+
228
+ // then
229
+ expect(browser.getCurrentUrl()).to.eventually.contain(
230
+ '#/process-instance/'
231
+ );
232
+ });
233
+ });
234
+
235
+ describe('navigation action', function() {
236
+ before(function() {
237
+ return testHelper(setupFile.setup4, function() {
238
+ dashboardPage.navigateToWebapp('Cockpit');
239
+ dashboardPage.authentication.userLogin('admin', 'admin');
240
+ dashboardPage.goToSection('Decisions');
241
+ decisionsPage.deployedDecisionsList.selectDecision(0);
242
+ definitionPage.decisionInstancesTab.selectInstanceId(0);
243
+ });
244
+ });
245
+
246
+ it('is not displayed', function() {
247
+ // then
248
+ expect(instancePage.processInstanceLink().getText()).to.eventually.eql(
249
+ 'null'
250
+ );
251
+ });
252
+ });
253
+ });
254
+
255
+ describe('multi tenancy', function() {
256
+ before(function() {
257
+ return testHelper(setupFile.multiTenancySetup, function() {
258
+ dashboardPage.navigateToWebapp('Cockpit');
259
+ dashboardPage.authentication.userLogin('admin', 'admin');
260
+ });
261
+ });
262
+
263
+ it('should not display tenant id of instance if not exists', function() {
264
+ // given
265
+ dashboardPage.goToSection('Decisions');
266
+
267
+ // when
268
+ decisionsPage.deployedDecisionsList.selectDecision(0);
269
+ definitionPage.decisionInstancesTab.selectInstanceId(0);
270
+
271
+ // then
272
+ expect(instancePage.information.tenantId()).to.eventually.contain('null');
273
+ });
274
+
275
+ it('should display tenant id of instance', function() {
276
+ // given
277
+ dashboardPage.navigateToWebapp('Cockpit');
278
+ dashboardPage.goToSection('Decisions');
279
+
280
+ // when
281
+ decisionsPage.deployedDecisionsList.selectDecision(1);
282
+ definitionPage.decisionInstancesTab.selectInstanceId(0);
283
+
284
+ // then
285
+ expect(instancePage.information.tenantId()).to.eventually.contain(
286
+ 'tenant1'
287
+ );
288
+ });
289
+ });
290
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/decision-setup.js ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var factory = require('../../../common/tests/setup-factory.js'),
21
+ readResource = factory.readResource,
22
+ combine = factory.combine,
23
+ operation = factory.operation;
24
+
25
+ var deployFirst = combine(
26
+ operation('deployment', 'create', [
27
+ {
28
+ deploymentName: 'assign-approver',
29
+ files: [
30
+ {
31
+ name: 'assign-approver-groups.dmn',
32
+ content: readResource('assign-approver-groups.dmn')
33
+ },
34
+ {
35
+ name: 'invoice.bpmn',
36
+ content: readResource('invoice.bpmn')
37
+ }
38
+ ]
39
+ }
40
+ ]),
41
+
42
+ operation('process-definition', 'start', [
43
+ {
44
+ key: 'invoice',
45
+ businessKey: 'invoice1',
46
+ variables: {
47
+ amount: {value: 100},
48
+ invoiceCategory: {value: 'travelExpenses'}
49
+ }
50
+ }
51
+ ])
52
+ );
53
+
54
+ var deploySecond = operation('deployment', 'create', [
55
+ {
56
+ deploymentName: 'assign-approver',
57
+ files: [
58
+ {
59
+ name: 'assign-approver-groups-changed.dmn',
60
+ content: readResource('assign-approver-groups-changed.dmn')
61
+ }
62
+ ]
63
+ }
64
+ ]);
65
+
66
+ var deployThird = combine(
67
+ operation('deployment', 'create', [
68
+ {
69
+ deploymentName: 'assign-approver-without-clause-name',
70
+ files: [
71
+ {
72
+ name: 'assign-approver-groups-clauses-without-name.dmn',
73
+ content: readResource(
74
+ 'assign-approver-groups-clauses-without-name.dmn'
75
+ )
76
+ },
77
+ {
78
+ name: 'invoice.bpmn',
79
+ content: readResource('invoice.bpmn')
80
+ }
81
+ ]
82
+ }
83
+ ]),
84
+
85
+ operation('process-definition', 'start', [
86
+ {
87
+ key: 'invoice',
88
+ businessKey: 'invoice1',
89
+ variables: {
90
+ amount: {value: 100},
91
+ invoiceCategory: {value: 'travelExpenses'}
92
+ }
93
+ }
94
+ ])
95
+ );
96
+
97
+ var deploy4 = combine(
98
+ operation('deployment', 'create', [
99
+ {
100
+ deploymentName: 'assign-approver',
101
+ files: [
102
+ {
103
+ name: 'assign-approver-groups.dmn',
104
+ content: readResource('assign-approver-groups.dmn')
105
+ }
106
+ ]
107
+ }
108
+ ]),
109
+
110
+ operation('decision-definition', 'evaluate', [
111
+ {
112
+ key: 'invoice-assign-approver',
113
+ variables: {
114
+ amount: {value: 100},
115
+ invoiceCategory: {value: 'travelExpenses'}
116
+ }
117
+ }
118
+ ])
119
+ );
120
+
121
+ var multiTenancyDeployment = combine(
122
+ operation('deployment', 'create', [
123
+ {
124
+ deploymentName: 'processTenantOne',
125
+ tenantId: 'tenant1',
126
+ files: [
127
+ {
128
+ name: 'invoice.bpmn',
129
+ filename: 'invoice-deployment-binding.bpmn',
130
+ content: readResource('invoice-deployment-binding.bpmn')
131
+ },
132
+ {
133
+ name: 'assign-approver-groups.dmn',
134
+ content: readResource('assign-approver-groups.dmn')
135
+ }
136
+ ]
137
+ }
138
+ ]),
139
+
140
+ operation('deployment', 'create', [
141
+ {
142
+ deploymentName: 'processNoTenant',
143
+ files: [
144
+ {
145
+ name: 'invoice.bpmn',
146
+ filename: 'invoice-deployment-binding.bpmn',
147
+ content: readResource('invoice-deployment-binding.bpmn')
148
+ },
149
+ {
150
+ name: 'assign-approver-groups.dmn',
151
+ content: readResource('assign-approver-groups.dmn')
152
+ }
153
+ ]
154
+ }
155
+ ]),
156
+
157
+ operation('process-definition', 'start', [
158
+ {
159
+ key: 'invoice',
160
+ tenantId: 'tenant1',
161
+ variables: {
162
+ creditor: {
163
+ value: 'test',
164
+ type: 'String'
165
+ },
166
+ amount: {
167
+ value: 20.5,
168
+ type: 'Double'
169
+ },
170
+ invoiceCategory: {
171
+ value: 'Travel Expenses',
172
+ type: 'String'
173
+ }
174
+ }
175
+ }
176
+ ]),
177
+
178
+ operation('process-definition', 'start', [
179
+ {
180
+ key: 'invoice',
181
+ variables: {
182
+ creditor: {
183
+ value: 'test',
184
+ type: 'String'
185
+ },
186
+ amount: {
187
+ value: 15.0,
188
+ type: 'Double'
189
+ },
190
+ invoiceCategory: {
191
+ value: 'Travel Expenses',
192
+ type: 'String'
193
+ }
194
+ }
195
+ }
196
+ ])
197
+ );
198
+
199
+ var deployMultipleInstances = combine(
200
+ operation('deployment', 'create', [
201
+ {
202
+ deploymentName: 'assign-approver',
203
+ files: [
204
+ {
205
+ name: 'assign-approver-groups.dmn',
206
+ content: readResource('assign-approver-groups.dmn')
207
+ },
208
+ {
209
+ name: 'invoice.bpmn',
210
+ content: readResource('invoice.bpmn')
211
+ }
212
+ ]
213
+ }
214
+ ]),
215
+
216
+ operation('process-definition', 'start', [
217
+ {
218
+ key: 'invoice',
219
+ businessKey: 'invoice1',
220
+ variables: {
221
+ amount: {value: 100},
222
+ invoiceCategory: {value: 'travelExpenses'}
223
+ }
224
+ }
225
+ ]),
226
+ operation('process-definition', 'start', [
227
+ {
228
+ key: 'invoice',
229
+ businessKey: 'invoice2',
230
+ variables: {
231
+ amount: {value: 200},
232
+ invoiceCategory: {value: 'travelExpenses2'}
233
+ }
234
+ }
235
+ ])
236
+ );
237
+
238
+ module.exports = {
239
+ setup1: deployFirst,
240
+ setup2: combine(deployFirst, deploySecond),
241
+ setup3: deployThird,
242
+ setup4: deploy4,
243
+ setup5: deployMultipleInstances,
244
+ multiTenancySetup: multiTenancyDeployment
245
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/decisions-spec.js ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var testHelper = require('../../../common/tests/test-helper');
21
+ var setupFile = require('./dashboard-setup');
22
+
23
+ var decisionsPage = require('../pages/decisions');
24
+
25
+ describe('Cockpit Decisions Dashboard Spec', function() {
26
+ describe('dashboard page navigation', function() {
27
+ before(function() {
28
+ return testHelper(setupFile.setup1, function() {
29
+ decisionsPage.navigateToWebapp('Cockpit');
30
+ decisionsPage.authentication.userLogin('admin', 'admin');
31
+ decisionsPage.goToSection('Decisions');
32
+ });
33
+ });
34
+
35
+ describe('deploy decision and validate', function() {
36
+ before(function() {
37
+ return testHelper(setupFile.setup4, true);
38
+ });
39
+
40
+ it('should show deployed decision', function() {
41
+ // when
42
+ decisionsPage.navigateTo();
43
+
44
+ // then
45
+ expect(
46
+ decisionsPage.deployedDecisionsList.decisionCountHeader()
47
+ ).to.eventually.eql('1 decision definition deployed');
48
+ expect(
49
+ decisionsPage.deployedDecisionsList.decisionsList().count()
50
+ ).to.eventually.eql(1);
51
+ expect(
52
+ decisionsPage.deployedDecisionsList.decisionName(0)
53
+ ).to.eventually.eql('Assign Approver');
54
+ });
55
+ });
56
+
57
+ describe('deploy decision without name', function() {
58
+ before(function() {
59
+ return testHelper(setupFile.setup5, true);
60
+ });
61
+
62
+ it('should show decision key', function() {
63
+ // when
64
+ decisionsPage.navigateTo();
65
+
66
+ // then
67
+ expect(
68
+ decisionsPage.deployedDecisionsList.decisionCountHeader()
69
+ ).to.eventually.eql('2 decision definitions deployed');
70
+ expect(
71
+ decisionsPage.deployedDecisionsList.decisionsList().count()
72
+ ).to.eventually.eql(2);
73
+ expect(
74
+ decisionsPage.deployedDecisionsList.decisionName(1)
75
+ ).to.eventually.eql('invoice-approver');
76
+ });
77
+ });
78
+ });
79
+
80
+ describe('multi tenancy', function() {
81
+ before(function() {
82
+ return testHelper(setupFile.multiTenancySetup, function() {
83
+ decisionsPage.navigateToWebapp('Cockpit');
84
+ decisionsPage.authentication.userLogin('admin', 'admin');
85
+ decisionsPage.goToSection('Decisions');
86
+ });
87
+ });
88
+
89
+ it('should show tenant ids of decision definitions', function() {
90
+ expect(
91
+ decisionsPage.deployedDecisionsList.decisionsList().count()
92
+ ).to.eventually.eql(2);
93
+
94
+ expect(decisionsPage.deployedDecisionsList.tenantId(0)).to.eventually.eql(
95
+ ''
96
+ );
97
+ expect(decisionsPage.deployedDecisionsList.tenantId(1)).to.eventually.eql(
98
+ 'tenant1'
99
+ );
100
+ });
101
+ });
102
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/header-spec.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ describe(
21
+ 'Cockpit page header Spec',
22
+ require('../../../common/tests/specs/header-spec-definition')('Cockpit')
23
+ );
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/process-definition-filter-spec.js ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var testHelper = require('../../../common/tests/test-helper');
21
+ var setupFile = require('./process-setup');
22
+
23
+ var dashboardPage = require('../pages/dashboard');
24
+ var processesPage = require('../pages/processes');
25
+ var definitionPage = require('../pages/process-definition');
26
+
27
+ describe('Cockpit Process Definition Filter Spec', function() {
28
+ afterEach(function() {
29
+ definitionPage.search.clearSearch();
30
+ });
31
+
32
+ describe('filter by variable', function() {
33
+ before(function() {
34
+ return testHelper(setupFile.setup1, function() {
35
+ dashboardPage.navigateToWebapp('Cockpit');
36
+ dashboardPage.authentication.userLogin('admin', 'admin');
37
+ dashboardPage.goToSection('Processes');
38
+ processesPage.deployedProcessesList.selectProcess(0);
39
+ });
40
+ });
41
+
42
+ it('should filter by number', function() {
43
+ // when
44
+ definitionPage.search.createSearch('Variable', '=', '1.5', 'test');
45
+
46
+ // then
47
+ expect(
48
+ definitionPage.processInstancesTab.table().count()
49
+ ).to.eventually.eql(2);
50
+ });
51
+
52
+ it('should filter by string', function() {
53
+ // when
54
+ definitionPage.search.createSearch(
55
+ 'Variable',
56
+ '=',
57
+ 'abc dfg',
58
+ 'myString'
59
+ );
60
+
61
+ // then
62
+ expect(
63
+ definitionPage.processInstancesTab.table().count()
64
+ ).to.eventually.eql(2);
65
+ expect(
66
+ definitionPage.processInstancesTab.businessKey(1).getText()
67
+ ).to.eventually.eql('Instance2');
68
+ });
69
+
70
+ it('should add like filter', function() {
71
+ // when
72
+ definitionPage.search.createSearch('Variable', 'like', '123', 'myString');
73
+
74
+ // then
75
+ expect(
76
+ definitionPage.processInstancesTab.table().count()
77
+ ).to.eventually.eql(1);
78
+ expect(
79
+ definitionPage.processInstancesTab.businessKey(0).getText()
80
+ ).to.eventually.eql('Instance1');
81
+ });
82
+ });
83
+
84
+ describe('filter by business key and variable', function() {
85
+ before(function() {
86
+ return testHelper(setupFile.setup1, function() {
87
+ dashboardPage.navigateToWebapp('Cockpit');
88
+ dashboardPage.authentication.userLogin('admin', 'admin');
89
+ dashboardPage.goToSection('Processes');
90
+ processesPage.deployedProcessesList.selectProcess(0);
91
+ });
92
+ });
93
+
94
+ it('should add business key filter', function() {
95
+ // when
96
+ definitionPage.search.createSearch('Business Key', 'myBusinessKey');
97
+
98
+ // then
99
+ expect(
100
+ definitionPage.processInstancesTab.table().count()
101
+ ).to.eventually.eql(1);
102
+ expect(
103
+ definitionPage.processInstancesTab.businessKey(0).getText()
104
+ ).to.eventually.eql('myBusinessKey');
105
+ });
106
+
107
+ it('should combine variable filter and business key filter', function() {
108
+ // when
109
+ definitionPage.search.createSearch('Variable', '>', '1.49', 'test');
110
+
111
+ // then
112
+ expect(
113
+ definitionPage.processInstancesTab.table().count()
114
+ ).to.eventually.eql(2);
115
+
116
+ // when
117
+ definitionPage.search.createSearch('Business Key', 'Instance1');
118
+
119
+ // then
120
+ expect(
121
+ definitionPage.processInstancesTab.table().count()
122
+ ).to.eventually.eql(1);
123
+ expect(
124
+ definitionPage.processInstancesTab.businessKey(0).getText()
125
+ ).to.eventually.eql('Instance1');
126
+ });
127
+ });
128
+
129
+ describe.skip('filtering with long expressions', function() {
130
+ before(function() {
131
+ return testHelper(setupFile.setup1, function() {
132
+ dashboardPage.navigateToWebapp('Cockpit');
133
+ dashboardPage.authentication.userLogin('admin', 'admin');
134
+ dashboardPage.goToSection('Processes');
135
+ processesPage.deployedProcessesList.selectProcess(0);
136
+ });
137
+ });
138
+
139
+ afterEach(function() {
140
+ definitionPage.filter.removeVariableFilter(0);
141
+ });
142
+
143
+ it('should filter date', function() {
144
+ // when
145
+ definitionPage.search.createSearch(
146
+ 'Variable',
147
+ '=',
148
+ '2011-11-11T11:11:11',
149
+ 'myDate'
150
+ );
151
+
152
+ // then
153
+ expect(
154
+ definitionPage.processInstancesTab.table().count()
155
+ ).to.eventually.eql(1);
156
+ expect(
157
+ definitionPage.processInstancesTab.businessKey(0).getText()
158
+ ).to.eventually.eql('myBusinessKey');
159
+ });
160
+
161
+ it('should filter long variable', function() {
162
+ // when
163
+ definitionPage.search.createSearch(
164
+ 'Variable',
165
+ '=',
166
+ '1234567890987654321',
167
+ 'extraLong'
168
+ );
169
+
170
+ // then
171
+ expect(
172
+ definitionPage.processInstancesTab.table().count()
173
+ ).to.eventually.eql(1);
174
+ expect(
175
+ definitionPage.processInstancesTab.businessKey(0).getText()
176
+ ).to.eventually.eql('Instance1');
177
+ });
178
+ });
179
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/process-definition-spec.js ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /* jshint ignore:start */
19
+ 'use strict';
20
+
21
+ var testHelper = require('../../../common/tests/test-helper');
22
+ var setupFile = require('./process-setup');
23
+
24
+ var dashboardPage = require('../pages/dashboard');
25
+ var processesPage = require('../pages/processes');
26
+ var definitionPage = require('../pages/process-definition');
27
+
28
+ describe('Cockpit Process Definition Spec', function() {
29
+ describe('page navigation', function() {
30
+ before(function() {
31
+ return testHelper(setupFile.setup1, function() {
32
+ dashboardPage.navigateToWebapp('Cockpit');
33
+ dashboardPage.authentication.userLogin('admin', 'admin');
34
+ dashboardPage.goToSection('Processes');
35
+ });
36
+ });
37
+
38
+ it('should go to process definition view', function() {
39
+ // given
40
+ var runningInstances = processesPage.deployedProcessesList.runningInstances(
41
+ 0
42
+ );
43
+ processesPage.deployedProcessesList
44
+ .processName(0)
45
+ .then(function(processName) {
46
+ // when
47
+ processesPage.deployedProcessesList.selectProcess(0);
48
+
49
+ // then
50
+ expect(
51
+ dashboardPage.breadcrumb.activeCrumb().getText()
52
+ ).to.eventually.eql(processName);
53
+ expect(
54
+ definitionPage.processInstancesTab.isTabSelected()
55
+ ).to.eventually.be.true;
56
+ runningInstances.then(function(noOfInstances) {
57
+ expect(
58
+ definitionPage.processInstancesTab.table().count()
59
+ ).to.eventually.eql(parseInt(noOfInstances, 10));
60
+ });
61
+ });
62
+ });
63
+
64
+ it('should display definition key', function() {
65
+ // then
66
+ expect(definitionPage.information.definitionKey()).to.eventually.contain(
67
+ 'user-tasks'
68
+ );
69
+ });
70
+
71
+ it('should go to Called Process Definitions tab', function() {
72
+ // when
73
+ definitionPage.calledProcessDefinitionsTab.selectTab();
74
+
75
+ // then
76
+ expect(definitionPage.calledProcessDefinitionsTab.isTabSelected()).to
77
+ .eventually.be.true;
78
+ expect(
79
+ definitionPage.calledProcessDefinitionsTab.tabName()
80
+ ).to.eventually.eql(definitionPage.calledProcessDefinitionsTab.tabLabel);
81
+ });
82
+
83
+ it('should go to Job Definitions tab', function() {
84
+ // when
85
+ definitionPage.jobDefinitionsTab.selectTab();
86
+
87
+ // then
88
+ expect(definitionPage.jobDefinitionsTab.isTabSelected()).to.eventually.be
89
+ .true;
90
+ expect(definitionPage.jobDefinitionsTab.tabName()).to.eventually.eql(
91
+ definitionPage.jobDefinitionsTab.tabLabel
92
+ );
93
+ });
94
+
95
+ it('should go to Process Instances tab', function() {
96
+ // when
97
+ definitionPage.processInstancesTab.selectTab();
98
+
99
+ // then
100
+ expect(definitionPage.processInstancesTab.isTabSelected()).to.eventually
101
+ .be.true;
102
+ expect(definitionPage.processInstancesTab.tabName()).to.eventually.eql(
103
+ definitionPage.processInstancesTab.tabLabel
104
+ );
105
+ });
106
+
107
+ it('should not display report link', function() {
108
+ // then
109
+ expect(definitionPage.getReportLink().isPresent()).to.eventually.be.false;
110
+ });
111
+ });
112
+
113
+ describe('diagram interaction', function() {
114
+ before(function() {
115
+ return testHelper(setupFile.setup1, function() {
116
+ dashboardPage.navigateToWebapp('Cockpit');
117
+ dashboardPage.authentication.userLogin('admin', 'admin');
118
+ dashboardPage.goToSection('Processes');
119
+ processesPage.deployedProcessesList.selectProcess(0);
120
+ });
121
+ });
122
+
123
+ it('should display process diagram', function() {
124
+ // then
125
+ expect(definitionPage.diagram.diagramElement().isDisplayed()).to
126
+ .eventually.be.true;
127
+ });
128
+
129
+ it('should display the number of running process instances', function() {
130
+ // then
131
+ expect(
132
+ definitionPage.diagram.instancesBadgeFor('UserTask_1').getText()
133
+ ).to.eventually.eql('3');
134
+ });
135
+
136
+ it('should select activity', function() {
137
+ // when
138
+ definitionPage.diagram.selectActivity('UserTask_1');
139
+
140
+ // then
141
+ expect(definitionPage.diagram.isActivitySelected('UserTask_1')).to
142
+ .eventually.be.true;
143
+ });
144
+
145
+ it('should keep selection after page refresh', function() {
146
+ // when
147
+ browser.getCurrentUrl().then(function(url) {
148
+ browser.get(url);
149
+ });
150
+
151
+ // then
152
+ expect(definitionPage.diagram.isActivitySelected('UserTask_1')).to
153
+ .eventually.be.true;
154
+ });
155
+
156
+ it('should show loading indicator when loading status is set to LOADING', function() {
157
+ browser.executeScript(
158
+ '(function() {' +
159
+ 'var scope = angular.element(document.querySelector("[diagram-statistics-loader]")).scope();' +
160
+ 'scope.loadingStatus = "LOADING";' +
161
+ 'scope.$digest();' +
162
+ '})();'
163
+ );
164
+
165
+ expect(
166
+ element(
167
+ by.css('[diagram-statistics-loader] .glyphicon-refresh')
168
+ ).isDisplayed()
169
+ ).to.eventually.be.eql(true);
170
+ });
171
+ });
172
+
173
+ describe('multi tenancy', function() {
174
+ before(function() {
175
+ return testHelper(setupFile.multiTenancySetup, function() {
176
+ dashboardPage.navigateToWebapp('Cockpit');
177
+ dashboardPage.authentication.userLogin('admin', 'admin');
178
+ dashboardPage.goToSection('Processes');
179
+ });
180
+ });
181
+
182
+ describe('process definition with tenant id', function() {
183
+ before(function() {
184
+ // process definitions with tenants are sorted below the ones without
185
+ processesPage.deployedProcessesList.selectProcess(1);
186
+ });
187
+
188
+ it('should display definition tenant id', function() {
189
+ // then
190
+ expect(definitionPage.information.tenantId()).to.eventually.contain(
191
+ 'tenant1'
192
+ );
193
+ });
194
+
195
+ it('should display definition version for tenant only', function() {
196
+ // then
197
+ expect(
198
+ definitionPage.information.definitionVersion()
199
+ ).to.eventually.contain('1');
200
+ expect(
201
+ definitionPage.information
202
+ .definitionVersionDropdownButton()
203
+ .isPresent()
204
+ ).to.eventually.be.false;
205
+ });
206
+
207
+ it('should display running instances for tenant only', function() {
208
+ // then
209
+ expect(
210
+ definitionPage.information.definitionInstancesCurrent()
211
+ ).to.eventually.contain('1');
212
+ expect(
213
+ definitionPage.information.definitionInstancesAll()
214
+ ).to.eventually.contain('1');
215
+ });
216
+ });
217
+
218
+ describe('process definition without tenant id', function() {
219
+ before(function() {
220
+ dashboardPage.navigateToWebapp('Cockpit');
221
+ // first process definition displayed is deployed without tenant id
222
+ dashboardPage.goToSection('Processes');
223
+ processesPage.deployedProcessesList.selectProcess(0);
224
+ });
225
+
226
+ it('should not display definition tenant id', function() {
227
+ // then
228
+ expect(definitionPage.information.tenantId()).to.eventually.contain(
229
+ 'null'
230
+ );
231
+ });
232
+
233
+ it('should display definition version for non-tenant only', function() {
234
+ // then
235
+ expect(
236
+ definitionPage.information.definitionVersion()
237
+ ).to.eventually.contain('1');
238
+ expect(
239
+ definitionPage.information
240
+ .definitionVersionDropdownButton()
241
+ .isPresent()
242
+ ).to.eventually.be.false;
243
+ });
244
+
245
+ it('should display running instances for non-tenant only', function() {
246
+ // then
247
+ expect(
248
+ definitionPage.information.definitionInstancesCurrent()
249
+ ).to.eventually.contain('1');
250
+ expect(
251
+ definitionPage.information.definitionInstancesAll()
252
+ ).to.eventually.contain('1');
253
+ });
254
+ });
255
+ });
256
+
257
+ describe('version tagging', function() {
258
+ before(function() {
259
+ return testHelper(setupFile.versionTagSetup, function() {
260
+ dashboardPage.navigateToWebapp('Cockpit');
261
+ dashboardPage.authentication.userLogin('admin', 'admin');
262
+ dashboardPage.goToSection('Processes');
263
+ });
264
+ });
265
+
266
+ describe('process definition with a version tag', function() {
267
+ before(function() {
268
+ dashboardPage.navigateToWebapp('Cockpit');
269
+ // second process definition is deployed without tenant id
270
+ dashboardPage.goToSection('Processes');
271
+ processesPage.deployedProcessesList.selectProcess(0);
272
+ });
273
+
274
+ it('should display definition version tag', function() {
275
+ // then
276
+ expect(definitionPage.information.versionTag()).to.eventually.contain(
277
+ '1.0.0'
278
+ );
279
+ });
280
+ });
281
+
282
+ describe('process definition without a version tag', function() {
283
+ before(function() {
284
+ dashboardPage.navigateToWebapp('Cockpit');
285
+ // second process definition is deployed without tenant id
286
+ dashboardPage.goToSection('Processes');
287
+ processesPage.deployedProcessesList.selectProcess(1);
288
+ });
289
+
290
+ it('should display null on missing definition version tag', function() {
291
+ // then
292
+ expect(definitionPage.information.versionTag()).to.eventually.contain(
293
+ 'null'
294
+ );
295
+ });
296
+ });
297
+ });
298
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/process-instance-spec.js ADDED
@@ -0,0 +1,651 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /* jshint ignore:start */
19
+ 'use strict';
20
+
21
+ var testHelper = require('../../../common/tests/test-helper');
22
+ var setupFile = require('./process-setup');
23
+ var CamSDK = require('camunda-bpm-sdk-js');
24
+
25
+ var dashboardPage = require('../pages/dashboard');
26
+ var processesPage = require('../pages/processes');
27
+ var definitionPage = require('../pages/process-definition');
28
+ var instancePage = require('../pages/process-instance');
29
+
30
+ describe.skip('Cockpit Process Instance Spec', function() {
31
+ describe('page navigation', function() {
32
+ before(function() {
33
+ return testHelper(setupFile.setup1, function() {
34
+ dashboardPage.navigateToWebapp('Cockpit');
35
+ dashboardPage.authentication.userLogin('admin', 'admin');
36
+ dashboardPage.goToSection('Processes');
37
+ processesPage.deployedProcessesList.selectProcess(0);
38
+ });
39
+ });
40
+
41
+ it('should go to process instance view', function() {
42
+ // given
43
+ definitionPage.processInstancesTab
44
+ .instanceId(1)
45
+ .then(function(instanceId) {
46
+ // when
47
+ definitionPage.processInstancesTab.selectInstanceId(1);
48
+
49
+ // then
50
+ expect(
51
+ instancePage.pageHeaderProcessInstanceName()
52
+ ).to.eventually.eql(instanceId);
53
+ });
54
+ });
55
+
56
+ it('should go to User Tasks tab', function() {
57
+ // when
58
+ instancePage.userTasksTab.selectTab();
59
+
60
+ // then
61
+ expect(instancePage.userTasksTab.isTabSelected()).to.eventually.be.true;
62
+ expect(instancePage.userTasksTab.tabName()).to.eventually.eql(
63
+ instancePage.userTasksTab.tabLabel
64
+ );
65
+ });
66
+
67
+ it('should go to Called Process Instances tab', function() {
68
+ // when
69
+ instancePage.calledInstancesTab.selectTab();
70
+
71
+ // then
72
+ expect(instancePage.calledInstancesTab.isTabSelected()).to.eventually.be
73
+ .true;
74
+ expect(instancePage.calledInstancesTab.tabName()).to.eventually.eql(
75
+ instancePage.calledInstancesTab.tabLabel
76
+ );
77
+ });
78
+
79
+ it('should go to Incidents tab', function() {
80
+ // when
81
+ instancePage.incidentsTab.selectTab();
82
+
83
+ // then
84
+ expect(instancePage.incidentsTab.isTabSelected()).to.eventually.be.true;
85
+ expect(instancePage.incidentsTab.tabName()).to.eventually.eql(
86
+ instancePage.incidentsTab.tabLabel
87
+ );
88
+ });
89
+
90
+ it('should go to Variables tab', function() {
91
+ // when
92
+ instancePage.variablesTab.selectTab();
93
+
94
+ // then
95
+ expect(instancePage.variablesTab.isTabSelected()).to.eventually.be.true;
96
+ expect(instancePage.variablesTab.tabName()).to.eventually.eql(
97
+ instancePage.variablesTab.tabLabel
98
+ );
99
+ });
100
+ });
101
+
102
+ describe('edit User Task assignee', function() {
103
+ before(function() {
104
+ return testHelper(setupFile.setup1, function() {
105
+ dashboardPage.navigateToWebapp('Cockpit');
106
+ dashboardPage.authentication.userLogin('admin', 'admin');
107
+ dashboardPage.goToSection('Processes');
108
+ processesPage.deployedProcessesList.selectProcess(0);
109
+ definitionPage.processInstancesTab.selectInstanceId(0);
110
+ });
111
+ });
112
+
113
+ it('should open user tasks tab', function() {
114
+ // when
115
+ instancePage.userTasksTab.selectTab();
116
+
117
+ // then
118
+ expect(instancePage.userTasksTab.table().count()).to.eventually.eql(1);
119
+ expect(instancePage.userTasksTab.activity(0).getText()).to.eventually.eql(
120
+ 'User Task 1'
121
+ );
122
+ });
123
+
124
+ it('should select user task', function() {
125
+ // when
126
+ instancePage.userTasksTab.activity(0).click();
127
+
128
+ // then
129
+ expect(instancePage.diagram.isActivitySelected('UserTask_1')).to
130
+ .eventually.be.true;
131
+ });
132
+
133
+ it('should add new assignee', function() {
134
+ // when
135
+ instancePage.userTasksTab.addNewAssignee(0, 'Franz');
136
+
137
+ // then
138
+ expect(instancePage.userTasksTab.assignee(0).getText()).is.eventually.eql(
139
+ 'Franz'
140
+ );
141
+ });
142
+ });
143
+
144
+ describe('edit User Task identity links', function() {
145
+ before(function() {
146
+ return testHelper(setupFile.setup1, function() {
147
+ dashboardPage.navigateToWebapp('Cockpit');
148
+ dashboardPage.authentication.userLogin('admin', 'admin');
149
+ dashboardPage.goToSection('Processes');
150
+ processesPage.deployedProcessesList.selectProcess(0);
151
+ definitionPage.processInstancesTab.selectInstanceId(0);
152
+ instancePage.userTasksTab.selectTab();
153
+ });
154
+ });
155
+
156
+ describe('edit group identity links', function() {
157
+ before(function() {
158
+ instancePage.userTasksTab.clickChangeGroupIdentityLinksButton();
159
+ });
160
+
161
+ it('opens', function() {
162
+ expect(
163
+ instancePage.userTasksTab.modal.dialog().isDisplayed()
164
+ ).to.eventually.eql(true);
165
+ });
166
+
167
+ it('has a title', function() {
168
+ expect(instancePage.userTasksTab.modal.title()).to.eventually.eql(
169
+ 'Manage groups'
170
+ );
171
+ });
172
+
173
+ it('initially contains two groups', function() {
174
+ expect(
175
+ instancePage.userTasksTab.modal.elements().count()
176
+ ).to.eventually.eql(2);
177
+ });
178
+
179
+ it('adds a new group identity link', function() {
180
+ // when
181
+ instancePage.userTasksTab.modal
182
+ .nameInput()
183
+ .clear()
184
+ .sendKeys('my-super-group');
185
+ instancePage.userTasksTab.modal.clickAddNameButton();
186
+
187
+ // then
188
+ expect(
189
+ instancePage.userTasksTab.modal.elements().count()
190
+ ).to.eventually.eql(3);
191
+ });
192
+
193
+ it('deletes a group identity link', function() {
194
+ // when
195
+ instancePage.userTasksTab.modal.clickDeleteNameButton('my-super-group');
196
+
197
+ // then
198
+ expect(
199
+ instancePage.userTasksTab.modal.elements().count()
200
+ ).to.eventually.eql(2);
201
+ });
202
+
203
+ it('closes the dialog', function() {
204
+ // when
205
+ instancePage.userTasksTab.modal.clickCloseButton();
206
+
207
+ // then
208
+ expect(
209
+ instancePage.userTasksTab.modal.dialog().isPresent()
210
+ ).to.eventually.eql(false);
211
+ });
212
+ });
213
+
214
+ describe('edit user identity links', function() {
215
+ before(function() {
216
+ var el = element(by.css('[ng-click="close($event)"]'));
217
+ el.isPresent().then(function(yepNope) {
218
+ if (!yepNope) {
219
+ return;
220
+ }
221
+ el.isDisplayed().then(function(yepNope) {
222
+ if (!yepNope) {
223
+ return;
224
+ }
225
+ el.click();
226
+ });
227
+ });
228
+ instancePage.userTasksTab.clickChangeUserIdentityLinksButton();
229
+ });
230
+
231
+ it('opens', function() {
232
+ expect(
233
+ instancePage.userTasksTab.modal.dialog().isDisplayed()
234
+ ).to.eventually.eql(true);
235
+ });
236
+
237
+ it('has a title', function() {
238
+ expect(instancePage.userTasksTab.modal.title()).to.eventually.eql(
239
+ 'Manage users'
240
+ );
241
+ });
242
+
243
+ it('initially contains no users', function() {
244
+ expect(
245
+ instancePage.userTasksTab.modal.elements().count()
246
+ ).to.eventually.eql(0);
247
+ });
248
+
249
+ it('adds a new user identity link', function() {
250
+ // when
251
+ instancePage.userTasksTab.modal
252
+ .nameInput()
253
+ .clear()
254
+ .sendKeys('superman');
255
+ instancePage.userTasksTab.modal.clickAddNameButton();
256
+
257
+ // then
258
+ expect(
259
+ instancePage.userTasksTab.modal.elements().count()
260
+ ).to.eventually.eql(1);
261
+ });
262
+
263
+ it('deletes a group identity link', function() {
264
+ // when
265
+ instancePage.userTasksTab.modal.clickDeleteNameButton('superman');
266
+
267
+ // then
268
+ expect(
269
+ instancePage.userTasksTab.modal.elements().count()
270
+ ).to.eventually.eql(0);
271
+ });
272
+
273
+ it('closes the dialog', function() {
274
+ // when
275
+ instancePage.userTasksTab.modal.clickCloseButton();
276
+
277
+ // then
278
+ expect(
279
+ instancePage.userTasksTab.modal.dialog().isPresent()
280
+ ).to.eventually.eql(false);
281
+ });
282
+ });
283
+ });
284
+
285
+ describe('diagram interaction', function() {
286
+ before(function() {
287
+ return testHelper(setupFile.setup1, function() {
288
+ dashboardPage.navigateToWebapp('Cockpit');
289
+ dashboardPage.authentication.userLogin('admin', 'admin');
290
+ dashboardPage.goToSection('Processes');
291
+ processesPage.deployedProcessesList.selectProcess(0);
292
+ definitionPage.processInstancesTab.selectInstanceId(0);
293
+ });
294
+ });
295
+
296
+ it('should display process diagram', function() {
297
+ // then
298
+ expect(instancePage.diagram.diagramElement().isDisplayed()).to.eventually
299
+ .be.true;
300
+ });
301
+
302
+ it('should select unselectable task', function() {
303
+ // when
304
+ instancePage.diagram.selectActivity('UserTask_2');
305
+
306
+ // then
307
+ expect(instancePage.diagram.isActivitySelected('UserTask_2')).to
308
+ .eventually.be.false;
309
+ });
310
+
311
+ it('should display the number of concurrent activities', function() {
312
+ // then
313
+ expect(
314
+ instancePage.diagram.instancesBadgeFor('UserTask_1').getText()
315
+ ).to.eventually.eql('1');
316
+ });
317
+
318
+ it('should process clicks in diagram', function() {
319
+ // given
320
+ instancePage.sidebarTabClick('Filter');
321
+ instancePage.instanceTree.selectInstance('User Task 1');
322
+ expect(instancePage.diagram.isActivitySelected('UserTask_1')).to
323
+ .eventually.be.true;
324
+
325
+ // when
326
+ instancePage.diagram.deselectAll();
327
+
328
+ // then
329
+ expect(instancePage.diagram.isActivitySelected('UserTask_1')).to
330
+ .eventually.be.false;
331
+ expect(instancePage.instanceTree.isInstanceSelected('User Task 1')).to
332
+ .eventually.be.false;
333
+ });
334
+
335
+ it('should keep selection after page refresh', function() {
336
+ // given
337
+ instancePage.instanceTree.selectInstance('User Task 1');
338
+ expect(instancePage.diagram.isActivitySelected('UserTask_1')).to
339
+ .eventually.be.true;
340
+
341
+ // when
342
+ browser.getCurrentUrl().then(function(url) {
343
+ browser.get(url).then(function() {
344
+ browser.sleep(500);
345
+ });
346
+ });
347
+
348
+ // then
349
+ expect(instancePage.diagram.isActivitySelected('UserTask_1')).to
350
+ .eventually.be.true;
351
+ });
352
+
353
+ it('should reflect the tree view selection in diagram', function() {
354
+ // given
355
+ instancePage.sidebarTabClick('Filter');
356
+ instancePage.instanceTree.selectInstance('User Task 1');
357
+ expect(instancePage.diagram.isActivitySelected('UserTask_1')).to
358
+ .eventually.be.true;
359
+
360
+ // when
361
+ instancePage.instanceTree.deselectInstance('User Task 1');
362
+
363
+ // then
364
+ expect(instancePage.diagram.isActivitySelected('UserTask_1')).to
365
+ .eventually.be.false;
366
+ });
367
+ });
368
+
369
+ describe('cancel instance', function() {
370
+ before(function() {
371
+ return testHelper(setupFile.setup1, function() {
372
+ dashboardPage.navigateToWebapp('Cockpit');
373
+ dashboardPage.authentication.userLogin('admin', 'admin');
374
+ dashboardPage.goToSection('Processes');
375
+ processesPage.deployedProcessesList.selectProcess(0);
376
+ });
377
+ });
378
+
379
+ it('cancel instances', function() {
380
+ // given
381
+ definitionPage.processInstancesTab
382
+ .table()
383
+ .count()
384
+ .then(function(numberOfInstances) {
385
+ definitionPage.processInstancesTab.selectInstanceId(0);
386
+
387
+ // when
388
+ instancePage.cancelInstance.cancelInstance();
389
+
390
+ // then
391
+ expect(
392
+ definitionPage.processInstancesTab.table().count()
393
+ ).to.eventually.eql(numberOfInstances - 1);
394
+ });
395
+ });
396
+ });
397
+
398
+ describe('Multi Instance Incidents', function() {
399
+ before(function() {
400
+ return testHelper(setupFile.setup2, function() {
401
+ dashboardPage.navigateToWebapp('Cockpit');
402
+ dashboardPage.authentication.userLogin('admin', 'admin');
403
+ dashboardPage.goToSection('Processes');
404
+ processesPage.deployedProcessesList.selectProcess(0);
405
+ });
406
+ });
407
+
408
+ it('show incidents badge', function() {
409
+ // given
410
+ definitionPage.processInstancesTab
411
+ .table()
412
+ .count()
413
+ .then(function(numberOfInstances) {
414
+ definitionPage.processInstancesTab.selectInstanceId(0);
415
+ browser.sleep(1000);
416
+ // then
417
+ expect(
418
+ instancePage.diagram.incidentsBadgeFor('ServiceTask_1').getText()
419
+ ).to.eventually.eql('!');
420
+ });
421
+ });
422
+ });
423
+
424
+ // CAM-5846
425
+ describe('Retry external task incident', function() {
426
+ before(function(done) {
427
+ return testHelper(setupFile.setup4, function() {
428
+ var camClient = new CamSDK.Client({
429
+ mock: false,
430
+ apiUri: 'http://localhost:8080/engine-rest'
431
+ });
432
+
433
+ var ExternalTask = camClient.resource('external-task');
434
+ ExternalTask.fetchAndLock(
435
+ {
436
+ workerId: 'myWorker',
437
+ maxTasks: 1,
438
+ topics: [
439
+ {
440
+ topicName: 'must-have-topic',
441
+ lockDuration: 10000,
442
+ variables: []
443
+ }
444
+ ]
445
+ },
446
+ function(err, res) {
447
+ if (err) {
448
+ return done(err);
449
+ }
450
+
451
+ if (res.length > 0) {
452
+ var extTask = res[0].id;
453
+
454
+ ExternalTask.failure(
455
+ {
456
+ id: extTask,
457
+ workerId: 'myWorker',
458
+ errorMessage: 'must-have-error-message.',
459
+ retries: 0,
460
+ retriesTimeout: 10
461
+ },
462
+ function(err) {
463
+ if (err) {
464
+ return done(err);
465
+ }
466
+
467
+ done();
468
+ }
469
+ );
470
+ }
471
+ }
472
+ );
473
+
474
+ dashboardPage.navigateToWebapp('Cockpit');
475
+ dashboardPage.authentication.userLogin('admin', 'admin');
476
+ dashboardPage.goToSection('Processes');
477
+ processesPage.deployedProcessesList.selectProcessByName(
478
+ 'Failed external task'
479
+ );
480
+ element(
481
+ by.css('.ctn-content-bottom .instance-id [ng-transclude] a')
482
+ ).click();
483
+ instancePage.incidentsTab.selectTab();
484
+ });
485
+ });
486
+
487
+ it('should have a retry button', function() {
488
+ var retriesButton = instancePage.incidentsTab.incidentRetryAction(0);
489
+ expect(retriesButton.isDisplayed()).to.eventually.eql(true);
490
+ });
491
+ });
492
+
493
+ describe('Bulk job retry', function() {
494
+ before(function() {
495
+ return testHelper(setupFile.setup3, function() {
496
+ dashboardPage.navigateToWebapp('Cockpit');
497
+ dashboardPage.authentication.userLogin('admin', 'admin');
498
+ dashboardPage.goToSection('Processes');
499
+ });
500
+ });
501
+
502
+ function goToInstanceJobRetryModal(name) {
503
+ dashboardPage.navigateToWebapp('Cockpit');
504
+ dashboardPage.goToSection('Processes');
505
+ processesPage.deployedProcessesList.selectProcessByName(name);
506
+ element(
507
+ by.css('.ctn-content-bottom .instance-id [ng-transclude] a')
508
+ ).click();
509
+ element(by.css('.ctn-toolbar [tooltip~="Retries"]')).click();
510
+ }
511
+
512
+ function getCheckedCheckboxes() {
513
+ return element.all(by.css('.modal-body [type=checkbox]:checked'));
514
+ }
515
+
516
+ describe('when only 1 job failed', function() {
517
+ before(function() {
518
+ goToInstanceJobRetryModal('mi-incident');
519
+ });
520
+
521
+ it('pre-selects the job', function() {
522
+ expect(element(by.css('.modal-body')).isDisplayed()).to.eventually.eql(
523
+ true
524
+ );
525
+ expect(getCheckedCheckboxes().count()).to.eventually.eql(2);
526
+ });
527
+ });
528
+
529
+ describe('when 4 jobs failed', function() {
530
+ before(function() {
531
+ goToInstanceJobRetryModal('4 Failing Service Tasks');
532
+ });
533
+
534
+ it('pre-selects the jobs', function() {
535
+ expect(element(by.css('.modal-body')).isDisplayed()).to.eventually.eql(
536
+ true
537
+ );
538
+ expect(getCheckedCheckboxes().count()).to.eventually.eql(5);
539
+ });
540
+ });
541
+
542
+ describe('when 7 job failed', function() {
543
+ before(function() {
544
+ goToInstanceJobRetryModal('7 Failing Service Tasks');
545
+ });
546
+
547
+ it('does not pre-select the jobs', function() {
548
+ expect(element(by.css('.modal-body')).isDisplayed()).to.eventually.eql(
549
+ true
550
+ );
551
+ expect(getCheckedCheckboxes().count()).to.eventually.eql(0);
552
+ });
553
+ });
554
+ });
555
+
556
+ describe('multi tenancy', function() {
557
+ before(function() {
558
+ return testHelper(setupFile.multiTenancySetup, function() {
559
+ dashboardPage.navigateToWebapp('Cockpit');
560
+ dashboardPage.authentication.userLogin('admin', 'admin');
561
+ dashboardPage.goToSection('Processes');
562
+ });
563
+ });
564
+
565
+ it('should display tenant id of instance', function() {
566
+ dashboardPage.goToSection('Processes');
567
+
568
+ // through sorting, first process definition is without tenant, second has tenant
569
+ processesPage.deployedProcessesList.selectProcess(1);
570
+ definitionPage.processInstancesTab.selectInstanceId(0);
571
+
572
+ // when
573
+ instancePage.sidebarTabClick('Information');
574
+
575
+ // then
576
+ expect(instancePage.information.tenantId()).to.eventually.contain(
577
+ 'tenant1'
578
+ );
579
+ });
580
+
581
+ it('should not display tenant id of instance if not exists', function() {
582
+ dashboardPage.navigateToWebapp('Cockpit');
583
+ dashboardPage.goToSection('Processes');
584
+ // through sorting, first process definition is without tenant, second has tenant
585
+ processesPage.deployedProcessesList.selectProcess(0);
586
+ definitionPage.processInstancesTab.selectInstanceId(0);
587
+
588
+ // when
589
+ instancePage.sidebarTabClick('Information');
590
+
591
+ // then
592
+ expect(instancePage.information.tenantId()).to.eventually.contain('null');
593
+ });
594
+ });
595
+
596
+ describe('search widget', function() {
597
+ before(function() {
598
+ return testHelper(setupFile.multiTenancySetup, function() {
599
+ dashboardPage.navigateToWebapp('Cockpit');
600
+ dashboardPage.authentication.userLogin('admin', 'admin');
601
+ dashboardPage.goToSection('Processes');
602
+
603
+ processesPage.deployedProcessesList.selectProcess(1);
604
+ definitionPage.processInstancesTab.selectInstanceId(0);
605
+
606
+ instancePage.variablesTab.selectTab();
607
+ });
608
+ });
609
+
610
+ afterEach(function() {
611
+ instancePage.search.clearSearch();
612
+ });
613
+
614
+ it('should display search widget', function() {
615
+ expect(instancePage.search.formElement().isDisplayed()).to.eventually.be
616
+ .true;
617
+ });
618
+
619
+ it('should have Variable Name filter with = operator', function() {
620
+ //when
621
+ instancePage.search.createSearch('Variable Name', '=', 'test');
622
+
623
+ //then
624
+ var eqOperator = instancePage.search
625
+ .formElement()
626
+ .element(by.cssContainingText('[uib-tooltip="Operator"]', '='));
627
+
628
+ expect(eqOperator.isDisplayed()).to.eventually.be.true;
629
+ });
630
+
631
+ it('should have Variable Name filter with like operator', function() {
632
+ //when
633
+ instancePage.search.createSearch('Variable Name', 'like', 'test');
634
+
635
+ //then
636
+ var likeOperator = instancePage.search
637
+ .formElement()
638
+ .element(by.cssContainingText('[uib-tooltip="Operator"]', 'like'));
639
+
640
+ expect(likeOperator.isDisplayed()).to.eventually.be.true;
641
+ });
642
+
643
+ it('should display only one variable with name test', function() {
644
+ //when
645
+ instancePage.search.createSearch('Variable Name', '=', 'test');
646
+
647
+ //then
648
+ expect(instancePage.variablesTab.table().count()).to.eventually.eql(1);
649
+ });
650
+ });
651
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/process-setup.js ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var factory = require('../../../common/tests/setup-factory.js'),
21
+ readResource = factory.readResource,
22
+ combine = factory.combine,
23
+ operation = factory.operation;
24
+
25
+ module.exports = {
26
+ setup1: combine(
27
+ operation('deployment', 'create', [
28
+ {
29
+ deploymentName: 'user-tasks',
30
+ files: [
31
+ {
32
+ name: 'user-tasks.bpmn',
33
+ content: readResource('user-tasks.bpmn')
34
+ }
35
+ ]
36
+ }
37
+ ]),
38
+
39
+ operation('process-definition', 'start', [
40
+ {
41
+ key: 'user-tasks',
42
+ businessKey: 'Instance1',
43
+ variables: {
44
+ test: {
45
+ value: 1.5,
46
+ type: 'Double'
47
+ },
48
+ myString: {
49
+ value: '123 dfg',
50
+ type: 'String'
51
+ },
52
+ extraLong: {
53
+ value: '1234567890987654321',
54
+ type: 'Long'
55
+ }
56
+ }
57
+ },
58
+ {
59
+ key: 'user-tasks',
60
+ businessKey: 'Instance2',
61
+ variables: {
62
+ test: {
63
+ value: 1.5,
64
+ type: 'Double'
65
+ },
66
+ myString: {
67
+ value: 'abc dfg',
68
+ type: 'String'
69
+ }
70
+ }
71
+ },
72
+ {
73
+ key: 'user-tasks',
74
+ businessKey: 'myBusinessKey',
75
+ variables: {
76
+ test: {
77
+ value: 1.49,
78
+ type: 'Double'
79
+ },
80
+ myString: {
81
+ value: 'abc dfg',
82
+ type: 'String'
83
+ },
84
+ myDate: {
85
+ value: '2011-11-11T11:11:11.000+0200',
86
+ type: 'Date'
87
+ }
88
+ }
89
+ }
90
+ ])
91
+ ),
92
+
93
+ setup2: combine(
94
+ operation('deployment', 'create', [
95
+ {
96
+ deploymentName: 'mi-incident',
97
+ files: [
98
+ {
99
+ name: 'mi-incident.bpmn',
100
+ content: readResource('mi-incident.bpmn')
101
+ }
102
+ ]
103
+ }
104
+ ]),
105
+
106
+ operation('process-definition', 'start', [
107
+ {
108
+ key: 'mi-incident',
109
+ businessKey: 'MultiInstance'
110
+ }
111
+ ])
112
+ ),
113
+
114
+ setup3: combine(
115
+ operation('deployment', 'create', [
116
+ {
117
+ deploymentName: 'bulk-retry',
118
+ files: [
119
+ {
120
+ name: 'mi-incident.bpmn',
121
+ content: readResource('mi-incident.bpmn')
122
+ }
123
+ ]
124
+ }
125
+ ]),
126
+
127
+ operation('deployment', 'create', [
128
+ {
129
+ deploymentName: 'four-fails',
130
+ files: [
131
+ {
132
+ name: '4-failed-service-tasks.bpmn',
133
+ content: readResource('4-failed-service-tasks.bpmn')
134
+ }
135
+ ]
136
+ }
137
+ ]),
138
+
139
+ operation('deployment', 'create', [
140
+ {
141
+ deploymentName: 'seven-fails',
142
+ files: [
143
+ {
144
+ name: '7-failed-service-tasks.bpmn',
145
+ content: readResource('7-failed-service-tasks.bpmn')
146
+ }
147
+ ]
148
+ }
149
+ ]),
150
+
151
+ operation('process-definition', 'start', [
152
+ {
153
+ key: 'mi-incident'
154
+ },
155
+ {
156
+ key: 'fourFailingServiceTasks'
157
+ },
158
+ {
159
+ key: 'sevenFailingServiceTasks'
160
+ }
161
+ ])
162
+ ),
163
+
164
+ setup4: combine(
165
+ operation('deployment', 'create', [
166
+ {
167
+ deploymentName: 'failed-external-task',
168
+ files: [
169
+ {
170
+ name: 'failed-external-task.bpmn',
171
+ content: readResource('failed-external-task.bpmn')
172
+ }
173
+ ]
174
+ }
175
+ ]),
176
+
177
+ operation('process-definition', 'start', [
178
+ {
179
+ key: 'failed-external-task'
180
+ }
181
+ ])
182
+ ),
183
+
184
+ multiTenancySetup: combine(
185
+ operation('deployment', 'create', [
186
+ {
187
+ deploymentName: 'user-tasks',
188
+ tenantId: 'tenant1',
189
+ files: [
190
+ {
191
+ name: 'user-tasks.bpmn',
192
+ content: readResource('user-tasks.bpmn')
193
+ }
194
+ ]
195
+ }
196
+ ]),
197
+
198
+ operation('deployment', 'create', [
199
+ {
200
+ deploymentName: 'user-tasks',
201
+ files: [
202
+ {
203
+ name: 'user-tasks.bpmn',
204
+ content: readResource('user-tasks.bpmn')
205
+ }
206
+ ]
207
+ }
208
+ ]),
209
+
210
+ operation('process-definition', 'start', [
211
+ {
212
+ key: 'user-tasks',
213
+ tenantId: 'tenant1',
214
+ variables: {
215
+ test: {
216
+ value: 1.5,
217
+ type: 'Double'
218
+ },
219
+ myString: {
220
+ value: '123 dfg',
221
+ type: 'String'
222
+ },
223
+ extraLong: {
224
+ value: '1234567890987654321',
225
+ type: 'Long'
226
+ }
227
+ }
228
+ }
229
+ ]),
230
+
231
+ operation('process-definition', 'start', [
232
+ {
233
+ key: 'user-tasks',
234
+ variables: {
235
+ test: {
236
+ value: 3.0,
237
+ type: 'Double'
238
+ },
239
+ myString: {
240
+ value: '50 dfg',
241
+ type: 'String'
242
+ },
243
+ extraLong: {
244
+ value: '42',
245
+ type: 'Long'
246
+ }
247
+ }
248
+ }
249
+ ])
250
+ ),
251
+
252
+ versionTagSetup: combine(
253
+ operation('deployment', 'create', [
254
+ {
255
+ deploymentName: 'user-tasks',
256
+ files: [
257
+ {
258
+ name: 'user-tasks.bpmn',
259
+ content: readResource('user-tasks.bpmn')
260
+ }
261
+ ]
262
+ }
263
+ ]),
264
+
265
+ operation('deployment', 'create', [
266
+ {
267
+ deploymentName: 'invoice-deployment-binding',
268
+ files: [
269
+ {
270
+ name: 'invoice-deployment-binding.bpmn',
271
+ content: readResource('invoice-deployment-binding.bpmn')
272
+ }
273
+ ]
274
+ }
275
+ ])
276
+ )
277
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/processes-spec.js ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var testHelper = require('../../../common/tests/test-helper');
21
+ var setupFile = require('./dashboard-setup');
22
+
23
+ var processesPage = require('../pages/processes');
24
+
25
+ describe('Cockpit Processes Dashboard Spec', function() {
26
+ describe('dashboard page navigation', function() {
27
+ before(function() {
28
+ return testHelper(setupFile.setup1, function() {
29
+ processesPage.navigateToWebapp('Cockpit');
30
+ processesPage.authentication.userLogin('admin', 'admin');
31
+ processesPage.goToSection('Processes');
32
+ });
33
+ });
34
+
35
+ it('should validate processes plugin', function() {
36
+ // then
37
+ processesPage.isActive();
38
+ expect(
39
+ processesPage.deployedProcessesList.processCountHeader()
40
+ ).to.eventually.eql('1 process definition deployed');
41
+ });
42
+
43
+ it('should validate process previews tab', function() {
44
+ // when
45
+ processesPage.deployedProcessesPreviews.switchTab();
46
+
47
+ // then
48
+ expect(
49
+ processesPage.deployedProcessesPreviews.processesPreviews().count()
50
+ ).to.eventually.eql(1);
51
+ });
52
+
53
+ it('should validate prosess list tab', function() {
54
+ // when
55
+ processesPage.deployedProcessesList.switchTab();
56
+
57
+ // then
58
+ expect(
59
+ processesPage.deployedProcessesList.processesList().count()
60
+ ).to.eventually.eql(1);
61
+ expect(
62
+ processesPage.deployedProcessesList.processName(0)
63
+ ).to.eventually.eql('Failing Process');
64
+ expect(
65
+ processesPage.deployedProcessesList.runningInstances(0)
66
+ ).to.eventually.eql('0');
67
+ });
68
+
69
+ it('should not display report column in process list tab', function() {
70
+ // then
71
+ expect(processesPage.deployedProcessesList.getReportColumn().isPresent())
72
+ .to.eventually.be.false;
73
+ });
74
+
75
+ describe('start instance and validate', function() {
76
+ before(function() {
77
+ return testHelper(setupFile.setup2, true);
78
+ });
79
+
80
+ it('should count number of processes', function() {
81
+ // when
82
+ processesPage.navigateTo();
83
+
84
+ // then
85
+ expect(
86
+ processesPage.deployedProcessesList.processCountHeader()
87
+ ).to.eventually.eql('1 process definition deployed');
88
+ expect(
89
+ processesPage.deployedProcessesList.processesList().count()
90
+ ).to.eventually.eql(1);
91
+ expect(
92
+ processesPage.deployedProcessesList.runningInstances(0)
93
+ ).to.eventually.eql('1');
94
+ });
95
+ });
96
+
97
+ describe('deploy process and validate', function() {
98
+ before(function() {
99
+ return testHelper(setupFile.setup3, true);
100
+ });
101
+
102
+ it('should validate process list', function() {
103
+ // when
104
+ processesPage.navigateTo();
105
+
106
+ // then
107
+ expect(
108
+ processesPage.deployedProcessesList.processCountHeader()
109
+ ).to.eventually.eql('2 process definitions deployed');
110
+ expect(
111
+ processesPage.deployedProcessesList.processesList().count()
112
+ ).to.eventually.eql(2);
113
+ expect(
114
+ processesPage.deployedProcessesList.runningInstances(1)
115
+ ).to.eventually.eql('1');
116
+ expect(
117
+ processesPage.deployedProcessesList.processName(1)
118
+ ).to.eventually.eql('processWithSubProcess');
119
+ });
120
+
121
+ it('should validate process previews', function() {
122
+ // when
123
+ processesPage.deployedProcessesPreviews.switchTab();
124
+
125
+ // then
126
+ expect(
127
+ processesPage.deployedProcessesPreviews.processesPreviews().count()
128
+ ).to.eventually.eql(2);
129
+ });
130
+ });
131
+ });
132
+
133
+ describe('multi tenancy', function() {
134
+ before(function() {
135
+ return testHelper(setupFile.multiTenancySetup, function() {
136
+ processesPage.navigateToWebapp('Cockpit');
137
+ processesPage.authentication.userLogin('admin', 'admin');
138
+ processesPage.goToSection('Processes');
139
+ });
140
+ });
141
+
142
+ it('should show tenant ids of process definitions', function() {
143
+ expect(
144
+ processesPage.deployedProcessesList.processesList().count()
145
+ ).to.eventually.eql(2);
146
+
147
+ expect(processesPage.deployedProcessesList.tenantId(0)).to.eventually.eql(
148
+ ''
149
+ );
150
+ expect(processesPage.deployedProcessesList.tenantId(1)).to.eventually.eql(
151
+ 'tenant1'
152
+ );
153
+ });
154
+
155
+ it('should aggregate process instance count by tenant id', function() {
156
+ expect(
157
+ processesPage.deployedProcessesList.processesList().count()
158
+ ).to.eventually.eql(2);
159
+
160
+ expect(
161
+ processesPage.deployedProcessesList.runningInstances(0)
162
+ ).to.eventually.eql('1');
163
+ expect(
164
+ processesPage.deployedProcessesList.runningInstances(1)
165
+ ).to.eventually.eql('1');
166
+ });
167
+ });
168
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/reports-spec.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var testHelper = require('../../../common/tests/test-helper');
21
+
22
+ var reportsPage = require('../pages/reports');
23
+
24
+ describe('Cockpit Reports Spec', function() {
25
+ describe('reports page', function() {
26
+ before(function() {
27
+ return testHelper([], function() {
28
+ reportsPage.navigateToWebapp('Cockpit');
29
+ reportsPage.authentication.userLogin('admin', 'admin');
30
+ reportsPage.navigateTo();
31
+ });
32
+ });
33
+
34
+ it('shows that no report is available', function() {
35
+ // then
36
+ reportsPage.isActive();
37
+ expect(reportsPage.noReportsAvailableHint().isPresent()).to.eventually.be
38
+ .true;
39
+ });
40
+ });
41
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/repository-setup.js ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var factory = require('../../../common/tests/setup-factory.js'),
21
+ readResource = factory.readResource,
22
+ combine = factory.combine,
23
+ operation = factory.operation;
24
+
25
+ module.exports = {
26
+ setup1: combine(
27
+ operation('deployment', 'create', [
28
+ {
29
+ deploymentName: 'first-deployment',
30
+ deploymentSource: 'process application',
31
+ files: [
32
+ {
33
+ name: 'user-tasks.bpmn',
34
+ content: readResource('user-tasks.bpmn')
35
+ }
36
+ ]
37
+ },
38
+ {
39
+ deploymentName: 'second-deployment',
40
+ files: [
41
+ {
42
+ name: 'suspension-process.bpmn',
43
+ content: readResource('suspension-process.bpmn')
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ deploymentName: 'third-deployment',
49
+ deploymentSource: 'cockpit',
50
+ files: [
51
+ {
52
+ name: 'failing-process.bpmn',
53
+ content: readResource('failing-process.bpmn')
54
+ }
55
+ ]
56
+ }
57
+ ]),
58
+
59
+ operation('process-definition', 'start', [
60
+ {
61
+ key: 'user-tasks'
62
+ },
63
+ {
64
+ key: 'suspension-process'
65
+ },
66
+ {
67
+ key: 'failing-process'
68
+ }
69
+ ])
70
+ ),
71
+
72
+ setup2: combine(
73
+ operation('deployment', 'create', [
74
+ {
75
+ deploymentName: 'bpmn',
76
+ files: [
77
+ {
78
+ name: 'user-tasks.bpmn',
79
+ content: readResource('user-tasks.bpmn')
80
+ }
81
+ ]
82
+ },
83
+ {
84
+ deploymentName: 'cmmn',
85
+ files: [
86
+ {
87
+ name: 'loan-application.cmmn',
88
+ content: readResource('loan-application.cmmn')
89
+ }
90
+ ]
91
+ },
92
+ {
93
+ deploymentName: 'dmn',
94
+ files: [
95
+ {
96
+ name: 'assign-approver-groups.dmn',
97
+ content: readResource('assign-approver-groups.dmn')
98
+ },
99
+ {
100
+ name: 'drd.dmn',
101
+ content: readResource('drd.dmn')
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ deploymentName: 'image',
107
+ files: [
108
+ {
109
+ name: 'diagram.svg',
110
+ content: readResource('diagram.svg')
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ deploymentName: 'script',
116
+ files: [
117
+ {
118
+ name: 'my-script.groovy',
119
+ content: readResource('my-script.groovy')
120
+ }
121
+ ]
122
+ }
123
+ ]),
124
+
125
+ operation('process-definition', 'start', [
126
+ {
127
+ key: 'user-tasks'
128
+ },
129
+ {
130
+ key: 'user-tasks'
131
+ }
132
+ ]),
133
+
134
+ operation('case-definition', 'create', [
135
+ {
136
+ key: 'loanApplicationCase'
137
+ },
138
+ {
139
+ key: 'loanApplicationCase'
140
+ },
141
+ {
142
+ key: 'loanApplicationCase'
143
+ }
144
+ ])
145
+ ),
146
+
147
+ multiTenancySetup: combine(
148
+ operation('deployment', 'create', [
149
+ {
150
+ deploymentName: 'processTenantOne',
151
+ tenantId: 'tenant1',
152
+ files: [
153
+ {
154
+ name: 'user-tasks.bpmn',
155
+ content: readResource('user-tasks.bpmn')
156
+ }
157
+ ]
158
+ }
159
+ ]),
160
+
161
+ operation('deployment', 'create', [
162
+ {
163
+ deploymentName: 'processNoTenant',
164
+ files: [
165
+ {
166
+ name: 'user-tasks.bpmn',
167
+ content: readResource('user-tasks.bpmn')
168
+ }
169
+ ]
170
+ }
171
+ ])
172
+ )
173
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/repository-spec.js ADDED
@@ -0,0 +1,639 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var testHelper = require('../../../common/tests/test-helper');
21
+ var setupFile = require('./repository-setup');
22
+
23
+ var repositoryPage = require('../pages/repository');
24
+ var deploymentsPage = repositoryPage.deployments;
25
+ var resourcesPage = repositoryPage.resources;
26
+ var resourcePage = repositoryPage.resource;
27
+
28
+ describe('Repository Spec', function() {
29
+ describe('deployments sorting', function() {
30
+ before(function() {
31
+ return testHelper(setupFile.setup1, function() {
32
+ repositoryPage.navigateToWebapp('Cockpit');
33
+ repositoryPage.authentication.userLogin('admin', 'admin');
34
+ repositoryPage.navigateTo();
35
+ });
36
+ });
37
+
38
+ // handled by dashboard
39
+ xit('shows an active link in the header', function() {
40
+ expect(repositoryPage.navbarItem(1).getText()).to.eventually.eql(
41
+ 'Deployments'
42
+ );
43
+ expect(
44
+ repositoryPage.navbarItem(1).getAttribute('class')
45
+ ).to.eventually.contain('active');
46
+ });
47
+
48
+ it('should change sorting by', function() {
49
+ // given
50
+ expect(deploymentsPage.sortingBy()).to.eventually.eql('Deployment Time');
51
+
52
+ // when
53
+ deploymentsPage.changeSortingBy('Name');
54
+
55
+ // then
56
+ expect(deploymentsPage.sortingBy()).to.eventually.eql('Name');
57
+ expect(deploymentsPage.deploymentName(0)).to.eventually.eql(
58
+ 'third-deployment'
59
+ );
60
+ });
61
+
62
+ it('should change sorting order', function() {
63
+ // given
64
+ expect(deploymentsPage.isSortingDescending()).to.eventually.be.true;
65
+
66
+ // when
67
+ deploymentsPage.changeSortingDirection();
68
+
69
+ // then
70
+ expect(deploymentsPage.isSortingDescending()).to.eventually.be.false;
71
+ expect(deploymentsPage.isSortingAscending()).to.eventually.be.true;
72
+ expect(deploymentsPage.deploymentName(0)).to.eventually.eql(
73
+ 'first-deployment'
74
+ );
75
+ });
76
+
77
+ it('should change sorting order on URL change', function() {
78
+ browser.getLocationAbsUrl().then(function(url) {
79
+ expect(url).to.contain('deploymentsSortBy=name');
80
+
81
+ var location = url.substr(url.indexOf('#') + 2);
82
+
83
+ location = location.replace(
84
+ 'deploymentsSortBy=name',
85
+ 'deploymentsSortBy=id'
86
+ );
87
+
88
+ browser.setLocation(location).then(function() {
89
+ expect(deploymentsPage.sortingBy()).to.eventually.eql('ID');
90
+ });
91
+ });
92
+ });
93
+
94
+ it('should preserve sorting order on unrelated URL change', function() {
95
+ browser.setLocation('repository').then(function() {
96
+ expect(deploymentsPage.sortingBy()).to.eventually.eql('ID');
97
+ });
98
+ });
99
+ });
100
+
101
+ describe.skip('deployments search', function() {
102
+ before(function() {
103
+ return testHelper(setupFile.setup1, function() {
104
+ repositoryPage.navigateToWebapp('Cockpit');
105
+ repositoryPage.authentication.userLogin('admin', 'admin');
106
+ repositoryPage.navigateTo();
107
+ });
108
+ });
109
+
110
+ describe('add a search pill', function() {
111
+ it('should use wrong deployment name and find nothing', function() {
112
+ // when
113
+ deploymentsPage.createSearch('Name', 'xyz');
114
+
115
+ //then
116
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(0);
117
+ });
118
+
119
+ it('should change deployment name and find one deployment', function() {
120
+ // when
121
+ deploymentsPage.changeValue(0, 'second-deployment');
122
+
123
+ // then
124
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(1);
125
+ expect(deploymentsPage.deploymentName(0)).to.eventually.eql(
126
+ 'second-deployment'
127
+ );
128
+ });
129
+
130
+ it('should change operator and find one deployment', function() {
131
+ // when
132
+ deploymentsPage.changeOperator(0, 'like');
133
+
134
+ // then
135
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(1);
136
+ expect(deploymentsPage.deploymentName(0)).to.eventually.eql(
137
+ 'second-deployment'
138
+ );
139
+ });
140
+
141
+ it('should change value and find all deployments', function() {
142
+ // when
143
+ deploymentsPage.changeValue(0, '-deployment');
144
+
145
+ // then
146
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(3);
147
+ });
148
+ });
149
+
150
+ describe('add more search pills', function() {
151
+ it('should add Date search and find nothing', function() {
152
+ // when
153
+ deploymentsPage.createSearch(
154
+ 'Time',
155
+ 'before',
156
+ '2015-01-01T00:00:00',
157
+ true
158
+ );
159
+
160
+ // then
161
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(0);
162
+ });
163
+
164
+ it('should change operator and find all deployments', function() {
165
+ // when
166
+ deploymentsPage.changeOperator(1, 'after');
167
+
168
+ // then
169
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(3);
170
+ });
171
+
172
+ it('should keep search pills after page refresh', function() {
173
+ // given
174
+ deploymentsPage.changeOperator(0, '=');
175
+ deploymentsPage.changeValue(0, 'first-deployment');
176
+
177
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(1);
178
+ expect(deploymentsPage.deploymentName(0)).to.eventually.eql(
179
+ 'first-deployment'
180
+ );
181
+
182
+ // when
183
+ browser.getCurrentUrl().then(function(url) {
184
+ browser.get(url).then(function() {
185
+ browser.sleep(500);
186
+ });
187
+ });
188
+
189
+ // then
190
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(1);
191
+ expect(deploymentsPage.deploymentName(0)).to.eventually.eql(
192
+ 'first-deployment'
193
+ );
194
+ });
195
+ });
196
+
197
+ describe('remove search pill', function() {
198
+ it('should remove Name search', function() {
199
+ // when
200
+ deploymentsPage.deleteSearch(0);
201
+
202
+ // then
203
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(3);
204
+ });
205
+
206
+ it('should remove Deployment Time search', function() {
207
+ // when
208
+ deploymentsPage.deleteSearch(0);
209
+
210
+ // then
211
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(3);
212
+ });
213
+ });
214
+
215
+ describe('search by deployment source', function() {
216
+ it('should search by invalid deployment source', function() {
217
+ // when
218
+ deploymentsPage.createSearch('Source', 'xyz');
219
+
220
+ //then
221
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(0);
222
+ });
223
+
224
+ it('should search by process application deployment source', function() {
225
+ // when
226
+ deploymentsPage.changeValue(0, 'process application');
227
+
228
+ // then
229
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(1);
230
+ expect(deploymentsPage.deploymentName(0)).to.eventually.eql(
231
+ 'first-deployment'
232
+ );
233
+ expect(deploymentsPage.deploymentSource(0)).to.eventually.eql(
234
+ 'process application'
235
+ );
236
+ });
237
+
238
+ it('should search for undefined deployment sources', function() {
239
+ // when
240
+ deploymentsPage.changeType(0, 'Source Undefined');
241
+
242
+ // then
243
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(1);
244
+ expect(deploymentsPage.deploymentName(0)).to.eventually.eql(
245
+ 'second-deployment'
246
+ );
247
+ expect(deploymentsPage.deploymentSource(0)).to.eventually.eql('null');
248
+ });
249
+ });
250
+ });
251
+
252
+ describe('deployment selection', function() {
253
+ before(function() {
254
+ return testHelper(setupFile.setup1, function() {
255
+ repositoryPage.navigateToWebapp('Cockpit');
256
+ repositoryPage.authentication.userLogin('admin', 'admin');
257
+ repositoryPage.navigateTo();
258
+ });
259
+ });
260
+
261
+ it('should initially select first deployment', function() {
262
+ // then
263
+ expect(deploymentsPage.isDeploymentSelected(0)).to.eventually.be.true;
264
+ });
265
+
266
+ it('should select a deployment', function() {
267
+ // given
268
+ expect(deploymentsPage.isDeploymentSelected(0)).to.eventually.be.true;
269
+ expect(deploymentsPage.isDeploymentSelected(1)).to.eventually.be.false;
270
+ expect(deploymentsPage.isDeploymentSelected(2)).to.eventually.be.false;
271
+
272
+ // when
273
+ deploymentsPage.selectDeployment(2);
274
+
275
+ // then
276
+ expect(deploymentsPage.isDeploymentSelected(0)).to.eventually.be.false;
277
+ expect(deploymentsPage.isDeploymentSelected(1)).to.eventually.be.false;
278
+ expect(deploymentsPage.isDeploymentSelected(2)).to.eventually.be.true;
279
+ });
280
+ });
281
+
282
+ describe('delete deployment', function() {
283
+ before(function() {
284
+ return testHelper(setupFile.setup1, function() {
285
+ repositoryPage.navigateToWebapp('Cockpit');
286
+ repositoryPage.authentication.userLogin('admin', 'admin');
287
+ repositoryPage.navigateTo();
288
+ });
289
+ });
290
+
291
+ it('should open delete deployment modal', function() {
292
+ // given
293
+ deploymentsPage.deploymentName(2).then(function(name) {
294
+ // when
295
+ deploymentsPage.selectDeployment(2);
296
+ deploymentsPage.openDeleteDeployment(2);
297
+
298
+ // then
299
+ expect(deploymentsPage.modalTitle()).to.eventually.eql(
300
+ 'Delete Deployment: ' + name
301
+ );
302
+
303
+ expect(deploymentsPage.infobox().isPresent()).to.eventually.be.true;
304
+
305
+ expect(
306
+ deploymentsPage.cascadeCheckbox().isSelected()
307
+ ).to.eventually.be.false;
308
+ expect(
309
+ deploymentsPage.skipCustomListenersCheckbox().isSelected()
310
+ ).to.eventually.be.true;
311
+
312
+ expect(
313
+ deploymentsPage.deleteButton().isPresent()
314
+ ).to.eventually.be.true;
315
+ expect(
316
+ deploymentsPage.deleteButton().isEnabled()
317
+ ).to.eventually.be.false;
318
+
319
+ expect(deploymentsPage.closeButton().isPresent()).to.eventually.be.true;
320
+ });
321
+ });
322
+
323
+ it('should close delete deployment modal', function() {
324
+ // when
325
+ deploymentsPage.closeModal();
326
+
327
+ // then
328
+ expect(deploymentsPage.modalContent().isPresent()).to.eventually.be.false;
329
+ });
330
+
331
+ it('should enable delete button', function() {
332
+ // given
333
+ deploymentsPage.selectDeployment(2);
334
+ deploymentsPage.openDeleteDeployment(2);
335
+
336
+ expect(deploymentsPage.cascadeCheckbox().isSelected()).to.eventually.be
337
+ .false;
338
+
339
+ expect(deploymentsPage.deleteButton().isPresent()).to.eventually.be.true;
340
+ expect(deploymentsPage.deleteButton().isEnabled()).to.eventually.be.false;
341
+
342
+ // when
343
+ deploymentsPage.cascadeCheckbox().click();
344
+
345
+ // then
346
+ expect(deploymentsPage.cascadeCheckbox().isSelected()).to.eventually.be
347
+ .true;
348
+ expect(deploymentsPage.deleteButton().isEnabled()).to.eventually.be.true;
349
+ });
350
+
351
+ it('should delete deployment', function() {
352
+ // when
353
+ deploymentsPage.deleteDeployment();
354
+
355
+ // then
356
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(2);
357
+ });
358
+
359
+ it('should initially select first deployment', function() {
360
+ // then
361
+ expect(deploymentsPage.isDeploymentSelected(0)).to.eventually.be.true;
362
+ });
363
+ });
364
+
365
+ describe('resource details view', function() {
366
+ before(function() {
367
+ return testHelper(setupFile.setup1, function() {
368
+ repositoryPage.navigateToWebapp('Cockpit');
369
+ repositoryPage.authentication.userLogin('admin', 'admin');
370
+ repositoryPage.navigateTo();
371
+ });
372
+ });
373
+
374
+ it('should display info text when no resource is selected', function() {
375
+ // then
376
+ expect(resourcePage.noResourceInfoText()).to.eventually.eql(
377
+ 'Select a resource in the list.'
378
+ );
379
+ });
380
+
381
+ it('should appear when a resource is selected', function() {
382
+ // when
383
+ resourcesPage.resourceName(0).then(function(name) {
384
+ resourcesPage.selectResource(0);
385
+
386
+ // then
387
+ expect(resourcePage.resourceName()).to.eventually.eql(name);
388
+ });
389
+ });
390
+
391
+ it('should display version of the resource', function() {
392
+ expect(resourcePage.resourceVersion()).to.eventually.eql('Version: 1');
393
+ });
394
+ });
395
+
396
+ describe('diagram', function() {
397
+ before(function() {
398
+ return testHelper(setupFile.setup2, function() {
399
+ repositoryPage.navigateToWebapp('Cockpit');
400
+ repositoryPage.authentication.userLogin('admin', 'admin');
401
+ repositoryPage.navigateTo();
402
+ });
403
+ });
404
+
405
+ it('should display bpmn diagram', function() {
406
+ // given
407
+ expect(resourcePage.bpmnDiagramFormElement().isPresent()).to.eventually.be
408
+ .false;
409
+
410
+ // when
411
+ deploymentsPage.selectDeployment('bpmn');
412
+ resourcesPage.selectResource(0);
413
+
414
+ // then
415
+ expect(resourcePage.bpmnDiagramFormElement().isPresent()).to.eventually.be
416
+ .true;
417
+ });
418
+
419
+ it('should display cmmn diagram', function() {
420
+ // given
421
+ expect(resourcePage.cmmnDiagramFormElement().isPresent()).to.eventually.be
422
+ .false;
423
+
424
+ // when
425
+ deploymentsPage.selectDeployment('cmmn');
426
+ resourcesPage.selectResource(0);
427
+
428
+ // then
429
+ expect(resourcePage.cmmnDiagramFormElement().isPresent()).to.eventually.be
430
+ .true;
431
+ });
432
+
433
+ it('should display dmn diagram', function() {
434
+ // given
435
+ expect(resourcePage.dmnDiagramFormElement().isPresent()).to.eventually.be
436
+ .false;
437
+
438
+ // when
439
+ deploymentsPage.selectDeployment('dmn');
440
+ resourcesPage.selectResource(0);
441
+
442
+ // then
443
+ expect(resourcePage.dmnDiagramFormElement().isPresent()).to.eventually.be
444
+ .true;
445
+ });
446
+
447
+ it('should display image', function() {
448
+ // given
449
+ expect(resourcePage.imageFormElement().isPresent()).to.eventually.be
450
+ .false;
451
+
452
+ // when
453
+ deploymentsPage.selectDeployment('image');
454
+ resourcesPage.selectResource(0);
455
+
456
+ // then
457
+ expect(resourcePage.imageFormElement().isPresent()).to.eventually.be.true;
458
+ });
459
+
460
+ it('should display script', function() {
461
+ // given
462
+ expect(resourcePage.unkownResourceFormElement().isPresent()).to.eventually
463
+ .be.false;
464
+
465
+ // when
466
+ deploymentsPage.selectDeployment('script');
467
+ resourcesPage.selectResource(0);
468
+
469
+ // then
470
+ expect(resourcePage.unkownResourceFormElement().isPresent()).to.eventually
471
+ .be.true;
472
+ });
473
+ });
474
+
475
+ describe('download button', function() {
476
+ before(function() {
477
+ return testHelper(setupFile.setup1, function() {
478
+ repositoryPage.navigateToWebapp('Cockpit');
479
+ repositoryPage.authentication.userLogin('admin', 'admin');
480
+ repositoryPage.navigateTo();
481
+ });
482
+ });
483
+
484
+ it('should not display download button', function() {
485
+ // then
486
+ expect(resourcePage.downloadButton().isPresent()).to.eventually.be.false;
487
+ });
488
+
489
+ it('should display download button', function() {
490
+ // whe
491
+ resourcesPage.selectResource(0);
492
+
493
+ // then
494
+ expect(resourcePage.downloadButton().isPresent()).to.eventually.be.true;
495
+ });
496
+ });
497
+
498
+ describe('definitions tab', function() {
499
+ before(function() {
500
+ return testHelper(setupFile.setup2, function() {
501
+ repositoryPage.navigateToWebapp('Cockpit');
502
+ repositoryPage.authentication.userLogin('admin', 'admin');
503
+ repositoryPage.navigateTo();
504
+ });
505
+ });
506
+
507
+ it('should display deployed process definitions', function() {
508
+ // when
509
+ deploymentsPage.selectDeployment('bpmn');
510
+ resourcesPage.selectResource(0);
511
+
512
+ // then
513
+ expect(resourcePage.definitions.table().count()).to.eventually.eql(1);
514
+
515
+ expect(resourcePage.definitions.name(0).getText()).to.eventually.eql(
516
+ 'User Tasks'
517
+ );
518
+ expect(resourcePage.definitions.key(0).getText()).to.eventually.eql(
519
+ 'user-tasks'
520
+ );
521
+ expect(
522
+ resourcePage.definitions.instanceCount(0).getText()
523
+ ).to.eventually.eql('2');
524
+ });
525
+
526
+ it('should be empty', function() {
527
+ // when
528
+ deploymentsPage.selectDeployment('script');
529
+ resourcesPage.selectResource(0);
530
+
531
+ // then
532
+ expect(resourcePage.definitions.table().count()).to.eventually.eql(0);
533
+ });
534
+
535
+ it('should display deployed case definitions', function() {
536
+ // when
537
+ deploymentsPage.selectDeployment('cmmn');
538
+ resourcesPage.selectResource(0);
539
+
540
+ // then
541
+ expect(resourcePage.definitions.table().count()).to.eventually.eql(1);
542
+
543
+ expect(resourcePage.definitions.name(0).getText()).to.eventually.eql(
544
+ 'Loan Application'
545
+ );
546
+ expect(resourcePage.definitions.key(0).getText()).to.eventually.eql(
547
+ 'loanApplicationCase'
548
+ );
549
+ expect(
550
+ resourcePage.definitions.instanceCount(0).getText()
551
+ ).to.eventually.eql('0');
552
+ });
553
+
554
+ it('should display deployed decision definitions', function() {
555
+ // when
556
+ deploymentsPage.selectDeployment('dmn');
557
+ resourcesPage.selectResource(0);
558
+
559
+ // then
560
+ expect(resourcePage.definitions.table().count()).to.eventually.eql(1);
561
+
562
+ expect(resourcePage.definitions.name(0).getText()).to.eventually.eql(
563
+ 'Assign Approver'
564
+ );
565
+ expect(resourcePage.definitions.key(0).getText()).to.eventually.eql(
566
+ 'invoice-assign-approver'
567
+ );
568
+ });
569
+
570
+ it('should not display the version for dmn resources in the header', function() {
571
+ expect(resourcePage.resourceVersionElement().isDisplayed()).to.eventually
572
+ .be.false;
573
+ });
574
+
575
+ it('should contain the version in the definitions table', function() {
576
+ expect(resourcePage.definitions.version(0).getText()).to.eventually.eql(
577
+ '1'
578
+ );
579
+ });
580
+
581
+ it('should display deployed decision requirements definitions', function() {
582
+ resourcesPage.selectResource(1);
583
+
584
+ // then
585
+ expect(resourcePage.definitions.table().count()).to.eventually.eql(2);
586
+
587
+ expect(resourcePage.drdTable.name().getText()).to.eventually.eql(
588
+ 'camunda'
589
+ );
590
+ expect(resourcePage.drdTable.key().getText()).to.eventually.eql(
591
+ 'definitions'
592
+ );
593
+ expect(resourcePage.drdTable.version().getText()).to.eventually.eql('1');
594
+ });
595
+ });
596
+
597
+ describe('multi tenancy', function() {
598
+ before(function() {
599
+ return testHelper(setupFile.multiTenancySetup, function() {
600
+ repositoryPage.navigateToWebapp('Cockpit');
601
+ repositoryPage.authentication.userLogin('admin', 'admin');
602
+ repositoryPage.navigateTo();
603
+ });
604
+ });
605
+
606
+ it('should search by invalid tenant id', function() {
607
+ // when
608
+ deploymentsPage.createSearch('Tenant ID', 'nonExisting');
609
+
610
+ //then
611
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(0);
612
+ });
613
+
614
+ it('should search by tenant id', function() {
615
+ // when
616
+ deploymentsPage.changeValue(0, 'tenant1');
617
+
618
+ // then
619
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(1);
620
+ expect(deploymentsPage.deploymentTenantId(0)).to.eventually.eql(
621
+ 'tenant1'
622
+ );
623
+ });
624
+
625
+ it('should search for deployment without tenant id', function() {
626
+ // when
627
+ // prevent tooltip to intercept click
628
+ browser
629
+ .actions()
630
+ .mouseDown(element(by.css('body')))
631
+ .perform();
632
+ deploymentsPage.changeType(0, 'without Tenant ID');
633
+
634
+ // then
635
+ expect(deploymentsPage.deploymentList().count()).to.eventually.eql(1);
636
+ expect(deploymentsPage.deploymentTenantId(0)).to.eventually.eql('null');
637
+ });
638
+ });
639
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/sideba-spec.js ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /* jshint ignore:start */
19
+ 'use strict';
20
+
21
+ var testHelper = require('../../../common/tests/test-helper');
22
+ var setupFile = require('./decision-setup');
23
+
24
+ var dashboardPage = require('../pages/dashboard');
25
+ var decisionsPage = require('../pages/decisions');
26
+
27
+ describe('Sidebar Maximize/Restore Spec', function() {
28
+ var diagram;
29
+
30
+ before(function() {
31
+ return testHelper(setupFile.setup1, function() {
32
+ dashboardPage.navigateToWebapp('Cockpit');
33
+ dashboardPage.authentication.userLogin('admin', 'admin');
34
+ dashboardPage.goToSection('Decisions');
35
+ decisionsPage.deployedDecisionsList.decisionName(0);
36
+ decisionsPage.deployedDecisionsList.selectDecision(0);
37
+
38
+ browser.sleep(1000);
39
+
40
+ diagram = element(by.css('[decision-table]'));
41
+ });
42
+ });
43
+
44
+ it('maximize and restore element with controll buttons', function(done) {
45
+ var start = getDimensions(diagram);
46
+
47
+ clickMaximizeBtn();
48
+ browser.sleep(1000); //wait for animation to end
49
+
50
+ var maximized = getDimensions(diagram);
51
+
52
+ clickRestoreBtn();
53
+ browser.sleep(1000); //wait for animation to end
54
+
55
+ var restored = getDimensions(diagram);
56
+
57
+ protractor.promise
58
+ .all([start, maximized, restored])
59
+ .then(function(dimensions) {
60
+ var start = dimensions[0];
61
+ var maximized = dimensions[1];
62
+ var restored = dimensions[2];
63
+
64
+ expect(start).to.eql(restored);
65
+ expect(maximized.width).to.be.above(start.width);
66
+ expect(maximized.height).to.be.above(start.height);
67
+
68
+ done();
69
+ });
70
+ });
71
+ });
72
+
73
+ function clickMaximizeBtn() {
74
+ element(by.css('.maximize-collapsable')).click();
75
+ }
76
+
77
+ function clickRestoreBtn() {
78
+ element(by.css('.restore-collapsable')).click();
79
+ }
80
+
81
+ function getDimensions(element) {
82
+ var width = element.getCssValue('width');
83
+ var height = element.getCssValue('height');
84
+
85
+ return protractor.promise.all([width, height]).then(function(dimensions) {
86
+ return {
87
+ width: extractPxNumber(dimensions[0]),
88
+ height: extractPxNumber(dimensions[1])
89
+ };
90
+ });
91
+ }
92
+
93
+ function extractPxNumber(value) {
94
+ var pattern = /^([0-9]+)/;
95
+ var matched = value.match(pattern);
96
+
97
+ if (!matched) {
98
+ return;
99
+ }
100
+
101
+ return +matched[1];
102
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/suspension-setup.js ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var factory = require('../../../common/tests/setup-factory.js'),
21
+ readResource = factory.readResource,
22
+ combine = factory.combine,
23
+ operation = factory.operation;
24
+
25
+ module.exports = {
26
+ setup1: combine(
27
+ operation('deployment', 'create', [
28
+ {
29
+ deploymentName: 'suspension-process',
30
+ files: [
31
+ {
32
+ name: 'suspension-process.bpmn',
33
+ content: readResource('suspension-process.bpmn')
34
+ }
35
+ ]
36
+ }
37
+ ]),
38
+
39
+ operation('process-definition', 'start', [
40
+ {
41
+ key: 'suspension-process',
42
+ businessKey: 'Instance1'
43
+ },
44
+ {
45
+ key: 'suspension-process',
46
+ businessKey: 'Instance2'
47
+ },
48
+ {
49
+ key: 'suspension-process',
50
+ businessKey: 'myBusinessKey'
51
+ }
52
+ ])
53
+ )
54
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/suspension-spec.js ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var testHelper = require('../../../common/tests/test-helper');
21
+ var setupFile = require('./suspension-setup');
22
+
23
+ var dashboardPage = require('../pages/dashboard');
24
+ var processesPage = require('../pages/processes');
25
+ var definitionPage = require('../pages/process-definition');
26
+ var instancePage = require('../pages/process-instance');
27
+
28
+ describe('Cockpit Suspsension Spec', function() {
29
+ describe('process definition suspension', function() {
30
+ before(function() {
31
+ return testHelper(setupFile.setup1, function() {
32
+ dashboardPage.navigateToWebapp('Cockpit');
33
+ dashboardPage.authentication.userLogin('admin', 'admin');
34
+ dashboardPage.goToSection('Processes');
35
+ processesPage.deployedProcessesList.selectProcess(0);
36
+ });
37
+ });
38
+
39
+ it('should suspend definition immediately', function() {
40
+ // when
41
+ definitionPage.suspension.suspendDefinition();
42
+
43
+ // then
44
+ expect(definitionPage.isDefinitionSuspended()).to.eventually.be.true;
45
+ });
46
+
47
+ it('should active definition immediately', function() {
48
+ // when
49
+ definitionPage.suspension.activateDefinition();
50
+
51
+ // then
52
+ expect(definitionPage.isDefinitionSuspended()).to.eventually.be.false;
53
+ });
54
+ });
55
+
56
+ describe('process instance suspension', function() {
57
+ before(function() {
58
+ return testHelper(setupFile.setup1, function() {
59
+ dashboardPage.navigateToWebapp('Cockpit');
60
+ dashboardPage.authentication.userLogin('admin', 'admin');
61
+ dashboardPage.goToSection('Processes');
62
+ processesPage.deployedProcessesList.selectProcess(0);
63
+ definitionPage.processInstancesTab.selectInstanceId(0);
64
+ });
65
+ });
66
+
67
+ it('should suspend instance', function() {
68
+ // when
69
+ instancePage.suspension.suspendInstance();
70
+
71
+ // then
72
+ expect(instancePage.isInstanceSuspended()).to.eventually.be.true;
73
+ });
74
+
75
+ it('should validate suspended instance', function() {
76
+ // when
77
+ instancePage.navbarBrand().click();
78
+ dashboardPage.goToSection('Processes');
79
+ processesPage.deployedProcessesList.selectProcess(0);
80
+
81
+ // then
82
+ expect(definitionPage.processInstancesTab.isInstanceSuspended(0)).to
83
+ .eventually.be.true;
84
+
85
+ // finaly
86
+ definitionPage.processInstancesTab.selectInstanceId(0);
87
+ });
88
+
89
+ it('should active instance', function() {
90
+ // when
91
+ instancePage.suspension.activateInstance();
92
+
93
+ // then
94
+ expect(instancePage.isInstanceSuspended()).to.eventually.be.false;
95
+ });
96
+ });
97
+
98
+ describe('job suspension', function() {
99
+ before(function() {
100
+ return testHelper(setupFile.setup1, function() {
101
+ dashboardPage.navigateToWebapp('Cockpit');
102
+ dashboardPage.authentication.userLogin('admin', 'admin');
103
+ dashboardPage.goToSection('Processes');
104
+ processesPage.deployedProcessesList.selectProcess(0);
105
+ definitionPage.jobDefinitionsTab.selectTab();
106
+ });
107
+ });
108
+
109
+ it('should suspend job definition immediately', function() {
110
+ // when
111
+ definitionPage.jobDefinitionsTab.suspendJobDefinition(0);
112
+
113
+ // then
114
+ expect(definitionPage.diagram.isActivitySuspended('HelloCallActivity')).to
115
+ .eventually.be.true;
116
+ });
117
+
118
+ it('should active job definition immediately', function() {
119
+ // when
120
+ definitionPage.jobDefinitionsTab.activateJobDefinition(0);
121
+
122
+ // then
123
+ expect(definitionPage.diagram.isActivitySuspended('HelloCallActivity')).to
124
+ .eventually.be.false;
125
+ });
126
+
127
+ it('should display suspension badge on suspension for second job for activity', function() {
128
+ // when
129
+ definitionPage.jobDefinitionsTab.suspendJobDefinition(1);
130
+
131
+ // then
132
+ expect(definitionPage.diagram.isActivitySuspended('HelloCallActivity')).to
133
+ .eventually.be.true;
134
+ });
135
+ });
136
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/task-setup.js ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var factory = require('../../../common/tests/setup-factory.js'),
21
+ readResource = factory.readResource,
22
+ combine = factory.combine,
23
+ operation = factory.operation;
24
+
25
+ var singleTaskSetup = combine(
26
+ combine(
27
+ operation('deployment', 'create', [
28
+ {
29
+ deploymentName: 'parallel-user-tasks',
30
+ files: [
31
+ {
32
+ name: 'parallel-user-tasks.bpmn',
33
+ content: readResource('parallel-user-tasks.bpmn')
34
+ }
35
+ ]
36
+ }
37
+ ]),
38
+
39
+ operation('process-definition', 'start', [
40
+ {
41
+ key: 'parallel-user-tasks',
42
+ businessKey: 'Instance1',
43
+ variables: {
44
+ test: {
45
+ value: 1.5,
46
+ type: 'Double'
47
+ },
48
+ myString: {
49
+ value: '123 dfg',
50
+ type: 'String'
51
+ },
52
+ extraLong: {
53
+ value: '1234567890987654321',
54
+ type: 'Long'
55
+ }
56
+ }
57
+ }
58
+ ])
59
+ )
60
+ );
61
+
62
+ module.exports = {
63
+ setup1: singleTaskSetup
64
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/tasks-spec.js ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var testHelper = require('../../../common/tests/test-helper');
21
+ var setupFile = require('./task-setup');
22
+
23
+ var tasksPage = require('../pages/tasks');
24
+
25
+ describe('Cockpit Tasks Dashboard Spec', function() {
26
+ describe('dashboard page navigation', function() {
27
+ before(function() {
28
+ return testHelper(setupFile.setup1, function() {
29
+ // when
30
+ tasksPage.navigateToWebapp('Cockpit');
31
+ tasksPage.authentication.userLogin('admin', 'admin');
32
+ tasksPage.goToSection('Human Tasks');
33
+ });
34
+ });
35
+
36
+ describe('open tasks statistics', function() {
37
+ it('should show total open tasks', function() {
38
+ // then
39
+ expect(
40
+ tasksPage.openTasksStatistics.taskStatisticsTableHeadCount()
41
+ ).to.eventually.eql('3');
42
+ });
43
+
44
+ it('should show task counts for assigned/claimed tasks', function() {
45
+ // then
46
+ expect(
47
+ tasksPage.openTasksStatistics.taskStatisticLabel(0)
48
+ ).to.eventually.eql('assigned to a user');
49
+ expect(
50
+ tasksPage.openTasksStatistics.taskStatisticCount(0)
51
+ ).to.eventually.eql('1');
52
+ });
53
+
54
+ it('should show tasks counts for tasks with a group', function() {
55
+ // then
56
+ expect(
57
+ tasksPage.openTasksStatistics.taskStatisticLabel(1)
58
+ ).to.eventually.eql('assigned to 1 or more groups');
59
+ expect(
60
+ tasksPage.openTasksStatistics.taskStatisticCount(1)
61
+ ).to.eventually.eql('1');
62
+ });
63
+
64
+ it('should show tasks counts for tasks without a user or a group', function() {
65
+ // then
66
+ expect(
67
+ tasksPage.openTasksStatistics.taskStatisticLabel(2)
68
+ ).to.eventually.eql('unassigned');
69
+ expect(
70
+ tasksPage.openTasksStatistics.taskStatisticCount(2)
71
+ ).to.eventually.eql('1');
72
+ });
73
+ });
74
+
75
+ describe('open task count by group table', function() {
76
+ it('should contain a number groups', function() {
77
+ // then
78
+ expect(
79
+ tasksPage.openTasksStatistics.taskGroupList()
80
+ ).to.eventually.have.length(3);
81
+ });
82
+
83
+ it('should show a group entry', function() {
84
+ // then
85
+ expect(
86
+ tasksPage.openTasksStatistics.taskGroupName(0)
87
+ ).to.eventually.eql('without group');
88
+ expect(
89
+ tasksPage.openTasksStatistics.taskGroupCount(0)
90
+ ).to.eventually.eql('1');
91
+ });
92
+
93
+ it('should show an info that a task can have multiple groups', function() {
94
+ // then
95
+ expect(
96
+ tasksPage.openTasksStatistics.multipleGroupsInfo()
97
+ ).to.eventually.eql(true);
98
+ });
99
+ });
100
+ });
101
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/cockpit/tests/specs/variable-spec.js ADDED
@@ -0,0 +1,526 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var testHelper = require('../../../common/tests/test-helper');
21
+ var setupFile = require('./process-setup');
22
+
23
+ var dashboardPage = require('../pages/dashboard');
24
+ var processesPage = require('../pages/processes');
25
+ var definitionPage = require('../pages/process-definition');
26
+ var instancePage = require('../pages/process-instance');
27
+
28
+ describe('Cockpit Variable Spec', function() {
29
+ describe('work with variables', function() {
30
+ before(function() {
31
+ return testHelper(setupFile.setup1, function() {
32
+ dashboardPage.navigateToWebapp('Cockpit');
33
+ dashboardPage.authentication.userLogin('admin', 'admin');
34
+ dashboardPage.goToSection('Processes');
35
+ processesPage.deployedProcessesList.selectProcess(0);
36
+ definitionPage.processInstancesTab.selectInstanceId(0);
37
+ });
38
+ });
39
+
40
+ it('should select variable scope', function() {
41
+ // given
42
+ instancePage.sidebarTabClick('Filter');
43
+ expect(
44
+ instancePage.instanceTree.instanceSelectionLabel().getText()
45
+ ).to.eventually.eql('Nothing');
46
+
47
+ // when
48
+ instancePage.variablesTab.variableScopeLink(1).click();
49
+
50
+ // then
51
+ expect(instancePage.instanceTree.isInstanceSelected('User Tasks')).to
52
+ .eventually.be.true;
53
+ expect(
54
+ instancePage.instanceTree.instanceSelectionLabel().getText()
55
+ ).to.eventually.eql('1 activity instance');
56
+
57
+ // finally
58
+ instancePage.instanceTree.clearInstanceSelection();
59
+ });
60
+
61
+ it('should add String variable', function() {
62
+ // given
63
+ expect(instancePage.variablesTab.table().count()).to.eventually.eql(3);
64
+
65
+ // when
66
+ instancePage.addVariable.addVariable('myTestVar', 'String', '12345');
67
+
68
+ // then
69
+ expect(instancePage.variablesTab.table().count()).to.eventually.eql(4);
70
+
71
+ instancePage.variablesTab
72
+ .findElementIndexInRepeater(
73
+ '(v, info) in variables',
74
+ by.binding('variable.name'),
75
+ 'myTestVar'
76
+ )
77
+ .then(function(idx) {
78
+ var variable = instancePage.variablesTab.variableAt(idx);
79
+
80
+ expect(variable.name().getText()).to.eventually.eql('myTestVar');
81
+ expect(variable.type().getText()).to.eventually.eql('String');
82
+ expect(variable.value().getText()).to.eventually.eql('12345');
83
+
84
+ expect(
85
+ instancePage.variablesTab.variableScope(idx).getText()
86
+ ).to.eventually.eql('User Tasks');
87
+ });
88
+ });
89
+
90
+ it('should add Boolean variable', function() {
91
+ // given
92
+ instancePage.variablesTab
93
+ .table()
94
+ .count()
95
+ .then(function(varCountBefore) {
96
+ // when
97
+ instancePage.addVariable.addVariable('myBooleanVar', 'Boolean', true);
98
+
99
+ // then
100
+ expect(instancePage.variablesTab.table().count()).to.eventually.eql(
101
+ varCountBefore + 1
102
+ );
103
+
104
+ instancePage.variablesTab
105
+ .findElementIndexInRepeater(
106
+ '(v, info) in variables',
107
+ by.binding('variable.name'),
108
+ 'myBooleanVar'
109
+ )
110
+ .then(function(idx) {
111
+ var variable = instancePage.variablesTab.variableAt(idx);
112
+
113
+ expect(variable.name().getText()).to.eventually.eql(
114
+ 'myBooleanVar'
115
+ );
116
+ expect(variable.type().getText()).to.eventually.eql('Boolean');
117
+ expect(variable.value().getText()).to.eventually.eql('true');
118
+
119
+ expect(
120
+ instancePage.variablesTab.variableScope(idx).getText()
121
+ ).to.eventually.eql('User Tasks');
122
+ });
123
+ });
124
+ });
125
+
126
+ it('should add a NULL process variable', function() {
127
+ //given
128
+ instancePage.variablesTab
129
+ .table()
130
+ .count()
131
+ .then(function(varCountBefore) {
132
+ // when
133
+ instancePage.addVariable.addVariable('myNullVar', 'Null');
134
+
135
+ // then
136
+ expect(instancePage.variablesTab.table().count()).to.eventually.eql(
137
+ varCountBefore + 1
138
+ );
139
+ instancePage.variablesTab
140
+ .findElementIndexInRepeater(
141
+ '(v, info) in variables',
142
+ by.binding('variable.name'),
143
+ 'myNullVar'
144
+ )
145
+ .then(function(idx) {
146
+ var variable = instancePage.variablesTab.variableAt(idx);
147
+
148
+ expect(variable.name().getText()).to.eventually.eql('myNullVar');
149
+ expect(variable.type().getText()).to.eventually.eql('Null');
150
+ expect(variable.value().getText()).to.eventually.eql('');
151
+
152
+ expect(
153
+ instancePage.variablesTab.variableScope(idx).getText()
154
+ ).to.eventually.eql('User Tasks');
155
+ });
156
+ });
157
+ });
158
+
159
+ it('should add an Object process variable', function() {
160
+ // given
161
+ instancePage.variablesTab
162
+ .table()
163
+ .count()
164
+ .then(function(varCountBefore) {
165
+ // when
166
+ instancePage.addVariable.addVariable('myObjectVar', 'Object', {
167
+ value:
168
+ 'rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAADdwQAAAADdAADb25ldAADdHdvdAAFdGhyZWV4',
169
+ objectTypeName: 'java.util.ArrayList',
170
+ serializationDataFormat: 'application/x-java-serialized-object'
171
+ });
172
+
173
+ // then
174
+ expect(instancePage.variablesTab.table().count()).to.eventually.eql(
175
+ varCountBefore + 1
176
+ );
177
+ instancePage.variablesTab
178
+ .findElementIndexInRepeater(
179
+ '(v, info) in variables',
180
+ by.binding('variable.name'),
181
+ 'myObjectVar'
182
+ )
183
+ .then(function(idx) {
184
+ var variable = instancePage.variablesTab.variableAt(idx);
185
+
186
+ expect(variable.name().getText()).to.eventually.eql(
187
+ 'myObjectVar'
188
+ );
189
+ expect(variable.type().getText()).to.eventually.eql('Object');
190
+ expect(variable.value().getText()).to.eventually.eql(
191
+ 'java.util.ArrayList'
192
+ );
193
+
194
+ expect(
195
+ instancePage.variablesTab.variableScope(idx).getText()
196
+ ).to.eventually.eql('User Tasks');
197
+ });
198
+ });
199
+ });
200
+
201
+ it('should change variable', function() {
202
+ // given
203
+ var variable = instancePage.variablesTab.variableByName('test');
204
+
205
+ expect(variable.type().getText()).to.eventually.eql('Double');
206
+ expect(variable.value().getText()).to.eventually.eql('1.49');
207
+
208
+ // when
209
+ variable.enterEditMode();
210
+ variable
211
+ .valueInput()
212
+ .clear()
213
+ .sendKeys('1.5');
214
+ variable.typeSelect('String').click();
215
+ variable.saveButton().click();
216
+
217
+ // then
218
+ expect(variable.name().getText()).to.eventually.eql('test');
219
+ expect(variable.type().getText()).to.eventually.eql('String');
220
+ expect(variable.value().getText()).to.eventually.eql('1.5');
221
+ });
222
+
223
+ it('should select wrong variable type', function() {
224
+ // given
225
+ var variable = instancePage.variablesTab.variableByName('myDate');
226
+
227
+ expect(variable.type().getText()).to.eventually.eql('Date');
228
+ expect(variable.value().getText()).to.eventually.eql(
229
+ '2011-11-11T11:11:11'
230
+ );
231
+
232
+ // when
233
+ variable.enterEditMode();
234
+ variable.typeSelect('Short').click();
235
+
236
+ // then
237
+ expect(variable.classes()).to.eventually.match(/invalid/);
238
+ expect(variable.saveButton().isEnabled()).to.be.eventually.be.false;
239
+ });
240
+
241
+ describe('validate add variables modal view', function() {
242
+ // ensure the modal dialog to be closed
243
+ after(function(done) {
244
+ var btn = instancePage.addVariable.okButton();
245
+ btn.isPresent().then(
246
+ function() {
247
+ btn.click().then(function() {
248
+ done();
249
+ });
250
+ },
251
+ function() {
252
+ done();
253
+ }
254
+ );
255
+ });
256
+
257
+ it('should open modal view', function() {
258
+ // when
259
+ instancePage.addVariable.addVariableButton().click();
260
+
261
+ // then
262
+ expect(
263
+ instancePage.addVariable.modalHeading().getText()
264
+ ).to.eventually.eql('Add Variable to Process Instance');
265
+ });
266
+
267
+ it('should enter variable data', function() {
268
+ // given
269
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
270
+ .be.false;
271
+ expect(
272
+ instancePage.addVariable.variableTypeDropdownSelectedItem().getText()
273
+ ).to.eventually.eql('String');
274
+
275
+ // when
276
+ instancePage.addVariable.variableNameInput('myTestVariable');
277
+
278
+ // then
279
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
280
+ .be.false;
281
+
282
+ // when
283
+ instancePage.addVariable.variableValueInput('abc123$%&');
284
+
285
+ // then
286
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
287
+ .be.true;
288
+
289
+ // when
290
+ instancePage.addVariable.variableNameInput().clear();
291
+
292
+ // then
293
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
294
+ .be.false;
295
+
296
+ // finaly
297
+ instancePage.addVariable.variableNameInput('myTestVariable');
298
+ });
299
+
300
+ it('should change from string to integer', function() {
301
+ // given
302
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
303
+ .be.true;
304
+
305
+ // when
306
+ instancePage.addVariable.variableTypeDropdown('Integer').click();
307
+
308
+ // then
309
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
310
+ .be.false;
311
+ expect(
312
+ instancePage.addVariable.variableValueInfoLabel().getText()
313
+ ).to.eventually.eql('Only a Integer value is allowed.');
314
+ });
315
+
316
+ it('should change to short', function() {
317
+ // when
318
+ instancePage.addVariable.variableTypeDropdown('Short').click();
319
+
320
+ // then
321
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
322
+ .be.false;
323
+ expect(
324
+ instancePage.addVariable.variableValueInfoLabel().getText()
325
+ ).to.eventually.eql('Only a Short value is allowed.');
326
+ });
327
+
328
+ it('should change to double', function() {
329
+ // when
330
+ instancePage.addVariable.variableTypeDropdown('Double').click();
331
+
332
+ // then
333
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
334
+ .be.false;
335
+ expect(
336
+ instancePage.addVariable.variableValueInfoLabel().getText()
337
+ ).to.eventually.eql('Only a Double value is allowed.');
338
+ });
339
+
340
+ it('should change long', function() {
341
+ // when
342
+ instancePage.addVariable.variableTypeDropdown('Long').click();
343
+
344
+ // then
345
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
346
+ .be.false;
347
+ expect(
348
+ instancePage.addVariable.variableValueInfoLabel().getText()
349
+ ).to.eventually.eql('Only a Long value is allowed.');
350
+ });
351
+
352
+ it('should enter valid variable value', function() {
353
+ // when
354
+ instancePage.addVariable.variableValueInput().clear();
355
+ instancePage.addVariable.variableValueInput('123456789');
356
+
357
+ // then
358
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
359
+ .be.true;
360
+ expect(instancePage.addVariable.variableValueInfoLabel().isPresent()).to
361
+ .eventually.be.false;
362
+ });
363
+
364
+ it('should change to date', function() {
365
+ // when
366
+ instancePage.addVariable.variableTypeDropdown('Date').click();
367
+
368
+ // then
369
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
370
+ .be.false;
371
+ expect(
372
+ instancePage.addVariable.variableValueInfoLabel().getText()
373
+ ).to.eventually.eql("Supported pattern 'yyyy-MM-ddTHH:mm:ss'.");
374
+ });
375
+
376
+ it('should change to object', function() {
377
+ // when
378
+ instancePage.addVariable.variableTypeDropdown('Object').click();
379
+
380
+ // then
381
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
382
+ .be.false;
383
+ expect(
384
+ instancePage.addVariable.objectValueInput().getAttribute('value')
385
+ ).to.eventually.eql('123456789');
386
+ });
387
+
388
+ it('should change to null', function() {
389
+ // when
390
+ instancePage.addVariable.variableTypeDropdown('Null').click();
391
+
392
+ // then
393
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
394
+ .be.true;
395
+ expect(instancePage.addVariable.variableValueInput().isPresent()).to
396
+ .eventually.be.false;
397
+ });
398
+
399
+ it('should change to boolean', function() {
400
+ // when
401
+ instancePage.addVariable.variableTypeDropdown('Boolean').click();
402
+
403
+ // then
404
+ expect(instancePage.addVariable.addButton().isEnabled()).to.eventually
405
+ .be.true;
406
+ });
407
+ });
408
+
409
+ describe('variables table widget', function() {
410
+ var variable;
411
+
412
+ before(function() {
413
+ // NEVER select a variable by index as you get no guarantee on a consistent order
414
+ // select variable by name instead
415
+ variable = instancePage.variablesTab.variableByName('myString');
416
+ });
417
+
418
+ it('shows the information about the variables by default', function() {
419
+ expect(variable.name().getText()).to.eventually.eql('myString');
420
+
421
+ expect(variable.value().getText()).to.eventually.eql('abc dfg');
422
+
423
+ expect(variable.type().getText()).to.eventually.eql('String');
424
+
425
+ expect(variable.actionsCell().isDisplayed()).to.eventually.eql(true);
426
+ });
427
+
428
+ it('provides actions', function() {
429
+ expect(variable.editButton().isDisplayed()).to.eventually.eql(true);
430
+
431
+ expect(variable.deleteButton().isDisplayed()).to.eventually.eql(true);
432
+ });
433
+
434
+ describe('edit mode', function() {
435
+ before(function() {
436
+ variable.enterEditMode();
437
+ });
438
+
439
+ it('shows the relevant fields', function() {
440
+ expect(variable.typeSelectElement().isDisplayed()).to.eventually.eql(
441
+ true
442
+ );
443
+
444
+ expect(variable.valueInput().isDisplayed()).to.eventually.eql(true);
445
+
446
+ expect(variable.nameInput().isPresent()).to.eventually.eql(false);
447
+ });
448
+
449
+ describe('unchanged', function() {
450
+ it('does not allow to save', function() {
451
+ expect(
452
+ variable.saveButton().getAttribute('disabled')
453
+ ).to.eventually.eql('true');
454
+ });
455
+ });
456
+
457
+ describe('changed', function() {
458
+ before(function() {
459
+ variable
460
+ .valueInput()
461
+ .clear()
462
+ .sendKeys('pipapo');
463
+ });
464
+
465
+ it('enables the save button', function() {
466
+ expect(
467
+ variable.saveButton().getAttribute('disabled')
468
+ ).to.eventually.eql(null);
469
+ });
470
+
471
+ describe('save action', function() {
472
+ before(function() {
473
+ variable.saveButton().click();
474
+ });
475
+
476
+ it('saves the variable', function() {
477
+ expect(variable.value().getText()).to.eventually.eql('pipapo');
478
+ });
479
+
480
+ it('exits the edit mode', function() {
481
+ expect(
482
+ variable.typeSelectElement().isPresent()
483
+ ).to.eventually.eql(false);
484
+
485
+ expect(variable.valueInput().isPresent()).to.eventually.eql(
486
+ false
487
+ );
488
+
489
+ expect(variable.nameInput().isPresent()).to.eventually.eql(false);
490
+
491
+ expect(variable.saveButton().isPresent()).to.eventually.eql(
492
+ false
493
+ );
494
+
495
+ expect(variable.editButton().isDisplayed()).to.eventually.eql(
496
+ true
497
+ );
498
+ });
499
+ });
500
+ });
501
+ });
502
+
503
+ describe('deletion', function() {
504
+ before(function() {
505
+ instancePage.addVariable.addVariable(
506
+ 'toBeDeleted',
507
+ 'String',
508
+ 'whatever'
509
+ );
510
+
511
+ variable = instancePage.variablesTab.variableByName('toBeDeleted');
512
+ });
513
+
514
+ it('is possible in read mode', function() {
515
+ expect(variable.name().getText()).to.eventually.eql('toBeDeleted');
516
+
517
+ expect(variable.deleteButton().isDisplayed()).to.eventually.eql(true);
518
+
519
+ variable.deleteButton().click();
520
+
521
+ expect(variable.node.isPresent()).to.eventually.eql(false);
522
+ });
523
+ });
524
+ });
525
+ });
526
+ });
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/images/favicon.ico ADDED
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/lib/jquery.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ window.jQuery = require('jquery');
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/directives/breadcrumbs.html ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- # CE - camunda-bpm-webapp/ui/common/scripts/directives/breadcrumbs.html -->
2
+ <ul class="cam-breadcrumb">
3
+ <li ng-class="{ active: !breadcrumbs || !breadcrumbs.length }">
4
+ <a href="#/"
5
+ class="text">{{ 'DASHBOARD_DASHBOARD' | translate }}</a>
6
+ </li>
7
+
8
+ <li ng-repeat="(index, crumb) in breadcrumbs"
9
+ ng-class="{ active: !!$last }"
10
+ data-index="{{ index }}">
11
+ <span class="divider" ng-click="crumb.hidden = !crumb.hidden">{{ crumb.divider || divider }}</span>
12
+
13
+ <!-- using ng-show to separate logic of creating breadcrumbs elements from
14
+ logic of dynamically showing and hidding them -->
15
+ <a ng-if="!!crumb.href && !$last"
16
+ ng-show="!crumb.hidden"
17
+ href="{{ getHref(crumb) }}"
18
+ class="text">{{ crumb.label | translate }}</a>
19
+
20
+ <span ng-if="!!crumb.href && !!$last"
21
+ ng-show="!crumb.hidden"
22
+ class="text">{{ crumb.label }}</span>
23
+
24
+ <a ng-if="!crumb.href && !!crumb.callback"
25
+ ng-show="!crumb.hidden"
26
+ ng-click="crumb.callback(index, breadcrumbs)"
27
+ href
28
+ class="text">{{ crumb.label }}</a>
29
+
30
+ <span ng-if="!crumb.href && !crumb.callback"
31
+ ng-show="!crumb.hidden"
32
+ class="text">{{ crumb.label | translate }}</span>
33
+
34
+ <span ng-if="(crumb.type === 'processDefinition' && crumb.processDefinition.suspended) || (crumb.type === 'processInstance' && crumb.processInstance.suspended)"
35
+ ng-show="!crumb.hidden"
36
+ class="badge badge-warning badge-suspended"
37
+ uib-tooltip="{{ 'BREAD_CRUMBS_CURRENTLY_SUSPENDED' | translate }}"
38
+ tooltip-placement="bottom">
39
+ <span class="glyphicon glyphicon-pause white"></span>
40
+ </span>
41
+
42
+ <span ng-if="!!crumb.choices && crumb.choices.length === 1" ng-show="!crumb.hidden">
43
+ <span class="divider">:</span>
44
+ {{ getActiveChoice(crumb.choices) | translate }}
45
+ </span>
46
+
47
+ <span ng-if="!!crumb.choices && crumb.choices.length === 2"
48
+ class="switcher"
49
+ ng-show="!crumb.hidden"
50
+ ng-init="choices = sortedChoices(crumb.choices)">
51
+ <span class="divider">:</span>
52
+
53
+ <span class="current">{{ choices[0].label | translate}}</span>
54
+ <span class="divider">|</span>
55
+ <a href ng-click="selectChoice($event, choices[1])">{{ choices[1].label | translate}}</a>
56
+ </span>
57
+
58
+ <span ng-if="!!crumb.choices && crumb.choices.length > 2"
59
+ ng-show="!crumb.hidden"
60
+ class="dropdown"
61
+ uib-dropdown>
62
+ <span class="divider">:</span>
63
+
64
+ <a class="dropdown-toggle"
65
+ uib-dropdown-toggle
66
+ ng-show="!crumb.hidden"
67
+ href>
68
+ {{ getActiveChoice(crumb.choices) }}
69
+ <span class="caret"></span>
70
+ </a>
71
+
72
+ <ul class="dropdown-menu dropdown-menu-right" ng-show="!crumb.hidden" uib-dropdown-menu>
73
+ <li ng-repeat="choice in crumb.choices"
74
+ ng-class="{active: choice.active}">
75
+ <a href ng-click="selectChoice($event, choice)">{{ choice.label }}</a>
76
+ </li>
77
+ </ul>
78
+ </span>
79
+ </li>
80
+ </ul>
81
+ <!-- / CE - camunda-bpm-webapp/ui/common/scripts/directives/breadcrumbs.html -->
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/directives/breadcrumbs.js ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var template = require('./breadcrumbs.html?raw');
21
+
22
+ module.exports = [
23
+ '$location',
24
+ 'routeUtil',
25
+ function($location, routeUtil) {
26
+ return {
27
+ scope: {
28
+ divider: '@'
29
+ },
30
+
31
+ restrict: 'A',
32
+
33
+ template: template,
34
+
35
+ link: function(scope) {
36
+ // event triggered by the breadcrumbs service when the breadcrumbs are alterated
37
+ scope.$on('page.breadcrumbs.changed', function(ev, breadcrumbs) {
38
+ scope.breadcrumbs = breadcrumbs;
39
+ });
40
+
41
+ scope.getHref = function(crumb) {
42
+ return routeUtil.redirectTo(
43
+ crumb.href,
44
+ $location.search(),
45
+ crumb.keepSearchParams
46
+ );
47
+ };
48
+
49
+ scope.selectChoice = function(evt, choice) {
50
+ evt.preventDefault();
51
+ $location.path(choice.href.substr(1));
52
+ };
53
+
54
+ scope.getActiveChoice = function(choices) {
55
+ var label;
56
+ choices.forEach(function(choice) {
57
+ if (choice.active) {
58
+ label = choice.label;
59
+ }
60
+ });
61
+ return label || 'Options';
62
+ };
63
+
64
+ scope.sortedChoices = function(choices) {
65
+ return choices.sort(function(a, b) {
66
+ return a.active ? -1 : b.active ? 1 : 0;
67
+ });
68
+ };
69
+ },
70
+
71
+ controller: [
72
+ '$scope',
73
+ 'page',
74
+ function($scope, page) {
75
+ // initialize the $scope breadcrumbs from the service
76
+ $scope.breadcrumbs = page.breadcrumbsGet();
77
+ }
78
+ ]
79
+ };
80
+ }
81
+ ];
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/directives/date.js ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ module.exports = function() {
21
+ return {
22
+ restrict: 'A',
23
+ require: 'ngModel',
24
+ link: function(scope, element, attrs, model) {
25
+ var pattern = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(|\.[0-9]{0,4})$/;
26
+
27
+ var dateParser = function(value) {
28
+ var isValidPattern = pattern.test(value);
29
+ var isValidValue = isValidPattern
30
+ ? !isNaN(new Date(value).getTime())
31
+ : true;
32
+ model.$setValidity('datePattern', isValidPattern);
33
+ model.$setValidity('dateValue', isValidValue);
34
+ return value;
35
+ };
36
+
37
+ model.$parsers.push(dateParser);
38
+
39
+ var dateFormatter = function(value) {
40
+ // if the value is not set,
41
+ // then ignore it!
42
+ if (!value) {
43
+ return;
44
+ }
45
+
46
+ var isValidValue = !isNaN(new Date(value).getTime());
47
+ var isValidPattern = pattern.test(value);
48
+ var isValid = isValidValue && isValidPattern;
49
+ model.$setValidity('datePattern', isValidPattern);
50
+ model.$setValidity('dateValue', isValidValue);
51
+
52
+ if (!isValid) {
53
+ // if the value is invalid, then
54
+ // set $pristine to false and set $dirty to true,
55
+ // that means the user has interacted with the controller.
56
+ model.$pristine = false;
57
+ model.$dirty = true;
58
+
59
+ // add 'ng-dirty' as class to the element
60
+ element.addClass('ng-dirty');
61
+ }
62
+
63
+ return value;
64
+ };
65
+
66
+ model.$formatters.push(dateFormatter);
67
+ }
68
+ };
69
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-pagination.html ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- CE # camunda-bpm-webapp/ui/common/scripts/module/components/cam-pagination.html -->
2
+ <ul uib-pagination ng-if="Pagination.total > Pagination.pages.size"
3
+ class="pagination-sm"
4
+
5
+ page="Pagination.pages.current"
6
+ ng-model="Pagination.pages.current"
7
+
8
+ total-items="Pagination.total"
9
+ items-per-page="Pagination.pages.size"
10
+
11
+ max-size="7"
12
+ boundary-links="true"></ul>
13
+ <!-- CE / camunda-bpm-webapp/ui/common/scripts/module/components/cam-pagination.html -->
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-pagination.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var template = require('./cam-pagination.html?raw');
21
+
22
+ module.exports = function() {
23
+ return {
24
+ restrict: 'A',
25
+ template: template,
26
+ controller: 'CamPaginationController as Pagination',
27
+ scope: {
28
+ total: '=',
29
+ onPaginationChange: '&camPagination'
30
+ }
31
+ };
32
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-searchable-area.html ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div cam-widget-search
2
+ cam-widget-search-total="Searchable.pages.total"
3
+ cam-widget-search-size="Searchable.pages.size"
4
+ cam-widget-search-valid-searches="Searchable.config.searches"
5
+ cam-widget-search-translations="Searchable.config.tooltips"
6
+ cam-widget-search-types="Searchable.config.types"
7
+ cam-widget-search-id="{{searchId}}"
8
+ cam-widget-search-operators="Searchable.config.operators"
9
+ cam-widget-search-storage-group="Searchable.storageGroup"
10
+ cam-widget-search-mode="filter">
11
+ </div>
12
+ <div cam-widget-loader
13
+ text-error="{{Searchable.loadingError}}"
14
+ text-empty="{{Searchable.textEmpty}}"
15
+ loading-state="{{Searchable.loadingState}}">
16
+
17
+ <div ng-transclude></div>
18
+
19
+ <ul uib-pagination ng-if="Searchable.pages.total > Searchable.pages.size"
20
+ class="pagination-sm"
21
+ page="Searchable.pages.current"
22
+ ng-model="Searchable.pages.current"
23
+ total-items="Searchable.pages.total"
24
+ items-per-page="Searchable.pages.size"
25
+ max-size="7"
26
+ boundary-links="true">
27
+ </ul>
28
+ </div>
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-searchable-area.js ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var template = require('./cam-searchable-area.html?raw');
21
+
22
+ module.exports = function() {
23
+ return {
24
+ restrict: 'A',
25
+ transclude: true,
26
+ template: template,
27
+ controller: 'CamPaginationSearchIntegrationController as Searchable',
28
+ scope: {
29
+ config: '=',
30
+ loadingState: '=',
31
+ loadingError: '@',
32
+ arrayTypes: '=?',
33
+ variableTypes: '=?',
34
+ buildCustomQuery: '&',
35
+ onSearchChange: '&',
36
+ textEmpty: '@',
37
+ storageGroup: '=',
38
+ searchId: '@?',
39
+ blocked: '='
40
+ }
41
+ };
42
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-tabs.html ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <ul class="nav nav-tabs"
2
+ ng-if="Tabs.providers.length > 1">
3
+ <li ng-repeat="tabProvider in Tabs.providers"
4
+ ng-class="{ active: Tabs.isSelected(tabProvider) }">
5
+ <a href ng-click="Tabs.selectTab(tabProvider)">{{ tabProvider.label | translate }}</a>
6
+ </li>
7
+ </ul>
8
+
9
+ <h4 ng-if="Tabs.providers.length === 1">{{ Tabs.providers[0].label | translate }}:</h4>
10
+
11
+ <div class="ctn-tabbed-content ctn-scroll"
12
+ ng-if="Tabs.providers.length">
13
+ <view provider="Tabs.selected"
14
+ vars="Tabs.vars" />
15
+ </div>
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-tabs.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var template = require('./cam-tabs.html?raw');
21
+
22
+ module.exports = function() {
23
+ return {
24
+ restrict: 'A',
25
+ template: template,
26
+ controller: 'CamTabsController as Tabs',
27
+ scope: {
28
+ providerParams: '=camTabs',
29
+ tabsApi: '=?',
30
+ vars: '=?',
31
+ varsValues: '=?'
32
+ }
33
+ };
34
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-toolbar.html ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ <!-- # CE - ui/common/scripts/module/components/cam-toolbar.html -->
2
+ <div class="ctn-toolbar">
3
+ <!-- Toolbar actions are provided by plugins -->
4
+ <span ng-repeat="provider in providers">
5
+ <view provider="provider"
6
+ vars="vars" />
7
+ </span>
8
+ </div>
9
+ <!-- / CE - ui/common/scripts/module/components/cam-toolbar.html -->
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/components/cam-toolbar.js ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var template = require('./cam-toolbar.html?raw');
21
+
22
+ module.exports = function() {
23
+ return {
24
+ restrict: 'A',
25
+ template: template,
26
+ scope: {
27
+ providers: '=camToolbar',
28
+ vars: '=?'
29
+ }
30
+ };
31
+ };
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/controllers/cam-pagination-search-integration.js ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var angular = require('camunda-commons-ui/vendor/angular');
21
+
22
+ module.exports = [
23
+ '$scope',
24
+ '$rootScope',
25
+ 'searchWidgetUtils',
26
+ 'search',
27
+ 'exposeScopeProperties',
28
+ CamPaginationSearchIntegrationController
29
+ ];
30
+
31
+ function CamPaginationSearchIntegrationController(
32
+ $scope,
33
+ $rootScope,
34
+ searchWidgetUtils,
35
+ search,
36
+ exposeScopeProperties
37
+ ) {
38
+ this.searchId = $scope.searchId || 'search';
39
+ this.paginationId = $scope.paginationId || 'page';
40
+ this.searchWidgetUtils = searchWidgetUtils;
41
+ this.search = search;
42
+ this.lastSearchQueryString = null;
43
+ this.locationChange = true;
44
+
45
+ // reset Page when changing Tabs
46
+ $scope.$on('$destroy', () => {
47
+ // when not resetting searches, state from other page is used
48
+ // which can lead to search not reloading due to dirty check
49
+ $scope.config.searches = null;
50
+ search(this.paginationId, null);
51
+ });
52
+
53
+ exposeScopeProperties($scope, this, [
54
+ 'config',
55
+ 'arrayTypes',
56
+ 'variableTypes',
57
+ 'onSearchChange',
58
+ 'buildCustomQuery',
59
+ 'loadingError',
60
+ 'loadingState',
61
+ 'textEmpty',
62
+ 'storageGroup',
63
+ 'blocked'
64
+ ]);
65
+
66
+ this.arrayTypes = angular.isArray(this.arrayTypes) ? this.arrayTypes : [];
67
+ this.variableTypes = angular.isArray(this.variableTypes)
68
+ ? this.variableTypes
69
+ : [];
70
+ this.pages = {
71
+ size: 50,
72
+ total: 0,
73
+ current: this.getCurrentPageFromSearch()
74
+ };
75
+
76
+ // RESULTS CHANGE TRIGGERS
77
+ var pagesWatchExpr = function() {
78
+ return this.pages.current;
79
+ }.bind(this);
80
+
81
+ $scope.$watch(pagesWatchExpr, this.onPageChange.bind(this));
82
+ $scope.$on('$locationChangeSuccess', this.onLocationChange.bind(this));
83
+ $scope.$watch('config.searches', this.updateQuery.bind(this), true);
84
+ $scope.$watch('blocked', this.onBlockedChange.bind(this));
85
+ var removeForcedRefresh = $rootScope.$on(
86
+ 'cam-common:cam-searchable:query-force-change',
87
+ this.onForcedRefresh.bind(this)
88
+ );
89
+
90
+ $scope.$on('$destroy', function() {
91
+ removeForcedRefresh();
92
+ });
93
+ }
94
+
95
+ CamPaginationSearchIntegrationController.prototype.onForcedRefresh = function() {
96
+ this.resetPage();
97
+ this.executeQueries();
98
+ };
99
+
100
+ CamPaginationSearchIntegrationController.prototype.onBlockedChange = function(
101
+ newValue,
102
+ oldValue
103
+ ) {
104
+ if (!newValue && oldValue && this.query) {
105
+ this.executeQueries();
106
+ }
107
+ };
108
+
109
+ CamPaginationSearchIntegrationController.prototype.getSearchQueryString = function() {
110
+ return this.search()[this.searchId + 'Query'];
111
+ };
112
+
113
+ CamPaginationSearchIntegrationController.prototype.hasSearchQueryStringChanged = function() {
114
+ var searchQuery = this.getSearchQueryString();
115
+
116
+ return (
117
+ searchQuery !== this.lastSearchQueryString &&
118
+ (this.lastSearchQueryString || searchQuery !== '[]')
119
+ );
120
+ };
121
+
122
+ CamPaginationSearchIntegrationController.prototype.onPageChange = function(
123
+ newValue,
124
+ oldValue
125
+ ) {
126
+ // Used for checking if current page change is due to $locationChangeSuccess event
127
+ // If so this change was already passed to updateCallback, so it can be ignored
128
+
129
+ var searchCurrentPage = this.getCurrentPageFromSearch();
130
+
131
+ if (newValue == oldValue || newValue === searchCurrentPage) {
132
+ return;
133
+ }
134
+
135
+ this.search(this.paginationId, !newValue || newValue == 1 ? null : newValue);
136
+
137
+ if (!this.hasSearchQueryStringChanged()) {
138
+ this.executeQueries();
139
+ }
140
+ };
141
+
142
+ CamPaginationSearchIntegrationController.prototype.onLocationChange = function() {
143
+ var currentPage = this.getCurrentPageFromSearch();
144
+
145
+ if (+this.pages.current !== +currentPage) {
146
+ this.pages.current = currentPage;
147
+
148
+ if (!this.hasSearchQueryStringChanged()) {
149
+ this.executeQueries();
150
+ } else {
151
+ this.locationChange = true;
152
+ }
153
+ }
154
+ };
155
+
156
+ CamPaginationSearchIntegrationController.prototype.getCurrentPageFromSearch = function() {
157
+ return +this.search()[this.paginationId] || 1;
158
+ };
159
+
160
+ CamPaginationSearchIntegrationController.prototype.updateQuery = function(
161
+ newValue,
162
+ oldValue
163
+ ) {
164
+ if (this.areSearchesDifferent(newValue, oldValue)) {
165
+ this.query =
166
+ (this.buildCustomQuery && this.buildCustomQuery(newValue)) ||
167
+ this.createQuery(newValue);
168
+
169
+ if (!this.locationChange) {
170
+ this.resetPage();
171
+ }
172
+
173
+ this.lastSearchQueryString = this.getSearchQueryString();
174
+
175
+ this.executeQueries();
176
+ }
177
+ };
178
+
179
+ CamPaginationSearchIntegrationController.prototype.resetPage = function() {
180
+ var params = this.search();
181
+
182
+ this.pages.current = 1;
183
+ params[this.paginationId] = 1;
184
+
185
+ // Replace url with old pagination, so browser history is more clean
186
+ this.search.updateSilently(params, true);
187
+ };
188
+
189
+ CamPaginationSearchIntegrationController.prototype.executeQueries = function() {
190
+ if (this.query && !this.blocked) {
191
+ this.locationChange = false;
192
+ this.onSearchChange({
193
+ query: angular.copy(this.query),
194
+ pages: angular.copy(this.pages)
195
+ }).then(
196
+ function(total) {
197
+ this.pages.total = total;
198
+ }.bind(this)
199
+ );
200
+ }
201
+ };
202
+
203
+ CamPaginationSearchIntegrationController.prototype.createQuery = function(
204
+ searches
205
+ ) {
206
+ return this.searchWidgetUtils.createSearchQueryForSearchWidget(
207
+ searches,
208
+ this.arrayTypes,
209
+ this.variableTypes
210
+ );
211
+ };
212
+
213
+ CamPaginationSearchIntegrationController.prototype.areSearchesDifferent = function(
214
+ newSearches,
215
+ oldSearches
216
+ ) {
217
+ var preparedNewSearches = prepareSearchesForComparassion(newSearches);
218
+ var preparedOldSearches = prepareSearchesForComparassion(oldSearches);
219
+
220
+ return !angular.equals(preparedNewSearches, preparedOldSearches);
221
+ };
222
+
223
+ function prepareSearchesForComparassion(searches) {
224
+ return (
225
+ searches &&
226
+ searches.map(function(search) {
227
+ return extractMeaningfulInformation(search);
228
+ })
229
+ );
230
+ }
231
+
232
+ function extractMeaningfulInformation(search) {
233
+ var value = search.value && search.value.value;
234
+ var type = search.type && search.type.value.value;
235
+ var operator = search.operator && search.operator.value.key;
236
+ var name = search.name && search.name.value;
237
+
238
+ return {
239
+ value: value,
240
+ type: type,
241
+ operator: operator,
242
+ name: name
243
+ };
244
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/controllers/cam-pagination.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ module.exports = [
21
+ '$scope',
22
+ 'search',
23
+ 'paginationUtils',
24
+ 'exposeScopeProperties',
25
+ CamPagination
26
+ ];
27
+
28
+ function CamPagination($scope, search, paginationUtils, exposeScopeProperties) {
29
+ paginationUtils.initializePaginationInController($scope, search, function() {
30
+ $scope.onPaginationChange({pages: $scope.pages});
31
+ });
32
+
33
+ exposeScopeProperties($scope, this, ['total', 'pages']);
34
+
35
+ $scope.onPaginationChange({pages: $scope.pages});
36
+ }
source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/webapps/frontend/ui/common/scripts/module/controllers/cam-tabs.js ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information regarding copyright
5
+ * ownership. Camunda licenses this file to you under the Apache License,
6
+ * Version 2.0; you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ var angular = require('camunda-commons-ui/vendor/angular');
21
+
22
+ module.exports = ['$scope', 'search', 'Views', CamTabs];
23
+
24
+ function CamTabs($scope, search, Views) {
25
+ this.providers = this.getProviders(Views, $scope);
26
+ this.selected = this.providers[0];
27
+ this.search = search;
28
+
29
+ this.initializeVars($scope);
30
+
31
+ $scope.$on('$locationChangeSuccess', this.onLocationChange.bind(this));
32
+ this.onLocationChange();
33
+ }
34
+
35
+ CamTabs.prototype.initializeVars = function($scope) {
36
+ this.vars = $scope.vars || {
37
+ read: ['tabsApi']
38
+ };
39
+
40
+ if ($scope.varsValues) {
41
+ angular.extend($scope, $scope.varsValues);
42
+ }
43
+ };
44
+
45
+ CamTabs.prototype.getProviders = function(Views, $scope) {
46
+ return Views.getProviders($scope.providerParams).sort(compareProviders);
47
+ };
48
+
49
+ function compareProviders(providerA, providerB) {
50
+ return (providerB.priority || 0) - (providerA.priority || 0);
51
+ }
52
+
53
+ CamTabs.prototype.onLocationChange = function() {
54
+ var params = this.search();
55
+
56
+ if (this.isTabSelectionChangedInUrl(params)) {
57
+ this.selected = this.providers.filter(function(provider) {
58
+ return provider.id === params.tab;
59
+ })[0];
60
+ } else if (!params.tab) {
61
+ this.selected = this.providers[0];
62
+ }
63
+ };
64
+
65
+ CamTabs.prototype.isTabSelectionChangedInUrl = function(params) {
66
+ return (
67
+ angular.isString(params.tab) &&
68
+ (!this.selected || params.tab !== this.selected.id)
69
+ );
70
+ };
71
+
72
+ CamTabs.prototype.selectTab = function(tabProvider) {
73
+ var params = this.search();
74
+ var tabParams = {
75
+ tab: tabProvider.id
76
+ };
77
+
78
+ this.selected = tabProvider;
79
+
80
+ this.search.updateSilently(angular.extend(params, tabParams));
81
+ };
82
+
83
+ CamTabs.prototype.isSelected = function(tabProvider) {
84
+ return this.selected === tabProvider;
85
+ };