@skbkontur/playwright-react-ui-components 1.14.0-beta.1 → 1.14.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/assertions/AutocompleteAssertions.js +1 -1
- package/build/src/assertions/CheckboxAssertions.js +1 -1
- package/build/src/assertions/ComboBoxAssertions.js +4 -4
- package/build/src/assertions/DropdownAssertions.js +4 -4
- package/build/src/assertions/DropdownMenuAssertions.js +4 -4
- package/build/src/assertions/FileUploaderAssertions.js +1 -1
- package/build/src/assertions/FxInputAssertions.js +2 -2
- package/build/src/assertions/InputAssertions.js +1 -1
- package/build/src/assertions/KebabAssertions.js +4 -4
- package/build/src/assertions/LabelAssertions.js +2 -2
- package/build/src/assertions/LinkAssertions.js +2 -2
- package/build/src/assertions/PagingAssertions.js +2 -2
- package/build/src/assertions/RadioGroupAssertions.js +6 -6
- package/build/src/assertions/SelectAssertions.js +2 -2
- package/build/src/assertions/TabAssertions.js +2 -2
- package/build/src/assertions/TabsAssertions.js +3 -3
- package/build/src/assertions/TokenAssertions.js +1 -1
- package/build/src/assertions/TokenInputAssertions.js +1 -1
- package/build/src/components/ComboBox.d.ts +1 -2
- package/build/src/components/ComboBox.js +53 -54
- package/build/src/components/Dropdown.d.ts +1 -2
- package/build/src/components/Dropdown.js +61 -62
- package/build/src/components/DropdownMenu.d.ts +1 -2
- package/build/src/components/DropdownMenu.js +61 -62
- package/build/src/components/Kebab.d.ts +1 -2
- package/build/src/components/Kebab.js +43 -44
- package/build/src/components/MenuComponent.d.ts +2 -1
- package/build/src/components/MenuComponent.js +6 -5
- package/build/src/matchers/component/toBeActiveTab.d.ts +3 -0
- package/build/src/matchers/component/{toBeActiveEx.js → toBeActiveTab.js} +2 -2
- package/build/src/matchers/component/toBeAutoMode.d.ts +3 -0
- package/build/src/matchers/component/{toBeAutoEx.js → toBeAutoMode.js} +2 -2
- package/build/src/matchers/component/toBeCheckedByIndex.d.ts +3 -0
- package/build/src/matchers/component/{toBeUncheckedByIndexEx.js → toBeCheckedByIndex.js} +4 -4
- package/build/src/matchers/component/toBeCheckedByText.d.ts +3 -0
- package/build/src/matchers/component/{toBeCheckedByTextEx.js → toBeCheckedByText.js} +2 -2
- package/build/src/matchers/component/toBeCheckedByValue.d.ts +3 -0
- package/build/src/matchers/component/{toBeCheckedByValueEx.js → toBeCheckedByValue.js} +2 -2
- package/build/src/matchers/component/toBeDisabledEx.d.ts +1 -1
- package/build/src/matchers/component/toBeDisabledEx.js +7 -8
- package/build/src/matchers/component/toBeEmptyEx.d.ts +1 -1
- package/build/src/matchers/component/toBeEmptyEx.js +4 -5
- package/build/src/matchers/component/toBeEnabledEx.js +15 -25
- package/build/src/matchers/component/toBeHiddenEx.js +1 -2
- package/build/src/matchers/component/toBeInactiveTab.d.ts +3 -0
- package/build/src/matchers/component/{toBeInactiveEx.js → toBeInactiveTab.js} +2 -2
- package/build/src/matchers/component/toBeUnchecked.d.ts +3 -0
- package/build/src/matchers/component/{toBeUncheckedEx.js → toBeUnchecked.js} +2 -2
- package/build/src/matchers/component/{toBeCheckedByIndexEx.d.ts → toBeUncheckedByIndex.d.ts} +2 -2
- package/build/src/matchers/component/{toBeCheckedByIndexEx.js → toBeUncheckedByIndex.js} +4 -4
- package/build/src/matchers/component/{toBeCheckedByTextEx.d.ts → toBeUncheckedByText.d.ts} +2 -2
- package/build/src/matchers/component/{toBeUncheckedByTextEx.js → toBeUncheckedByText.js} +3 -3
- package/build/src/matchers/component/{toBeCheckedByValueEx.d.ts → toBeUncheckedByValue.d.ts} +2 -2
- package/build/src/matchers/component/{toBeUncheckedByValueEx.js → toBeUncheckedByValue.js} +3 -3
- package/build/src/matchers/component/toBeVisibleEx.js +1 -2
- package/build/src/matchers/component/toContainFormattedText.d.ts +3 -0
- package/build/src/matchers/component/{toContainFormattedTextEx.js → toContainFormattedText.js} +2 -2
- package/build/src/matchers/component/toContainItem.d.ts +4 -0
- package/build/src/matchers/component/{toContainItemEx.js → toContainItem.js} +2 -3
- package/build/src/matchers/component/toContainItems.d.ts +3 -0
- package/build/src/matchers/component/{toContainItemsEx.js → toContainItems.js} +4 -4
- package/build/src/matchers/component/toContainSelectValue.d.ts +3 -0
- package/build/src/matchers/component/{toContainValueEx.js → toContainSelectValue.js} +2 -2
- package/build/src/matchers/component/toContainTabs.d.ts +3 -0
- package/build/src/matchers/component/{toContainTabsEx.js → toContainTabs.js} +2 -2
- package/build/src/matchers/component/{toContainTokensEx.d.ts → toContainTokens.d.ts} +1 -1
- package/build/src/matchers/component/{toContainTokensEx.js → toContainTokens.js} +2 -2
- package/build/src/matchers/component/toContainUploadedFiles.d.ts +4 -0
- package/build/src/matchers/component/{toContainUploadedFilesEx.js → toContainUploadedFiles.js} +2 -2
- package/build/src/matchers/component/{toHavePageCountEx.d.ts → toHaveActivePage.d.ts} +1 -1
- package/build/src/matchers/component/{toHaveActivePageEx.js → toHaveActivePage.js} +2 -2
- package/build/src/matchers/component/toHaveActiveTab.d.ts +2 -0
- package/build/src/matchers/component/{toHaveActiveTabEx.js → toHaveActiveTab.js} +4 -4
- package/build/src/matchers/component/toHaveError.d.ts +3 -0
- package/build/src/matchers/component/{toHaveWarningEx.js → toHaveError.js} +3 -3
- package/build/src/matchers/component/toHaveFormattedText.d.ts +3 -0
- package/build/src/matchers/component/{toHaveFormattedTextEx.js → toHaveFormattedText.js} +2 -2
- package/build/src/matchers/component/toHaveFormattedValue.d.ts +3 -0
- package/build/src/matchers/component/{toHaveFormattedValueEx.js → toHaveFormattedValue.js} +2 -2
- package/build/src/matchers/component/toHaveHref.d.ts +3 -0
- package/build/src/matchers/component/{toHaveHrefEx.js → toHaveHref.js} +2 -2
- package/build/src/matchers/component/toHaveItems.d.ts +3 -0
- package/build/src/matchers/component/{toHaveItemsEx.js → toHaveItems.js} +4 -4
- package/build/src/matchers/component/{toHaveActivePageEx.d.ts → toHavePageCount.d.ts} +1 -1
- package/build/src/matchers/component/{toHavePageCountEx.js → toHavePageCount.js} +2 -2
- package/build/src/matchers/component/toHaveValueEx.d.ts +1 -1
- package/build/src/matchers/component/toHaveValueEx.js +4 -5
- package/build/src/matchers/component/{toHaveErrorEx.d.ts → toHaveWarning.d.ts} +2 -2
- package/build/src/matchers/component/{toHaveErrorEx.js → toHaveWarning.js} +3 -3
- package/build/src/matchers/componentMatchers.d.ts +76 -76
- package/build/src/matchers/componentMatchers.js +61 -55
- package/build/src/matchers/createAsyncMatcher.d.ts +35 -10
- package/build/src/matchers/createAsyncMatcher.js +38 -13
- package/build/src/utils/toMatchMessage.d.ts +11 -0
- package/build/src/utils/toMatchMessage.js +11 -0
- package/package.json +1 -1
- package/build/src/matchers/component/toBeActiveEx.d.ts +0 -3
- package/build/src/matchers/component/toBeAutoEx.d.ts +0 -3
- package/build/src/matchers/component/toBeInactiveEx.d.ts +0 -3
- package/build/src/matchers/component/toBeUncheckedByIndexEx.d.ts +0 -3
- package/build/src/matchers/component/toBeUncheckedByTextEx.d.ts +0 -3
- package/build/src/matchers/component/toBeUncheckedByValueEx.d.ts +0 -3
- package/build/src/matchers/component/toBeUncheckedEx.d.ts +0 -3
- package/build/src/matchers/component/toContainFormattedTextEx.d.ts +0 -3
- package/build/src/matchers/component/toContainItemEx.d.ts +0 -4
- package/build/src/matchers/component/toContainItemsEx.d.ts +0 -3
- package/build/src/matchers/component/toContainTabsEx.d.ts +0 -3
- package/build/src/matchers/component/toContainUploadedFilesEx.d.ts +0 -4
- package/build/src/matchers/component/toContainValueEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveActiveTabEx.d.ts +0 -2
- package/build/src/matchers/component/toHaveFormattedTextEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveFormattedValueEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveHrefEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveItemsEx.d.ts +0 -3
- package/build/src/matchers/component/toHaveWarningEx.d.ts +0 -3
- package/build/src/utils/is.d.ts +0 -3
- package/build/src/utils/is.js +0 -5
|
@@ -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, _c, _d
|
|
53
|
+
var _a, _b, _c, _d;
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.ComboBox = void 0;
|
|
56
56
|
var test_1 = require("@playwright/test");
|
|
@@ -75,8 +75,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
75
75
|
_this[_a] = function () { return _this.nativeInputLocator; };
|
|
76
76
|
_this[_b] = function () { return _this.getInputLocator(); };
|
|
77
77
|
_this[_c] = function () { return _this.getItemsLocator(); };
|
|
78
|
-
_this[_d] = function () { return _this.
|
|
79
|
-
_this[_e] = function () { return _this.nativeInputLocator; };
|
|
78
|
+
_this[_d] = function () { return _this.nativeInputLocator; };
|
|
80
79
|
_this.nativeInputLocator = rootLocator.locator('input');
|
|
81
80
|
_this.inputLikeTextLocator = rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(InputLikeText_1.InputLikeTextDataTids.input));
|
|
82
81
|
_this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
|
|
@@ -84,45 +83,45 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
84
83
|
}
|
|
85
84
|
ComboBox.prototype.getInputLocator = function () {
|
|
86
85
|
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
return __generator(this, function (
|
|
88
|
-
switch (
|
|
86
|
+
return __generator(this, function (_e) {
|
|
87
|
+
switch (_e.label) {
|
|
89
88
|
case 0: return [4 /*yield*/, this.isDisabled()];
|
|
90
|
-
case 1: return [2 /*return*/, !(
|
|
89
|
+
case 1: return [2 /*return*/, !(_e.sent()) ? this.nativeInputLocator : this.inputLikeTextLocator];
|
|
91
90
|
}
|
|
92
91
|
});
|
|
93
92
|
});
|
|
94
93
|
};
|
|
95
94
|
ComboBox.prototype.isDisabled = function (options) {
|
|
96
95
|
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
-
return __generator(this, function (
|
|
98
|
-
switch (
|
|
96
|
+
return __generator(this, function (_e) {
|
|
97
|
+
switch (_e.label) {
|
|
99
98
|
case 0: return [4 /*yield*/, this.nativeInputLocator.isDisabled(options)];
|
|
100
|
-
case 1: return [2 /*return*/,
|
|
99
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
101
100
|
}
|
|
102
101
|
});
|
|
103
102
|
});
|
|
104
103
|
};
|
|
105
104
|
ComboBox.prototype.isFocused = function (options) {
|
|
106
105
|
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
-
return __generator(this, function (
|
|
108
|
-
switch (
|
|
106
|
+
return __generator(this, function (_e) {
|
|
107
|
+
switch (_e.label) {
|
|
109
108
|
case 0: return [4 /*yield*/, this.nativeInputLocator.getAttribute('type', options)];
|
|
110
|
-
case 1: return [2 /*return*/, (
|
|
109
|
+
case 1: return [2 /*return*/, (_e.sent()) !== 'hidden'];
|
|
111
110
|
}
|
|
112
111
|
});
|
|
113
112
|
});
|
|
114
113
|
};
|
|
115
114
|
ComboBox.prototype.getSelectedValue = function () {
|
|
116
115
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
-
return __generator(this, function (
|
|
118
|
-
switch (
|
|
116
|
+
return __generator(this, function (_e) {
|
|
117
|
+
switch (_e.label) {
|
|
119
118
|
case 0: return [4 /*yield*/, this.isFocused()];
|
|
120
119
|
case 1:
|
|
121
|
-
if (!
|
|
120
|
+
if (!_e.sent()) return [3 /*break*/, 3];
|
|
122
121
|
return [4 /*yield*/, this.nativeInputLocator.inputValue()];
|
|
123
|
-
case 2: return [2 /*return*/,
|
|
122
|
+
case 2: return [2 /*return*/, _e.sent()];
|
|
124
123
|
case 3: return [4 /*yield*/, this.inputLikeTextLocator.innerText()];
|
|
125
|
-
case 4: return [2 /*return*/,
|
|
124
|
+
case 4: return [2 /*return*/, _e.sent()];
|
|
126
125
|
}
|
|
127
126
|
});
|
|
128
127
|
});
|
|
@@ -134,14 +133,14 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
134
133
|
ComboBox.prototype.selectFirst = function (value, options) {
|
|
135
134
|
return __awaiter(this, void 0, void 0, function () {
|
|
136
135
|
var items;
|
|
137
|
-
return __generator(this, function (
|
|
138
|
-
switch (
|
|
136
|
+
return __generator(this, function (_e) {
|
|
137
|
+
switch (_e.label) {
|
|
139
138
|
case 0: return [4 /*yield*/, this.getComboBoxMenuItemsLocator(value)];
|
|
140
139
|
case 1:
|
|
141
|
-
items =
|
|
140
|
+
items = _e.sent();
|
|
142
141
|
return [4 /*yield*/, items.first().click(options)];
|
|
143
142
|
case 2:
|
|
144
|
-
|
|
143
|
+
_e.sent();
|
|
145
144
|
return [2 /*return*/];
|
|
146
145
|
}
|
|
147
146
|
});
|
|
@@ -150,17 +149,17 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
150
149
|
ComboBox.prototype.select = function (value, options) {
|
|
151
150
|
return __awaiter(this, void 0, void 0, function () {
|
|
152
151
|
var items;
|
|
153
|
-
return __generator(this, function (
|
|
154
|
-
switch (
|
|
152
|
+
return __generator(this, function (_e) {
|
|
153
|
+
switch (_e.label) {
|
|
155
154
|
case 0: return [4 /*yield*/, this.getComboBoxMenuItemsLocator(value)];
|
|
156
155
|
case 1:
|
|
157
|
-
items =
|
|
156
|
+
items = _e.sent();
|
|
158
157
|
return [4 /*yield*/, (0, test_1.expect)(items).toHaveCount(1)];
|
|
159
158
|
case 2:
|
|
160
|
-
|
|
159
|
+
_e.sent();
|
|
161
160
|
return [4 /*yield*/, items.click(options)];
|
|
162
161
|
case 3:
|
|
163
|
-
|
|
162
|
+
_e.sent();
|
|
164
163
|
return [2 /*return*/];
|
|
165
164
|
}
|
|
166
165
|
});
|
|
@@ -168,14 +167,14 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
168
167
|
};
|
|
169
168
|
ComboBox.prototype.fill = function (value, options) {
|
|
170
169
|
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
-
return __generator(this, function (
|
|
172
|
-
switch (
|
|
170
|
+
return __generator(this, function (_e) {
|
|
171
|
+
switch (_e.label) {
|
|
173
172
|
case 0: return [4 /*yield*/, this.focus()];
|
|
174
173
|
case 1:
|
|
175
|
-
|
|
174
|
+
_e.sent();
|
|
176
175
|
return [4 /*yield*/, this.nativeInputLocator.fill(value, options)];
|
|
177
176
|
case 2:
|
|
178
|
-
|
|
177
|
+
_e.sent();
|
|
179
178
|
return [2 /*return*/];
|
|
180
179
|
}
|
|
181
180
|
});
|
|
@@ -183,14 +182,14 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
183
182
|
};
|
|
184
183
|
ComboBox.prototype.clear = function (options) {
|
|
185
184
|
return __awaiter(this, void 0, void 0, function () {
|
|
186
|
-
return __generator(this, function (
|
|
187
|
-
switch (
|
|
185
|
+
return __generator(this, function (_e) {
|
|
186
|
+
switch (_e.label) {
|
|
188
187
|
case 0: return [4 /*yield*/, this.focus()];
|
|
189
188
|
case 1:
|
|
190
|
-
|
|
189
|
+
_e.sent();
|
|
191
190
|
return [4 /*yield*/, this.nativeInputLocator.clear(options)];
|
|
192
191
|
case 2:
|
|
193
|
-
|
|
192
|
+
_e.sent();
|
|
194
193
|
return [2 /*return*/];
|
|
195
194
|
}
|
|
196
195
|
});
|
|
@@ -198,17 +197,17 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
198
197
|
};
|
|
199
198
|
ComboBox.prototype.focus = function (options) {
|
|
200
199
|
return __awaiter(this, void 0, void 0, function () {
|
|
201
|
-
return __generator(this, function (
|
|
202
|
-
switch (
|
|
200
|
+
return __generator(this, function (_e) {
|
|
201
|
+
switch (_e.label) {
|
|
203
202
|
case 0: return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
|
|
204
203
|
case 1:
|
|
205
|
-
|
|
204
|
+
_e.sent();
|
|
206
205
|
return [4 /*yield*/, this.rootLocator
|
|
207
206
|
.locator('input[type="text"]')
|
|
208
207
|
.or(this.rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(InputLikeText_1.InputLikeTextDataTids.root)))
|
|
209
208
|
.focus(options)];
|
|
210
209
|
case 2:
|
|
211
|
-
|
|
210
|
+
_e.sent();
|
|
212
211
|
return [2 /*return*/];
|
|
213
212
|
}
|
|
214
213
|
});
|
|
@@ -216,11 +215,11 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
216
215
|
};
|
|
217
216
|
ComboBox.prototype.blur = function (options) {
|
|
218
217
|
return __awaiter(this, void 0, void 0, function () {
|
|
219
|
-
return __generator(this, function (
|
|
220
|
-
switch (
|
|
218
|
+
return __generator(this, function (_e) {
|
|
219
|
+
switch (_e.label) {
|
|
221
220
|
case 0: return [4 /*yield*/, this.nativeInputLocator.press('Tab', { timeout: options === null || options === void 0 ? void 0 : options.timeout })];
|
|
222
221
|
case 1:
|
|
223
|
-
|
|
222
|
+
_e.sent();
|
|
224
223
|
return [2 /*return*/];
|
|
225
224
|
}
|
|
226
225
|
});
|
|
@@ -228,17 +227,17 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
228
227
|
};
|
|
229
228
|
ComboBox.prototype.click = function () {
|
|
230
229
|
return __awaiter(this, void 0, void 0, function () {
|
|
231
|
-
return __generator(this, function (
|
|
232
|
-
switch (
|
|
230
|
+
return __generator(this, function (_e) {
|
|
231
|
+
switch (_e.label) {
|
|
233
232
|
case 0:
|
|
234
233
|
// NOTE: rootLocator всегда в состоянии enabled, даже если ComboBox disabled
|
|
235
234
|
return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
|
|
236
235
|
case 1:
|
|
237
236
|
// NOTE: rootLocator всегда в состоянии enabled, даже если ComboBox disabled
|
|
238
|
-
|
|
237
|
+
_e.sent();
|
|
239
238
|
return [4 /*yield*/, _super.prototype.click.call(this)];
|
|
240
239
|
case 2:
|
|
241
|
-
|
|
240
|
+
_e.sent();
|
|
242
241
|
return [2 /*return*/];
|
|
243
242
|
}
|
|
244
243
|
});
|
|
@@ -259,17 +258,17 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
259
258
|
ComboBox.prototype.getMenuItems = function () {
|
|
260
259
|
return __awaiter(this, void 0, void 0, function () {
|
|
261
260
|
var container;
|
|
262
|
-
return __generator(this, function (
|
|
263
|
-
switch (
|
|
261
|
+
return __generator(this, function (_e) {
|
|
262
|
+
switch (_e.label) {
|
|
264
263
|
case 0: return [4 /*yield*/, this.focus()];
|
|
265
264
|
case 1:
|
|
266
|
-
|
|
265
|
+
_e.sent();
|
|
267
266
|
return [4 /*yield*/, this.portal.getContainer()];
|
|
268
267
|
case 2:
|
|
269
|
-
container =
|
|
268
|
+
container = _e.sent();
|
|
270
269
|
return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
|
|
271
270
|
case 3:
|
|
272
|
-
|
|
271
|
+
_e.sent();
|
|
273
272
|
return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
|
|
274
273
|
return locator
|
|
275
274
|
.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
|
|
@@ -289,11 +288,11 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
289
288
|
ComboBox.prototype.getComboBoxMenuItemsLocator = function (byText) {
|
|
290
289
|
return __awaiter(this, void 0, void 0, function () {
|
|
291
290
|
var container, items;
|
|
292
|
-
return __generator(this, function (
|
|
293
|
-
switch (
|
|
291
|
+
return __generator(this, function (_e) {
|
|
292
|
+
switch (_e.label) {
|
|
294
293
|
case 0: return [4 /*yield*/, this.portal.getContainer()];
|
|
295
294
|
case 1:
|
|
296
|
-
container =
|
|
295
|
+
container = _e.sent();
|
|
297
296
|
items = container.locator((0, dataTidSelector_1.getDataTidSelector)(CustomComboBox_1.ComboBoxMenuDataTids.item));
|
|
298
297
|
return [2 /*return*/, items.getByText(byText)];
|
|
299
298
|
}
|
|
@@ -303,4 +302,4 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
303
302
|
return ComboBox;
|
|
304
303
|
}(MenuComponent_1.MenuComponent));
|
|
305
304
|
exports.ComboBox = ComboBox;
|
|
306
|
-
_a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toValueElementLocator, _c = LocatorSymbols_1.toItemsElementLocator, _d = LocatorSymbols_1.
|
|
305
|
+
_a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toValueElementLocator, _c = LocatorSymbols_1.toItemsElementLocator, _d = LocatorSymbols_1.toFocusableElementLocator;
|
|
@@ -5,7 +5,7 @@ import { ComponentList } from './ComponentList';
|
|
|
5
5
|
import { MenuItem } from './MenuItem';
|
|
6
6
|
import type { BlurOptions, ClickOptions, FocusOptions, InnerTextOptions, IsDisabledOptions } from '../options';
|
|
7
7
|
import { MenuComponent } from './MenuComponent';
|
|
8
|
-
import { toControlElementLocator, toFocusableElementLocator,
|
|
8
|
+
import { toControlElementLocator, toFocusableElementLocator, toItemsElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
|
|
9
9
|
export declare class Dropdown extends MenuComponent {
|
|
10
10
|
readonly rootLocator: Locator;
|
|
11
11
|
readonly buttonLocator: Locator;
|
|
@@ -13,7 +13,6 @@ export declare class Dropdown extends MenuComponent {
|
|
|
13
13
|
readonly [toControlElementLocator]: () => Locator;
|
|
14
14
|
readonly [toTextElementLocator]: () => Locator;
|
|
15
15
|
readonly [toItemsElementLocator]: () => Promise<Locator>;
|
|
16
|
-
readonly [toContainItemElementLocator]: () => Locator;
|
|
17
16
|
readonly [toFocusableElementLocator]: () => Locator;
|
|
18
17
|
constructor(rootLocator: Locator);
|
|
19
18
|
isDisabled(options?: IsDisabledOptions): Promise<boolean>;
|
|
@@ -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, _c, _d
|
|
53
|
+
var _a, _b, _c, _d;
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.Dropdown = void 0;
|
|
56
56
|
var test_1 = require("@playwright/test");
|
|
@@ -72,41 +72,40 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
72
72
|
_this[_a] = function () { return _this.buttonLocator; };
|
|
73
73
|
_this[_b] = function () { return _this.buttonLocator; };
|
|
74
74
|
_this[_c] = function () { return _this.getItemsLocator(); };
|
|
75
|
-
_this[_d] = function () { return _this.
|
|
76
|
-
_this[_e] = function () { return _this.buttonLocator; };
|
|
75
|
+
_this[_d] = function () { return _this.buttonLocator; };
|
|
77
76
|
_this.buttonLocator = rootLocator.locator('button');
|
|
78
77
|
_this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
|
|
79
78
|
return _this;
|
|
80
79
|
}
|
|
81
80
|
Dropdown.prototype.isDisabled = function (options) {
|
|
82
81
|
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
return __generator(this, function (
|
|
84
|
-
switch (
|
|
82
|
+
return __generator(this, function (_e) {
|
|
83
|
+
switch (_e.label) {
|
|
85
84
|
case 0: return [4 /*yield*/, this.buttonLocator.isDisabled(options)];
|
|
86
|
-
case 1: return [2 /*return*/,
|
|
85
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
87
86
|
}
|
|
88
87
|
});
|
|
89
88
|
});
|
|
90
89
|
};
|
|
91
90
|
Dropdown.prototype.isMenuOpened = function () {
|
|
92
91
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
-
return __generator(this, function (
|
|
94
|
-
switch (
|
|
92
|
+
return __generator(this, function (_e) {
|
|
93
|
+
switch (_e.label) {
|
|
95
94
|
case 0: return [4 /*yield*/, this.waitFor()];
|
|
96
95
|
case 1:
|
|
97
|
-
|
|
96
|
+
_e.sent();
|
|
98
97
|
return [4 /*yield*/, this.portal.isVisible()];
|
|
99
|
-
case 2: return [2 /*return*/,
|
|
98
|
+
case 2: return [2 /*return*/, _e.sent()];
|
|
100
99
|
}
|
|
101
100
|
});
|
|
102
101
|
});
|
|
103
102
|
};
|
|
104
103
|
Dropdown.prototype.getText = function (options) {
|
|
105
104
|
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
return __generator(this, function (
|
|
107
|
-
switch (
|
|
105
|
+
return __generator(this, function (_e) {
|
|
106
|
+
switch (_e.label) {
|
|
108
107
|
case 0: return [4 /*yield*/, this.buttonLocator.innerText(options)];
|
|
109
|
-
case 1: return [2 /*return*/,
|
|
108
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
110
109
|
}
|
|
111
110
|
});
|
|
112
111
|
});
|
|
@@ -114,19 +113,19 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
114
113
|
Dropdown.prototype.selectFirstByText = function (text, options) {
|
|
115
114
|
return __awaiter(this, void 0, void 0, function () {
|
|
116
115
|
var items;
|
|
117
|
-
return __generator(this, function (
|
|
118
|
-
switch (
|
|
116
|
+
return __generator(this, function (_e) {
|
|
117
|
+
switch (_e.label) {
|
|
119
118
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
|
|
120
119
|
case 1:
|
|
121
|
-
items =
|
|
120
|
+
items = _e.sent();
|
|
122
121
|
return [4 /*yield*/, items.first().click(options)];
|
|
123
122
|
case 2:
|
|
124
|
-
|
|
123
|
+
_e.sent();
|
|
125
124
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
126
125
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
127
126
|
case 3:
|
|
128
127
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
129
|
-
|
|
128
|
+
_e.sent();
|
|
130
129
|
return [2 /*return*/];
|
|
131
130
|
}
|
|
132
131
|
});
|
|
@@ -135,19 +134,19 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
135
134
|
Dropdown.prototype.selectByIndex = function (index, options) {
|
|
136
135
|
return __awaiter(this, void 0, void 0, function () {
|
|
137
136
|
var items;
|
|
138
|
-
return __generator(this, function (
|
|
139
|
-
switch (
|
|
137
|
+
return __generator(this, function (_e) {
|
|
138
|
+
switch (_e.label) {
|
|
140
139
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
|
|
141
140
|
case 1:
|
|
142
|
-
items =
|
|
141
|
+
items = _e.sent();
|
|
143
142
|
return [4 /*yield*/, items.nth(index).click(options)];
|
|
144
143
|
case 2:
|
|
145
|
-
|
|
144
|
+
_e.sent();
|
|
146
145
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
147
146
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
148
147
|
case 3:
|
|
149
148
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
150
|
-
|
|
149
|
+
_e.sent();
|
|
151
150
|
return [2 /*return*/];
|
|
152
151
|
}
|
|
153
152
|
});
|
|
@@ -156,25 +155,25 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
156
155
|
Dropdown.prototype.selectByDataTid = function (dataTid, options) {
|
|
157
156
|
return __awaiter(this, void 0, void 0, function () {
|
|
158
157
|
var container, item;
|
|
159
|
-
return __generator(this, function (
|
|
160
|
-
switch (
|
|
158
|
+
return __generator(this, function (_e) {
|
|
159
|
+
switch (_e.label) {
|
|
161
160
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
162
161
|
case 1:
|
|
163
|
-
container =
|
|
162
|
+
container = _e.sent();
|
|
164
163
|
item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
|
|
165
164
|
return [4 /*yield*/, item.count()];
|
|
166
165
|
case 2:
|
|
167
|
-
if ((
|
|
166
|
+
if ((_e.sent()) > 1) {
|
|
168
167
|
throw Error('DataTid должен быть уникальным');
|
|
169
168
|
}
|
|
170
169
|
return [4 /*yield*/, item.click(options)];
|
|
171
170
|
case 3:
|
|
172
|
-
|
|
171
|
+
_e.sent();
|
|
173
172
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
174
173
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
175
174
|
case 4:
|
|
176
175
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
177
|
-
|
|
176
|
+
_e.sent();
|
|
178
177
|
return [2 /*return*/];
|
|
179
178
|
}
|
|
180
179
|
});
|
|
@@ -182,11 +181,11 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
182
181
|
};
|
|
183
182
|
Dropdown.prototype.click = function (options) {
|
|
184
183
|
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
-
return __generator(this, function (
|
|
186
|
-
switch (
|
|
184
|
+
return __generator(this, function (_e) {
|
|
185
|
+
switch (_e.label) {
|
|
187
186
|
case 0: return [4 /*yield*/, this.buttonLocator.click(options)];
|
|
188
187
|
case 1:
|
|
189
|
-
|
|
188
|
+
_e.sent();
|
|
190
189
|
return [2 /*return*/];
|
|
191
190
|
}
|
|
192
191
|
});
|
|
@@ -197,14 +196,14 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
197
196
|
};
|
|
198
197
|
Dropdown.prototype.focus = function (options) {
|
|
199
198
|
return __awaiter(this, void 0, void 0, function () {
|
|
200
|
-
return __generator(this, function (
|
|
201
|
-
switch (
|
|
199
|
+
return __generator(this, function (_e) {
|
|
200
|
+
switch (_e.label) {
|
|
202
201
|
case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
|
|
203
202
|
case 1:
|
|
204
|
-
|
|
203
|
+
_e.sent();
|
|
205
204
|
return [4 /*yield*/, this.buttonLocator.focus(options)];
|
|
206
205
|
case 2:
|
|
207
|
-
|
|
206
|
+
_e.sent();
|
|
208
207
|
return [2 /*return*/];
|
|
209
208
|
}
|
|
210
209
|
});
|
|
@@ -212,11 +211,11 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
212
211
|
};
|
|
213
212
|
Dropdown.prototype.blur = function (options) {
|
|
214
213
|
return __awaiter(this, void 0, void 0, function () {
|
|
215
|
-
return __generator(this, function (
|
|
216
|
-
switch (
|
|
214
|
+
return __generator(this, function (_e) {
|
|
215
|
+
switch (_e.label) {
|
|
217
216
|
case 0: return [4 /*yield*/, this.buttonLocator.blur(options)];
|
|
218
217
|
case 1:
|
|
219
|
-
|
|
218
|
+
_e.sent();
|
|
220
219
|
return [2 /*return*/];
|
|
221
220
|
}
|
|
222
221
|
});
|
|
@@ -231,14 +230,14 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
231
230
|
Dropdown.prototype.getMenuItems = function () {
|
|
232
231
|
return __awaiter(this, void 0, void 0, function () {
|
|
233
232
|
var container;
|
|
234
|
-
return __generator(this, function (
|
|
235
|
-
switch (
|
|
233
|
+
return __generator(this, function (_e) {
|
|
234
|
+
switch (_e.label) {
|
|
236
235
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
237
236
|
case 1:
|
|
238
|
-
container =
|
|
237
|
+
container = _e.sent();
|
|
239
238
|
return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
|
|
240
239
|
case 2:
|
|
241
|
-
|
|
240
|
+
_e.sent();
|
|
242
241
|
return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
|
|
243
242
|
return locator
|
|
244
243
|
.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
|
|
@@ -253,23 +252,23 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
253
252
|
return __awaiter(this, void 0, void 0, function () {
|
|
254
253
|
var items;
|
|
255
254
|
var _this = this;
|
|
256
|
-
return __generator(this, function (
|
|
257
|
-
switch (
|
|
255
|
+
return __generator(this, function (_e) {
|
|
256
|
+
switch (_e.label) {
|
|
258
257
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
259
258
|
case 1:
|
|
260
|
-
items =
|
|
259
|
+
items = _e.sent();
|
|
261
260
|
return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
262
261
|
var itemText;
|
|
263
|
-
return __generator(this, function (
|
|
264
|
-
switch (
|
|
262
|
+
return __generator(this, function (_e) {
|
|
263
|
+
switch (_e.label) {
|
|
265
264
|
case 0: return [4 /*yield*/, item.getText()];
|
|
266
265
|
case 1:
|
|
267
|
-
itemText =
|
|
266
|
+
itemText = _e.sent();
|
|
268
267
|
return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
|
|
269
268
|
}
|
|
270
269
|
});
|
|
271
270
|
}); })];
|
|
272
|
-
case 2: return [2 /*return*/,
|
|
271
|
+
case 2: return [2 /*return*/, _e.sent()];
|
|
273
272
|
}
|
|
274
273
|
});
|
|
275
274
|
});
|
|
@@ -277,11 +276,11 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
277
276
|
Dropdown.prototype.getMenuItemByIndex = function (index) {
|
|
278
277
|
return __awaiter(this, void 0, void 0, function () {
|
|
279
278
|
var items;
|
|
280
|
-
return __generator(this, function (
|
|
281
|
-
switch (
|
|
279
|
+
return __generator(this, function (_e) {
|
|
280
|
+
switch (_e.label) {
|
|
282
281
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
283
282
|
case 1:
|
|
284
|
-
items =
|
|
283
|
+
items = _e.sent();
|
|
285
284
|
return [2 /*return*/, items.getItemByIndex(index)];
|
|
286
285
|
}
|
|
287
286
|
});
|
|
@@ -293,11 +292,11 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
293
292
|
Dropdown.prototype.getMenuItemsLocator = function (byText) {
|
|
294
293
|
return __awaiter(this, void 0, void 0, function () {
|
|
295
294
|
var container, items;
|
|
296
|
-
return __generator(this, function (
|
|
297
|
-
switch (
|
|
295
|
+
return __generator(this, function (_e) {
|
|
296
|
+
switch (_e.label) {
|
|
298
297
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
299
298
|
case 1:
|
|
300
|
-
container =
|
|
299
|
+
container = _e.sent();
|
|
301
300
|
items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
|
|
302
301
|
return [2 /*return*/, !byText ? items : items.getByText(byText)];
|
|
303
302
|
}
|
|
@@ -306,15 +305,15 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
306
305
|
};
|
|
307
306
|
Dropdown.prototype.getPortalContainer = function () {
|
|
308
307
|
return __awaiter(this, void 0, void 0, function () {
|
|
309
|
-
return __generator(this, function (
|
|
310
|
-
switch (
|
|
308
|
+
return __generator(this, function (_e) {
|
|
309
|
+
switch (_e.label) {
|
|
311
310
|
case 0: return [4 /*yield*/, this.isMenuOpened()];
|
|
312
311
|
case 1:
|
|
313
|
-
if (!!(
|
|
312
|
+
if (!!(_e.sent())) return [3 /*break*/, 3];
|
|
314
313
|
return [4 /*yield*/, this.buttonLocator.click()];
|
|
315
314
|
case 2:
|
|
316
|
-
|
|
317
|
-
|
|
315
|
+
_e.sent();
|
|
316
|
+
_e.label = 3;
|
|
318
317
|
case 3: return [2 /*return*/, this.portal.getContainer()];
|
|
319
318
|
}
|
|
320
319
|
});
|
|
@@ -323,4 +322,4 @@ var Dropdown = /** @class */ (function (_super) {
|
|
|
323
322
|
return Dropdown;
|
|
324
323
|
}(MenuComponent_1.MenuComponent));
|
|
325
324
|
exports.Dropdown = Dropdown;
|
|
326
|
-
_a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toTextElementLocator, _c = LocatorSymbols_1.toItemsElementLocator, _d = LocatorSymbols_1.
|
|
325
|
+
_a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toTextElementLocator, _c = LocatorSymbols_1.toItemsElementLocator, _d = LocatorSymbols_1.toFocusableElementLocator;
|
|
@@ -5,14 +5,13 @@ import { ComponentList } from './ComponentList';
|
|
|
5
5
|
import { MenuItem } from './MenuItem';
|
|
6
6
|
import type { BlurOptions, ClickOptions, FocusOptions, InnerTextOptions } from '../options';
|
|
7
7
|
import { MenuComponent } from './MenuComponent';
|
|
8
|
-
import { toFocusableElementLocator,
|
|
8
|
+
import { toFocusableElementLocator, toItemsElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
|
|
9
9
|
export declare class DropdownMenu extends MenuComponent {
|
|
10
10
|
readonly rootLocator: Locator;
|
|
11
11
|
readonly buttonLocator: Locator;
|
|
12
12
|
private readonly portal;
|
|
13
13
|
readonly [toTextElementLocator]: () => Locator;
|
|
14
14
|
readonly [toItemsElementLocator]: () => Promise<Locator>;
|
|
15
|
-
readonly [toContainItemElementLocator]: () => Locator;
|
|
16
15
|
readonly [toFocusableElementLocator]: () => Locator;
|
|
17
16
|
constructor(rootLocator: Locator);
|
|
18
17
|
getText(options?: InnerTextOptions): Promise<string>;
|