@skbkontur/playwright-react-ui-components 1.18.0 → 1.19.0-beta.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/build/src/assertions/ComponentListAssertions.d.ts +6 -1
- package/build/src/assertions/ComponentListAssertions.js +60 -0
- package/build/src/assertions/FileUploaderAssertions.d.ts +2 -4
- package/build/src/assertions/PagingAssertions.d.ts +2 -2
- package/build/src/assertions/TabsAssertions.d.ts +5 -3
- package/build/src/assertions/TabsAssertions.js +36 -0
- package/build/src/assertions/TokenInputAssertions.d.ts +5 -4
- package/build/src/assertions/TokenInputAssertions.js +36 -0
- package/build/src/components/Autocomplete.js +3 -3
- package/build/src/components/BaseComponent.js +3 -3
- package/build/src/components/Button.d.ts +2 -1
- package/build/src/components/Button.js +35 -1
- package/build/src/components/Checkbox.js +1 -1
- package/build/src/components/ComboBox.d.ts +7 -3
- package/build/src/components/ComboBox.js +21 -19
- package/build/src/components/ComponentList.d.ts +5 -2
- package/build/src/components/ComponentList.js +38 -32
- package/build/src/components/CurrencyInput.js +5 -5
- package/build/src/components/DateInput.js +4 -4
- package/build/src/components/DatePicker.js +5 -5
- package/build/src/components/Dropdown.d.ts +9 -3
- package/build/src/components/Dropdown.js +22 -32
- package/build/src/components/DropdownMenu.d.ts +12 -3
- package/build/src/components/DropdownMenu.js +24 -34
- package/build/src/components/FileUploader.js +6 -19
- package/build/src/components/FxInput.js +4 -4
- package/build/src/components/Input.js +3 -3
- package/build/src/components/Kebab.d.ts +12 -4
- package/build/src/components/Kebab.js +16 -16
- package/build/src/components/Link.js +1 -1
- package/build/src/components/MenuComponent.d.ts +3 -1
- package/build/src/components/Paging.d.ts +4 -4
- package/build/src/components/Paging.js +22 -24
- package/build/src/components/Portal.d.ts +3 -1
- package/build/src/components/Portal.js +5 -5
- package/build/src/components/Radio.js +1 -1
- package/build/src/components/RadioGroup.d.ts +6 -5
- package/build/src/components/RadioGroup.js +12 -36
- package/build/src/components/Select.d.ts +9 -3
- package/build/src/components/Select.js +21 -21
- package/build/src/components/Tab.js +1 -1
- package/build/src/components/Tabs.d.ts +3 -3
- package/build/src/components/Tabs.js +3 -38
- package/build/src/components/Textarea.js +3 -3
- package/build/src/components/Toggle.js +1 -1
- package/build/src/components/Token.d.ts +1 -1
- package/build/src/components/Token.js +2 -2
- package/build/src/components/TokenInput.d.ts +5 -3
- package/build/src/components/TokenInput.js +27 -39
- package/build/src/components/Tooltip.d.ts +3 -1
- package/build/src/components/Tooltip.js +3 -3
- package/build/src/matchers/component/toBeCheckedByIndex.js +9 -10
- package/build/src/matchers/component/toBeCheckedByText.js +9 -10
- package/build/src/matchers/component/toBeUncheckedByIndex.js +9 -10
- package/build/src/matchers/component/toBeUncheckedByText.js +3 -4
- package/build/src/matchers/component/toContainFormattedText.js +2 -3
- package/build/src/matchers/component/toContainItem.d.ts +1 -2
- package/build/src/matchers/component/toContainItem.js +30 -32
- package/build/src/matchers/component/toContainTab.d.ts +3 -0
- package/build/src/matchers/component/toContainTab.js +59 -0
- package/build/src/matchers/component/toContainTabs.d.ts +1 -1
- package/build/src/matchers/component/toContainTabs.js +2 -20
- package/build/src/matchers/component/toContainToken.d.ts +3 -0
- package/build/src/matchers/component/toContainToken.js +59 -0
- package/build/src/matchers/component/toContainTokens.d.ts +2 -2
- package/build/src/matchers/component/toContainTokens.js +2 -20
- package/build/src/matchers/component/toContainUploadedFiles.d.ts +2 -3
- package/build/src/matchers/component/toContainUploadedFiles.js +2 -15
- package/build/src/matchers/component/toHaveActivePage.d.ts +2 -2
- package/build/src/matchers/component/toHaveActivePage.js +5 -21
- package/build/src/matchers/component/toHaveActiveTab.js +9 -10
- package/build/src/matchers/component/toHaveFormattedText.js +2 -3
- package/build/src/matchers/component/toHaveFormattedValue.js +2 -3
- package/build/src/matchers/component/toHaveItemsByPredicate.d.ts +3 -0
- package/build/src/matchers/component/toHaveItemsByPredicate.js +64 -0
- package/build/src/matchers/component/toHaveTabs.d.ts +3 -0
- package/build/src/matchers/component/toHaveTabs.js +62 -0
- package/build/src/matchers/component/toHaveTokens.d.ts +3 -0
- package/build/src/matchers/component/toHaveTokens.js +62 -0
- package/build/src/matchers/componentMatchers.d.ts +14 -8
- package/build/src/matchers/componentMatchers.js +10 -0
- package/build/src/options/LocatorOptions.d.ts +39 -0
- package/package.json +1 -1
|
@@ -108,7 +108,7 @@ var RadioGroup = /** @class */ (function (_super) {
|
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
};
|
|
111
|
-
RadioGroup.prototype.checkByValue = function (value) {
|
|
111
|
+
RadioGroup.prototype.checkByValue = function (value, options) {
|
|
112
112
|
return __awaiter(this, void 0, void 0, function () {
|
|
113
113
|
var radio;
|
|
114
114
|
return __generator(this, function (_b) {
|
|
@@ -116,7 +116,7 @@ var RadioGroup = /** @class */ (function (_super) {
|
|
|
116
116
|
case 0: return [4 /*yield*/, this.getByValue(value)];
|
|
117
117
|
case 1:
|
|
118
118
|
radio = _b.sent();
|
|
119
|
-
return [4 /*yield*/, radio.check()];
|
|
119
|
+
return [4 /*yield*/, radio.check(options)];
|
|
120
120
|
case 2:
|
|
121
121
|
_b.sent();
|
|
122
122
|
return [2 /*return*/];
|
|
@@ -124,32 +124,30 @@ var RadioGroup = /** @class */ (function (_super) {
|
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
};
|
|
127
|
-
RadioGroup.prototype.checkByIndex = function (index) {
|
|
127
|
+
RadioGroup.prototype.checkByIndex = function (index, options) {
|
|
128
128
|
return __awaiter(this, void 0, void 0, function () {
|
|
129
129
|
var radio;
|
|
130
130
|
return __generator(this, function (_b) {
|
|
131
131
|
switch (_b.label) {
|
|
132
|
-
case 0:
|
|
132
|
+
case 0:
|
|
133
|
+
radio = this.getByIndex(index);
|
|
134
|
+
return [4 /*yield*/, radio.check(options)];
|
|
133
135
|
case 1:
|
|
134
|
-
radio = _b.sent();
|
|
135
|
-
return [4 /*yield*/, radio.check()];
|
|
136
|
-
case 2:
|
|
137
136
|
_b.sent();
|
|
138
137
|
return [2 /*return*/];
|
|
139
138
|
}
|
|
140
139
|
});
|
|
141
140
|
});
|
|
142
141
|
};
|
|
143
|
-
RadioGroup.prototype.checkByText = function (text) {
|
|
142
|
+
RadioGroup.prototype.checkByText = function (text, options) {
|
|
144
143
|
return __awaiter(this, void 0, void 0, function () {
|
|
145
144
|
var radio;
|
|
146
145
|
return __generator(this, function (_b) {
|
|
147
146
|
switch (_b.label) {
|
|
148
|
-
case 0:
|
|
147
|
+
case 0:
|
|
148
|
+
radio = this.getByText(text);
|
|
149
|
+
return [4 /*yield*/, radio.check(options)];
|
|
149
150
|
case 1:
|
|
150
|
-
radio = _b.sent();
|
|
151
|
-
return [4 /*yield*/, radio.check()];
|
|
152
|
-
case 2:
|
|
153
151
|
_b.sent();
|
|
154
152
|
return [2 /*return*/];
|
|
155
153
|
}
|
|
@@ -191,32 +189,10 @@ var RadioGroup = /** @class */ (function (_super) {
|
|
|
191
189
|
});
|
|
192
190
|
};
|
|
193
191
|
RadioGroup.prototype.getByIndex = function (index) {
|
|
194
|
-
return
|
|
195
|
-
return __generator(this, function (_b) {
|
|
196
|
-
switch (_b.label) {
|
|
197
|
-
case 0: return [4 /*yield*/, this.list.getItemByIndex(index)];
|
|
198
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
});
|
|
192
|
+
return this.list.getItemByIndex(index);
|
|
202
193
|
};
|
|
203
194
|
RadioGroup.prototype.getByText = function (text) {
|
|
204
|
-
return
|
|
205
|
-
var _this = this;
|
|
206
|
-
return __generator(this, function (_b) {
|
|
207
|
-
switch (_b.label) {
|
|
208
|
-
case 0: return [4 /*yield*/, this.list.getFirstItemByPredicate(function (radio) { return __awaiter(_this, void 0, void 0, function () { var _b; return __generator(this, function (_c) {
|
|
209
|
-
switch (_c.label) {
|
|
210
|
-
case 0:
|
|
211
|
-
_b = Boolean;
|
|
212
|
-
return [4 /*yield*/, radio.getText()];
|
|
213
|
-
case 1: return [2 /*return*/, _b.apply(void 0, [(_c.sent()).match(text)])];
|
|
214
|
-
}
|
|
215
|
-
}); }); })];
|
|
216
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
});
|
|
195
|
+
return this.list.filter({ hasText: text }).getFirstItem();
|
|
220
196
|
};
|
|
221
197
|
RadioGroup.prototype.getTooltip = function (type) {
|
|
222
198
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -36,9 +36,15 @@ export declare class Select extends BaseComponent {
|
|
|
36
36
|
* - MenuHeaderDataTids.root
|
|
37
37
|
* - MenuFooterDataTids.root
|
|
38
38
|
*/
|
|
39
|
-
getMenuItems(
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
getMenuItems(options?: {
|
|
40
|
+
timeout?: number;
|
|
41
|
+
}): Promise<ComponentList<MenuItem>>;
|
|
42
|
+
getMenuItemByText(text: string, options?: {
|
|
43
|
+
timeout?: number;
|
|
44
|
+
}): Promise<MenuItem>;
|
|
45
|
+
getMenuItemByIndex(index: number, options?: {
|
|
46
|
+
timeout?: number;
|
|
47
|
+
}): Promise<MenuItem>;
|
|
42
48
|
expect(): SelectAssertions;
|
|
43
49
|
private getMenuItemsLocator;
|
|
44
50
|
private getSearchInput;
|
|
@@ -143,7 +143,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
143
143
|
var searchInput;
|
|
144
144
|
return __generator(this, function (_d) {
|
|
145
145
|
switch (_d.label) {
|
|
146
|
-
case 0: return [4 /*yield*/, this.getSearchInput()];
|
|
146
|
+
case 0: return [4 /*yield*/, this.getSearchInput(options)];
|
|
147
147
|
case 1:
|
|
148
148
|
searchInput = _d.sent();
|
|
149
149
|
return [4 /*yield*/, searchInput.fill(searchText, options)];
|
|
@@ -182,7 +182,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
182
182
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
|
|
183
183
|
case 1:
|
|
184
184
|
items = _d.sent();
|
|
185
|
-
return [4 /*yield*/, (0, test_1.expect)(items).toHaveCount(1)];
|
|
185
|
+
return [4 /*yield*/, (0, test_1.expect)(items).toHaveCount(1, options)];
|
|
186
186
|
case 2:
|
|
187
187
|
_d.sent();
|
|
188
188
|
return [4 /*yield*/, items.click(options)];
|
|
@@ -197,7 +197,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
197
197
|
return __awaiter(this, void 0, void 0, function () {
|
|
198
198
|
return __generator(this, function (_d) {
|
|
199
199
|
switch (_d.label) {
|
|
200
|
-
case 0: return [4 /*yield*/, this.waitEnabled()];
|
|
200
|
+
case 0: return [4 /*yield*/, this.waitEnabled(options)];
|
|
201
201
|
case 1:
|
|
202
202
|
_d.sent();
|
|
203
203
|
return [4 /*yield*/, this.buttonOrLinkLocator.focus(options)];
|
|
@@ -227,7 +227,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
227
227
|
case 0:
|
|
228
228
|
// note: rootLocator всегда в состоянии enabled, даже если Select disabled
|
|
229
229
|
// чтобы не было гонок дожидаемся доступности компонента, перед тем как взаимодействовать с ним
|
|
230
|
-
return [4 /*yield*/, this.waitEnabled()];
|
|
230
|
+
return [4 /*yield*/, this.waitEnabled(options)];
|
|
231
231
|
case 1:
|
|
232
232
|
// note: rootLocator всегда в состоянии enabled, даже если Select disabled
|
|
233
233
|
// чтобы не было гонок дожидаемся доступности компонента, перед тем как взаимодействовать с ним
|
|
@@ -258,12 +258,12 @@ var Select = /** @class */ (function (_super) {
|
|
|
258
258
|
* - MenuHeaderDataTids.root
|
|
259
259
|
* - MenuFooterDataTids.root
|
|
260
260
|
*/
|
|
261
|
-
Select.prototype.getMenuItems = function () {
|
|
261
|
+
Select.prototype.getMenuItems = function (options) {
|
|
262
262
|
return __awaiter(this, void 0, void 0, function () {
|
|
263
263
|
var container;
|
|
264
264
|
return __generator(this, function (_d) {
|
|
265
265
|
switch (_d.label) {
|
|
266
|
-
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
266
|
+
case 0: return [4 /*yield*/, this.getPortalContainer(options)];
|
|
267
267
|
case 1:
|
|
268
268
|
container = _d.sent();
|
|
269
269
|
return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
|
|
@@ -279,13 +279,13 @@ var Select = /** @class */ (function (_super) {
|
|
|
279
279
|
});
|
|
280
280
|
});
|
|
281
281
|
};
|
|
282
|
-
Select.prototype.getMenuItemByText = function (text) {
|
|
282
|
+
Select.prototype.getMenuItemByText = function (text, options) {
|
|
283
283
|
return __awaiter(this, void 0, void 0, function () {
|
|
284
284
|
var items;
|
|
285
285
|
var _this = this;
|
|
286
286
|
return __generator(this, function (_d) {
|
|
287
287
|
switch (_d.label) {
|
|
288
|
-
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
288
|
+
case 0: return [4 /*yield*/, this.getMenuItems(options)];
|
|
289
289
|
case 1:
|
|
290
290
|
items = _d.sent();
|
|
291
291
|
return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -304,12 +304,12 @@ var Select = /** @class */ (function (_super) {
|
|
|
304
304
|
});
|
|
305
305
|
});
|
|
306
306
|
};
|
|
307
|
-
Select.prototype.getMenuItemByIndex = function (index) {
|
|
307
|
+
Select.prototype.getMenuItemByIndex = function (index, options) {
|
|
308
308
|
return __awaiter(this, void 0, void 0, function () {
|
|
309
309
|
var items;
|
|
310
310
|
return __generator(this, function (_d) {
|
|
311
311
|
switch (_d.label) {
|
|
312
|
-
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
312
|
+
case 0: return [4 /*yield*/, this.getMenuItems(options)];
|
|
313
313
|
case 1:
|
|
314
314
|
items = _d.sent();
|
|
315
315
|
return [2 /*return*/, items.getItemByIndex(index)];
|
|
@@ -320,12 +320,12 @@ var Select = /** @class */ (function (_super) {
|
|
|
320
320
|
Select.prototype.expect = function () {
|
|
321
321
|
return new assertions_1.SelectAssertions(this);
|
|
322
322
|
};
|
|
323
|
-
Select.prototype.getMenuItemsLocator = function (byText) {
|
|
323
|
+
Select.prototype.getMenuItemsLocator = function (byText, options) {
|
|
324
324
|
return __awaiter(this, void 0, void 0, function () {
|
|
325
325
|
var container, items;
|
|
326
326
|
return __generator(this, function (_d) {
|
|
327
327
|
switch (_d.label) {
|
|
328
|
-
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
328
|
+
case 0: return [4 /*yield*/, this.getPortalContainer(options)];
|
|
329
329
|
case 1:
|
|
330
330
|
container = _d.sent();
|
|
331
331
|
items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
|
|
@@ -334,12 +334,12 @@ var Select = /** @class */ (function (_super) {
|
|
|
334
334
|
});
|
|
335
335
|
});
|
|
336
336
|
};
|
|
337
|
-
Select.prototype.getSearchInput = function () {
|
|
337
|
+
Select.prototype.getSearchInput = function (options) {
|
|
338
338
|
return __awaiter(this, void 0, void 0, function () {
|
|
339
339
|
var container;
|
|
340
340
|
return __generator(this, function (_d) {
|
|
341
341
|
switch (_d.label) {
|
|
342
|
-
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
342
|
+
case 0: return [4 /*yield*/, this.getPortalContainer(options)];
|
|
343
343
|
case 1:
|
|
344
344
|
container = _d.sent();
|
|
345
345
|
return [2 /*return*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.InputDataTids.root))];
|
|
@@ -347,26 +347,26 @@ var Select = /** @class */ (function (_super) {
|
|
|
347
347
|
});
|
|
348
348
|
});
|
|
349
349
|
};
|
|
350
|
-
Select.prototype.getPortalContainer = function () {
|
|
350
|
+
Select.prototype.getPortalContainer = function (options) {
|
|
351
351
|
return __awaiter(this, void 0, void 0, function () {
|
|
352
352
|
return __generator(this, function (_d) {
|
|
353
353
|
switch (_d.label) {
|
|
354
|
-
case 0: return [4 /*yield*/, this.openMenuIfNeeded()];
|
|
354
|
+
case 0: return [4 /*yield*/, this.openMenuIfNeeded(options)];
|
|
355
355
|
case 1:
|
|
356
356
|
_d.sent();
|
|
357
|
-
return [2 /*return*/, this.portal.getContainer()];
|
|
357
|
+
return [2 /*return*/, this.portal.getContainer(options)];
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
360
|
});
|
|
361
361
|
};
|
|
362
|
-
Select.prototype.openMenuIfNeeded = function () {
|
|
362
|
+
Select.prototype.openMenuIfNeeded = function (options) {
|
|
363
363
|
return __awaiter(this, void 0, void 0, function () {
|
|
364
364
|
return __generator(this, function (_d) {
|
|
365
365
|
switch (_d.label) {
|
|
366
366
|
case 0: return [4 /*yield*/, this.isMenuOpened()];
|
|
367
367
|
case 1:
|
|
368
368
|
if (!!(_d.sent())) return [3 /*break*/, 3];
|
|
369
|
-
return [4 /*yield*/, this.buttonOrLinkLocator.click()];
|
|
369
|
+
return [4 /*yield*/, this.buttonOrLinkLocator.click(options)];
|
|
370
370
|
case 2:
|
|
371
371
|
_d.sent();
|
|
372
372
|
_d.label = 3;
|
|
@@ -375,7 +375,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
375
375
|
});
|
|
376
376
|
});
|
|
377
377
|
};
|
|
378
|
-
Select.prototype.waitEnabled = function () {
|
|
378
|
+
Select.prototype.waitEnabled = function (options) {
|
|
379
379
|
return __awaiter(this, void 0, void 0, function () {
|
|
380
380
|
return __generator(this, function (_d) {
|
|
381
381
|
switch (_d.label) {
|
|
@@ -386,7 +386,7 @@ var Select = /** @class */ (function (_super) {
|
|
|
386
386
|
case 2:
|
|
387
387
|
_d.sent();
|
|
388
388
|
return [3 /*break*/, 5];
|
|
389
|
-
case 3: return [4 /*yield*/, (0, test_1.expect)(this.buttonOrLinkLocator).toBeEnabled()];
|
|
389
|
+
case 3: return [4 /*yield*/, (0, test_1.expect)(this.buttonOrLinkLocator).toBeEnabled(options)];
|
|
390
390
|
case 4:
|
|
391
391
|
_d.sent();
|
|
392
392
|
_d.label = 5;
|
|
@@ -82,7 +82,7 @@ var Tab = /** @class */ (function (_super) {
|
|
|
82
82
|
return __awaiter(this, void 0, void 0, function () {
|
|
83
83
|
return __generator(this, function (_d) {
|
|
84
84
|
switch (_d.label) {
|
|
85
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.rootLocator).toBeEnabled()];
|
|
85
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.rootLocator).toBeEnabled(options)];
|
|
86
86
|
case 1:
|
|
87
87
|
_d.sent();
|
|
88
88
|
return [4 /*yield*/, this.rootLocator.focus(options)];
|
|
@@ -11,9 +11,9 @@ export declare class Tabs extends BaseComponent {
|
|
|
11
11
|
constructor(rootLocator: Locator);
|
|
12
12
|
select(tabName: string): Promise<void>;
|
|
13
13
|
getActive(): Tab;
|
|
14
|
-
getFirst():
|
|
15
|
-
getByIndex(index: number):
|
|
16
|
-
getByName(name: string | RegExp):
|
|
14
|
+
getFirst(): Tab;
|
|
15
|
+
getByIndex(index: number): Tab;
|
|
16
|
+
getByName(name: string | RegExp): Tab;
|
|
17
17
|
expect(): TabsAssertions;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -86,48 +86,13 @@ var Tabs = /** @class */ (function (_super) {
|
|
|
86
86
|
return new Tab_1.Tab(this.activeTabLocator);
|
|
87
87
|
};
|
|
88
88
|
Tabs.prototype.getFirst = function () {
|
|
89
|
-
return
|
|
90
|
-
return __generator(this, function (_a) {
|
|
91
|
-
switch (_a.label) {
|
|
92
|
-
case 0: return [4 /*yield*/, this.list.getFirstItem()];
|
|
93
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
89
|
+
return this.list.getFirstItem();
|
|
97
90
|
};
|
|
98
91
|
Tabs.prototype.getByIndex = function (index) {
|
|
99
|
-
return
|
|
100
|
-
return __generator(this, function (_a) {
|
|
101
|
-
switch (_a.label) {
|
|
102
|
-
case 0: return [4 /*yield*/, this.list.getItemByIndex(index)];
|
|
103
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
92
|
+
return this.list.getItemByIndex(index);
|
|
107
93
|
};
|
|
108
94
|
Tabs.prototype.getByName = function (name) {
|
|
109
|
-
return
|
|
110
|
-
var pattern;
|
|
111
|
-
var _this = this;
|
|
112
|
-
return __generator(this, function (_a) {
|
|
113
|
-
switch (_a.label) {
|
|
114
|
-
case 0:
|
|
115
|
-
pattern = typeof name === 'string' ? new RegExp(name) : name;
|
|
116
|
-
return [4 /*yield*/, this.list.getFirstItemByPredicate(function (x) { return __awaiter(_this, void 0, void 0, function () {
|
|
117
|
-
var text;
|
|
118
|
-
return __generator(this, function (_a) {
|
|
119
|
-
switch (_a.label) {
|
|
120
|
-
case 0: return [4 /*yield*/, x.getText()];
|
|
121
|
-
case 1:
|
|
122
|
-
text = _a.sent();
|
|
123
|
-
return [2 /*return*/, pattern.test(text)];
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}); })];
|
|
127
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
});
|
|
95
|
+
return this.list.filter({ hasText: name }).getFirstItem();
|
|
131
96
|
};
|
|
132
97
|
Tabs.prototype.expect = function () {
|
|
133
98
|
return new assertions_1.TabsAssertions(this);
|
|
@@ -92,7 +92,7 @@ var Textarea = /** @class */ (function (_super) {
|
|
|
92
92
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
93
|
return __generator(this, function (_d) {
|
|
94
94
|
switch (_d.label) {
|
|
95
|
-
case 0: return [4 /*yield*/, this.focus()];
|
|
95
|
+
case 0: return [4 /*yield*/, this.focus(options)];
|
|
96
96
|
case 1:
|
|
97
97
|
_d.sent();
|
|
98
98
|
return [4 /*yield*/, this.textareaLocator.press(value, options)];
|
|
@@ -107,7 +107,7 @@ var Textarea = /** @class */ (function (_super) {
|
|
|
107
107
|
return __awaiter(this, void 0, void 0, function () {
|
|
108
108
|
return __generator(this, function (_d) {
|
|
109
109
|
switch (_d.label) {
|
|
110
|
-
case 0: return [4 /*yield*/, this.focus()];
|
|
110
|
+
case 0: return [4 /*yield*/, this.focus(options)];
|
|
111
111
|
case 1:
|
|
112
112
|
_d.sent();
|
|
113
113
|
return [4 /*yield*/, this.textareaLocator.pressSequentially(value, options)];
|
|
@@ -134,7 +134,7 @@ var Textarea = /** @class */ (function (_super) {
|
|
|
134
134
|
return __awaiter(this, void 0, void 0, function () {
|
|
135
135
|
return __generator(this, function (_d) {
|
|
136
136
|
switch (_d.label) {
|
|
137
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.textareaLocator).toBeEnabled()];
|
|
137
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.textareaLocator).toBeEnabled(options)];
|
|
138
138
|
case 1:
|
|
139
139
|
_d.sent();
|
|
140
140
|
return [4 /*yield*/, this.textareaLocator.focus(options)];
|
|
@@ -108,7 +108,7 @@ var Toggle = /** @class */ (function (_super) {
|
|
|
108
108
|
return __awaiter(this, void 0, void 0, function () {
|
|
109
109
|
return __generator(this, function (_e) {
|
|
110
110
|
switch (_e.label) {
|
|
111
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.inputLocator).toBeEnabled()];
|
|
111
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.inputLocator).toBeEnabled(options)];
|
|
112
112
|
case 1:
|
|
113
113
|
_e.sent();
|
|
114
114
|
return [4 /*yield*/, this.inputLocator.focus(options)];
|
|
@@ -18,5 +18,5 @@ export declare class Token extends BaseComponent {
|
|
|
18
18
|
* @deprecated createXXXControl feature for migration from '@skbkontur/react-ui-playwright-controls'
|
|
19
19
|
* Task: IF-2498
|
|
20
20
|
*/
|
|
21
|
-
export declare const createTokenControl: (context: Locator, options?: import("
|
|
21
|
+
export declare const createTokenControl: (context: Locator, options?: import("../utils").DataTIdOption) => Token;
|
|
22
22
|
export type TokenControl = Token;
|
|
@@ -56,7 +56,7 @@ exports.createTokenControl = exports.Token = void 0;
|
|
|
56
56
|
var react_ui_1 = require("@skbkontur/react-ui");
|
|
57
57
|
var BaseComponent_1 = require("./BaseComponent");
|
|
58
58
|
var assertions_1 = require("../assertions");
|
|
59
|
-
var
|
|
59
|
+
var utils_1 = require("../utils");
|
|
60
60
|
var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
|
|
61
61
|
var createComponentFactory_1 = require("../utils/createComponentFactory");
|
|
62
62
|
var Token = /** @class */ (function (_super) {
|
|
@@ -66,7 +66,7 @@ var Token = /** @class */ (function (_super) {
|
|
|
66
66
|
_this.rootLocator = rootLocator;
|
|
67
67
|
_this[_a] = function () { return _this.removeIconLocator; };
|
|
68
68
|
_this[_b] = function () { return _this.rootLocator; };
|
|
69
|
-
_this.removeIconLocator = rootLocator.locator((0,
|
|
69
|
+
_this.removeIconLocator = rootLocator.locator((0, utils_1.getDataTidSelector)(react_ui_1.TokenDataTids.removeIcon));
|
|
70
70
|
return _this;
|
|
71
71
|
}
|
|
72
72
|
Token.prototype.isDisabled = function (options) {
|
|
@@ -5,7 +5,7 @@ import { Token } from './Token';
|
|
|
5
5
|
import type { TooltipType } from '../utils';
|
|
6
6
|
import { TokenInputAssertions } from '../assertions';
|
|
7
7
|
import { MenuItem } from './MenuItem';
|
|
8
|
-
import type { BlurOptions, ClickOptions, FillOptions, FocusOptions, IsDisabledOptions } from '../options';
|
|
8
|
+
import type { BlurOptions, ClickOptions, FillOptions, FocusOptions, IsDisabledOptions, PressOptions } from '../options';
|
|
9
9
|
import { toControlElementLocator, toValueElementLocator, toFocusableElementLocator } from '../matchers/component/LocatorSymbols';
|
|
10
10
|
export declare class TokenInput extends BaseComponent {
|
|
11
11
|
readonly rootLocator: Locator;
|
|
@@ -24,7 +24,7 @@ export declare class TokenInput extends BaseComponent {
|
|
|
24
24
|
/**
|
|
25
25
|
* Символ, который разделяет введенный текст на токены. По умолчанию - запятая
|
|
26
26
|
*/
|
|
27
|
-
add(delimiter?: string): Promise<void>;
|
|
27
|
+
add(delimiter?: string, options?: PressOptions): Promise<void>;
|
|
28
28
|
/**
|
|
29
29
|
* Используй этот метод, когда в меню существует несколько элементов с одинаковым названием
|
|
30
30
|
* В остальных случаях лучше использовать `select`
|
|
@@ -42,7 +42,9 @@ export declare class TokenInput extends BaseComponent {
|
|
|
42
42
|
* - MenuHeaderDataTids.root
|
|
43
43
|
* - MenuFooterDataTids.root
|
|
44
44
|
*/
|
|
45
|
-
getMenuItems(
|
|
45
|
+
getMenuItems(options?: {
|
|
46
|
+
timeout?: number;
|
|
47
|
+
}): Promise<ComponentList<MenuItem>>;
|
|
46
48
|
expect(): TokenInputAssertions;
|
|
47
49
|
private getMenuItemsLocator;
|
|
48
50
|
}
|
|
@@ -64,7 +64,7 @@ var Token_1 = require("./Token");
|
|
|
64
64
|
var utils_1 = require("../utils");
|
|
65
65
|
var assertions_1 = require("../assertions");
|
|
66
66
|
var MenuItem_1 = require("./MenuItem");
|
|
67
|
-
var
|
|
67
|
+
var utils_2 = require("../utils");
|
|
68
68
|
var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
|
|
69
69
|
var createComponentFactory_1 = require("../utils/createComponentFactory");
|
|
70
70
|
var TokenInput = /** @class */ (function (_super) {
|
|
@@ -77,7 +77,7 @@ var TokenInput = /** @class */ (function (_super) {
|
|
|
77
77
|
_this[_c] = function () { return _this.textareaLocator; };
|
|
78
78
|
_this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
|
|
79
79
|
_this.textareaLocator = rootLocator.locator('textarea');
|
|
80
|
-
_this.tokens = new ComponentList_1.ComponentList(_this.rootLocator, function (locator) { return locator.locator((0,
|
|
80
|
+
_this.tokens = new ComponentList_1.ComponentList(_this.rootLocator, function (locator) { return locator.locator((0, utils_2.getDataTidSelector)(react_ui_1.TokenDataTids.root)); }, function (locator) { return new Token_1.Token(locator); });
|
|
81
81
|
return _this;
|
|
82
82
|
}
|
|
83
83
|
TokenInput.prototype.isDisabled = function (options) {
|
|
@@ -129,21 +129,12 @@ var TokenInput = /** @class */ (function (_super) {
|
|
|
129
129
|
TokenInput.prototype.removeTokenByText = function (text, options) {
|
|
130
130
|
return __awaiter(this, void 0, void 0, function () {
|
|
131
131
|
var token;
|
|
132
|
-
var _this = this;
|
|
133
132
|
return __generator(this, function (_d) {
|
|
134
133
|
switch (_d.label) {
|
|
135
|
-
case 0:
|
|
136
|
-
|
|
137
|
-
case 0:
|
|
138
|
-
_d = Boolean;
|
|
139
|
-
return [4 /*yield*/, token.getText()];
|
|
140
|
-
case 1: return [2 /*return*/, _d.apply(void 0, [(_e.sent()).match(text)])];
|
|
141
|
-
}
|
|
142
|
-
}); }); })];
|
|
143
|
-
case 1:
|
|
144
|
-
token = _d.sent();
|
|
134
|
+
case 0:
|
|
135
|
+
token = this.tokens.filter({ hasText: text }).getFirstItem();
|
|
145
136
|
return [4 /*yield*/, token.remove(options)];
|
|
146
|
-
case
|
|
137
|
+
case 1:
|
|
147
138
|
_d.sent();
|
|
148
139
|
return [2 /*return*/];
|
|
149
140
|
}
|
|
@@ -155,11 +146,10 @@ var TokenInput = /** @class */ (function (_super) {
|
|
|
155
146
|
var token;
|
|
156
147
|
return __generator(this, function (_d) {
|
|
157
148
|
switch (_d.label) {
|
|
158
|
-
case 0:
|
|
159
|
-
|
|
160
|
-
token = _d.sent();
|
|
149
|
+
case 0:
|
|
150
|
+
token = this.tokens.getItemByIndex(index);
|
|
161
151
|
return [4 /*yield*/, token.remove(options)];
|
|
162
|
-
case
|
|
152
|
+
case 1:
|
|
163
153
|
_d.sent();
|
|
164
154
|
return [2 /*return*/];
|
|
165
155
|
}
|
|
@@ -170,15 +160,11 @@ var TokenInput = /** @class */ (function (_super) {
|
|
|
170
160
|
* Символ, который разделяет введенный текст на токены. По умолчанию - запятая
|
|
171
161
|
*/
|
|
172
162
|
TokenInput.prototype.add = function () {
|
|
173
|
-
return __awaiter(this, arguments, void 0, function (delimiter) {
|
|
163
|
+
return __awaiter(this, arguments, void 0, function (delimiter, options) {
|
|
174
164
|
if (delimiter === void 0) { delimiter = ','; }
|
|
175
165
|
return __generator(this, function (_d) {
|
|
176
166
|
switch (_d.label) {
|
|
177
|
-
case 0:
|
|
178
|
-
if (delimiter.length != 1) {
|
|
179
|
-
throw new Error('Разделитель должен состоять из одного символа');
|
|
180
|
-
}
|
|
181
|
-
return [4 /*yield*/, this.textareaLocator.press(delimiter)];
|
|
167
|
+
case 0: return [4 /*yield*/, this.textareaLocator.press(delimiter, options)];
|
|
182
168
|
case 1:
|
|
183
169
|
_d.sent();
|
|
184
170
|
return [2 /*return*/];
|
|
@@ -195,7 +181,7 @@ var TokenInput = /** @class */ (function (_super) {
|
|
|
195
181
|
var items;
|
|
196
182
|
return __generator(this, function (_d) {
|
|
197
183
|
switch (_d.label) {
|
|
198
|
-
case 0: return [4 /*yield*/, this.getMenuItemsLocator(value)];
|
|
184
|
+
case 0: return [4 /*yield*/, this.getMenuItemsLocator(value, options)];
|
|
199
185
|
case 1:
|
|
200
186
|
items = _d.sent();
|
|
201
187
|
return [4 /*yield*/, items.first().click(options)];
|
|
@@ -211,10 +197,10 @@ var TokenInput = /** @class */ (function (_super) {
|
|
|
211
197
|
var items;
|
|
212
198
|
return __generator(this, function (_d) {
|
|
213
199
|
switch (_d.label) {
|
|
214
|
-
case 0: return [4 /*yield*/, this.getMenuItemsLocator(value)];
|
|
200
|
+
case 0: return [4 /*yield*/, this.getMenuItemsLocator(value, options)];
|
|
215
201
|
case 1:
|
|
216
202
|
items = _d.sent();
|
|
217
|
-
return [4 /*yield*/, (0, test_1.expect)(items).toHaveCount(1)];
|
|
203
|
+
return [4 /*yield*/, (0, test_1.expect)(items).toHaveCount(1, options)];
|
|
218
204
|
case 2:
|
|
219
205
|
_d.sent();
|
|
220
206
|
return [4 /*yield*/, items.click(options)];
|
|
@@ -229,7 +215,7 @@ var TokenInput = /** @class */ (function (_super) {
|
|
|
229
215
|
return __awaiter(this, void 0, void 0, function () {
|
|
230
216
|
return __generator(this, function (_d) {
|
|
231
217
|
switch (_d.label) {
|
|
232
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.textareaLocator).toBeEnabled()];
|
|
218
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.textareaLocator).toBeEnabled(options)];
|
|
233
219
|
case 1:
|
|
234
220
|
_d.sent();
|
|
235
221
|
return [4 /*yield*/, this.textareaLocator.focus(options)];
|
|
@@ -274,26 +260,28 @@ var TokenInput = /** @class */ (function (_super) {
|
|
|
274
260
|
* - MenuHeaderDataTids.root
|
|
275
261
|
* - MenuFooterDataTids.root
|
|
276
262
|
*/
|
|
277
|
-
TokenInput.prototype.getMenuItems = function () {
|
|
263
|
+
TokenInput.prototype.getMenuItems = function (options) {
|
|
278
264
|
return __awaiter(this, void 0, void 0, function () {
|
|
279
265
|
var container;
|
|
280
266
|
return __generator(this, function (_d) {
|
|
281
267
|
switch (_d.label) {
|
|
282
|
-
case 0: return [4 /*yield*/, this.focus()];
|
|
268
|
+
case 0: return [4 /*yield*/, this.focus(options)];
|
|
283
269
|
case 1:
|
|
284
270
|
_d.sent();
|
|
285
|
-
return [4 /*yield*/, this.portal.getContainer()];
|
|
271
|
+
return [4 /*yield*/, this.portal.getContainer(options)];
|
|
286
272
|
case 2:
|
|
287
273
|
container = _d.sent();
|
|
288
|
-
return [4 /*yield*/, container
|
|
274
|
+
return [4 /*yield*/, container
|
|
275
|
+
.locator((0, utils_2.getDataTidSelector)(react_ui_1.SpinnerDataTids.root))
|
|
276
|
+
.waitFor({ state: 'hidden', timeout: options === null || options === void 0 ? void 0 : options.timeout })];
|
|
289
277
|
case 3:
|
|
290
278
|
_d.sent();
|
|
291
279
|
return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
|
|
292
280
|
return locator
|
|
293
|
-
.locator((0,
|
|
294
|
-
.or(locator.locator((0,
|
|
295
|
-
.or(locator.locator((0,
|
|
296
|
-
.or(locator.locator((0,
|
|
281
|
+
.locator((0, utils_2.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
|
|
282
|
+
.or(locator.locator((0, utils_2.getDataTidSelector)(CustomComboBox_1.ComboBoxMenuDataTids.item)))
|
|
283
|
+
.or(locator.locator((0, utils_2.getDataTidSelector)(react_ui_1.MenuHeaderDataTids.root)))
|
|
284
|
+
.or(locator.locator((0, utils_2.getDataTidSelector)(MenuFooter_1.MenuFooterDataTids.root)));
|
|
297
285
|
}, function (locator) { return new MenuItem_1.MenuItem(locator); })];
|
|
298
286
|
}
|
|
299
287
|
});
|
|
@@ -302,15 +290,15 @@ var TokenInput = /** @class */ (function (_super) {
|
|
|
302
290
|
TokenInput.prototype.expect = function () {
|
|
303
291
|
return new assertions_1.TokenInputAssertions(this);
|
|
304
292
|
};
|
|
305
|
-
TokenInput.prototype.getMenuItemsLocator = function (byText) {
|
|
293
|
+
TokenInput.prototype.getMenuItemsLocator = function (byText, options) {
|
|
306
294
|
return __awaiter(this, void 0, void 0, function () {
|
|
307
295
|
var container, items;
|
|
308
296
|
return __generator(this, function (_d) {
|
|
309
297
|
switch (_d.label) {
|
|
310
|
-
case 0: return [4 /*yield*/, this.portal.getContainer()];
|
|
298
|
+
case 0: return [4 /*yield*/, this.portal.getContainer(options)];
|
|
311
299
|
case 1:
|
|
312
300
|
container = _d.sent();
|
|
313
|
-
items = container.locator((0,
|
|
301
|
+
items = container.locator((0, utils_2.getDataTidSelector)(CustomComboBox_1.ComboBoxMenuDataTids.item));
|
|
314
302
|
return [2 /*return*/, items.getByText(byText)];
|
|
315
303
|
}
|
|
316
304
|
});
|
|
@@ -11,7 +11,9 @@ export declare class Tooltip extends BaseComponent {
|
|
|
11
11
|
constructor(rootLocator: Locator);
|
|
12
12
|
getText(options?: InnerTextOptions): Promise<string>;
|
|
13
13
|
getContent(): Locator;
|
|
14
|
-
close(
|
|
14
|
+
close(options?: {
|
|
15
|
+
timeout?: number;
|
|
16
|
+
}): Promise<void>;
|
|
15
17
|
expect(): TooltipAssertions;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
@@ -75,14 +75,14 @@ var Tooltip = /** @class */ (function (_super) {
|
|
|
75
75
|
Tooltip.prototype.getContent = function () {
|
|
76
76
|
return this.contentLocator;
|
|
77
77
|
};
|
|
78
|
-
Tooltip.prototype.close = function () {
|
|
78
|
+
Tooltip.prototype.close = function (options) {
|
|
79
79
|
return __awaiter(this, void 0, void 0, function () {
|
|
80
80
|
return __generator(this, function (_b) {
|
|
81
81
|
switch (_b.label) {
|
|
82
|
-
case 0: return [4 /*yield*/, this.closeLocator.click()];
|
|
82
|
+
case 0: return [4 /*yield*/, this.closeLocator.click(options)];
|
|
83
83
|
case 1:
|
|
84
84
|
_b.sent();
|
|
85
|
-
return [4 /*yield*/, this.waitFor({ state: 'hidden' })];
|
|
85
|
+
return [4 /*yield*/, this.waitFor({ state: 'hidden', timeout: options === null || options === void 0 ? void 0 : options.timeout })];
|
|
86
86
|
case 2:
|
|
87
87
|
_b.sent();
|
|
88
88
|
return [2 /*return*/];
|