@coolon/angular-ui-powerups 12.4.0-alpha.2 → 12.4.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/assets/empty-state.scss +11 -0
  2. package/assets/styles.scss +1 -0
  3. package/bundles/coolon-angular-ui-powerups-cypress.umd.js +657 -306
  4. package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.js +7 -11
  6. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  7. package/coolon-angular-ui-powerups.metadata.json +1 -1
  8. package/cypress/builder.d.ts +45 -0
  9. package/cypress/components/aup-abstract-activity.d.ts +9 -0
  10. package/cypress/components/aup-abstract-table.d.ts +18 -0
  11. package/cypress/components/aup-activity.d.ts +9 -0
  12. package/cypress/components/aup-alert.d.ts +9 -0
  13. package/cypress/components/aup-command-face.d.ts +2 -8
  14. package/cypress/components/aup-command.d.ts +1 -1
  15. package/cypress/components/aup-empty-state.d.ts +4 -0
  16. package/cypress/components/aup-input.d.ts +11 -5
  17. package/cypress/components/aup-modal-activity.d.ts +4 -0
  18. package/cypress/components/aup-modal-alert.d.ts +7 -0
  19. package/cypress/components/aup-table.d.ts +5 -18
  20. package/cypress/components/aup-tree-table.d.ts +16 -0
  21. package/cypress/components/button.d.ts +9 -7
  22. package/cypress/components/form-element-mixin.d.ts +20 -0
  23. package/cypress/components/mat-checkbox.d.ts +29 -0
  24. package/cypress/components/popup/aup-abstract-popup-menu.d.ts +15 -0
  25. package/cypress/components/popup/aup-more-menu.d.ts +5 -0
  26. package/cypress/components/popup/aup-popup-menu-panel.d.ts +3 -0
  27. package/cypress/components/popup/aup-popup-menu.d.ts +7 -0
  28. package/cypress/components/table/aup-table-cell.d.ts +9 -0
  29. package/cypress/components/table/aup-table-column.d.ts +10 -0
  30. package/cypress/components/table/aup-table-row.d.ts +17 -0
  31. package/cypress/components/table/aup-table-selection-cell.d.ts +5 -0
  32. package/cypress/components/table/aup-table-selection-column.d.ts +5 -0
  33. package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
  34. package/cypress/element-locator.d.ts +8 -0
  35. package/cypress/exports.d.ts +22 -4
  36. package/cypress/page-builder.d.ts +8 -0
  37. package/cypress/page-element.d.ts +9 -12
  38. package/cypress/page.d.ts +5 -33
  39. package/esm2015/cypress/builder.js +99 -0
  40. package/esm2015/cypress/builder.js.map +1 -0
  41. package/esm2015/cypress/builder.metadata.json +1 -0
  42. package/esm2015/cypress/components/aup-abstract-activity.js +12 -0
  43. package/esm2015/cypress/components/aup-abstract-activity.js.map +1 -0
  44. package/esm2015/cypress/components/aup-abstract-activity.metadata.json +1 -0
  45. package/esm2015/cypress/components/aup-abstract-table.js +50 -0
  46. package/esm2015/cypress/components/aup-abstract-table.js.map +1 -0
  47. package/esm2015/cypress/components/aup-abstract-table.metadata.json +1 -0
  48. package/esm2015/cypress/components/aup-activity.js +13 -0
  49. package/esm2015/cypress/components/aup-activity.js.map +1 -0
  50. package/esm2015/cypress/components/aup-activity.metadata.json +1 -0
  51. package/esm2015/cypress/components/aup-alert.js +13 -0
  52. package/esm2015/cypress/components/aup-alert.js.map +1 -0
  53. package/esm2015/cypress/components/aup-alert.metadata.json +1 -0
  54. package/esm2015/cypress/components/aup-command-face.js +11 -22
  55. package/esm2015/cypress/components/aup-command-face.js.map +1 -1
  56. package/esm2015/cypress/components/aup-command-face.metadata.json +1 -1
  57. package/esm2015/cypress/components/aup-command.js +9 -6
  58. package/esm2015/cypress/components/aup-command.js.map +1 -1
  59. package/esm2015/cypress/components/aup-command.metadata.json +1 -1
  60. package/esm2015/cypress/components/aup-empty-state.js +7 -0
  61. package/esm2015/cypress/components/aup-empty-state.js.map +1 -0
  62. package/esm2015/cypress/components/aup-empty-state.metadata.json +1 -0
  63. package/esm2015/cypress/components/aup-input.js +17 -5
  64. package/esm2015/cypress/components/aup-input.js.map +1 -1
  65. package/esm2015/cypress/components/aup-input.metadata.json +1 -1
  66. package/esm2015/cypress/components/aup-modal-activity.js +7 -0
  67. package/esm2015/cypress/components/aup-modal-activity.js.map +1 -0
  68. package/esm2015/cypress/components/aup-modal-activity.metadata.json +1 -0
  69. package/esm2015/cypress/components/aup-modal-alert.js +12 -0
  70. package/esm2015/cypress/components/aup-modal-alert.js.map +1 -0
  71. package/esm2015/cypress/components/aup-modal-alert.metadata.json +1 -0
  72. package/esm2015/cypress/components/aup-navigation.js +1 -1
  73. package/esm2015/cypress/components/aup-navigation.js.map +1 -1
  74. package/esm2015/cypress/components/aup-table.js +5 -33
  75. package/esm2015/cypress/components/aup-table.js.map +1 -1
  76. package/esm2015/cypress/components/aup-table.metadata.json +1 -1
  77. package/esm2015/cypress/components/aup-tree-table.js +34 -0
  78. package/esm2015/cypress/components/aup-tree-table.js.map +1 -0
  79. package/esm2015/cypress/components/aup-tree-table.metadata.json +1 -0
  80. package/esm2015/cypress/components/button.js +4 -10
  81. package/esm2015/cypress/components/button.js.map +1 -1
  82. package/esm2015/cypress/components/button.metadata.json +1 -1
  83. package/esm2015/cypress/components/form-element-mixin.js +11 -0
  84. package/esm2015/cypress/components/form-element-mixin.js.map +1 -0
  85. package/esm2015/cypress/components/form-element-mixin.metadata.json +1 -0
  86. package/esm2015/cypress/components/mat-checkbox.js +34 -0
  87. package/esm2015/cypress/components/mat-checkbox.js.map +1 -0
  88. package/esm2015/cypress/components/mat-checkbox.metadata.json +1 -0
  89. package/esm2015/cypress/components/popup/aup-abstract-popup-menu.js +33 -0
  90. package/esm2015/cypress/components/popup/aup-abstract-popup-menu.js.map +1 -0
  91. package/esm2015/cypress/components/popup/aup-abstract-popup-menu.metadata.json +1 -0
  92. package/esm2015/cypress/components/popup/aup-more-menu.js +8 -0
  93. package/esm2015/cypress/components/popup/aup-more-menu.js.map +1 -0
  94. package/esm2015/cypress/components/popup/aup-more-menu.metadata.json +1 -0
  95. package/esm2015/cypress/components/popup/aup-popup-menu-panel.js +4 -0
  96. package/esm2015/cypress/components/popup/aup-popup-menu-panel.js.map +1 -0
  97. package/esm2015/cypress/components/popup/aup-popup-menu-panel.metadata.json +1 -0
  98. package/esm2015/cypress/components/popup/aup-popup-menu.js +12 -0
  99. package/esm2015/cypress/components/popup/aup-popup-menu.js.map +1 -0
  100. package/esm2015/cypress/components/popup/aup-popup-menu.metadata.json +1 -0
  101. package/esm2015/cypress/components/table/aup-table-cell.js +14 -0
  102. package/esm2015/cypress/components/table/aup-table-cell.js.map +1 -0
  103. package/esm2015/cypress/components/table/aup-table-cell.metadata.json +1 -0
  104. package/esm2015/cypress/components/table/aup-table-column.js +19 -0
  105. package/esm2015/cypress/components/table/aup-table-column.js.map +1 -0
  106. package/esm2015/cypress/components/table/aup-table-column.metadata.json +1 -0
  107. package/esm2015/cypress/components/table/aup-table-row.js +28 -0
  108. package/esm2015/cypress/components/table/aup-table-row.js.map +1 -0
  109. package/esm2015/cypress/components/table/aup-table-row.metadata.json +1 -0
  110. package/esm2015/cypress/components/table/aup-table-selection-cell.js +6 -0
  111. package/esm2015/cypress/components/table/aup-table-selection-cell.js.map +1 -0
  112. package/esm2015/cypress/components/table/aup-table-selection-cell.metadata.json +1 -0
  113. package/esm2015/cypress/components/table/aup-table-selection-column.js +6 -0
  114. package/esm2015/cypress/components/table/aup-table-selection-column.js.map +1 -0
  115. package/esm2015/cypress/components/table/aup-table-selection-column.metadata.json +1 -0
  116. package/esm2015/cypress/element-locator.js +16 -0
  117. package/esm2015/cypress/element-locator.js.map +1 -0
  118. package/esm2015/cypress/element-locator.metadata.json +1 -0
  119. package/esm2015/cypress/exports.js +22 -4
  120. package/esm2015/cypress/exports.js.map +1 -1
  121. package/esm2015/cypress/exports.metadata.json +1 -1
  122. package/esm2015/cypress/page-builder.js +15 -0
  123. package/esm2015/cypress/page-builder.js.map +1 -0
  124. package/esm2015/cypress/page-builder.metadata.json +1 -0
  125. package/esm2015/cypress/page-element.js +18 -20
  126. package/esm2015/cypress/page-element.js.map +1 -1
  127. package/esm2015/cypress/page-element.metadata.json +1 -1
  128. package/esm2015/cypress/page.js +8 -10
  129. package/esm2015/cypress/page.js.map +1 -1
  130. package/esm2015/cypress/page.metadata.json +1 -1
  131. package/esm2015/cypress/path.js +3 -1
  132. package/esm2015/cypress/path.js.map +1 -1
  133. package/esm2015/lib/components/empty-state/empty-state.component.js +1 -1
  134. package/esm2015/lib/components/empty-state/empty-state.component.metadata.json +1 -1
  135. package/esm2015/lib/components/tables/tree-table/flattened-tree-list-model.js +4 -4
  136. package/esm2015/lib/components/tables/tree-table/flattened-tree-list-model.js.map +1 -1
  137. package/esm2015/lib/components/tables/tree-table/flattened-tree-list-model.metadata.json +1 -1
  138. package/esm2015/lib/components/tables/tree-table/tree-table-model.js +1 -0
  139. package/esm2015/lib/components/tables/tree-table/tree-table-model.js.map +1 -1
  140. package/esm2015/lib/components/tables/tree-table/tree-table-model.metadata.json +1 -1
  141. package/esm2015/lib/place/url-snapshot.js +1 -7
  142. package/esm2015/lib/place/url-snapshot.js.map +1 -1
  143. package/esm2015/lib/place/url-snapshot.metadata.json +1 -1
  144. package/fesm2015/coolon-angular-ui-powerups-cypress.js +496 -221
  145. package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
  146. package/fesm2015/coolon-angular-ui-powerups.js +7 -11
  147. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  148. package/lib/components/tables/tree-table/flattened-tree-list-model.d.ts +0 -1
  149. package/lib/components/tables/tree-table/tree-table-model.d.ts +4 -5
  150. package/package.json +1 -1
  151. package/cypress/components/aup-more-menu.d.ts +0 -4
  152. package/cypress/components/aup-popup-menu.d.ts +0 -7
  153. package/cypress/components/button-mixin.d.ts +0 -19
  154. package/cypress/section.d.ts +0 -51
  155. package/esm2015/cypress/components/aup-more-menu.js +0 -7
  156. package/esm2015/cypress/components/aup-more-menu.js.map +0 -1
  157. package/esm2015/cypress/components/aup-more-menu.metadata.json +0 -1
  158. package/esm2015/cypress/components/aup-popup-menu.js +0 -19
  159. package/esm2015/cypress/components/aup-popup-menu.js.map +0 -1
  160. package/esm2015/cypress/components/aup-popup-menu.metadata.json +0 -1
  161. package/esm2015/cypress/components/button-mixin.js +0 -15
  162. package/esm2015/cypress/components/button-mixin.js.map +0 -1
  163. package/esm2015/cypress/components/button-mixin.metadata.json +0 -1
  164. package/esm2015/cypress/section.js +0 -58
  165. package/esm2015/cypress/section.js.map +0 -1
  166. package/esm2015/cypress/section.metadata.json +0 -1
