@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
|
@@ -50,7 +50,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
50
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
var _a, _b;
|
|
53
|
+
var _a, _b, _c, _d;
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.ComponentList = void 0;
|
|
56
56
|
var test_1 = require("@playwright/test");
|
|
@@ -65,16 +65,18 @@ var ComponentList = /** @class */ (function (_super) {
|
|
|
65
65
|
_this.rootLocator = rootLocator;
|
|
66
66
|
_this[_a] = function () { return _this.itemsLocator.first(); };
|
|
67
67
|
_this[_b] = function () { return _this.itemsLocator; };
|
|
68
|
+
_this[_c] = function () { return _this.itemsLocator; };
|
|
69
|
+
_this[_d] = function () { return _this.itemsLocator; };
|
|
68
70
|
_this.itemsLocator = itemsLocator(_this.rootLocator);
|
|
69
71
|
_this.itemFactory = itemFactory;
|
|
70
72
|
return _this;
|
|
71
73
|
}
|
|
72
74
|
ComponentList.prototype.isVisible = function (options) {
|
|
73
75
|
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
switch (
|
|
76
|
+
return __generator(this, function (_e) {
|
|
77
|
+
switch (_e.label) {
|
|
76
78
|
case 0: return [4 /*yield*/, this.itemsLocator.first().isVisible(options)];
|
|
77
|
-
case 1: return [2 /*return*/,
|
|
79
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
78
80
|
}
|
|
79
81
|
});
|
|
80
82
|
});
|
|
@@ -90,19 +92,23 @@ var ComponentList = /** @class */ (function (_super) {
|
|
|
90
92
|
return __awaiter(this, void 0, void 0, function () {
|
|
91
93
|
var itemsLocators;
|
|
92
94
|
var _this = this;
|
|
93
|
-
return __generator(this, function (
|
|
94
|
-
switch (
|
|
95
|
+
return __generator(this, function (_e) {
|
|
96
|
+
switch (_e.label) {
|
|
95
97
|
case 0: return [4 /*yield*/, this.waitFor({ state: 'attached' })];
|
|
96
98
|
case 1:
|
|
97
|
-
|
|
99
|
+
_e.sent();
|
|
98
100
|
return [4 /*yield*/, this.itemsLocator.all()];
|
|
99
101
|
case 2:
|
|
100
|
-
itemsLocators =
|
|
102
|
+
itemsLocators = _e.sent();
|
|
101
103
|
return [2 /*return*/, itemsLocators.map(function (x) { return _this.itemFactory(x); })];
|
|
102
104
|
}
|
|
103
105
|
});
|
|
104
106
|
});
|
|
105
107
|
};
|
|
108
|
+
ComponentList.prototype.filter = function (options) {
|
|
109
|
+
var _this = this;
|
|
110
|
+
return new ComponentList(this.rootLocator, function (_) { return _this.itemsLocator.filter(options); }, this.itemFactory);
|
|
111
|
+
};
|
|
106
112
|
/**
|
|
107
113
|
* Поведение метода идентично вызову locator.nth(0)
|
|
108
114
|
*/
|
|
@@ -124,11 +130,11 @@ var ComponentList = /** @class */ (function (_super) {
|
|
|
124
130
|
ComponentList.prototype.getFirstItemByPredicate = function (predicate) {
|
|
125
131
|
return __awaiter(this, void 0, void 0, function () {
|
|
126
132
|
var list;
|
|
127
|
-
return __generator(this, function (
|
|
128
|
-
switch (
|
|
133
|
+
return __generator(this, function (_e) {
|
|
134
|
+
switch (_e.label) {
|
|
129
135
|
case 0: return [4 /*yield*/, this.getItemsByPredicate(predicate)];
|
|
130
136
|
case 1:
|
|
131
|
-
list =
|
|
137
|
+
list = _e.sent();
|
|
132
138
|
return [2 /*return*/, list[0]];
|
|
133
139
|
}
|
|
134
140
|
});
|
|
@@ -138,37 +144,37 @@ var ComponentList = /** @class */ (function (_super) {
|
|
|
138
144
|
return __awaiter(this, void 0, void 0, function () {
|
|
139
145
|
var items;
|
|
140
146
|
var _this = this;
|
|
141
|
-
return __generator(this, function (
|
|
142
|
-
switch (
|
|
147
|
+
return __generator(this, function (_e) {
|
|
148
|
+
switch (_e.label) {
|
|
143
149
|
case 0:
|
|
144
150
|
items = [];
|
|
145
151
|
return [4 /*yield*/, test_1.expect
|
|
146
152
|
.poll(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
147
153
|
var list, predicateResults;
|
|
148
154
|
var _this = this;
|
|
149
|
-
return __generator(this, function (
|
|
150
|
-
switch (
|
|
155
|
+
return __generator(this, function (_e) {
|
|
156
|
+
switch (_e.label) {
|
|
151
157
|
case 0: return [4 /*yield*/, this.getItems()];
|
|
152
158
|
case 1:
|
|
153
|
-
list =
|
|
159
|
+
list = _e.sent();
|
|
154
160
|
return [4 /*yield*/, Promise.all(list.map(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
155
|
-
var
|
|
156
|
-
return __generator(this, function (
|
|
157
|
-
switch (
|
|
161
|
+
var _e;
|
|
162
|
+
return __generator(this, function (_f) {
|
|
163
|
+
switch (_f.label) {
|
|
158
164
|
case 0:
|
|
159
|
-
|
|
165
|
+
_e = { item: item };
|
|
160
166
|
return [4 /*yield*/, predicate(item)];
|
|
161
|
-
case 1: return [2 /*return*/, (
|
|
167
|
+
case 1: return [2 /*return*/, (_e.result = _f.sent(), _e)];
|
|
162
168
|
}
|
|
163
169
|
});
|
|
164
170
|
}); }))];
|
|
165
171
|
case 2:
|
|
166
|
-
predicateResults =
|
|
167
|
-
items = predicateResults.filter(function (
|
|
168
|
-
var result =
|
|
172
|
+
predicateResults = _e.sent();
|
|
173
|
+
items = predicateResults.filter(function (_e) {
|
|
174
|
+
var result = _e.result;
|
|
169
175
|
return result;
|
|
170
|
-
}).map(function (
|
|
171
|
-
var item =
|
|
176
|
+
}).map(function (_e) {
|
|
177
|
+
var item = _e.item;
|
|
172
178
|
return item;
|
|
173
179
|
});
|
|
174
180
|
return [2 /*return*/, items.length];
|
|
@@ -177,7 +183,7 @@ var ComponentList = /** @class */ (function (_super) {
|
|
|
177
183
|
}); }, { message: 'Items not found by predicate' })
|
|
178
184
|
.toBeGreaterThan(0)];
|
|
179
185
|
case 1:
|
|
180
|
-
|
|
186
|
+
_e.sent();
|
|
181
187
|
return [2 /*return*/, items];
|
|
182
188
|
}
|
|
183
189
|
});
|
|
@@ -188,13 +194,13 @@ var ComponentList = /** @class */ (function (_super) {
|
|
|
188
194
|
*/
|
|
189
195
|
ComponentList.prototype.count = function () {
|
|
190
196
|
return __awaiter(this, void 0, void 0, function () {
|
|
191
|
-
return __generator(this, function (
|
|
192
|
-
switch (
|
|
197
|
+
return __generator(this, function (_e) {
|
|
198
|
+
switch (_e.label) {
|
|
193
199
|
case 0: return [4 /*yield*/, this.waitFor({ state: 'attached' })];
|
|
194
200
|
case 1:
|
|
195
|
-
|
|
201
|
+
_e.sent();
|
|
196
202
|
return [4 /*yield*/, this.itemsLocator.count()];
|
|
197
|
-
case 2: return [2 /*return*/,
|
|
203
|
+
case 2: return [2 /*return*/, _e.sent()];
|
|
198
204
|
}
|
|
199
205
|
});
|
|
200
206
|
});
|
|
@@ -208,4 +214,4 @@ var ComponentList = /** @class */ (function (_super) {
|
|
|
208
214
|
return ComponentList;
|
|
209
215
|
}(BaseComponent_1.BaseComponent));
|
|
210
216
|
exports.ComponentList = ComponentList;
|
|
211
|
-
_a = LocatorSymbols_1.toVisibleElementLocator, _b = LocatorSymbols_1.toValueElementLocator;
|
|
217
|
+
_a = LocatorSymbols_1.toVisibleElementLocator, _b = LocatorSymbols_1.toValueElementLocator, _c = LocatorSymbols_1.toItemsElementLocator, _d = LocatorSymbols_1.toContainItemElementLocator;
|
|
@@ -94,7 +94,7 @@ var CurrencyInput = /** @class */ (function (_super) {
|
|
|
94
94
|
return __awaiter(this, void 0, void 0, function () {
|
|
95
95
|
return __generator(this, function (_d) {
|
|
96
96
|
switch (_d.label) {
|
|
97
|
-
case 0: return [4 /*yield*/, this.clear()];
|
|
97
|
+
case 0: return [4 /*yield*/, this.clear(options)];
|
|
98
98
|
case 1:
|
|
99
99
|
_d.sent();
|
|
100
100
|
return [4 /*yield*/, this.inputLocator.fill(typeof value === 'number' ? value.toString(10) : value, options)];
|
|
@@ -109,7 +109,7 @@ var CurrencyInput = /** @class */ (function (_super) {
|
|
|
109
109
|
return __awaiter(this, void 0, void 0, function () {
|
|
110
110
|
return __generator(this, function (_d) {
|
|
111
111
|
switch (_d.label) {
|
|
112
|
-
case 0: return [4 /*yield*/, this.clear()];
|
|
112
|
+
case 0: return [4 /*yield*/, this.clear(options)];
|
|
113
113
|
case 1:
|
|
114
114
|
_d.sent();
|
|
115
115
|
return [4 /*yield*/, this.inputLocator.press(value, options)];
|
|
@@ -124,7 +124,7 @@ var CurrencyInput = /** @class */ (function (_super) {
|
|
|
124
124
|
return __awaiter(this, void 0, void 0, function () {
|
|
125
125
|
return __generator(this, function (_d) {
|
|
126
126
|
switch (_d.label) {
|
|
127
|
-
case 0: return [4 /*yield*/, this.clear()];
|
|
127
|
+
case 0: return [4 /*yield*/, this.clear(options)];
|
|
128
128
|
case 1:
|
|
129
129
|
_d.sent();
|
|
130
130
|
return [4 /*yield*/, this.inputLocator.pressSequentially(typeof value === 'number' ? value.toString(10) : value, options)];
|
|
@@ -141,7 +141,7 @@ var CurrencyInput = /** @class */ (function (_super) {
|
|
|
141
141
|
switch (_d.label) {
|
|
142
142
|
case 0:
|
|
143
143
|
// NOTE: без фокуса currencyInput полностью не очистится
|
|
144
|
-
return [4 /*yield*/, this.focus()];
|
|
144
|
+
return [4 /*yield*/, this.focus(options)];
|
|
145
145
|
case 1:
|
|
146
146
|
// NOTE: без фокуса currencyInput полностью не очистится
|
|
147
147
|
_d.sent();
|
|
@@ -157,7 +157,7 @@ var CurrencyInput = /** @class */ (function (_super) {
|
|
|
157
157
|
return __awaiter(this, void 0, void 0, function () {
|
|
158
158
|
return __generator(this, function (_d) {
|
|
159
159
|
switch (_d.label) {
|
|
160
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.inputLocator).toBeEnabled()];
|
|
160
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.inputLocator).toBeEnabled(options)];
|
|
161
161
|
case 1:
|
|
162
162
|
_d.sent();
|
|
163
163
|
return [4 /*yield*/, this.inputLocator.focus(options)];
|
|
@@ -104,7 +104,7 @@ var DateInput = /** @class */ (function (_super) {
|
|
|
104
104
|
return __awaiter(this, void 0, void 0, function () {
|
|
105
105
|
return __generator(this, function (_d) {
|
|
106
106
|
switch (_d.label) {
|
|
107
|
-
case 0: return [4 /*yield*/, this.clear()];
|
|
107
|
+
case 0: return [4 /*yield*/, this.clear(options)];
|
|
108
108
|
case 1:
|
|
109
109
|
_d.sent();
|
|
110
110
|
return [4 /*yield*/, this.nativeInputLocator.pressSequentially(date, options)];
|
|
@@ -119,7 +119,7 @@ var DateInput = /** @class */ (function (_super) {
|
|
|
119
119
|
return __awaiter(this, void 0, void 0, function () {
|
|
120
120
|
return __generator(this, function (_d) {
|
|
121
121
|
switch (_d.label) {
|
|
122
|
-
case 0: return [4 /*yield*/, this.focus()];
|
|
122
|
+
case 0: return [4 /*yield*/, this.focus(options)];
|
|
123
123
|
case 1:
|
|
124
124
|
_d.sent();
|
|
125
125
|
return [4 /*yield*/, this.rootLocator.press('Control+A', options)];
|
|
@@ -140,7 +140,7 @@ var DateInput = /** @class */ (function (_super) {
|
|
|
140
140
|
return __awaiter(this, void 0, void 0, function () {
|
|
141
141
|
return __generator(this, function (_d) {
|
|
142
142
|
switch (_d.label) {
|
|
143
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
|
|
143
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled(options)];
|
|
144
144
|
case 1:
|
|
145
145
|
_d.sent();
|
|
146
146
|
return [4 /*yield*/, this.rootLocator.focus(options)];
|
|
@@ -169,7 +169,7 @@ var DateInput = /** @class */ (function (_super) {
|
|
|
169
169
|
switch (_d.label) {
|
|
170
170
|
case 0:
|
|
171
171
|
// NOTE: rootLocator всегда в состоянии enabled, даже если DatePicker disabled
|
|
172
|
-
return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
|
|
172
|
+
return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled(options)];
|
|
173
173
|
case 1:
|
|
174
174
|
// NOTE: rootLocator всегда в состоянии enabled, даже если DatePicker disabled
|
|
175
175
|
_d.sent();
|
|
@@ -111,13 +111,13 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
111
111
|
return __awaiter(this, void 0, void 0, function () {
|
|
112
112
|
return __generator(this, function (_d) {
|
|
113
113
|
switch (_d.label) {
|
|
114
|
-
case 0: return [4 /*yield*/, this.clear()];
|
|
114
|
+
case 0: return [4 /*yield*/, this.clear(options)];
|
|
115
115
|
case 1:
|
|
116
116
|
_d.sent();
|
|
117
117
|
return [4 /*yield*/, this.nativeInputLocator.pressSequentially(value, options)];
|
|
118
118
|
case 2:
|
|
119
119
|
_d.sent();
|
|
120
|
-
return [4 /*yield*/, this.blur()];
|
|
120
|
+
return [4 /*yield*/, this.blur(options)];
|
|
121
121
|
case 3:
|
|
122
122
|
_d.sent();
|
|
123
123
|
return [2 /*return*/];
|
|
@@ -129,7 +129,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
129
129
|
return __awaiter(this, void 0, void 0, function () {
|
|
130
130
|
return __generator(this, function (_d) {
|
|
131
131
|
switch (_d.label) {
|
|
132
|
-
case 0: return [4 /*yield*/, this.focus()];
|
|
132
|
+
case 0: return [4 /*yield*/, this.focus(options)];
|
|
133
133
|
case 1:
|
|
134
134
|
_d.sent();
|
|
135
135
|
return [4 /*yield*/, this.nativeInputLocator.press('Control+A', options)];
|
|
@@ -150,7 +150,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
150
150
|
return __awaiter(this, void 0, void 0, function () {
|
|
151
151
|
return __generator(this, function (_d) {
|
|
152
152
|
switch (_d.label) {
|
|
153
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
|
|
153
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled(options)];
|
|
154
154
|
case 1:
|
|
155
155
|
_d.sent();
|
|
156
156
|
return [4 /*yield*/, this.datePickerInputLocator.focus(options)];
|
|
@@ -179,7 +179,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
179
179
|
switch (_d.label) {
|
|
180
180
|
case 0:
|
|
181
181
|
// NOTE: rootLocator всегда в состоянии enabled, даже если DatePicker disabled
|
|
182
|
-
return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
|
|
182
|
+
return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled(options)];
|
|
183
183
|
case 1:
|
|
184
184
|
// NOTE: rootLocator всегда в состоянии enabled, даже если DatePicker disabled
|
|
185
185
|
_d.sent();
|
|
@@ -31,9 +31,15 @@ export declare class Dropdown extends MenuComponent {
|
|
|
31
31
|
* - MenuHeaderDataTids.root
|
|
32
32
|
* - MenuFooterDataTids.root
|
|
33
33
|
*/
|
|
34
|
-
getMenuItems(
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
getMenuItems(options?: {
|
|
35
|
+
timeout?: number;
|
|
36
|
+
}): Promise<ComponentList<MenuItem>>;
|
|
37
|
+
getMenuItemByText(text: string, options?: {
|
|
38
|
+
timeout?: number;
|
|
39
|
+
}): Promise<MenuItem>;
|
|
40
|
+
getMenuItemByIndex(index: number, options?: {
|
|
41
|
+
timeout?: number;
|
|
42
|
+
}): Promise<MenuItem>;
|
|
37
43
|
expect(): DropdownAssertions;
|
|
38
44
|
private getMenuItemsLocator;
|
|
39
45
|
private getPortalContainer;
|
|
@@ -116,14 +116,14 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
116
116
|
var items;
|
|
117
117
|
return __generator(this, function (_e) {
|
|
118
118
|
switch (_e.label) {
|
|
119
|
-
case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
|
|
119
|
+
case 0: return [4 /*yield*/, this.getMenuItemsLocator(text, options)];
|
|
120
120
|
case 1:
|
|
121
121
|
items = _e.sent();
|
|
122
122
|
return [4 /*yield*/, items.first().click(options)];
|
|
123
123
|
case 2:
|
|
124
124
|
_e.sent();
|
|
125
125
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
126
|
-
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
126
|
+
return [4 /*yield*/, this.portal.expect().toBeHidden(options)];
|
|
127
127
|
case 3:
|
|
128
128
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
129
129
|
_e.sent();
|
|
@@ -137,14 +137,14 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
137
137
|
var items;
|
|
138
138
|
return __generator(this, function (_e) {
|
|
139
139
|
switch (_e.label) {
|
|
140
|
-
case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
|
|
140
|
+
case 0: return [4 /*yield*/, this.getMenuItemsLocator(undefined, options)];
|
|
141
141
|
case 1:
|
|
142
142
|
items = _e.sent();
|
|
143
143
|
return [4 /*yield*/, items.nth(index).click(options)];
|
|
144
144
|
case 2:
|
|
145
145
|
_e.sent();
|
|
146
146
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
147
|
-
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
147
|
+
return [4 /*yield*/, this.portal.expect().toBeHidden(options)];
|
|
148
148
|
case 3:
|
|
149
149
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
150
150
|
_e.sent();
|
|
@@ -158,7 +158,7 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
158
158
|
var container, item;
|
|
159
159
|
return __generator(this, function (_e) {
|
|
160
160
|
switch (_e.label) {
|
|
161
|
-
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
161
|
+
case 0: return [4 /*yield*/, this.getPortalContainer(options)];
|
|
162
162
|
case 1:
|
|
163
163
|
container = _e.sent();
|
|
164
164
|
item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
|
|
@@ -171,7 +171,7 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
171
171
|
case 3:
|
|
172
172
|
_e.sent();
|
|
173
173
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
174
|
-
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
174
|
+
return [4 /*yield*/, this.portal.expect().toBeHidden(options)];
|
|
175
175
|
case 4:
|
|
176
176
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
177
177
|
_e.sent();
|
|
@@ -199,7 +199,7 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
199
199
|
return __awaiter(this, void 0, void 0, function () {
|
|
200
200
|
return __generator(this, function (_e) {
|
|
201
201
|
switch (_e.label) {
|
|
202
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
|
|
202
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled(options)];
|
|
203
203
|
case 1:
|
|
204
204
|
_e.sent();
|
|
205
205
|
return [4 /*yield*/, this.buttonLocator.focus(options)];
|
|
@@ -228,15 +228,17 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
228
228
|
* - MenuHeaderDataTids.root
|
|
229
229
|
* - MenuFooterDataTids.root
|
|
230
230
|
*/
|
|
231
|
-
Dropdown.prototype.getMenuItems = function () {
|
|
231
|
+
Dropdown.prototype.getMenuItems = function (options) {
|
|
232
232
|
return __awaiter(this, void 0, void 0, function () {
|
|
233
233
|
var container;
|
|
234
234
|
return __generator(this, function (_e) {
|
|
235
235
|
switch (_e.label) {
|
|
236
|
-
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
236
|
+
case 0: return [4 /*yield*/, this.getPortalContainer(options)];
|
|
237
237
|
case 1:
|
|
238
238
|
container = _e.sent();
|
|
239
|
-
return [4 /*yield*/, container
|
|
239
|
+
return [4 /*yield*/, container
|
|
240
|
+
.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root))
|
|
241
|
+
.waitFor({ state: 'hidden', timeout: options === null || options === void 0 ? void 0 : options.timeout })];
|
|
240
242
|
case 2:
|
|
241
243
|
_e.sent();
|
|
242
244
|
return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
|
|
@@ -249,37 +251,25 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
249
251
|
});
|
|
250
252
|
});
|
|
251
253
|
};
|
|
252
|
-
Dropdown.prototype.getMenuItemByText = function (text) {
|
|
254
|
+
Dropdown.prototype.getMenuItemByText = function (text, options) {
|
|
253
255
|
return __awaiter(this, void 0, void 0, function () {
|
|
254
256
|
var items;
|
|
255
|
-
var _this = this;
|
|
256
257
|
return __generator(this, function (_e) {
|
|
257
258
|
switch (_e.label) {
|
|
258
|
-
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
259
|
+
case 0: return [4 /*yield*/, this.getMenuItems(options)];
|
|
259
260
|
case 1:
|
|
260
261
|
items = _e.sent();
|
|
261
|
-
return [
|
|
262
|
-
var itemText;
|
|
263
|
-
return __generator(this, function (_e) {
|
|
264
|
-
switch (_e.label) {
|
|
265
|
-
case 0: return [4 /*yield*/, item.getText()];
|
|
266
|
-
case 1:
|
|
267
|
-
itemText = _e.sent();
|
|
268
|
-
return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
}); })];
|
|
272
|
-
case 2: return [2 /*return*/, _e.sent()];
|
|
262
|
+
return [2 /*return*/, items.filter({ hasText: text }).getFirstItem()];
|
|
273
263
|
}
|
|
274
264
|
});
|
|
275
265
|
});
|
|
276
266
|
};
|
|
277
|
-
Dropdown.prototype.getMenuItemByIndex = function (index) {
|
|
267
|
+
Dropdown.prototype.getMenuItemByIndex = function (index, options) {
|
|
278
268
|
return __awaiter(this, void 0, void 0, function () {
|
|
279
269
|
var items;
|
|
280
270
|
return __generator(this, function (_e) {
|
|
281
271
|
switch (_e.label) {
|
|
282
|
-
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
272
|
+
case 0: return [4 /*yield*/, this.getMenuItems(options)];
|
|
283
273
|
case 1:
|
|
284
274
|
items = _e.sent();
|
|
285
275
|
return [2 /*return*/, items.getItemByIndex(index)];
|
|
@@ -290,12 +280,12 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
290
280
|
Dropdown.prototype.expect = function () {
|
|
291
281
|
return new assertions_1.DropdownAssertions(this);
|
|
292
282
|
};
|
|
293
|
-
Dropdown.prototype.getMenuItemsLocator = function (byText) {
|
|
283
|
+
Dropdown.prototype.getMenuItemsLocator = function (byText, options) {
|
|
294
284
|
return __awaiter(this, void 0, void 0, function () {
|
|
295
285
|
var container, items;
|
|
296
286
|
return __generator(this, function (_e) {
|
|
297
287
|
switch (_e.label) {
|
|
298
|
-
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
288
|
+
case 0: return [4 /*yield*/, this.getPortalContainer(options)];
|
|
299
289
|
case 1:
|
|
300
290
|
container = _e.sent();
|
|
301
291
|
items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
|
|
@@ -304,18 +294,18 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
304
294
|
});
|
|
305
295
|
});
|
|
306
296
|
};
|
|
307
|
-
Dropdown.prototype.getPortalContainer = function () {
|
|
297
|
+
Dropdown.prototype.getPortalContainer = function (options) {
|
|
308
298
|
return __awaiter(this, void 0, void 0, function () {
|
|
309
299
|
return __generator(this, function (_e) {
|
|
310
300
|
switch (_e.label) {
|
|
311
301
|
case 0: return [4 /*yield*/, this.isMenuOpened()];
|
|
312
302
|
case 1:
|
|
313
303
|
if (!!(_e.sent())) return [3 /*break*/, 3];
|
|
314
|
-
return [4 /*yield*/, this.buttonLocator.click()];
|
|
304
|
+
return [4 /*yield*/, this.buttonLocator.click(options)];
|
|
315
305
|
case 2:
|
|
316
306
|
_e.sent();
|
|
317
307
|
_e.label = 3;
|
|
318
|
-
case 3: return [2 /*return*/, this.portal.getContainer()];
|
|
308
|
+
case 3: return [2 /*return*/, this.portal.getContainer(options)];
|
|
319
309
|
}
|
|
320
310
|
});
|
|
321
311
|
});
|
|
@@ -17,12 +17,15 @@ export declare class DropdownMenu extends MenuComponent {
|
|
|
17
17
|
isMenuOpened(): Promise<boolean>;
|
|
18
18
|
selectFirstByText(text: string | RegExp, options?: {
|
|
19
19
|
closedAfterSelect: boolean;
|
|
20
|
+
timeout?: number;
|
|
20
21
|
}): Promise<void>;
|
|
21
22
|
selectByDataTid(dataTid: string, options?: {
|
|
22
23
|
closedAfterSelect: boolean;
|
|
24
|
+
timeout?: number;
|
|
23
25
|
}): Promise<void>;
|
|
24
26
|
selectByIndex(index: number, options?: {
|
|
25
27
|
closedAfterSelect: boolean;
|
|
28
|
+
timeout?: number;
|
|
26
29
|
}): Promise<void>;
|
|
27
30
|
click(options?: ClickOptions): Promise<void>;
|
|
28
31
|
getTooltip(type: TooltipType): Promise<import("./Tooltip").Tooltip>;
|
|
@@ -32,9 +35,15 @@ export declare class DropdownMenu extends MenuComponent {
|
|
|
32
35
|
* - MenuHeaderDataTids.root
|
|
33
36
|
* - MenuFooterDataTids.root
|
|
34
37
|
*/
|
|
35
|
-
getMenuItems(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
getMenuItems(options?: {
|
|
39
|
+
timeout?: number;
|
|
40
|
+
}): Promise<ComponentList<MenuItem>>;
|
|
41
|
+
getMenuItemByText(text: string, options?: {
|
|
42
|
+
timeout?: number;
|
|
43
|
+
}): Promise<MenuItem>;
|
|
44
|
+
getMenuItemByIndex(index: number, options?: {
|
|
45
|
+
timeout?: number;
|
|
46
|
+
}): Promise<MenuItem>;
|
|
38
47
|
expect(): DropdownMenuAssertions;
|
|
39
48
|
private getMenuItemsLocator;
|
|
40
49
|
private getPortalContainer;
|