@o3r/testing 11.0.0-next.0 → 11.0.0-next.1
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/README.md +5 -1
- package/core/angular/angular-materials/autocomplete-material.js.map +1 -1
- package/core/angular/angular-materials/select-material.js.map +1 -1
- package/core/angular/component-fixture.js +12 -12
- package/core/angular/component-fixture.js.map +1 -1
- package/core/angular/elements/checkbox-element.js.map +1 -1
- package/core/angular/elements/radio-element.js.map +1 -1
- package/core/angular/elements/select-element.js.map +1 -1
- package/core/angular/groups/radio-group.js.map +1 -1
- package/core/angular/page-fixture.js.map +1 -1
- package/core/angular-materials/autocomplete-material.js.map +1 -1
- package/core/angular-materials/select-material.js.map +1 -1
- package/core/elements/checkbox-element.js.map +1 -1
- package/core/elements/radio-element.js.map +1 -1
- package/core/elements/select-element.js.map +1 -1
- package/core/groups/radio-group.js.map +1 -1
- package/core/helpers.d.ts.map +1 -1
- package/core/helpers.js.map +1 -1
- package/core/page-fixture.js.map +1 -1
- package/core/playwright/angular-materials/autocomplete-material.js +3 -3
- package/core/playwright/angular-materials/autocomplete-material.js.map +1 -1
- package/core/playwright/angular-materials/select-material.js +9 -9
- package/core/playwright/angular-materials/select-material.js.map +1 -1
- package/core/playwright/component-fixture.d.ts +6 -6
- package/core/playwright/component-fixture.d.ts.map +1 -1
- package/core/playwright/component-fixture.js +60 -106
- package/core/playwright/component-fixture.js.map +1 -1
- package/core/playwright/element.d.ts.map +1 -1
- package/core/playwright/element.js +4 -28
- package/core/playwright/element.js.map +1 -1
- package/core/playwright/elements/checkbox-element.js +3 -3
- package/core/playwright/elements/checkbox-element.js.map +1 -1
- package/core/playwright/elements/radio-element.js +3 -3
- package/core/playwright/elements/radio-element.js.map +1 -1
- package/core/playwright/elements/select-element.js.map +1 -1
- package/core/playwright/groups/radio-group.js.map +1 -1
- package/core/playwright/page-fixture.js.map +1 -1
- package/core/protractor/angular-materials/autocomplete-material.js.map +1 -1
- package/core/protractor/angular-materials/select-material.js.map +1 -1
- package/core/protractor/component-fixture.js +12 -12
- package/core/protractor/component-fixture.js.map +1 -1
- package/core/protractor/elements/checkbox-element.js +3 -3
- package/core/protractor/elements/checkbox-element.js.map +1 -1
- package/core/protractor/elements/radio-element.js +3 -3
- package/core/protractor/elements/radio-element.js.map +1 -1
- package/core/protractor/elements/select-element.js.map +1 -1
- package/core/protractor/groups/radio-group.js.map +1 -1
- package/core/protractor/page-fixture.js.map +1 -1
- package/errors/fixture-usage-error.js.map +1 -1
- package/errors/transpilation-purpose-only.js.map +1 -1
- package/kassette/update-dates-in-mocks.js +11 -11
- package/kassette/update-dates-in-mocks.js.map +1 -1
- package/localization/localization-mock.d.ts +10 -6
- package/localization/localization-mock.d.ts.map +1 -1
- package/localization/localization-mock.js +30 -11
- package/localization/localization-mock.js.map +1 -1
- package/mocks/mock-component-generator.js.map +1 -1
- package/package.json +63 -57
- package/schematics/add-functions-to-fixture/helpers.js.map +1 -1
- package/schematics/add-functions-to-fixture/index.d.ts +1 -2
- package/schematics/add-functions-to-fixture/index.d.ts.map +1 -1
- package/schematics/add-functions-to-fixture/index.js +6 -3
- package/schematics/add-functions-to-fixture/index.js.map +1 -1
- package/schematics/fixture-to-component/index.d.ts +6 -2
- package/schematics/fixture-to-component/index.d.ts.map +1 -1
- package/schematics/fixture-to-component/index.js +9 -5
- package/schematics/fixture-to-component/index.js.map +1 -1
- package/schematics/ng-add/fixture/index.d.ts +1 -2
- package/schematics/ng-add/fixture/index.d.ts.map +1 -1
- package/schematics/ng-add/fixture/index.js +16 -18
- package/schematics/ng-add/fixture/index.js.map +1 -1
- package/schematics/ng-add/index.d.ts +2 -2
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +45 -30
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/playwright/index.d.ts +3 -2
- package/schematics/ng-add/playwright/index.d.ts.map +1 -1
- package/schematics/ng-add/playwright/index.js +20 -8
- package/schematics/ng-add/playwright/index.js.map +1 -1
- package/schematics/ng-add/playwright/templates/e2e-playwright/playwright-config.sanity.ts.template +3 -3
- package/schematics/ng-add/playwright/templates/e2e-playwright/playwright-config.ts.template +3 -3
- package/schematics/ng-add/playwright/templates/e2e-playwright/scenarios/__name@dasherize__.e2e-playwright-spec.ts +2 -1
- package/schematics/ng-add/schema.d.ts +2 -0
- package/schematics/ng-add/schema.d.ts.map +1 -1
- package/schematics/ng-add/schema.json +5 -0
- package/schematics/ng-add/templates/project/jest.config.js.template +2 -2
- package/schematics/ng-add/templates/workspace/jest.config.ut.js.template +18 -11
- package/schematics/ng-update/v9-0/index.d.ts +1 -1
- package/schematics/ng-update/v9-0/index.d.ts.map +1 -1
- package/schematics/ng-update/v9-0/index.js +6 -2
- package/schematics/ng-update/v9-0/index.js.map +1 -1
- package/schematics/ng-update/v9-0/localization-imports/localization-imports.js +2 -2
- package/schematics/ng-update/v9-0/localization-imports/localization-imports.js.map +1 -1
- package/schematics/playwright/sanity/index.d.ts +1 -1
- package/schematics/playwright/sanity/index.d.ts.map +1 -1
- package/schematics/playwright/sanity/index.js +6 -2
- package/schematics/playwright/sanity/index.js.map +1 -1
- package/schematics/playwright/scenario/index.d.ts +1 -1
- package/schematics/playwright/scenario/index.d.ts.map +1 -1
- package/schematics/playwright/scenario/index.js +6 -2
- package/schematics/playwright/scenario/index.js.map +1 -1
- package/schematics/playwright/scenario/templates/__name@dasherize__.e2e-playwright-spec.ts +2 -1
- package/store/testable-select.js.map +1 -1
- package/tools/path-replacement/path-replacement.js.map +1 -1
- package/tools/protractor/fetch-manager/_fetch-manager.js.map +1 -1
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.js.map +1 -1
- package/tools/protractor/post-message-interceptor/post-message-interceptor.js +4 -4
- package/tools/protractor/post-message-interceptor/post-message-interceptor.js.map +1 -1
- package/visual-test/utils.js.map +1 -1
- package/visual-test/visual-test.js.map +1 -1
|
@@ -26,19 +26,15 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
26
26
|
*/
|
|
27
27
|
O3rComponentFixture.prototype.throwOnUndefinedElement = function (element, timeout) {
|
|
28
28
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
29
|
-
var count;
|
|
30
29
|
return tslib_1.__generator(this, function (_a) {
|
|
31
30
|
switch (_a.label) {
|
|
32
31
|
case 0:
|
|
33
32
|
if (!element) {
|
|
34
33
|
throw new Error('Element not found in ' + this.constructor.name);
|
|
35
34
|
}
|
|
36
|
-
return [4 /*yield*/,
|
|
35
|
+
return [4 /*yield*/, element.sourceElement.element.first().waitFor({ state: 'attached', timeout: timeout })];
|
|
37
36
|
case 1:
|
|
38
|
-
|
|
39
|
-
if (!count) {
|
|
40
|
-
throw new Error('Element not found in ' + this.constructor.name);
|
|
41
|
-
}
|
|
37
|
+
_a.sent();
|
|
42
38
|
return [2 /*return*/, element];
|
|
43
39
|
}
|
|
44
40
|
});
|
|
@@ -51,20 +47,21 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
51
47
|
* @param timeout specific timeout that will throw when reach
|
|
52
48
|
*/
|
|
53
49
|
O3rComponentFixture.prototype.throwOnUndefined = function (element, timeout) {
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
var _this = this;
|
|
51
|
+
return (0, helpers_1.withTimeout)((function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
52
|
+
var el;
|
|
56
53
|
return tslib_1.__generator(this, function (_a) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
switch (_a.label) {
|
|
55
|
+
case 0: return [4 /*yield*/, element];
|
|
56
|
+
case 1:
|
|
57
|
+
el = _a.sent();
|
|
58
|
+
return [4 /*yield*/, el.sourceElement.element.first().waitFor({ state: 'attached' })];
|
|
59
|
+
case 2:
|
|
60
|
+
_a.sent();
|
|
61
|
+
return [2 /*return*/, el];
|
|
62
|
+
}
|
|
66
63
|
});
|
|
67
|
-
});
|
|
64
|
+
}); })(), timeout);
|
|
68
65
|
};
|
|
69
66
|
/**
|
|
70
67
|
* Get the element associated to the selector if present
|
|
@@ -75,10 +72,10 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
75
72
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
76
73
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
77
74
|
*/
|
|
78
|
-
O3rComponentFixture.prototype.queryWithOptions = function (
|
|
79
|
-
|
|
80
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
75
|
+
O3rComponentFixture.prototype.queryWithOptions = function (selector_1, elementConstructor_1) {
|
|
76
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (selector, elementConstructor, options) {
|
|
81
77
|
var element;
|
|
78
|
+
if (options === void 0) { options = {}; }
|
|
82
79
|
return tslib_1.__generator(this, function (_a) {
|
|
83
80
|
switch (_a.label) {
|
|
84
81
|
case 0:
|
|
@@ -109,27 +106,22 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
109
106
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
110
107
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
111
108
|
*/
|
|
112
|
-
O3rComponentFixture.prototype.getText = function (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return tslib_1.__generator(this, function (
|
|
117
|
-
switch (
|
|
109
|
+
O3rComponentFixture.prototype.getText = function (selector_1) {
|
|
110
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
|
|
111
|
+
var element;
|
|
112
|
+
if (options === void 0) { options = {}; }
|
|
113
|
+
return tslib_1.__generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
118
115
|
case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
|
|
119
116
|
case 1:
|
|
120
|
-
element =
|
|
121
|
-
_a = !element;
|
|
122
|
-
if (_a) return [3 /*break*/, 3];
|
|
117
|
+
element = _a.sent();
|
|
123
118
|
return [4 /*yield*/, element.isVisible()];
|
|
124
119
|
case 2:
|
|
125
|
-
|
|
126
|
-
_b.label = 3;
|
|
127
|
-
case 3:
|
|
128
|
-
if (_a) {
|
|
120
|
+
if (!(_a.sent())) {
|
|
129
121
|
return [2 /*return*/];
|
|
130
122
|
}
|
|
131
123
|
return [4 /*yield*/, element.getText()];
|
|
132
|
-
case
|
|
124
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
133
125
|
}
|
|
134
126
|
});
|
|
135
127
|
});
|
|
@@ -143,22 +135,17 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
143
135
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
144
136
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
145
137
|
*/
|
|
146
|
-
O3rComponentFixture.prototype.isVisible = function (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return tslib_1.__generator(this, function (
|
|
151
|
-
switch (
|
|
138
|
+
O3rComponentFixture.prototype.isVisible = function (selector_1) {
|
|
139
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
|
|
140
|
+
var element;
|
|
141
|
+
if (options === void 0) { options = {}; }
|
|
142
|
+
return tslib_1.__generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
152
144
|
case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
|
|
153
145
|
case 1:
|
|
154
|
-
element =
|
|
155
|
-
_a = !!element;
|
|
156
|
-
if (!_a) return [3 /*break*/, 3];
|
|
146
|
+
element = _a.sent();
|
|
157
147
|
return [4 /*yield*/, element.isVisible()];
|
|
158
|
-
case 2:
|
|
159
|
-
_a = (_b.sent());
|
|
160
|
-
_b.label = 3;
|
|
161
|
-
case 3: return [2 /*return*/, _a];
|
|
148
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
162
149
|
}
|
|
163
150
|
});
|
|
164
151
|
});
|
|
@@ -172,71 +159,43 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
172
159
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
173
160
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
174
161
|
*/
|
|
175
|
-
O3rComponentFixture.prototype.click = function (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return tslib_1.__generator(this, function (
|
|
180
|
-
switch (
|
|
162
|
+
O3rComponentFixture.prototype.click = function (selector_1) {
|
|
163
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
|
|
164
|
+
var element;
|
|
165
|
+
if (options === void 0) { options = {}; }
|
|
166
|
+
return tslib_1.__generator(this, function (_a) {
|
|
167
|
+
switch (_a.label) {
|
|
181
168
|
case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
|
|
182
169
|
case 1:
|
|
183
|
-
element =
|
|
184
|
-
_a = !!element;
|
|
185
|
-
if (!_a) return [3 /*break*/, 3];
|
|
170
|
+
element = _a.sent();
|
|
186
171
|
return [4 /*yield*/, element.isVisible()];
|
|
187
172
|
case 2:
|
|
188
|
-
|
|
189
|
-
_b.label = 3;
|
|
190
|
-
case 3:
|
|
191
|
-
if (!_a) return [3 /*break*/, 5];
|
|
173
|
+
if (!_a.sent()) return [3 /*break*/, 4];
|
|
192
174
|
return [4 /*yield*/, element.click()];
|
|
193
|
-
case
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
case
|
|
175
|
+
case 3:
|
|
176
|
+
_a.sent();
|
|
177
|
+
_a.label = 4;
|
|
178
|
+
case 4: return [2 /*return*/];
|
|
197
179
|
}
|
|
198
180
|
});
|
|
199
181
|
});
|
|
200
182
|
};
|
|
201
183
|
O3rComponentFixture.prototype.query = function (selector, returnType) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
elements = this.rootElement.sourceElement.element.locator(selector);
|
|
207
|
-
element = elements.first();
|
|
208
|
-
selectedElement = { element: element, page: this.rootElement.sourceElement.page };
|
|
209
|
-
return [2 /*return*/, Promise.resolve(new (returnType || element_1.O3rElement)(selectedElement))];
|
|
210
|
-
}
|
|
211
|
-
catch (err) {
|
|
212
|
-
console.warn("Failed to query ".concat(selector), err);
|
|
213
|
-
return [2 /*return*/, Promise.resolve(undefined)];
|
|
214
|
-
}
|
|
215
|
-
return [2 /*return*/];
|
|
216
|
-
});
|
|
217
|
-
});
|
|
184
|
+
var elements = this.rootElement.sourceElement.element.locator(selector);
|
|
185
|
+
var element = elements.first();
|
|
186
|
+
var selectedElement = { element: element, page: this.rootElement.sourceElement.page };
|
|
187
|
+
return Promise.resolve(new (returnType || element_1.O3rElement)(selectedElement));
|
|
218
188
|
};
|
|
219
189
|
O3rComponentFixture.prototype.queryNth = function (selector, index, returnType) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
elements = this.rootElement.sourceElement.element.locator(selector);
|
|
225
|
-
element = elements.nth(index);
|
|
226
|
-
selectedElement = { element: element, page: this.rootElement.sourceElement.page };
|
|
227
|
-
return [2 /*return*/, Promise.resolve(new (returnType || element_1.O3rElement)(selectedElement))];
|
|
228
|
-
}
|
|
229
|
-
catch (_b) {
|
|
230
|
-
return [2 /*return*/, Promise.resolve(undefined)];
|
|
231
|
-
}
|
|
232
|
-
return [2 /*return*/];
|
|
233
|
-
});
|
|
234
|
-
});
|
|
190
|
+
var elements = this.rootElement.sourceElement.element.locator(selector);
|
|
191
|
+
var element = elements.nth(index);
|
|
192
|
+
var selectedElement = { element: element, page: this.rootElement.sourceElement.page };
|
|
193
|
+
return Promise.resolve(new (returnType || element_1.O3rElement)(selectedElement));
|
|
235
194
|
};
|
|
236
|
-
O3rComponentFixture.prototype.queryAll = function (
|
|
237
|
-
|
|
238
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
195
|
+
O3rComponentFixture.prototype.queryAll = function (selector_1, returnType_1, groupType_1) {
|
|
196
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (selector, returnType, groupType, timeout) {
|
|
239
197
|
var sourceElement, pElements, pElementsCount, elements, i, selectedElement, group, isValid, err_1;
|
|
198
|
+
if (timeout === void 0) { timeout = 5000; }
|
|
240
199
|
return tslib_1.__generator(this, function (_a) {
|
|
241
200
|
switch (_a.label) {
|
|
242
201
|
case 0:
|
|
@@ -285,13 +244,8 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
285
244
|
};
|
|
286
245
|
/** @inheritDoc */
|
|
287
246
|
O3rComponentFixture.prototype.queryNotPresent = function (selector) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return tslib_1.__generator(this, function (_a) {
|
|
291
|
-
element = this.rootElement.sourceElement.element.locator(selector).first();
|
|
292
|
-
return [2 /*return*/, element.isHidden()];
|
|
293
|
-
});
|
|
294
|
-
});
|
|
247
|
+
var element = this.rootElement.sourceElement.element.locator(selector).first();
|
|
248
|
+
return element.isHidden();
|
|
295
249
|
};
|
|
296
250
|
return O3rComponentFixture;
|
|
297
251
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":";;;;AAAA,4BAA4B;AAC5B,4CAAuD;AAEvD,sCAAyC;AACzC,qCAAuF;AAKvF;;GAEG;AACH;IAOE;;;;OAIG;IACH,6BAAY,WAAc;QACxB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACa,qDAAuB,GAAvC,UAA8D,OAAW,EAAE,OAAgB;;;;;;wBACzF,IAAI,CAAC,OAAO,EAAE;4BACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;yBAClE;wBACa,qBAAM,IAAA,qBAAW,EAAC,OAAO,CAAC,aAAa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OAAO,GAAG,SAA0B;wBAE1C,IAAI,CAAC,OAAO,EAAE;4BACZ,MAAM,IAAI,yBAAiB,CAAC,wBAAwB,CAAC,CAAC;yBACvD;wBACD,sBAAO,KAAK,EAAC;4BAGf,sBAAO,QAAQ,EAAC;;;wBAEhB,OAAO,CAAC,IAAI,CAAC,8BAAuB,QAAQ,CAAE,EAAE,KAAG,CAAC,CAAC;wBACrD,sBAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAC;;;;;KAE9B;IAED,kBAAkB;IACX,wCAAU,GAAjB;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,kBAAkB;IACX,8CAAgB,GAAvB;QACE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,CAAC,IAAI,CAAC,EAAC,CAAC,CAAC;IAC1C,CAAC;IAED,kBAAkB;IACL,6CAAe,GAA5B,UAA6B,QAAgB;;;;gBACrC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;gBACjF,sBAAO,OAAO,CAAC,QAAQ,EAAE,EAAC;;;KAC3B;IACH,0BAAC;AAAD,CAAC,AAjOD,IAiOC;AAjOY,kDAAmB","sourcesContent":["/* eslint-disable new-cap */\nimport { FixtureUsageError } from '../../errors/index';\nimport type { ComponentFixtureProfile } from '../component-fixture';\nimport { withTimeout } from '../helpers';\nimport { O3rElement, O3rElementConstructor, PlaywrightSourceElement } from './element';\nimport { O3rGroup, O3rGroupConstructor } from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to Playwright, hence using the webdriver to interact with the dom.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n\n /**\n * DOM element linked to the fixture.\n */\n protected rootElement: V;\n\n /**\n * Root element of this fixture.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param rootElement\n */\n constructor(rootElement: V) {\n this.rootElement = rootElement;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefinedElement<T extends O3rElement>(element?: T, timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n const count = await withTimeout(element.sourceElement.element.count(), timeout);\n if (!count) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefined<T extends O3rElement>(element: Promise<T | undefined>, timeout?: number): Promise<T> {\n return withTimeout(element, timeout)\n .then((el) => el?.sourceElement.element.count())\n .then((count) => (count || 0) > 0)\n .then((isPresent) => {\n if (!isPresent) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n })\n .then(() => element as Promise<T>);\n }\n\n /**\n * Get the element associated to the selector if present\n * @param selector Selector to access the element\n * @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options Options supported\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async queryWithOptions(\n selector: string,\n elementConstructor?: O3rElementConstructor<O3rElement>,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<O3rElement | undefined> {\n let element: O3rElement | undefined;\n if (options.index !== undefined) {\n element = await this.queryNth(selector, options.index, elementConstructor as any);\n } else {\n element = await this.query(selector, elementConstructor as any);\n }\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T>;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!element || !await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n return !!element && await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!!element && await element.isVisible()) {\n await element.click();\n }\n }\n\n /** @inheritdoc */\n public async query(selector: string, returnType?: undefined): Promise<O3rElement | undefined>;\n public async query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public async query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n try {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.first();\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n } catch (err) {\n console.warn(`Failed to query ${selector}`, err);\n return Promise.resolve(undefined);\n }\n }\n\n /** @inheritdoc */\n public async queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement | undefined>;\n public async queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public async queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n try {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.nth(index);\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n } catch {\n return Promise.resolve(undefined);\n }\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout = 5000\n ): Promise<(T | O3rElement)[] | K> {\n try {\n const sourceElement = this.rootElement.sourceElement.element;\n const pElements = sourceElement.locator(selector);\n // Mandatory because count is not reliable if we don't wait for the list to be attached\n await pElements.first().waitFor({state: 'attached', timeout});\n const pElementsCount = await pElements.count();\n const elements = [];\n for (let i = 0; i < pElementsCount; i++) {\n const selectedElement: PlaywrightSourceElement = {element: pElements.nth(i), page: this.rootElement.sourceElement.page};\n elements.push(returnType ? new returnType(selectedElement) : new O3rElement(selectedElement));\n }\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return group;\n }\n\n return elements;\n } catch (err) {\n console.warn(`Failed to query all ${selector}`, err);\n return Promise.resolve([]);\n }\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.rootElement;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{[componentName: string]: ComponentFixtureProfile[]}> {\n return Promise.resolve({block: [this]});\n }\n\n /** @inheritDoc */\n public async queryNotPresent(selector: string): Promise<boolean> {\n const element = this.rootElement.sourceElement.element.locator(selector).first();\n return element.isHidden();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":";;;;AAAA,4BAA4B;AAC5B,4CAAuD;AAEvD,sCAAyC;AACzC,qCAAuF;AAKvF;;GAEG;AACH;IAOE;;;;OAIG;IACH,6BAAY,WAAc;QACxB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACa,qDAAuB,GAAvC,UAA8D,OAAW,EAAE,OAAgB;;;;;wBACzF,IAAI,CAAC,OAAO,EAAE,CAAC;4BACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;wBACnE,CAAC;wBACD,qBAAM,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,UAAU,EAAE,OAAO,SAAA,EAAC,CAAC,EAAA;;wBAAjF,SAAiF,CAAC;wBAClF,sBAAO,OAAO,EAAC;;;;KA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ureUsageError } from '../../errors/index';\nimport type { ComponentFixtureProfile } from '../component-fixture';\nimport { withTimeout } from '../helpers';\nimport { O3rElement, O3rElementConstructor, PlaywrightSourceElement } from './element';\nimport { O3rGroup, O3rGroupConstructor } from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to Playwright, hence using the webdriver to interact with the dom.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n\n /**\n * DOM element linked to the fixture.\n */\n protected rootElement: V;\n\n /**\n * Root element of this fixture.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param rootElement\n */\n constructor(rootElement: V) {\n this.rootElement = rootElement;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefinedElement<T extends O3rElement>(element?: T, timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n await element.sourceElement.element.first().waitFor({state: 'attached', timeout});\n return element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected throwOnUndefined<T extends O3rElement>(element: Promise<T>, timeout?: number): Promise<T> {\n return withTimeout(\n (async () => {\n const el = await element;\n await el.sourceElement.element.first().waitFor({state: 'attached'});\n return el;\n })(),\n timeout);\n }\n\n /**\n * Get the element associated to the selector if present\n * @param selector Selector to access the element\n * @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options Options supported\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async queryWithOptions(\n selector: string,\n elementConstructor?: O3rElementConstructor<O3rElement>,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<O3rElement> {\n let element: O3rElement;\n if (options.index !== undefined) {\n element = await this.queryNth(selector, options.index, elementConstructor as any);\n } else {\n element = await this.query(selector, elementConstructor as any);\n }\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T>;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n return await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (await element.isVisible()) {\n await element.click();\n }\n }\n\n /** @inheritdoc */\n public query(selector: string, returnType?: undefined): Promise<O3rElement>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.first();\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.nth(index);\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout = 5000\n ): Promise<(T | O3rElement)[] | K> {\n try {\n const sourceElement = this.rootElement.sourceElement.element;\n const pElements = sourceElement.locator(selector);\n // Mandatory because count is not reliable if we don't wait for the list to be attached\n await pElements.first().waitFor({state: 'attached', timeout});\n const pElementsCount = await pElements.count();\n const elements = [];\n for (let i = 0; i < pElementsCount; i++) {\n const selectedElement: PlaywrightSourceElement = {element: pElements.nth(i), page: this.rootElement.sourceElement.page};\n elements.push(returnType ? new returnType(selectedElement) : new O3rElement(selectedElement));\n }\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return group;\n }\n\n return elements;\n } catch (err) {\n console.warn(`Failed to query all ${selector}`, err);\n return Promise.resolve([]);\n }\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.rootElement;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{[componentName: string]: ComponentFixtureProfile[]}> {\n return Promise.resolve({block: [this]});\n }\n\n /** @inheritDoc */\n public queryNotPresent(selector: string): Promise<boolean> {\n const element = this.rootElement.sourceElement.element.locator(selector).first();\n return element.isHidden();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C;;;;GAIG;AAEH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,sBAE7C;AAED;;GAEG;AACH,qBAAa,UAAW,YAAW,cAAc;IAC/C,+BAA+B;IACxB,aAAa,EAAE,uBAAu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BAAqB,CAAC,CAAC,SAAS,cAAc,IAAI,KAAK,aAAa,EAAE,uBAAuB,GAAG,UAAU,KAAK,CAAC,CAAC"}
|
|
@@ -72,17 +72,11 @@ var O3rElement = /** @class */ (function () {
|
|
|
72
72
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
73
73
|
return tslib_1.__generator(this, function (_a) {
|
|
74
74
|
switch (_a.label) {
|
|
75
|
-
case 0:
|
|
76
|
-
// Clears the value in the field
|
|
77
|
-
return [4 /*yield*/, this.clearValue()];
|
|
75
|
+
case 0: return [4 /*yield*/, this.sourceElement.element.fill(input)];
|
|
78
76
|
case 1:
|
|
79
|
-
// Clears the value in the field
|
|
80
|
-
_a.sent();
|
|
81
|
-
return [4 /*yield*/, this.sourceElement.element.fill(input)];
|
|
82
|
-
case 2:
|
|
83
77
|
_a.sent();
|
|
84
78
|
return [4 /*yield*/, this.sourceElement.element.press('Tab')];
|
|
85
|
-
case
|
|
79
|
+
case 2:
|
|
86
80
|
_a.sent();
|
|
87
81
|
return [2 /*return*/];
|
|
88
82
|
}
|
|
@@ -92,30 +86,12 @@ var O3rElement = /** @class */ (function () {
|
|
|
92
86
|
/** @inheritdoc */
|
|
93
87
|
O3rElement.prototype.clearValue = function () {
|
|
94
88
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
95
|
-
var currentValue, i;
|
|
96
89
|
return tslib_1.__generator(this, function (_a) {
|
|
97
90
|
switch (_a.label) {
|
|
98
|
-
case 0: return [4 /*yield*/, this.
|
|
91
|
+
case 0: return [4 /*yield*/, this.sourceElement.element.fill('')];
|
|
99
92
|
case 1:
|
|
100
|
-
currentValue = _a.sent();
|
|
101
|
-
if (!(currentValue !== undefined)) return [3 /*break*/, 6];
|
|
102
|
-
i = 0;
|
|
103
|
-
_a.label = 2;
|
|
104
|
-
case 2:
|
|
105
|
-
if (!(i < currentValue.length)) return [3 /*break*/, 6];
|
|
106
|
-
// ensure backspace deletes the value
|
|
107
|
-
return [4 /*yield*/, this.sourceElement.element.press('ArrowRight')];
|
|
108
|
-
case 3:
|
|
109
|
-
// ensure backspace deletes the value
|
|
110
93
|
_a.sent();
|
|
111
|
-
return [
|
|
112
|
-
case 4:
|
|
113
|
-
_a.sent();
|
|
114
|
-
_a.label = 5;
|
|
115
|
-
case 5:
|
|
116
|
-
i++;
|
|
117
|
-
return [3 /*break*/, 2];
|
|
118
|
-
case 6: return [2 /*return*/];
|
|
94
|
+
return [2 /*return*/];
|
|
119
95
|
}
|
|
120
96
|
});
|
|
121
97
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/core/playwright/element.ts"],"names":[],"mappings":";;;;AAgBA;;;GAGG;AACH,SAAgB,YAAY,CAAC,SAAiB;IAC5C,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACzG,CAAC;AAFD,oCAEC;AAED;;GAEG;AACH;IAIE,oBAAY,aAAmD;QAC7D,IAAI,CAAC,aAAa,GAAG,aAAa,YAAY,UAAU;YACtD,CAAC,CAAC,EAAC,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,IAAI,EAAC;YACxF,CAAC,CAAC,aAAa,CAAC;IACpB,CAAC;IAED,kBAAkB;IACX,4BAAO,GAAd;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IAED,kBAAkB;IACL,iCAAY,GAAzB;;;;;;wBACS,KAAA,YAAY,CAAA;wBAAC,qBAAM,IAAI,CAAC,OAAO,EAAE,EAAA;4BAAxC,sBAAO,kBAAa,SAAoB,EAAC,EAAC;;;;KAC3C;IAED,kBAAkB;IACX,iCAAY,GA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,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAA;;wBAAzC,SAAyC,CAAC;;;;;KAC3C;IAED,kBAAkB;IACX,0BAAK,GAAZ;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC5C,CAAC;IAED,kBAAkB;IACX,8BAAS,GAAhB;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IAED,kBAAkB;IACL,iCAAY,GAAzB,UAA0B,aAAqB;;;;;4BAC3B,qBAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,EAAA;;wBAAxE,SAAS,GAAG,SAA4D;wBAC9E,sBAAO,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAC;;;;KACnD;IACH,iBAAC;AAAD,CAAC,AApED,IAoEC;AApEY,gCAAU","sourcesContent":["import type {Locator, Page} from '@playwright/test';\nimport {ElementProfile} from '../element';\n\nexport {ElementProfile} from '../element';\n\n/**\n * Playwright type for source element\n * @param element is the DOM element\n * @param page is the tab in the browser where the test is run\n */\n\nexport type PlaywrightSourceElement = {\n element: Locator;\n page: Page;\n};\n\n/**\n * Remove text formatting (endline etc.) and return the content.\n * @param innerText\n */\nexport function getPlainText(innerText: string) {\n return innerText ? innerText.replace(/(?:\\r\\n|\\r|\\n)/g, ' ').replace(/\\s\\s+/g, ' ').trim() : undefined;\n}\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rElement implements ElementProfile {\n /** Playwright sourceElement */\n public sourceElement: PlaywrightSourceElement;\n\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n this.sourceElement = sourceElement instanceof O3rElement\n ? {element: sourceElement.sourceElement.element, page: sourceElement.sourceElement.page}\n : sourceElement;\n }\n\n /** @inheritdoc */\n public getText() {\n return this.sourceElement.element.innerText();\n }\n\n /** @inheritdoc */\n public async getPlainText() {\n return getPlainText(await this.getText());\n }\n\n /** @inheritdoc */\n public getInnerHTML(): Promise<string | undefined> {\n return this.sourceElement.element.innerHTML();\n }\n\n /** @inheritdoc */\n public mouseOver() {\n return this.sourceElement.element.hover();\n }\n\n /** @inheritdoc */\n public async getValue() {\n try {\n return await this.sourceElement.element.inputValue();\n } catch (error) {\n console.warn('Failed to retrieve input value');\n const valueByAttribute = await this.sourceElement.element.getAttribute('value');\n return valueByAttribute !== null ? valueByAttribute : undefined;\n }\n }\n\n /** @inheritdoc */\n public async setValue(input: string) {\n await this.sourceElement.element.fill(input);\n\n await this.sourceElement.element.press('Tab');\n }\n\n /** @inheritdoc */\n public async clearValue() {\n await this.sourceElement.element.fill('');\n }\n\n /** @inheritdoc */\n public click() {\n return this.sourceElement.element.click();\n }\n\n /** @inheritdoc */\n public isVisible() {\n return this.sourceElement.element.isVisible();\n }\n\n /** @inheritdoc */\n public async getAttribute(attributeName: string) {\n const attribute = await this.sourceElement.element.getAttribute(attributeName);\n return attribute !== null ? attribute : undefined;\n }\n}\n\n/**\n * Constructor of a O3rElement\n */\nexport type O3rElementConstructor<T extends ElementProfile> = new (sourceElement: PlaywrightSourceElement | O3rElement) => T;\n"]}
|
|
@@ -60,10 +60,10 @@ var O3rCheckboxElement = /** @class */ (function (_super) {
|
|
|
60
60
|
* @inheritDoc
|
|
61
61
|
* If the element contains a label, the label will be used to (un)check the checkbox.
|
|
62
62
|
*/
|
|
63
|
-
O3rCheckboxElement.prototype.check = function (
|
|
64
|
-
|
|
65
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
63
|
+
O3rCheckboxElement.prototype.check = function () {
|
|
64
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (value) {
|
|
66
65
|
var labelElement, currentValue;
|
|
66
|
+
if (value === void 0) { value = true; }
|
|
67
67
|
return tslib_1.__generator(this, function (_a) {
|
|
68
68
|
switch (_a.label) {
|
|
69
69
|
case 0: return [4 /*yield*/, this.getLabelElement()];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/checkbox-element.ts"],"names":[],"mappings":";;;;AACA,sCAA+D;AAE/D;;GAEG;AACH;IAAwC,8CAAU;IAChD,4BAAY,aAAmD;
|
|
1
|
+
{"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/checkbox-element.ts"],"names":[],"mappings":";;;;AACA,sCAA+D;AAE/D;;GAEG;AACH;IAAwC,8CAAU;IAChD,4BAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAEa,4CAAe,GAA7B;;;;;;;wBAEU,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;wBACjF,qBAAM,eAAe,CAAC,KAAK,EAAE,EAAA;;wBAAjC,IAAI,SAA6B,EAAE,CAAC;4BAClC,sBAAO,eAAe,EAAC;wBACzB,CAAC;wBACD,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAC;;;wBAElC,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAC;;;;;KAErC;IAEa,4CAAe,GAA7B;;;;;;;wBAEU,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;wBACxD,qBAAM,OAAO,CAAC,KAAK,EAAE,EAAA;;wBAAzB,IAAI,SAAqB,EAAE,CAAC;4BAC1B,sBAAO,OAAO,EAAC;wBACjB,CAAC;;;;wBAED,OAAO,CAAC,IAAI,CAAC,gDAAgD,EAAE,KAAG,CAAC,CAAC;wBACpE,sBAAO;;;;;KAEV;IAED;;;OAGG;IACU,kCAAK,GAAlB;oEAAmB,KAAY;;YAAZ,sBAAA,EAAA,YAAY;;;4BACR,qBAAM,IAAI,CAAC,eAAe,EAAE,EAAA;;wBAA3C,YAAY,GAAG,SAA4B;6BAC7C,YAAY,EAAZ,wBAAY;wBACO,qBAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAArC,YAAY,GAAG,SAAsB;wBAC3C,IAAI,YAAY,KAAK,KAAK,EAAE,CAAC;4BAC3B,OAAO,CAAC,IAAI,CAAC,8BAAuB,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAE,CAAC,CAAC;4BAC9E,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;wBAC3B,CAAC;wBACD,sBAAO,YAAY,CAAC,KAAK,EAAE,EAAC;4BAEtB,qBAAM,IAAI,CAAC,eAAe,EAAE,EAAA;4BAApC,sBAAO,CAAC,SAA4B,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAAC;;;;KACzD;IAED,kBAAkB;IACX,oCAAO,GAAd;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,kBAAkB;IACL,sCAAS,GAAtB;;;;;4BACuB,qBAAM,IAAI,CAAC,eAAe,EAAE,EAAA;;wBAA3C,YAAY,GAAG,SAA4B;wBACjD,sBAAO,YAAY,CAAC,SAAS,EAAE,EAAC;;;;KACjC;IACH,yBAAC;AAAD,CAAC,AAxDD,CAAwC,oBAAU,GAwDjD;AAxDY,gDAAkB","sourcesContent":["import {CheckboxElementProfile} from '../../elements';\nimport {O3rElement, PlaywrightSourceElement} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rCheckboxElement extends O3rElement implements CheckboxElementProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n private async getInputElement() {\n try {\n const subInputElement = this.sourceElement.element.locator('input[type=\"checkbox\"]');\n if (await subInputElement.count()) {\n return subInputElement;\n }\n return this.sourceElement.element;\n } catch {\n return this.sourceElement.element;\n }\n }\n\n private async getLabelElement() {\n try {\n const element = this.sourceElement.element.locator('label');\n if (await element.count()) {\n return element;\n }\n } catch (err) {\n console.warn('Failed to retrieve label of O3rCheckboxElement', err);\n return;\n }\n }\n\n /**\n * @inheritDoc\n * If the element contains a label, the label will be used to (un)check the checkbox.\n */\n public async check(value = true) {\n const labelElement = await this.getLabelElement();\n if (labelElement) {\n const currentValue = await this.isChecked();\n if (currentValue === value) {\n console.warn(`Checkbox is already ${currentValue ? 'checked' : 'unchecked'}`);\n return Promise.resolve();\n }\n return labelElement.click();\n }\n return (await this.getInputElement()).setChecked(value);\n }\n\n /** @inheritDoc */\n public uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public async isChecked(): Promise<boolean> {\n const inputElement = await this.getInputElement();\n return inputElement.isChecked();\n }\n}\n"]}
|
|
@@ -12,9 +12,9 @@ var O3rRadioElement = /** @class */ (function (_super) {
|
|
|
12
12
|
return _super.call(this, sourceElement) || this;
|
|
13
13
|
}
|
|
14
14
|
/** @inheritDoc */
|
|
15
|
-
O3rRadioElement.prototype.check = function (
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
O3rRadioElement.prototype.check = function () {
|
|
16
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (value) {
|
|
17
|
+
if (value === void 0) { value = true; }
|
|
18
18
|
return tslib_1.__generator(this, function (_a) {
|
|
19
19
|
switch (_a.label) {
|
|
20
20
|
case 0: return [4 /*yield*/, this.isChecked()];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/radio-element.ts"],"names":[],"mappings":";;;;AACA,sCAA+D;AAE/D;;GAEG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAAmD;
|
|
1
|
+
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/radio-element.ts"],"names":[],"mappings":";;;;AACA,sCAA+D;AAE/D;;GAEG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,+BAAK,GAAlB;oEAAmB,KAAY;YAAZ,sBAAA,EAAA,YAAY;;;4BACxB,qBAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAA3B,IAAI,CAAC,SAAsB,CAAC,KAAK,KAAK,EAAE,CAAC;4BACvC,OAAO,CAAC,IAAI,CAAC,qCAA8B,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAE,CAAC,CAAC;4BAC9E,sBAAO;wBACT,CAAC;wBACD,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAC;;;;KACrD;IAED,kBAAkB;IACL,iCAAO,GAApB;;;gBACE,sBAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAC;;;KAC1B;IAED,kBAAkB;IACX,mCAAS,GAAhB;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IACH,sBAAC;AAAD,CAAC,AAvBD,CAAqC,oBAAU,GAuB9C;AAvBY,0CAAe","sourcesContent":["import {RadioElementProfile} from '../../elements';\nimport {O3rElement, PlaywrightSourceElement} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rRadioElement extends O3rElement implements RadioElementProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritDoc */\n public async check(value = true) {\n if ((await this.isChecked()) === value) {\n console.warn(`O3rRadioELement is already ${value ? 'checked' : 'unchecked'}`);\n return;\n }\n return this.sourceElement.element.setChecked(value);\n }\n\n /** @inheritDoc */\n public async uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public isChecked(): Promise<boolean> {\n return this.sourceElement.element.isChecked();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/select-element.ts"],"names":[],"mappings":";;;;AAAA,sCAA+D;AAG/D;;GAEG;AACH;IAAsC,4CAAU;IAC9C,0BAAY,aAAmD;
|
|
1
|
+
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/select-element.ts"],"names":[],"mappings":";;;;AAAA,sCAA+D;AAG/D;;GAEG;AACH;IAAsC,4CAAU;IAC9C,0BAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACX,wCAAa,GAApB,UAAqB,KAAa,EAAE,QAAiB;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAC,KAAK,OAAA,EAAC,CAAC,CAAC;IAC1D,CAAC;IAED,kBAAkB;IACX,wCAAa,GAApB,UAAqB,KAAa,EAAE,QAAiB;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,kBAAkB;IACL,mCAAQ,GAArB;;;gBACE,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE,EAAC;;;KAC1E;IACH,uBAAC;AAAD,CAAC,AAnBD,CAAsC,oBAAU,GAmB/C;AAnBY,4CAAgB","sourcesContent":["import {O3rElement, PlaywrightSourceElement} from '../element';\n\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rSelectElement extends O3rElement {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public selectByIndex(index: number, _timeout?: number) {\n return this.sourceElement.element.selectOption({index});\n }\n\n /** @inheritdoc */\n public selectByValue(value: string, _timeout?: number) {\n return this.sourceElement.element.selectOption({ value });\n }\n\n /** @inheritDoc */\n public async getValue() {\n return this.sourceElement.element.locator('option:checked').inputValue();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../../src/core/playwright/groups/radio-group.ts"],"names":[],"mappings":";;;;AAEA,kCAAkC;AAElC;;GAEG;AACH;IAAmC,yCAAyB;IAC1D,uBAAY,aAAgC;
|
|
1
|
+
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../../src/core/playwright/groups/radio-group.ts"],"names":[],"mappings":";;;;AAEA,kCAAkC;AAElC;;GAEG;AACH;IAAmC,yCAAyB;IAC1D,uBAAY,aAAgC;QAC1C,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,oCAAY,GAAzB;;;;;;wBACM,IAAI,GAAG,EAAE,CAAC;8BAEe,EAAV,KAAA,IAAI,CAAC,KAAK;;;6BAAV,CAAA,cAAU,CAAA;wBAAlB,IAAI;wBACI,qBAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAA;;wBAA1C,QAAQ,GAAG,SAA+B;wBAChD,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;4BACrC,sBAAO,KAAK,EAAC;wBACf,CAAC;wBACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;4BAC3B,IAAI,GAAG,QAAQ,CAAC;wBAClB,CAAC;;;wBAPgB,IAAU,CAAA;;4BAU7B,sBAAO,IAAI,EAAC;;;;KACb;IAED;;OAEG;IACU,uCAAe,GAA5B;;;;;;8BAC+B,EAAV,KAAA,IAAI,CAAC,KAAK;;;6BAAV,CAAA,cAAU,CAAA;wBAAlB,IAAI;wBACM,qBAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAAnC,UAAU,GAAG,SAAsB;wBACzC,IAAI,UAAU,EAAE,CAAC;4BACf,sBAAO,IAAI,EAAC;wBACd,CAAC;;;wBAJgB,IAAU,CAAA;;4BAO7B,sBAAO,SAAS,EAAC;;;;KAClB;IACH,oBAAC;AAAD,CAAC,AAnCD,CAAmC,gBAAQ,GAmC1C;AAnCY,sCAAa","sourcesContent":["import {RadioGroupProfile} from '../../groups/radio-group';\nimport {O3rRadioElement} from '../elements/radio-element';\nimport {O3rGroup} from '../group';\n\n/**\n * Group element to manage a radio group\n */\nexport class O3rRadioGroup extends O3rGroup<O3rRadioElement> implements RadioGroupProfile {\n constructor(sourceElement: O3rRadioElement[]) {\n super(sourceElement);\n }\n\n /** @inheritDoc */\n public async isValidGroup() {\n let name = '';\n\n for (const item of this.items) {\n const itemName = await item.getAttribute('name');\n if (name !== '' && name !== itemName) {\n return false;\n }\n if (itemName !== undefined) {\n name = itemName;\n }\n }\n\n return true;\n }\n\n /**\n * Get the selected radio\n */\n public async getSelectedItem() {\n for (const item of this.items) {\n const isSelected = await item.isChecked();\n if (isSelected) {\n return item;\n }\n }\n\n return undefined;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/page-fixture.ts"],"names":[],"mappings":";;;;AACA,yDAAwD;AAKxD;;GAEG;AACH;IAAuE,0CAAsB;IAC3F,wBAAY,WAAc;
|
|
1
|
+
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/page-fixture.ts"],"names":[],"mappings":";;;;AACA,yDAAwD;AAKxD;;GAEG;AACH;IAAuE,0CAAsB;IAC3F,wBAAY,WAAc;QACxB,OAAA,MAAK,YAAC,WAAW,CAAC,SAAC;IACrB,CAAC;IAEY,iCAAQ,GAArB;;;;4BACS,qBAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,EAAA;4BAAxD,sBAAO,SAAiD,EAAC;;;;KAC1D;IACH,qBAAC;AAAD,CAAC,AARD,CAAuE,uCAAmB,GAQzF;AARY,wCAAc","sourcesContent":["import {PageFixtureProfile} from '../page-fixture';\nimport {O3rComponentFixture} from './component-fixture';\nimport {O3rElement} from './element';\n\nexport {PageFixtureProfile} from '../page-fixture';\n\n/**\n * Implementation of the page fixture dedicated to Playwright.\n */\nexport class O3rPageFixture<V extends O3rElement = O3rElement> extends O3rComponentFixture<V> implements PageFixtureProfile<V> {\n constructor(rootElement: V) {\n super(rootElement);\n }\n\n public async getTitle() {\n return await this.rootElement.sourceElement.page.title();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-material.js","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/autocomplete-material.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,sCAAsC;AAItC;;GAEG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAAyC;
|
|
1
|
+
{"version":3,"file":"autocomplete-material.js","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/autocomplete-material.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,sCAAsC;AAItC;;GAEG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAAyC;QACnD,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,uCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;;4BACzD,qBAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAA;;wBAA1B,SAA0B,CAAC;wBAC3B,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBACb,SAAS,GAAG,IAAA,oBAAO,EAAC,eAAE,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAC;wBAC7D,sBAAO,IAAI,oBAAU,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAC;;;;KAC1C;IACH,sBAAC;AAAD,CAAC,AAZD,CAAqC,oBAAU,GAY9C;AAZY,0CAAe","sourcesContent":["import {By, element, ElementFinder} from 'protractor';\nimport {MatAutocompleteProfile} from '../../angular-materials';\nimport {O3rElement} from '../element';\n\nexport {SelectElementProfile} from '../../elements';\n\n/**\n * Implementation dedicated to Protractor.\n */\nexport class MatAutocomplete extends O3rElement implements MatAutocompleteProfile {\n constructor(sourceElement: ElementFinder | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, _timeout?: number) {\n await this.setValue(value);\n await this.click();\n const matOption = element(By.css('.mat-option, mat-option'));\n return new O3rElement(matOption).click();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-material.js","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/select-material.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,sCAAsC;AAGtC;;GAEG;AACH;IAA+B,qCAAU;IACvC,mBAAY,aAAyC;
|
|
1
|
+
{"version":3,"file":"select-material.js","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/select-material.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,sCAAsC;AAGtC;;GAEG;AACH;IAA+B,qCAAU;IACvC,mBAAY,aAAyC;QACnD,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,iCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;;4BACzD,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBAEc,qBAAM,oBAAO,CAAC,GAAG,CAAC,eAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,EAAE,EAAA;;wBAAtF,OAAO,GAAoB,SAA2D;wBAC5F,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,WAAW,EAAE,CAAC;4BACpC,MAAM,GAAG,IAAI,oBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;4BAC9C,sBAAO,MAAM,CAAC,KAAK,EAAE,EAAC;wBACxB,CAAC;6BAAM,CAAC;4BACN,sBAAO,OAAO,CAAC,MAAM,CAAC,4BAAqB,KAAK,kCAA+B,CAAC,EAAC;wBAC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;;wBAJe,IAAO,CAAA;;4BAOzB,sBAAO,OAAO,CAAC,MAAM,CAAC,4BAAqB,KAAK,kCAA+B,CAAC,EAAC;;;;KAClF;IAED,kBAAkB;IACX,4BAAQ,GAAf;QACE,OAAO,CAAC,IAAI,CAAC,mGAAmG,CAAC,CAAC;QAClH,OAAO,gBAAK,CAAC,QAAQ,WAAE,CAAC;IAC1B,CAAC;IACH,gBAAC;AAAD,CAAC,AAvDD,CAA+B,oBAAU,GAuDxC;AAvDY,8BAAS","sourcesContent":["import {By, element, ElementFinder} from 'protractor';\nimport {MatSelectProfile} from '../../angular-materials';\nimport {O3rElement} from '../element';\nexport {SelectElementProfile} from '../../elements';\n\n/**\n * Implementation dedicated to Protractor.\n */\nexport class MatSelect extends O3rElement implements MatSelectProfile {\n constructor(sourceElement: ElementFinder | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByIndex(index: number, _timeout?: number) {\n await this.click();\n // eslint-disable-next-line no-underscore-dangle\n const options: ElementFinder[] = await element.all(By.css('mat-option')).asElementFinders_();\n if (typeof options[index] !== 'undefined') {\n const option = new O3rElement(options[index]);\n return option.click();\n } else {\n return Promise.reject(`Option with index ${index} not found in select element.`);\n }\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, _timeout?: number) {\n await this.click();\n // eslint-disable-next-line no-underscore-dangle\n const options: ElementFinder[] = await element.all(By.css('mat-option')).asElementFinders_();\n\n for (const opt of options) {\n const option = new O3rElement(opt);\n if (await option.getAttribute('ng-reflect-value') === value) {\n return option.click();\n }\n }\n\n return Promise.reject(`Option with value ${value} not found in select element.`);\n }\n\n /** @inheritdoc */\n public async selectByLabel(label: string, _timeout?: number) {\n await this.click();\n // eslint-disable-next-line no-underscore-dangle\n const options: ElementFinder[] = await element.all(By.css('mat-option')).asElementFinders_();\n\n for (const opt of options) {\n const option = new O3rElement(opt);\n if (await option.getText() === label) {\n return option.click();\n }\n }\n\n return Promise.reject(`Option with label ${label} not found in select element.`);\n }\n\n /** @inheritDoc */\n public getValue() {\n console.warn('Usage of \"getValue\" is not recommended on Material Select elements. Use \"getPlainText()\" instead.');\n return super.getValue();\n }\n}\n"]}
|
|
@@ -61,10 +61,10 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
61
61
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
62
62
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
63
63
|
*/
|
|
64
|
-
O3rComponentFixture.prototype.queryWithOptions = function (
|
|
65
|
-
|
|
66
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
64
|
+
O3rComponentFixture.prototype.queryWithOptions = function (selector_1, elementConstructor_1) {
|
|
65
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (selector, elementConstructor, options) {
|
|
67
66
|
var queryElement;
|
|
67
|
+
if (options === void 0) { options = {}; }
|
|
68
68
|
return tslib_1.__generator(this, function (_a) {
|
|
69
69
|
switch (_a.label) {
|
|
70
70
|
case 0:
|
|
@@ -95,10 +95,10 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
95
95
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
96
96
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
97
97
|
*/
|
|
98
|
-
O3rComponentFixture.prototype.getText = function (
|
|
99
|
-
|
|
100
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
98
|
+
O3rComponentFixture.prototype.getText = function (selector_1) {
|
|
99
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
|
|
101
100
|
var getTextElement, _a;
|
|
101
|
+
if (options === void 0) { options = {}; }
|
|
102
102
|
return tslib_1.__generator(this, function (_b) {
|
|
103
103
|
switch (_b.label) {
|
|
104
104
|
case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
|
|
@@ -129,10 +129,10 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
129
129
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
130
130
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
131
131
|
*/
|
|
132
|
-
O3rComponentFixture.prototype.isVisible = function (
|
|
133
|
-
|
|
134
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
132
|
+
O3rComponentFixture.prototype.isVisible = function (selector_1) {
|
|
133
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
|
|
135
134
|
var isVisibleElement, _a;
|
|
135
|
+
if (options === void 0) { options = {}; }
|
|
136
136
|
return tslib_1.__generator(this, function (_b) {
|
|
137
137
|
switch (_b.label) {
|
|
138
138
|
case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
|
|
@@ -158,10 +158,10 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
158
158
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
159
159
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
160
160
|
*/
|
|
161
|
-
O3rComponentFixture.prototype.click = function (
|
|
162
|
-
|
|
163
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
161
|
+
O3rComponentFixture.prototype.click = function (selector_1) {
|
|
162
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
|
|
164
163
|
var clickElement, _a;
|
|
164
|
+
if (options === void 0) { options = {}; }
|
|
165
165
|
return tslib_1.__generator(this, function (_b) {
|
|
166
166
|
switch (_b.label) {
|
|
167
167
|
case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
|