@@ -1,27 +1,40 @@
1
1
  import { lang, Mixin } from '@coolon/typescript-utilities';
2
2
  import * as _ from 'lodash';
3
+ import { __decorate, __metadata } from 'tslib';
4
+ import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
3
5
  import { DefaultUrlSerializer } from '@angular/router';
4
6
 
5
- class PageElement {
6
- constructor(parent, selector) {
7
- this.parentElementAccessor = parent instanceof PageElement ? () => parent.element() : parent;
8
- this.elementAccessStrategy = _.isString(selector) ? {
9
- findIn: p => p.find(selector),
10
- shouldNotExist: (p) => p.should('not.have', selector)
11
- } : selector;
7
+ var ElementLocator;
8
+ (function (ElementLocator) {
9
+ function findByCssSelector(selector) {
10
+ return parent => parent.dom().find(selector);
11
+ }
12
+ ElementLocator.findByCssSelector = findByCssSelector;
13
+ function findByTextContent(text) {
14
+ return parent => parent.dom().contains(text);
12
15
  }
13
- element() {
14
- const parent = this.getParentElement();
15
- return parent ? this.elementAccessStrategy.findIn(parent) : undefined;
16
+ ElementLocator.findByTextContent = findByTextContent;
17
+ function findBySelectorAndTextContent(selector, text) {
18
+ return parent => parent.dom().contains(selector, text);
16
19
  }
17
- getParentElement() {
18
- return this.parentElementAccessor ? this.parentElementAccessor() : undefined;
20
+ ElementLocator.findBySelectorAndTextContent = findBySelectorAndTextContent;
21
+ })(ElementLocator || (ElementLocator = {}));
22
+
23
+ class PageElement {
24
+ constructor(parent, selectorOrLocator) {
25
+ this.parent = parent;
26
+ this.domElementLocator = _.isString(selectorOrLocator) ?
27
+ ElementLocator.findByCssSelector(selectorOrLocator) :
28
+ selectorOrLocator;
29
+ }
30
+ dom() {
31
+ return this.domElementLocator(this.parent);
19
32
  }
20
33
  find(selector) {
21
- return new PageElement(() => this.element(), selector);
34
+ return new PageElement(this, selector);
22
35
  }
23
36
  click(text) {
24
- text ? this.element().contains(text).click() : this.element().click();
37
+ text ? this.dom().contains(text).click() : this.dom().click();
25
38
  }
26
39
  get should() {
27
40
  return this.getShoulder(this.getShouldElement());
@@ -30,113 +43,47 @@ class PageElement {
30
43
  return element.should.bind(element);
31
44
  }
32
45
  getShouldElement() {
33
- return this.element();
46
+ return this.dom();
34
47
  }
35
48
  shouldBeVisible() {
36
49
  this.should('be.visible');
37
50
  }
38
51
  shouldNotBeVisible() {
39
- if (!this.elementAccessStrategy.shouldNotExist) {
40
- lang.abstractMethod(this.constructor);
41
- }
42
- this.elementAccessStrategy.shouldNotExist(this.getParentElement());
52
+ this.should('not.be.visible');
43
53
  }
44
- }
45
-
46
- let urlSerialiser = new DefaultUrlSerializer();
47
- class Path {
48
- constructor(segments) {
49
- this.segments = segments;
50
- }
51
- static extractVisitParameters(url) {
52
- let result = {};
53
- const urlTree = urlSerialiser.parse(url);
54
- urlTree.root.children.primary.segments.forEach(s => {
55
- result = Object.assign(Object.assign({}, result), s.parameters);
56
- });
57
- return result;
54
+ shouldExist() {
55
+ this.dom().should('exist');
58
56
  }
59
- toUrl(matrixParams) {
60
- return this.segments.map(s => s.toUrlPart(matrixParams)).join('/');
57
+ shouldNotExist() {
58
+ this.dom().should('not.exist');
61
59
  }
62
60
  }
63
- (function (Path) {
64
- function setUrlSerialiser(serialiser) {
65
- urlSerialiser = serialiser;
66
- }
67
- Path.setUrlSerialiser = setUrlSerialiser;
68
- class Segment {
69
- constructor(path, params = {}) {
70
- var _a;
71
- this.path = path;
72
- this.routeId = params === null || params === void 0 ? void 0 : params.routeId;
73
- this.visitParams = (_a = params === null || params === void 0 ? void 0 : params.visitParams) !== null && _a !== void 0 ? _a : [];
74
- }
75
- toUrlPart(params) {
76
- let path = this.path;
77
- this.visitParams.forEach(p => {
78
- const value = params[p];
79
- if (value) {
80
- path = `${path};${p}=${value}`;
81
- }
82
- });
83
- if (this.routeId && params[this.routeId]) {
84
- path = path + '/' + params[this.routeId];
85
- }
86
- return path;
87
- }
88
- }
89
- Path.Segment = Segment;
90
- class Builder {
91
- constructor() {
92
- this.segments = [];
93
- }
94
- segment(name, params) {
95
- const builder = new Segment(name, params);
96
- this.segments.push(builder);
97
- return this;
98
- }
99
- getPath() {
100
- return new Path(this.segments);
101
- }
102
- }
103
- Path.Builder = Builder;
104
- })(Path || (Path = {}));
105
61
 
106
- class FaceAccessor {
107
- constructor(face) {
108
- this.face = face;
109
- }
110
- findIn(parent) {
111
- return this.face.text ?
112
- parent.contains(`aup-command-face`, this.face.text()) :
113
- this.face.icon ?
114
- parent.find(`aup-icon[ng-reflect-icon=${this.face.icon()}]`).closest('aup-command-face') :
115
- undefined;
116
- }
117
- shouldNotExist(parent) {
118
- return this.face.text ?
119
- parent.should('not.contain', `aup-command-face`, this.face.text()) :
120
- this.face.icon ?
121
- parent.should('not.contain', `aup-icon[ng-reflect-icon=${this.face.icon()}]`) :
122
- undefined;
123
- }
124
- }
125
62
  class AupCommandFace extends PageElement {
126
63
  constructor(parentElement, face) {
127
- super(() => parentElement.element(), AupCommandFace.createAccessor(face));
128
- }
129
- static createAccessor(face) {
130
- return new FaceAccessor(face);
64
+ super(parentElement, AupCommandFace.createElementLocator(face));
65
+ }
66
+ static createElementLocator(face) {
67
+ const locator = parent => {
68
+ return face.text ?
69
+ parent.dom().contains(`aup-command-face`, face.text()) :
70
+ face.icon ?
71
+ parent.dom().find(`aup-icon[ng-reflect-icon=${face.icon()}]`).closest('aup-command-face') :
72
+ undefined;
73
+ };
74
+ // aot compiler doesn't like lambas
75
+ return locator;
131
76
  }
132
77
  }
133
78
 
134
79
  class AupCommand extends PageElement {
135
- constructor(parent, face) {
136
- const faceAccessor = AupCommandFace.createAccessor(face);
137
- super(parent, {
138
- findIn(parentElement) {
139
- return faceAccessor.findIn(parentElement).closest('aup-command');
80
+ constructor(parent, faceOrSelector) {
81
+ super(parent, parentElement => {
82
+ if (_.isString(faceOrSelector)) {
83
+ return parentElement.dom().find(faceOrSelector);
84
+ }
85
+ else {
86
+ return AupCommandFace.createElementLocator(faceOrSelector)(parentElement).closest('aup-command');
140
87
  }
141
88
  });
142
89
  }
@@ -150,19 +97,25 @@ class AupCommand extends PageElement {
150
97
  this.getButton().should('be.disabled');
151
98
  }
152
99
  getButton() {
153
- return this.element().find('button');
100
+ return this.dom().find('button');
101
+ }
102
+ }
103
+
104
+ class AupEmptyState extends PageElement {
105
+ shouldContainText(text) {
106
+ this.dom().should("contain.text", text);
154
107
  }
155
108
  }
156
109
 
157
110
  class AupInput extends PageElement {
158
111
  label() {
159
- return this.element().find('label');
112
+ return this.dom().find('label');
160
113
  }
161
114
  hint() {
162
- return this.element().find('mat-hint');
115
+ return this.dom().find('mat-hint');
163
116
  }
164
117
  error() {
165
- return this.element().find('mat-error');
118
+ return this.dom().find('mat-error');
166
119
  }
167
120
  get labelShould() {
168
121
  return this.getShoulder(this.label());
@@ -182,11 +135,23 @@ class AupInput extends PageElement {
182
135
  errorShouldBe(text) {
183
136
  return this.errorShould("have.text", text);
184
137
  }
138
+ shouldBeFocused() {
139
+ this.input().should("have.focus");
140
+ }
141
+ shouldNotBeFocused() {
142
+ this.input().should("not.have.focus");
143
+ }
144
+ type(characters) {
145
+ this.input().type(characters);
146
+ }
147
+ hitEnter() {
148
+ this.type("{enter}");
149
+ }
185
150
  }
186
151
  (function (AupInput) {
187
152
  class HtmlInput extends AupInput {
188
153
  input() {
189
- return this.element().find('input');
154
+ return this.dom().find('input');
190
155
  }
191
156
  clear() {
192
157
  this.input().clear();
@@ -207,7 +172,7 @@ class AupInput extends PageElement {
207
172
  return this.input();
208
173
  }
209
174
  input() {
210
- return this.element().find('textarea');
175
+ return this.dom().find('textarea');
211
176
  }
212
177
  clear() {
213
178
  this.input().clear();
@@ -222,6 +187,46 @@ class AupInput extends PageElement {
222
187
  AupInput.TextAreaInput = TextAreaInput;
223
188
  })(AupInput || (AupInput = {}));
224
189
 
190
+ class AupPopupMenuPanel extends PageElement {
191
+ }
192
+
193
+ class AupAbstractPopupMenu extends PageElement {
194
+ constructor(parent, locator) {
195
+ super(parent, locator);
196
+ this.popup = new AupPopupMenuPanel(this, p => this.findPopupIn(p));
197
+ }
198
+ findPopupIn(p) {
199
+ return this.getOverlay().find('.mat-menu-panel');
200
+ }
201
+ getOverlay() {
202
+ return this.dom().closest('body').find('.cdk-overlay-container');
203
+ }
204
+ getBackdrop() {
205
+ return this.getOverlay().find('.cdk-overlay-backdrop');
206
+ }
207
+ openPopup() {
208
+ this.shouldNotBeOpen();
209
+ this.click();
210
+ return this.popup;
211
+ }
212
+ closePopup() {
213
+ this.shouldBeOpen();
214
+ this.getBackdrop().click();
215
+ }
216
+ shouldBeOpen() {
217
+ this.popup.shouldBeVisible();
218
+ }
219
+ shouldNotBeOpen() {
220
+ this.dom().closest('body').find('.mat-menu-panel').should("not.exist");
221
+ }
222
+ }
223
+
224
+ class AupMoreMenu extends AupAbstractPopupMenu {
225
+ static create(parent, selector) {
226
+ return new AupMoreMenu(parent, ElementLocator.findByCssSelector(selector !== null && selector !== void 0 ? selector : 'aup-more-menu'));
227
+ }
228
+ }
229
+
225
230
  class AupNavigation extends PageElement {
226
231
  click(label) {
227
232
  return super.click(label);
@@ -233,123 +238,403 @@ class AupNavigation extends PageElement {
233
238
  this.face(label).shouldBeVisible();
234
239
  }
235
240
  shouldNotHaveLink(label) {
236
- this.face(label).shouldNotBeVisible();
241
+ this.face(label).shouldNotExist();
242
+ }
243
+ }
244
+
245
+ class AupTableCell extends PageElement {
246
+ rowId() {
247
+ return this.dom().closest('tr').invoke('attr', 'aup-row-id');
248
+ }
249
+ row() {
250
+ const self = this;
251
+ return this.parent.createRow(parent => {
252
+ return self.rowId().then(rowId => parent.dom().find(AupAbstractTable.cssSelectorForTableRowById(rowId)));
253
+ });
254
+ }
255
+ }
256
+
257
+ class AupTableColumn extends PageElement {
258
+ constructor(table, columnId) {
259
+ super(table, AupAbstractTable.cssSelectorForColumnCellRendererById(columnId));
260
+ this.columnId = columnId;
261
+ }
262
+ cellContaining(content) {
263
+ const self = this;
264
+ return new AupTableCell(this.parent, parent => {
265
+ return parent.dom().contains(AupAbstractTable.cssSelectorForColumnCellRendererById(self.columnId), content);
266
+ });
267
+ }
268
+ rowContaining(content) {
269
+ return this.cellContaining(content).row();
237
270
  }
238
271
  }
239
272
 
240
- class AupTable extends PageElement {
241
- constructor(parentElementAccessor, selector) {
242
- super(parentElementAccessor, selector);
273
+ class AupTableSelectionColumn extends AupTableColumn {
274
+ selectAll() {
243
275
  }
276
+ }
277
+
278
+ class AupAbstractTable extends PageElement {
244
279
  row(rowId) {
245
- return new AupTable.Row(() => this.element(), `tr[aup-table-id=${rowId}]`);
280
+ return this.createRow(parent => {
281
+ return parent.dom().find(AupAbstractTable.cssSelectorForTableRowById(rowId));
282
+ });
283
+ }
284
+ rowNumber(rowNumber) {
285
+ return this.createRow(parent => {
286
+ return parent.dom().find(AupAbstractTable.cssSelectorForNthTableRow(rowNumber));
287
+ });
246
288
  }
247
289
  column(columnId) {
248
- return new AupTable.Column(this, columnId);
290
+ return new AupTableColumn(this, columnId);
291
+ }
292
+ get selectionColumn() {
293
+ return new AupTableSelectionColumn(this, 'selection-column');
249
294
  }
250
295
  }
251
- (function (AupTable) {
252
- class Row extends PageElement {
296
+ __decorate([
297
+ Memoize(),
298
+ __metadata("design:type", AupTableSelectionColumn),
299
+ __metadata("design:paramtypes", [])
300
+ ], AupAbstractTable.prototype, "selectionColumn", null);
301
+ (function (AupAbstractTable) {
302
+ function cssSelectorForTableRowById(rowId) {
303
+ return `tbody tr[aup-row-id=${rowId}]`;
304
+ }
305
+ AupAbstractTable.cssSelectorForTableRowById = cssSelectorForTableRowById;
306
+ function cssSelectorForNthTableRow(rowNumber) {
307
+ return `tbody tr:nth-child(${rowNumber})`;
308
+ }
309
+ AupAbstractTable.cssSelectorForNthTableRow = cssSelectorForNthTableRow;
310
+ function cssSelectorForColumnCellRendererById(columnOrId) {
311
+ const columnId = _.isString(columnOrId) ? columnOrId : columnOrId.columnId;
312
+ return `aup-table-cell-renderer[column-id=${columnId}]`;
313
+ }
314
+ AupAbstractTable.cssSelectorForColumnCellRendererById = cssSelectorForColumnCellRendererById;
315
+ function cssSelectorForCell(rowId, columnOrId) {
316
+ return `${cssSelectorForTableRowById(rowId)} ${cssSelectorForColumnCellRendererById(columnOrId)}`;
317
+ }
318
+ AupAbstractTable.cssSelectorForCell = cssSelectorForCell;
319
+ })(AupAbstractTable || (AupAbstractTable = {}));
320
+
321
+ /* tslint:disable:unified-signatures */
322
+ class AupTableRow extends PageElement {
323
+ rowId() {
324
+ return this.dom()
325
+ .invoke('attr', 'aup-row-id');
326
+ }
327
+ shouldHaveRowId(rowId) {
328
+ this.rowId().should('eq', rowId);
329
+ }
330
+ cell(columnOrId) {
331
+ const self = this;
332
+ return new AupTableCell(this.parent, parent => {
333
+ return self.rowId()
334
+ .then(rowId => AupAbstractTable.cssSelectorForCell(rowId, columnOrId))
335
+ .then(selector => parent.dom().find(selector));
336
+ });
337
+ }
338
+ shouldBeSelected() {
339
+ this.dom().should('have.class', 'aup-row-selected');
340
+ }
341
+ shouldNotBeSelected() {
342
+ this.dom().should('not.have.class', 'aup-row-selected');
343
+ }
344
+ }
345
+
346
+ class AupTable extends AupAbstractTable {
347
+ createRow(locator) {
348
+ return new AupTableRow(this, locator);
349
+ }
350
+ }
351
+
352
+ class AupTreeTable extends AupAbstractTable {
353
+ get treeControlColumn() {
354
+ return new AupTreeTable.TreeControlColumn(this, 'tree-label');
355
+ }
356
+ createRow(locator) {
357
+ return new AupTreeTable.Row(this, locator);
253
358
  }
254
- AupTable.Row = Row;
255
- class Column {
256
- constructor(table, columnId) {
257
- this.table = table;
258
- this.columnId = columnId;
359
+ }
360
+ __decorate([
361
+ Memoize(),
362
+ __metadata("design:type", AupTreeTable.TreeControlColumn),
363
+ __metadata("design:paramtypes", [])
364
+ ], AupTreeTable.prototype, "treeControlColumn", null);
365
+ (function (AupTreeTable) {
366
+ class Row extends AupTableRow {
367
+ shouldBeExpanded() {
368
+ this.dom().should("not.have.class", "aup-node-collapsed");
259
369
  }
260
- cell(content) {
261
- const self = this;
262
- return new Cell(this.table, {
263
- findIn(parent) {
264
- return parent.contains(`aup-table-cell-renderer[column-id=${self.columnId}]`, content);
265
- }
266
- });
370
+ shouldBeCollapsed() {
371
+ this.dom().should("have.class", "aup-node-collapsed");
267
372
  }
268
373
  }
269
- AupTable.Column = Column;
270
- class Cell extends PageElement {
374
+ AupTreeTable.Row = Row;
375
+ class TreeControlColumn extends AupTableColumn {
271
376
  }
272
- AupTable.Cell = Cell;
273
- })(AupTable || (AupTable = {}));
377
+ AupTreeTable.TreeControlColumn = TreeControlColumn;
378
+ })(AupTreeTable || (AupTreeTable = {}));
274
379
 
275
- function ButtonMixin(Base) {
380
+ function FormElementMixin(Base) {
276
381
  return class extends Base {
277
382
  constructor(...args) {
278
383
  super(...args);
279
384
  }
280
- click() {
281
- return this.element().click();
282
- }
283
385
  shouldBeDisabled() {
284
386
  this.should("be.disabled");
285
- // this.should("have.css", "color", "rgba(0,0,0,0.26)")
286
387
  }
287
388
  };
288
389
  }
289
390
 
290
- class Button extends ButtonMixin(PageElement) {
391
+ class Button extends FormElementMixin(PageElement) {
291
392
  constructor(parentElementAccessor, buttonText) {
292
- super(parentElementAccessor, {
293
- findIn(parent) {
294
- return parent.contains('button', buttonText);
295
- },
296
- shouldNotExist(parent) {
297
- return parent.should('not.contain', buttonText);
298
- }
299
- });
393
+ super(parentElementAccessor, ElementLocator.findBySelectorAndTextContent('button', buttonText));
300
394
  }
301
395
  }
302
396
 
303
- var Section;
304
- (function (Section) {
305
- function Mixin$1(Base) {
306
- return class extends Base {
307
- section(selector, section) {
308
- const impl = new Impl(() => this.element(), selector);
309
- return Mixin.createProxy(section(impl), impl);
310
- }
311
- find(selector) {
312
- return new PageElement(() => this.element(), selector);
313
- }
314
- contains(text) {
315
- return new PageElement(() => this.element(), {
316
- findIn: parent => parent.contains(text),
317
- shouldNotExist: (parent) => parent.should('not.contain', text)
318
- });
319
- }
320
- button(text) {
321
- return new Button(() => this.element(), text);
322
- }
323
- aupStringInput(selector) {
324
- return new AupInput.HtmlInput(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-string-input');
325
- }
326
- aupTextInput(selector) {
327
- return new AupInput.TextAreaInput(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-text-input');
328
- }
329
- aupPasswordInput(selector) {
330
- return new AupInput.HtmlInput(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-password-input');
331
- }
332
- aupNumberInput(selector) {
333
- return new AupInput.HtmlInput(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-number-input');
334
- }
335
- aupCommand(face) {
336
- return new AupCommand(this, face);
337
- }
338
- aupTabbedNavigation() {
339
- return new AupNavigation(this, 'aup-tabbed-place-navigation');
397
+ class MatCheckbox extends FormElementMixin(PageElement) {
398
+ constructor(parentElementAccessor, text) {
399
+ super(parentElementAccessor, ElementLocator.findBySelectorAndTextContent('mat-checkbox', text));
400
+ }
401
+ shouldBeChecked() {
402
+ this.hiddenCheckBoxElement().should('be.checked');
403
+ }
404
+ shouldNotBeChecked() {
405
+ this.hiddenCheckBoxElement().should('not.be.checked');
406
+ }
407
+ hiddenCheckBoxElement() {
408
+ return this.dom().find('input[type=checkbox]');
409
+ }
410
+ check() {
411
+ this.hiddenCheckBoxElement().then(el => {
412
+ if (!el.prop('checked')) {
413
+ this.click();
414
+ this.shouldBeChecked();
340
415
  }
341
- aupSideNavigation() {
342
- return new AupNavigation(() => this.element(), 'aup-list-place-nav');
416
+ });
417
+ }
418
+ uncheck() {
419
+ this.hiddenCheckBoxElement().then(el => {
420
+ if (el.prop('checked')) {
421
+ this.click();
422
+ this.shouldNotBeChecked();
343
423
  }
344
- aupTable(selector) {
345
- return new AupTable(() => this.element(), selector !== null && selector !== void 0 ? selector : 'aup-table');
424
+ });
425
+ }
426
+ }
427
+
428
+ class Builder {
429
+ constructor(parentPageElement) {
430
+ this.parentPageElement = parentPageElement;
431
+ }
432
+ find(selector) {
433
+ return new PageElement(this.parentPageElement, selector);
434
+ }
435
+ section(selector, builder) {
436
+ return this.createContainerElement(PageElement, selector, builder);
437
+ }
438
+ contains(text) {
439
+ return new PageElement(this.parentPageElement, ElementLocator.findByTextContent(text));
440
+ }
441
+ button(text) {
442
+ return new Button(this.parentPageElement, text);
443
+ }
444
+ matCheckbox(text) {
445
+ return new MatCheckbox(this.parentPageElement, text);
446
+ }
447
+ aupStringInput(selector) {
448
+ return new AupInput.HtmlInput(this.parentPageElement, selector !== null && selector !== void 0 ? selector : 'aup-string-input');
449
+ }
450
+ aupTextInput(selector) {
451
+ return new AupInput.TextAreaInput(this.parentPageElement, selector !== null && selector !== void 0 ? selector : 'aup-text-input');
452
+ }
453
+ aupPasswordInput(selector) {
454
+ return new AupInput.HtmlInput(this.parentPageElement, selector !== null && selector !== void 0 ? selector : 'aup-password-input');
455
+ }
456
+ aupNumberInput(selector) {
457
+ return new AupInput.HtmlInput(this.parentPageElement, selector !== null && selector !== void 0 ? selector : 'aup-number-input');
458
+ }
459
+ aupCommand(faceOrSelector) {
460
+ return new AupCommand(this.parentPageElement, faceOrSelector);
461
+ }
462
+ aupTabbedNavigation() {
463
+ return new AupNavigation(this.parentPageElement, 'aup-tabbed-place-navigation');
464
+ }
465
+ aupSideNavigation() {
466
+ return new AupNavigation(this.parentPageElement, 'aup-list-place-nav');
467
+ }
468
+ aupMoreMenu(selector) {
469
+ return AupMoreMenu.create(this.parentPageElement, selector);
470
+ }
471
+ aupTable(selectorOrBuilder, optionalBuilder) {
472
+ return this.createContainerElement(AupTable, selectorOrBuilder, optionalBuilder, 'aup-table');
473
+ }
474
+ aupTreeTable(selectorOrBuilder, optionalBuilder) {
475
+ return this.createContainerElement(AupTreeTable, selectorOrBuilder, optionalBuilder, 'aup-tree-table');
476
+ }
477
+ aupEmptyState(selectorOrBuilder, optionalBuilder) {
478
+ return this.createContainerElement(AupEmptyState, selectorOrBuilder, optionalBuilder, 'aup-empty-state');
479
+ }
480
+ // TODO: use this in all the element factory methods to allow customisation
481
+ createElement(klass, selectorOrBuilder, optionalBuilder, defaultSelector) {
482
+ const selector = _.isString(selectorOrBuilder) ? selectorOrBuilder : defaultSelector;
483
+ const builder = _.isFunction(selectorOrBuilder) ? selectorOrBuilder : optionalBuilder;
484
+ if (!selector) {
485
+ lang.illegalState('This element requires a selector but none was provided');
486
+ }
487
+ const element = new klass(this.parentPageElement, selector);
488
+ if (builder) {
489
+ return Mixin.createProxy(element, builder(element));
490
+ }
491
+ else {
492
+ return element;
493
+ }
494
+ }
495
+ createContainerElement(klass, selectorOrBuilder, optionalBuilder, defaultSelector) {
496
+ const selector = _.isString(selectorOrBuilder) ? selectorOrBuilder : defaultSelector;
497
+ const builder = _.isFunction(selectorOrBuilder) ? selectorOrBuilder : optionalBuilder;
498
+ if (!selector) {
499
+ lang.illegalState('This element requires a selector but none was provided');
500
+ }
501
+ const element = new klass(this.parentPageElement, selector);
502
+ if (builder) {
503
+ // create the B&E type that the builder has access to
504
+ const decoratedElement = Mixin.createProxy(element, new Builder(element));
505
+ // create final type that has the E & T type
506
+ return Mixin.createProxy(decoratedElement, builder(decoratedElement));
507
+ }
508
+ else {
509
+ return element;
510
+ }
511
+ }
512
+ }
513
+
514
+ class AupAbstractActivity extends PageElement {
515
+ constructor(parent, selector) {
516
+ // @ts-ignore
517
+ super(parent, selector);
518
+ this.title = this.find('aup-activity-title');
519
+ this._confirmCommand = new Builder(this).aupCommand('[data-cy=confirm-command]');
520
+ this._cancelCommand = new Builder(this).aupCommand('[data-cy=cancel-command]');
521
+ }
522
+ }
523
+
524
+ class AupActivity extends AupAbstractActivity {
525
+ constructor(parent, selector) {
526
+ super(parent, selector);
527
+ }
528
+ get confirmCommand() {
529
+ return this._confirmCommand;
530
+ }
531
+ get cancelCommand() {
532
+ return this._cancelCommand;
533
+ }
534
+ }
535
+
536
+ class AupModalActivity extends AupActivity {
537
+ clickBackdrop() {
538
+ this.dom().closest(`.cdk-overlay-backdrop`).click(-50, -50, { force: true });
539
+ }
540
+ }
541
+
542
+ class AupAlert extends AupAbstractActivity {
543
+ constructor(parent, selector) {
544
+ super(parent, selector);
545
+ }
546
+ get closeCommand() {
547
+ return this._confirmCommand;
548
+ }
549
+ clickClose() {
550
+ this.closeCommand.click();
551
+ }
552
+ }
553
+
554
+ class AupModalAlert extends AupAlert {
555
+ constructor(parent, selector) {
556
+ super(parent, selector);
557
+ }
558
+ clickBackdrop() {
559
+ this.dom()
560
+ .closest(`.cdk-overlay-container`)
561
+ .find(`.cdk-overlay-backdrop`).click(-50, -50, { force: true });
562
+ }
563
+ }
564
+
565
+ class PageBuilder extends Builder {
566
+ aupModalActivity(selector, builder) {
567
+ return this.createContainerElement(AupModalActivity, `.dialog-interaction-context ${selector}`, builder);
568
+ }
569
+ aupModalAlert(builder) {
570
+ return this.createContainerElement(AupModalAlert, `.dialog-interaction-context aup-alert-dialog`, builder);
571
+ }
572
+ aupModelConfirm(builder) {
573
+ return this.aupModalActivity(`aup-confirm-dialog`, builder);
574
+ }
575
+ }
576
+
577
+ let urlSerialiser = new DefaultUrlSerializer();
578
+ class Path {
579
+ constructor(segments) {
580
+ this.segments = segments;
581
+ }
582
+ static extractVisitParameters(url) {
583
+ var _a, _b;
584
+ let result = {};
585
+ const urlTree = urlSerialiser.parse(url);
586
+ const urlSegments = (_b = (_a = urlTree.root.children.primary) === null || _a === void 0 ? void 0 : _a.segments) !== null && _b !== void 0 ? _b : [];
587
+ urlSegments === null || urlSegments === void 0 ? void 0 : urlSegments.forEach(s => {
588
+ result = Object.assign(Object.assign({}, result), s.parameters);
589
+ });
590
+ return result;
591
+ }
592
+ toUrl(matrixParams) {
593
+ return this.segments.map(s => s.toUrlPart(matrixParams)).join('/');
594
+ }
595
+ }
596
+ (function (Path) {
597
+ function setUrlSerialiser(serialiser) {
598
+ urlSerialiser = serialiser;
599
+ }
600
+ Path.setUrlSerialiser = setUrlSerialiser;
601
+ class Segment {
602
+ constructor(path, params = {}) {
603
+ var _a;
604
+ this.path = path;
605
+ this.routeId = params === null || params === void 0 ? void 0 : params.routeId;
606
+ this.visitParams = (_a = params === null || params === void 0 ? void 0 : params.visitParams) !== null && _a !== void 0 ? _a : [];
607
+ }
608
+ toUrlPart(params) {
609
+ let path = this.path;
610
+ this.visitParams.forEach(p => {
611
+ const value = params[p];
612
+ if (value) {
613
+ path = `${path};${p}=${value}`;
614
+ }
615
+ });
616
+ if (this.routeId && params[this.routeId]) {
617
+ path = path + '/' + params[this.routeId];
346
618
  }
347
- };
619
+ return path;
620
+ }
348
621
  }
349
- Section.Mixin = Mixin$1;
350
- class Impl extends Mixin$1(PageElement) {
622
+ Path.Segment = Segment;
623
+ class Builder {
624
+ constructor() {
625
+ this.segments = [];
626
+ }
627
+ segment(name, params) {
628
+ const builder = new Segment(name, params);
629
+ this.segments.push(builder);
630
+ return this;
631
+ }
632
+ getPath() {
633
+ return new Path(this.segments);
634
+ }
351
635
  }
352
- })(Section || (Section = {}));
636
+ Path.Builder = Builder;
637
+ })(Path || (Path = {}));
353
638
 
354
639
  class Page extends PageElement {
355
640
  constructor(path) {
@@ -357,7 +642,7 @@ class Page extends PageElement {
357
642
  this.path = path;
358
643
  this.rootElementSelector = 'body';
359
644
  }
360
- element() {
645
+ dom() {
361
646
  return cy.get(this.rootElementSelector);
362
647
  }
363
648
  visit(visitParams, queryParams) {
@@ -380,7 +665,7 @@ class Page extends PageElement {
380
665
  }
381
666
  shouldBeActive(withParameters) {
382
667
  // Note: cy.window() doesn't return a promise... it's a chainable.
383
- cy["waitUntil"](() => {
668
+ cy['waitUntil'](() => {
384
669
  return cy.window().then(window => {
385
670
  return window['aup.PlaceRouter'] && !window['aup.PlaceRouter'].isNavigating();
386
671
  });
@@ -398,53 +683,43 @@ class Page extends PageElement {
398
683
  }
399
684
  }
400
685
  (function (Page) {
401
- function create(pathOrPathBuilder, page) {
686
+ function create(pathOrPathBuilder, builder) {
402
687
  const pathBuilder = new Path.Builder();
403
688
  if (_.isString(pathOrPathBuilder)) {
404
- pathOrPathBuilder.split("/").filter(p => !_.isEmpty(p)).forEach(p => pathBuilder.segment(p));
689
+ pathOrPathBuilder.split('/').filter(p => !_.isEmpty(p)).forEach(p => pathBuilder.segment(p));
405
690
  }
406
691
  else {
407
692
  pathOrPathBuilder(pathBuilder);
408
693
  }
409
- const builder = new PageBuilder(pathBuilder.getPath());
410
- return Mixin.createProxy(page(builder), builder);
694
+ const instance = new Page(pathBuilder.getPath());
695
+ const content = builder.call(instance, new PageBuilder(instance));
696
+ return Mixin.createProxy(content, instance);
411
697
  }
412
698
  Page.create = create;
413
- class PageBuilder extends Section.Mixin(Page) {
414
- }
415
- Page.PageBuilder = PageBuilder;
416
699
  })(Page || (Page = {}));
417
700
 
418
701
  class AupCommandGroup extends PageElement {
419
702
  }
420
703
 
421
- class AupMoreMenu extends PageElement {
422
- static create(parent) {
423
- return new AupMoreMenu(parent, 'aup-more-menu');
704
+ class AupToolBar extends PageElement {
705
+ static create(parent, face) {
706
+ // const findFace = AupCommandFace.createFinder(() => parent.element(), face)
707
+ // return new AupCommandGroup(() => findFace().closest('button'));
424
708
  }
425
709
  }
426
710
 
427
- class AupPopupMenu extends PageElement {
711
+ class AupPopupMenu extends AupAbstractPopupMenu {
428
712
  constructor(parentElementAccessor, face) {
429
- const accessor = AupCommandFace.createAccessor(face);
430
- super(parentElementAccessor, {
431
- findIn(parent) {
432
- return accessor.findIn(parent).closest('button');
433
- },
434
- shouldNotExist(parent) {
435
- accessor.shouldNotExist(parent);
436
- }
437
- });
713
+ const locator = AupCommandFace.createElementLocator(face);
714
+ super(parentElementAccessor, parent => locator(parent).closest('button'));
438
715
  }
439
716
  static create(parent, face) {
440
717
  return new AupPopupMenu(parent, face);
441
718
  }
442
719
  }
443
720
 
444
- class AupToolBar extends PageElement {
445
- static create(parent, face) {
446
- // const findFace = AupCommandFace.createFinder(() => parent.element(), face)
447
- // return new AupCommandGroup(() => findFace().closest('button'));
721
+ class AupTableSelectionCell extends AupTableCell {
722
+ selectAll() {
448
723
  }
449
724
  }
450
725
 
@@ -456,5 +731,5 @@ class AupToolBar extends PageElement {
456
731
  * Generated bundle index. Do not edit.
457
732
  */
458
733
 
459
- export { AupCommand, AupCommandFace, AupCommandGroup, AupInput, AupMoreMenu, AupNavigation, AupPopupMenu, AupTable, AupToolBar, Button, ButtonMixin, FaceAccessor, Page, PageElement, Path, Section };
734
+ export { AupAbstractActivity, AupAbstractPopupMenu, AupAbstractTable, AupActivity, AupAlert, AupCommand, AupCommandFace, AupCommandGroup, AupEmptyState, AupInput, AupModalActivity, AupModalAlert, AupMoreMenu, AupNavigation, AupPopupMenu, AupPopupMenuPanel, AupTable, AupTableCell, AupTableColumn, AupTableRow, AupTableSelectionCell, AupTableSelectionColumn, AupToolBar, AupTreeTable, Builder, Button, ElementLocator, FormElementMixin, MatCheckbox, Page, PageBuilder, PageElement, Path };
460
735
  //# sourceMappingURL=coolon-angular-ui-powerups-cypress.js.map