@coolon/angular-ui-powerups 12.4.0-alpha.0 → 12.4.0-alpha.10
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.
- package/assets/empty-state.scss +11 -0
- package/assets/styles.scss +1 -0
- package/bundles/coolon-angular-ui-powerups-cypress.umd.js +382 -263
- package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.js +241 -251
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/cypress/builder.d.ts +48 -0
- package/cypress/components/aup-abstract-activity.d.ts +8 -0
- package/cypress/components/aup-activity.d.ts +8 -0
- package/cypress/components/aup-alert.d.ts +8 -0
- package/cypress/components/aup-command-face.d.ts +7 -0
- package/cypress/components/aup-command.d.ts +6 -18
- package/cypress/components/aup-empty-state.d.ts +3 -0
- package/cypress/components/aup-input.d.ts +8 -8
- package/cypress/components/aup-modal-activity.d.ts +4 -0
- package/cypress/components/aup-modal-alert.d.ts +6 -0
- package/cypress/components/aup-table.d.ts +1 -2
- package/cypress/components/button-mixin.d.ts +3 -1
- package/cypress/components/button.d.ts +4 -2
- package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
- package/cypress/exports.d.ts +8 -1
- package/cypress/page-builder.d.ts +10 -0
- package/cypress/page-element.d.ts +5 -2
- package/cypress/page.d.ts +10 -32
- package/cypress/path.d.ts +1 -1
- package/esm2015/cypress/builder.js +80 -0
- package/esm2015/cypress/builder.js.map +1 -0
- package/esm2015/cypress/builder.metadata.json +1 -0
- package/esm2015/cypress/components/aup-abstract-activity.js +11 -0
- package/esm2015/cypress/components/aup-abstract-activity.js.map +1 -0
- package/esm2015/cypress/components/aup-abstract-activity.metadata.json +1 -0
- package/esm2015/cypress/components/aup-activity.js +13 -0
- package/esm2015/cypress/components/aup-activity.js.map +1 -0
- package/esm2015/cypress/components/aup-activity.metadata.json +1 -0
- package/esm2015/cypress/components/aup-alert.js +13 -0
- package/esm2015/cypress/components/aup-alert.js.map +1 -0
- package/esm2015/cypress/components/aup-alert.metadata.json +1 -0
- package/esm2015/cypress/components/aup-command-face.js +20 -18
- package/esm2015/cypress/components/aup-command-face.js.map +1 -1
- package/esm2015/cypress/components/aup-command-face.metadata.json +1 -1
- package/esm2015/cypress/components/aup-command.js +25 -9
- package/esm2015/cypress/components/aup-command.js.map +1 -1
- package/esm2015/cypress/components/aup-command.metadata.json +1 -1
- package/esm2015/cypress/components/aup-empty-state.js +4 -0
- package/esm2015/cypress/components/aup-empty-state.js.map +1 -0
- package/esm2015/cypress/components/aup-empty-state.metadata.json +1 -0
- package/esm2015/cypress/components/aup-input.js +7 -7
- package/esm2015/cypress/components/aup-input.js.map +1 -1
- package/esm2015/cypress/components/aup-modal-activity.js +7 -0
- package/esm2015/cypress/components/aup-modal-activity.js.map +1 -0
- package/esm2015/cypress/components/aup-modal-activity.metadata.json +1 -0
- package/esm2015/cypress/components/aup-modal-alert.js +12 -0
- package/esm2015/cypress/components/aup-modal-alert.js.map +1 -0
- package/esm2015/cypress/components/aup-modal-alert.metadata.json +1 -0
- package/esm2015/cypress/components/aup-table.js.map +1 -1
- package/esm2015/cypress/components/aup-table.metadata.json +1 -1
- package/esm2015/cypress/components/button.js.map +1 -1
- package/esm2015/cypress/components/button.metadata.json +1 -1
- package/esm2015/cypress/exports.js +8 -1
- package/esm2015/cypress/exports.js.map +1 -1
- package/esm2015/cypress/exports.metadata.json +1 -1
- package/esm2015/cypress/page-builder.js +20 -0
- package/esm2015/cypress/page-builder.js.map +1 -0
- package/esm2015/cypress/page-builder.metadata.json +1 -0
- package/esm2015/cypress/page-element.js +9 -3
- package/esm2015/cypress/page-element.js.map +1 -1
- package/esm2015/cypress/page-element.metadata.json +1 -1
- package/esm2015/cypress/page.js +13 -14
- package/esm2015/cypress/page.js.map +1 -1
- package/esm2015/cypress/page.metadata.json +1 -1
- package/esm2015/cypress/path.js +5 -3
- package/esm2015/cypress/path.js.map +1 -1
- package/esm2015/lib/components/empty-state/empty-state.component.js +1 -1
- package/esm2015/lib/components/empty-state/empty-state.component.metadata.json +1 -1
- package/esm2015/lib/place/navigation/place-component-deactivation-handler.js +3 -9
- package/esm2015/lib/place/navigation/place-component-deactivation-handler.js.map +1 -1
- package/esm2015/lib/place/navigation/place-component-deactivation-handler.metadata.json +1 -1
- package/esm2015/lib/place/url-snapshot.js +1 -7
- package/esm2015/lib/place/url-snapshot.js.map +1 -1
- package/esm2015/lib/place/url-snapshot.metadata.json +1 -1
- package/fesm2015/coolon-angular-ui-powerups-cypress.js +284 -169
- package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +225 -235
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/package.json +1 -1
- package/cypress/section.d.ts +0 -49
- package/esm2015/cypress/section.js +0 -58
- package/esm2015/cypress/section.js.map +0 -1
- package/esm2015/cypress/section.metadata.json +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as _ from 'lodash';
|
|
2
1
|
import { lang, Mixin } from '@coolon/typescript-utilities';
|
|
2
|
+
import * as _ from 'lodash';
|
|
3
3
|
import { DefaultUrlSerializer } from '@angular/router';
|
|
4
4
|
|
|
5
5
|
class PageElement {
|
|
@@ -7,7 +7,7 @@ class PageElement {
|
|
|
7
7
|
this.parentElementAccessor = parent instanceof PageElement ? () => parent.element() : parent;
|
|
8
8
|
this.elementAccessStrategy = _.isString(selector) ? {
|
|
9
9
|
findIn: p => p.find(selector),
|
|
10
|
-
shouldNotExist: (p) => p.should('not.
|
|
10
|
+
shouldNotExist: (p) => p.find(selector).should('not.exist')
|
|
11
11
|
} : selector;
|
|
12
12
|
}
|
|
13
13
|
element() {
|
|
@@ -24,7 +24,13 @@ class PageElement {
|
|
|
24
24
|
text ? this.element().contains(text).click() : this.element().click();
|
|
25
25
|
}
|
|
26
26
|
get should() {
|
|
27
|
-
return this.
|
|
27
|
+
return this.getShoulder(this.getShouldElement());
|
|
28
|
+
}
|
|
29
|
+
getShoulder(element) {
|
|
30
|
+
return element.should.bind(element);
|
|
31
|
+
}
|
|
32
|
+
getShouldElement() {
|
|
33
|
+
return this.element();
|
|
28
34
|
}
|
|
29
35
|
shouldBeVisible() {
|
|
30
36
|
this.should('be.visible');
|
|
@@ -37,121 +43,67 @@ class PageElement {
|
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
class FaceAccessor {
|
|
47
|
+
constructor(face) {
|
|
48
|
+
this.face = face;
|
|
49
|
+
}
|
|
50
|
+
findIn(parent) {
|
|
51
|
+
return this.face.text ?
|
|
52
|
+
parent.contains(`aup-command-face`, this.face.text()) :
|
|
53
|
+
this.face.icon ?
|
|
54
|
+
parent.find(`aup-icon[ng-reflect-icon=${this.face.icon()}]`).closest('aup-command-face') :
|
|
55
|
+
undefined;
|
|
56
|
+
}
|
|
57
|
+
shouldNotExist(parent) {
|
|
58
|
+
return this.face.text ?
|
|
59
|
+
parent.should('not.contain', `aup-command-face`, this.face.text()) :
|
|
60
|
+
this.face.icon ?
|
|
61
|
+
parent.should('not.contain', `aup-icon[ng-reflect-icon=${this.face.icon()}]`) :
|
|
62
|
+
undefined;
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
|
-
(function (Path) {
|
|
58
|
-
function setUrlSerialiser(serialiser) {
|
|
59
|
-
urlSerialiser = serialiser;
|
|
60
|
-
}
|
|
61
|
-
Path.setUrlSerialiser = setUrlSerialiser;
|
|
62
|
-
class Segment {
|
|
63
|
-
constructor(path, params = {}) {
|
|
64
|
-
var _a;
|
|
65
|
-
this.path = path;
|
|
66
|
-
this.routeId = params === null || params === void 0 ? void 0 : params.routeId;
|
|
67
|
-
this.visitParams = (_a = params === null || params === void 0 ? void 0 : params.visitParams) !== null && _a !== void 0 ? _a : [];
|
|
68
|
-
}
|
|
69
|
-
toUrlPart(params) {
|
|
70
|
-
let path = this.path;
|
|
71
|
-
this.visitParams.forEach(p => {
|
|
72
|
-
const value = params[p];
|
|
73
|
-
if (value) {
|
|
74
|
-
path = `${path};${p}=${value}`;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
if (this.routeId && params[this.routeId]) {
|
|
78
|
-
path = path + '/' + params[this.routeId];
|
|
79
|
-
}
|
|
80
|
-
return path;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
Path.Segment = Segment;
|
|
84
|
-
class Builder {
|
|
85
|
-
constructor() {
|
|
86
|
-
this.segments = [];
|
|
87
|
-
}
|
|
88
|
-
segment(name, params) {
|
|
89
|
-
const builder = new Segment(name, params);
|
|
90
|
-
this.segments.push(builder);
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
getPath() {
|
|
94
|
-
return new Path(this.segments);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
Path.Builder = Builder;
|
|
98
|
-
})(Path || (Path = {}));
|
|
99
|
-
|
|
100
65
|
class AupCommandFace extends PageElement {
|
|
101
66
|
constructor(parentElement, face) {
|
|
102
67
|
super(() => parentElement.element(), AupCommandFace.createAccessor(face));
|
|
103
68
|
}
|
|
104
69
|
static createAccessor(face) {
|
|
105
|
-
|
|
106
|
-
const accessor = {
|
|
107
|
-
findIn(parent) {
|
|
108
|
-
return face.text ?
|
|
109
|
-
parent.contains(`aup-command-face`, face.text()) :
|
|
110
|
-
face.icon ?
|
|
111
|
-
parent.find(`aup-icon[ng-reflect-icon=${face.icon()}]`).closest('aup-command-face') :
|
|
112
|
-
undefined;
|
|
113
|
-
},
|
|
114
|
-
shouldNotExist(parent) {
|
|
115
|
-
return face.text ?
|
|
116
|
-
parent.should("not.contain", `aup-command-face`, face.text()) :
|
|
117
|
-
face.icon ?
|
|
118
|
-
parent.should("not.contain", `aup-icon[ng-reflect-icon=${face.icon()}]`) :
|
|
119
|
-
undefined;
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
return accessor;
|
|
70
|
+
return new FaceAccessor(face);
|
|
123
71
|
}
|
|
124
72
|
}
|
|
125
73
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
class AupCommand extends ButtonMixin(PageElement) {
|
|
142
|
-
constructor(parentElementAccessor, face) {
|
|
143
|
-
const faceAccessor = AupCommandFace.createAccessor(face);
|
|
144
|
-
super(parentElementAccessor, {
|
|
145
|
-
findIn(parent) {
|
|
146
|
-
return faceAccessor.findIn(parent).closest("aup-command");
|
|
74
|
+
class AupCommand extends PageElement {
|
|
75
|
+
constructor(parent, faceOrSelector) {
|
|
76
|
+
super(parent, {
|
|
77
|
+
findIn(parentElement) {
|
|
78
|
+
if (_.isString(faceOrSelector)) {
|
|
79
|
+
return parentElement.find(faceOrSelector);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return AupCommandFace.createAccessor(faceOrSelector).findIn(parentElement).closest('aup-command');
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
shouldNotExist(parentElement) {
|
|
86
|
+
this.findIn(parentElement).should("not.exist");
|
|
147
87
|
}
|
|
148
88
|
});
|
|
149
89
|
}
|
|
150
|
-
|
|
151
|
-
|
|
90
|
+
click() {
|
|
91
|
+
this.getButton().click();
|
|
92
|
+
}
|
|
93
|
+
getShouldElement() {
|
|
94
|
+
return this.getButton();
|
|
95
|
+
}
|
|
96
|
+
shouldBeDisabled() {
|
|
97
|
+
this.getButton().should('be.disabled');
|
|
98
|
+
}
|
|
99
|
+
getButton() {
|
|
100
|
+
return this.element().find('button');
|
|
152
101
|
}
|
|
153
102
|
}
|
|
154
103
|
|
|
104
|
+
class AupEmptyState extends PageElement {
|
|
105
|
+
}
|
|
106
|
+
|
|
155
107
|
class AupInput extends PageElement {
|
|
156
108
|
label() {
|
|
157
109
|
return this.element().find('label');
|
|
@@ -163,13 +115,13 @@ class AupInput extends PageElement {
|
|
|
163
115
|
return this.element().find('mat-error');
|
|
164
116
|
}
|
|
165
117
|
get labelShould() {
|
|
166
|
-
return this.label()
|
|
118
|
+
return this.getShoulder(this.label());
|
|
167
119
|
}
|
|
168
120
|
get hintShould() {
|
|
169
|
-
return this.hint()
|
|
121
|
+
return this.getShoulder(this.hint());
|
|
170
122
|
}
|
|
171
123
|
get errorShould() {
|
|
172
|
-
return this.error()
|
|
124
|
+
return this.getShoulder(this.error());
|
|
173
125
|
}
|
|
174
126
|
labelShouldBe(text) {
|
|
175
127
|
return this.labelShould("have.text", text);
|
|
@@ -195,14 +147,14 @@ class AupInput extends PageElement {
|
|
|
195
147
|
input.type(`${value}`);
|
|
196
148
|
this.input().should('have.value', `${value}`);
|
|
197
149
|
}
|
|
198
|
-
|
|
199
|
-
return this.input()
|
|
150
|
+
getShouldElement() {
|
|
151
|
+
return this.input();
|
|
200
152
|
}
|
|
201
153
|
}
|
|
202
154
|
AupInput.HtmlInput = HtmlInput;
|
|
203
155
|
class TextAreaInput extends AupInput {
|
|
204
|
-
|
|
205
|
-
return this.input()
|
|
156
|
+
getShouldElement() {
|
|
157
|
+
return this.input();
|
|
206
158
|
}
|
|
207
159
|
input() {
|
|
208
160
|
return this.element().find('textarea');
|
|
@@ -270,6 +222,21 @@ class AupTable extends PageElement {
|
|
|
270
222
|
AupTable.Cell = Cell;
|
|
271
223
|
})(AupTable || (AupTable = {}));
|
|
272
224
|
|
|
225
|
+
function ButtonMixin(Base) {
|
|
226
|
+
return class extends Base {
|
|
227
|
+
constructor(...args) {
|
|
228
|
+
super(...args);
|
|
229
|
+
}
|
|
230
|
+
click() {
|
|
231
|
+
return this.element().click();
|
|
232
|
+
}
|
|
233
|
+
shouldBeDisabled() {
|
|
234
|
+
this.should("be.disabled");
|
|
235
|
+
// this.should("have.css", "color", "rgba(0,0,0,0.26)")
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
273
240
|
class Button extends ButtonMixin(PageElement) {
|
|
274
241
|
constructor(parentElementAccessor, buttonText) {
|
|
275
242
|
super(parentElementAccessor, {
|
|
@@ -283,56 +250,205 @@ class Button extends ButtonMixin(PageElement) {
|
|
|
283
250
|
}
|
|
284
251
|
}
|
|
285
252
|
|
|
286
|
-
|
|
287
|
-
(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
253
|
+
class Builder {
|
|
254
|
+
constructor(source) {
|
|
255
|
+
this.source = source;
|
|
256
|
+
this._sectionFactory = Builder.createFactoryMethod(this.source, PageElement);
|
|
257
|
+
this.aupEmptyState = Builder.createFactoryMethod(this.source, AupEmptyState, 'aup-empty-state');
|
|
258
|
+
}
|
|
259
|
+
find(selector) {
|
|
260
|
+
return new PageElement(this.source, selector);
|
|
261
|
+
}
|
|
262
|
+
section(selector, builder) {
|
|
263
|
+
return this._sectionFactory(selector, builder);
|
|
264
|
+
}
|
|
265
|
+
contains(text) {
|
|
266
|
+
return new PageElement(this.source, {
|
|
267
|
+
findIn: parent => parent.contains(text),
|
|
268
|
+
shouldNotExist: (parent) => parent.should('not.contain', text)
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
button(text) {
|
|
272
|
+
return new Button(this.source, text);
|
|
273
|
+
}
|
|
274
|
+
aupStringInput(selector) {
|
|
275
|
+
return new AupInput.HtmlInput(this.source, selector !== null && selector !== void 0 ? selector : 'aup-string-input');
|
|
276
|
+
}
|
|
277
|
+
aupTextInput(selector) {
|
|
278
|
+
return new AupInput.TextAreaInput(this.source, selector !== null && selector !== void 0 ? selector : 'aup-text-input');
|
|
279
|
+
}
|
|
280
|
+
aupPasswordInput(selector) {
|
|
281
|
+
return new AupInput.HtmlInput(this.source, selector !== null && selector !== void 0 ? selector : 'aup-password-input');
|
|
282
|
+
}
|
|
283
|
+
aupNumberInput(selector) {
|
|
284
|
+
return new AupInput.HtmlInput(this.source, selector !== null && selector !== void 0 ? selector : 'aup-number-input');
|
|
285
|
+
}
|
|
286
|
+
aupCommand(faceOrSelector) {
|
|
287
|
+
return new AupCommand(this.source, faceOrSelector);
|
|
288
|
+
}
|
|
289
|
+
aupTabbedNavigation() {
|
|
290
|
+
return new AupNavigation(this.source, 'aup-tabbed-place-navigation');
|
|
291
|
+
}
|
|
292
|
+
aupSideNavigation() {
|
|
293
|
+
return new AupNavigation(this.source, 'aup-list-place-nav');
|
|
294
|
+
}
|
|
295
|
+
aupTable(selector) {
|
|
296
|
+
return new AupTable(this.source, selector !== null && selector !== void 0 ? selector : 'aup-table');
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
(function (Builder) {
|
|
300
|
+
class Factory {
|
|
301
|
+
constructor(parent, klass, defaultSelector) {
|
|
302
|
+
this.parent = parent;
|
|
303
|
+
this.klass = klass;
|
|
304
|
+
this.defaultSelector = defaultSelector;
|
|
305
|
+
}
|
|
306
|
+
create(selectorOrBuilder, optionalBuilder) {
|
|
307
|
+
const selector = _.isFunction(selectorOrBuilder) ? this.defaultSelector : selectorOrBuilder;
|
|
308
|
+
if (!selector) {
|
|
309
|
+
lang.illegalState('This element requires a selector but none was provided');
|
|
326
310
|
}
|
|
327
|
-
|
|
328
|
-
|
|
311
|
+
const callback = _.isFunction(selectorOrBuilder) ? selectorOrBuilder : optionalBuilder;
|
|
312
|
+
const element = new this.klass(this.parent, selector);
|
|
313
|
+
return callback ? Mixin.createProxy(element, callback(new Builder(this.parent))) : element;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
Builder.Factory = Factory;
|
|
317
|
+
function createFactoryMethod(element, klass, defaultSelector) {
|
|
318
|
+
const factory = new Factory(element, klass, defaultSelector);
|
|
319
|
+
return factory.create.bind(factory);
|
|
320
|
+
}
|
|
321
|
+
Builder.createFactoryMethod = createFactoryMethod;
|
|
322
|
+
})(Builder || (Builder = {}));
|
|
323
|
+
|
|
324
|
+
class AupAbstractActivity extends PageElement {
|
|
325
|
+
constructor(parent, selector) {
|
|
326
|
+
super(parent, selector);
|
|
327
|
+
this.title = this.find('aup-activity-title');
|
|
328
|
+
this._confirmCommand = new Builder(this).aupCommand('[data-cy=confirm-command]');
|
|
329
|
+
this._cancelCommand = new Builder(this).aupCommand('[data-cy=cancel-command]');
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
class AupActivity extends AupAbstractActivity {
|
|
334
|
+
constructor(parent, selector) {
|
|
335
|
+
super(parent, selector);
|
|
336
|
+
}
|
|
337
|
+
get confirmCommand() {
|
|
338
|
+
return this._confirmCommand;
|
|
339
|
+
}
|
|
340
|
+
get cancelCommand() {
|
|
341
|
+
return this._cancelCommand;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
class AupModalActivity extends AupActivity {
|
|
346
|
+
clickBackdrop() {
|
|
347
|
+
this.element().closest(`.cdk-overlay-backdrop`).click(-50, -50, { force: true });
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
class AupAlert extends AupAbstractActivity {
|
|
352
|
+
constructor(parent, selector) {
|
|
353
|
+
super(parent, selector);
|
|
354
|
+
}
|
|
355
|
+
get closeCommand() {
|
|
356
|
+
return this._confirmCommand;
|
|
357
|
+
}
|
|
358
|
+
clickClose() {
|
|
359
|
+
this.closeCommand.click();
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
class AupModalAlert extends AupAlert {
|
|
364
|
+
constructor(parent, selector) {
|
|
365
|
+
super(parent, selector);
|
|
366
|
+
}
|
|
367
|
+
clickBackdrop() {
|
|
368
|
+
this.element()
|
|
369
|
+
.closest(`.cdk-overlay-container`)
|
|
370
|
+
.find(`.cdk-overlay-backdrop`).click(-50, -50, { force: true });
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
class PageBuilder extends Builder {
|
|
375
|
+
constructor() {
|
|
376
|
+
super(...arguments);
|
|
377
|
+
this._modalInteractionFactory = Builder.createFactoryMethod(this.source, AupModalActivity);
|
|
378
|
+
this._modalAlertFactory = Builder.createFactoryMethod(this.source, AupModalAlert);
|
|
379
|
+
}
|
|
380
|
+
aupModalActivity(selector, builder) {
|
|
381
|
+
return this._modalInteractionFactory(`.dialog-interaction-context ${selector}`, builder);
|
|
382
|
+
}
|
|
383
|
+
aupModalAlert(builder) {
|
|
384
|
+
return this._modalAlertFactory(`.dialog-interaction-context aup-alert-dialog`, builder);
|
|
385
|
+
}
|
|
386
|
+
aupModelConfirm(builder) {
|
|
387
|
+
return this._modalInteractionFactory(`.dialog-interaction-context aup-confirm-dialog`, builder);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
let urlSerialiser = new DefaultUrlSerializer();
|
|
392
|
+
class Path {
|
|
393
|
+
constructor(segments) {
|
|
394
|
+
this.segments = segments;
|
|
395
|
+
}
|
|
396
|
+
static extractVisitParameters(url) {
|
|
397
|
+
var _a, _b;
|
|
398
|
+
let result = {};
|
|
399
|
+
const urlTree = urlSerialiser.parse(url);
|
|
400
|
+
const urlSegments = (_b = (_a = urlTree.root.children.primary) === null || _a === void 0 ? void 0 : _a.segments) !== null && _b !== void 0 ? _b : [];
|
|
401
|
+
urlSegments === null || urlSegments === void 0 ? void 0 : urlSegments.forEach(s => {
|
|
402
|
+
result = Object.assign(Object.assign({}, result), s.parameters);
|
|
403
|
+
});
|
|
404
|
+
return result;
|
|
405
|
+
}
|
|
406
|
+
toUrl(matrixParams) {
|
|
407
|
+
return this.segments.map(s => s.toUrlPart(matrixParams)).join('/');
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
(function (Path) {
|
|
411
|
+
function setUrlSerialiser(serialiser) {
|
|
412
|
+
urlSerialiser = serialiser;
|
|
413
|
+
}
|
|
414
|
+
Path.setUrlSerialiser = setUrlSerialiser;
|
|
415
|
+
class Segment {
|
|
416
|
+
constructor(path, params = {}) {
|
|
417
|
+
var _a;
|
|
418
|
+
this.path = path;
|
|
419
|
+
this.routeId = params === null || params === void 0 ? void 0 : params.routeId;
|
|
420
|
+
this.visitParams = (_a = params === null || params === void 0 ? void 0 : params.visitParams) !== null && _a !== void 0 ? _a : [];
|
|
421
|
+
}
|
|
422
|
+
toUrlPart(params) {
|
|
423
|
+
let path = this.path;
|
|
424
|
+
this.visitParams.forEach(p => {
|
|
425
|
+
const value = params[p];
|
|
426
|
+
if (value) {
|
|
427
|
+
path = `${path};${p}=${value}`;
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
if (this.routeId && params[this.routeId]) {
|
|
431
|
+
path = path + '/' + params[this.routeId];
|
|
329
432
|
}
|
|
330
|
-
|
|
433
|
+
return path;
|
|
434
|
+
}
|
|
331
435
|
}
|
|
332
|
-
|
|
333
|
-
class
|
|
436
|
+
Path.Segment = Segment;
|
|
437
|
+
class Builder {
|
|
438
|
+
constructor() {
|
|
439
|
+
this.segments = [];
|
|
440
|
+
}
|
|
441
|
+
segment(name, params) {
|
|
442
|
+
const builder = new Segment(name, params);
|
|
443
|
+
this.segments.push(builder);
|
|
444
|
+
return this;
|
|
445
|
+
}
|
|
446
|
+
getPath() {
|
|
447
|
+
return new Path(this.segments);
|
|
448
|
+
}
|
|
334
449
|
}
|
|
335
|
-
|
|
450
|
+
Path.Builder = Builder;
|
|
451
|
+
})(Path || (Path = {}));
|
|
336
452
|
|
|
337
453
|
class Page extends PageElement {
|
|
338
454
|
constructor(path) {
|
|
@@ -343,12 +459,14 @@ class Page extends PageElement {
|
|
|
343
459
|
element() {
|
|
344
460
|
return cy.get(this.rootElementSelector);
|
|
345
461
|
}
|
|
346
|
-
visit(
|
|
347
|
-
this.tryAndVisit(
|
|
348
|
-
this.shouldBeActive(
|
|
462
|
+
visit(visitParams, queryParams) {
|
|
463
|
+
this.tryAndVisit(visitParams, queryParams);
|
|
464
|
+
this.shouldBeActive(visitParams);
|
|
349
465
|
}
|
|
350
|
-
tryAndVisit(params) {
|
|
351
|
-
|
|
466
|
+
tryAndVisit(params, queryParams) {
|
|
467
|
+
const path = this.path.toUrl(params !== null && params !== void 0 ? params : {});
|
|
468
|
+
const queryString = queryParams ? `?${new URLSearchParams(queryParams).toString()}` : '';
|
|
469
|
+
cy.visit(`/${path}${queryString}`);
|
|
352
470
|
}
|
|
353
471
|
shouldHaveActivityIds(...ids) {
|
|
354
472
|
cy.location('search').should('contain', `?aup-interactions=${ids.join('--')}`);
|
|
@@ -361,8 +479,8 @@ class Page extends PageElement {
|
|
|
361
479
|
}
|
|
362
480
|
shouldBeActive(withParameters) {
|
|
363
481
|
// Note: cy.window() doesn't return a promise... it's a chainable.
|
|
364
|
-
cy
|
|
365
|
-
cy
|
|
482
|
+
cy['waitUntil'](() => {
|
|
483
|
+
return cy.window().then(window => {
|
|
366
484
|
return window['aup.PlaceRouter'] && !window['aup.PlaceRouter'].isNavigating();
|
|
367
485
|
});
|
|
368
486
|
});
|
|
@@ -382,18 +500,15 @@ class Page extends PageElement {
|
|
|
382
500
|
function create(pathOrPathBuilder, page) {
|
|
383
501
|
const pathBuilder = new Path.Builder();
|
|
384
502
|
if (_.isString(pathOrPathBuilder)) {
|
|
385
|
-
pathOrPathBuilder.split(
|
|
503
|
+
pathOrPathBuilder.split('/').filter(p => !_.isEmpty(p)).forEach(p => pathBuilder.segment(p));
|
|
386
504
|
}
|
|
387
505
|
else {
|
|
388
506
|
pathOrPathBuilder(pathBuilder);
|
|
389
507
|
}
|
|
390
|
-
const
|
|
391
|
-
return Mixin.createProxy(page(
|
|
508
|
+
const instance = new Page(pathBuilder.getPath());
|
|
509
|
+
return Mixin.createProxy(page(new PageBuilder(instance)), instance);
|
|
392
510
|
}
|
|
393
511
|
Page.create = create;
|
|
394
|
-
class PageBuilder extends Section.Mixin(Page) {
|
|
395
|
-
}
|
|
396
|
-
Page.PageBuilder = PageBuilder;
|
|
397
512
|
})(Page || (Page = {}));
|
|
398
513
|
|
|
399
514
|
class AupCommandGroup extends PageElement {
|
|
@@ -437,5 +552,5 @@ class AupToolBar extends PageElement {
|
|
|
437
552
|
* Generated bundle index. Do not edit.
|
|
438
553
|
*/
|
|
439
554
|
|
|
440
|
-
export { AupCommand, AupCommandFace, AupCommandGroup, AupInput, AupMoreMenu, AupNavigation, AupPopupMenu, AupTable, AupToolBar, Button, ButtonMixin, Page, PageElement, Path
|
|
555
|
+
export { AupAbstractActivity, AupActivity, AupAlert, AupCommand, AupCommandFace, AupCommandGroup, AupEmptyState, AupInput, AupModalActivity, AupModalAlert, AupMoreMenu, AupNavigation, AupPopupMenu, AupTable, AupToolBar, Builder, Button, ButtonMixin, FaceAccessor, Page, PageBuilder, PageElement, Path };
|
|
441
556
|
//# sourceMappingURL=coolon-angular-ui-powerups-cypress.js.map
|