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

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