@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
|
|
53
|
+
var _a, _b, _c;
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.DropdownMenu = void 0;
|
|
56
56
|
var test_1 = require("@playwright/test");
|
|
@@ -71,31 +71,30 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
71
71
|
_this.rootLocator = rootLocator;
|
|
72
72
|
_this[_a] = function () { return _this.buttonLocator; };
|
|
73
73
|
_this[_b] = function () { return _this.getItemsLocator(); };
|
|
74
|
-
_this[_c] = function () { return _this.
|
|
75
|
-
_this[_d] = function () { return _this.buttonLocator; };
|
|
74
|
+
_this[_c] = function () { return _this.buttonLocator; };
|
|
76
75
|
_this.buttonLocator = rootLocator.locator('button');
|
|
77
76
|
_this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
|
|
78
77
|
return _this;
|
|
79
78
|
}
|
|
80
79
|
DropdownMenu.prototype.getText = function (options) {
|
|
81
80
|
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
-
return __generator(this, function (
|
|
83
|
-
switch (
|
|
81
|
+
return __generator(this, function (_d) {
|
|
82
|
+
switch (_d.label) {
|
|
84
83
|
case 0: return [4 /*yield*/, this.buttonLocator.innerText(options)];
|
|
85
|
-
case 1: return [2 /*return*/,
|
|
84
|
+
case 1: return [2 /*return*/, _d.sent()];
|
|
86
85
|
}
|
|
87
86
|
});
|
|
88
87
|
});
|
|
89
88
|
};
|
|
90
89
|
DropdownMenu.prototype.isMenuOpened = function () {
|
|
91
90
|
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
-
return __generator(this, function (
|
|
93
|
-
switch (
|
|
91
|
+
return __generator(this, function (_d) {
|
|
92
|
+
switch (_d.label) {
|
|
94
93
|
case 0: return [4 /*yield*/, this.waitFor()];
|
|
95
94
|
case 1:
|
|
96
|
-
|
|
95
|
+
_d.sent();
|
|
97
96
|
return [4 /*yield*/, this.portal.isVisible()];
|
|
98
|
-
case 2: return [2 /*return*/,
|
|
97
|
+
case 2: return [2 /*return*/, _d.sent()];
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
100
|
});
|
|
@@ -104,21 +103,21 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
104
103
|
return __awaiter(this, arguments, void 0, function (text, options) {
|
|
105
104
|
var items;
|
|
106
105
|
if (options === void 0) { options = { closedAfterSelect: true }; }
|
|
107
|
-
return __generator(this, function (
|
|
108
|
-
switch (
|
|
106
|
+
return __generator(this, function (_d) {
|
|
107
|
+
switch (_d.label) {
|
|
109
108
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
|
|
110
109
|
case 1:
|
|
111
|
-
items =
|
|
110
|
+
items = _d.sent();
|
|
112
111
|
return [4 /*yield*/, items.first().click()];
|
|
113
112
|
case 2:
|
|
114
|
-
|
|
113
|
+
_d.sent();
|
|
115
114
|
if (!options.closedAfterSelect) return [3 /*break*/, 4];
|
|
116
115
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
117
116
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
118
117
|
case 3:
|
|
119
118
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
_d.sent();
|
|
120
|
+
_d.label = 4;
|
|
122
121
|
case 4: return [2 /*return*/];
|
|
123
122
|
}
|
|
124
123
|
});
|
|
@@ -128,27 +127,27 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
128
127
|
return __awaiter(this, arguments, void 0, function (dataTid, options) {
|
|
129
128
|
var container, item;
|
|
130
129
|
if (options === void 0) { options = { closedAfterSelect: true }; }
|
|
131
|
-
return __generator(this, function (
|
|
132
|
-
switch (
|
|
130
|
+
return __generator(this, function (_d) {
|
|
131
|
+
switch (_d.label) {
|
|
133
132
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
134
133
|
case 1:
|
|
135
|
-
container =
|
|
134
|
+
container = _d.sent();
|
|
136
135
|
item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
|
|
137
136
|
return [4 /*yield*/, item.count()];
|
|
138
137
|
case 2:
|
|
139
|
-
if ((
|
|
138
|
+
if ((_d.sent()) > 1) {
|
|
140
139
|
throw Error('DataTid должен быть уникальным');
|
|
141
140
|
}
|
|
142
141
|
return [4 /*yield*/, item.click()];
|
|
143
142
|
case 3:
|
|
144
|
-
|
|
143
|
+
_d.sent();
|
|
145
144
|
if (!options.closedAfterSelect) return [3 /*break*/, 5];
|
|
146
145
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
147
146
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
148
147
|
case 4:
|
|
149
148
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
_d.sent();
|
|
150
|
+
_d.label = 5;
|
|
152
151
|
case 5: return [2 /*return*/];
|
|
153
152
|
}
|
|
154
153
|
});
|
|
@@ -158,21 +157,21 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
158
157
|
return __awaiter(this, arguments, void 0, function (index, options) {
|
|
159
158
|
var items;
|
|
160
159
|
if (options === void 0) { options = { closedAfterSelect: true }; }
|
|
161
|
-
return __generator(this, function (
|
|
162
|
-
switch (
|
|
160
|
+
return __generator(this, function (_d) {
|
|
161
|
+
switch (_d.label) {
|
|
163
162
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
|
|
164
163
|
case 1:
|
|
165
|
-
items =
|
|
164
|
+
items = _d.sent();
|
|
166
165
|
return [4 /*yield*/, items.nth(index).click()];
|
|
167
166
|
case 2:
|
|
168
|
-
|
|
167
|
+
_d.sent();
|
|
169
168
|
if (!options.closedAfterSelect) return [3 /*break*/, 4];
|
|
170
169
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
171
170
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
172
171
|
case 3:
|
|
173
172
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
_d.sent();
|
|
174
|
+
_d.label = 4;
|
|
176
175
|
case 4: return [2 /*return*/];
|
|
177
176
|
}
|
|
178
177
|
});
|
|
@@ -180,11 +179,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
180
179
|
};
|
|
181
180
|
DropdownMenu.prototype.click = function (options) {
|
|
182
181
|
return __awaiter(this, void 0, void 0, function () {
|
|
183
|
-
return __generator(this, function (
|
|
184
|
-
switch (
|
|
182
|
+
return __generator(this, function (_d) {
|
|
183
|
+
switch (_d.label) {
|
|
185
184
|
case 0: return [4 /*yield*/, this.buttonLocator.click(options)];
|
|
186
185
|
case 1:
|
|
187
|
-
|
|
186
|
+
_d.sent();
|
|
188
187
|
return [2 /*return*/];
|
|
189
188
|
}
|
|
190
189
|
});
|
|
@@ -192,14 +191,14 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
192
191
|
};
|
|
193
192
|
DropdownMenu.prototype.focus = function (options) {
|
|
194
193
|
return __awaiter(this, void 0, void 0, function () {
|
|
195
|
-
return __generator(this, function (
|
|
196
|
-
switch (
|
|
194
|
+
return __generator(this, function (_d) {
|
|
195
|
+
switch (_d.label) {
|
|
197
196
|
case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
|
|
198
197
|
case 1:
|
|
199
|
-
|
|
198
|
+
_d.sent();
|
|
200
199
|
return [4 /*yield*/, this.buttonLocator.focus(options)];
|
|
201
200
|
case 2:
|
|
202
|
-
|
|
201
|
+
_d.sent();
|
|
203
202
|
return [2 /*return*/];
|
|
204
203
|
}
|
|
205
204
|
});
|
|
@@ -207,11 +206,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
207
206
|
};
|
|
208
207
|
DropdownMenu.prototype.blur = function (options) {
|
|
209
208
|
return __awaiter(this, void 0, void 0, function () {
|
|
210
|
-
return __generator(this, function (
|
|
211
|
-
switch (
|
|
209
|
+
return __generator(this, function (_d) {
|
|
210
|
+
switch (_d.label) {
|
|
212
211
|
case 0: return [4 /*yield*/, this.buttonLocator.blur(options)];
|
|
213
212
|
case 1:
|
|
214
|
-
|
|
213
|
+
_d.sent();
|
|
215
214
|
return [2 /*return*/];
|
|
216
215
|
}
|
|
217
216
|
});
|
|
@@ -229,14 +228,14 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
229
228
|
DropdownMenu.prototype.getMenuItems = function () {
|
|
230
229
|
return __awaiter(this, void 0, void 0, function () {
|
|
231
230
|
var container;
|
|
232
|
-
return __generator(this, function (
|
|
233
|
-
switch (
|
|
231
|
+
return __generator(this, function (_d) {
|
|
232
|
+
switch (_d.label) {
|
|
234
233
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
235
234
|
case 1:
|
|
236
|
-
container =
|
|
235
|
+
container = _d.sent();
|
|
237
236
|
return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
|
|
238
237
|
case 2:
|
|
239
|
-
|
|
238
|
+
_d.sent();
|
|
240
239
|
return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
|
|
241
240
|
return locator
|
|
242
241
|
.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
|
|
@@ -251,23 +250,23 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
251
250
|
return __awaiter(this, void 0, void 0, function () {
|
|
252
251
|
var items;
|
|
253
252
|
var _this = this;
|
|
254
|
-
return __generator(this, function (
|
|
255
|
-
switch (
|
|
253
|
+
return __generator(this, function (_d) {
|
|
254
|
+
switch (_d.label) {
|
|
256
255
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
257
256
|
case 1:
|
|
258
|
-
items =
|
|
257
|
+
items = _d.sent();
|
|
259
258
|
return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
260
259
|
var itemText;
|
|
261
|
-
return __generator(this, function (
|
|
262
|
-
switch (
|
|
260
|
+
return __generator(this, function (_d) {
|
|
261
|
+
switch (_d.label) {
|
|
263
262
|
case 0: return [4 /*yield*/, item.getText()];
|
|
264
263
|
case 1:
|
|
265
|
-
itemText =
|
|
264
|
+
itemText = _d.sent();
|
|
266
265
|
return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
|
|
267
266
|
}
|
|
268
267
|
});
|
|
269
268
|
}); })];
|
|
270
|
-
case 2: return [2 /*return*/,
|
|
269
|
+
case 2: return [2 /*return*/, _d.sent()];
|
|
271
270
|
}
|
|
272
271
|
});
|
|
273
272
|
});
|
|
@@ -275,11 +274,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
275
274
|
DropdownMenu.prototype.getMenuItemByIndex = function (index) {
|
|
276
275
|
return __awaiter(this, void 0, void 0, function () {
|
|
277
276
|
var items;
|
|
278
|
-
return __generator(this, function (
|
|
279
|
-
switch (
|
|
277
|
+
return __generator(this, function (_d) {
|
|
278
|
+
switch (_d.label) {
|
|
280
279
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
281
280
|
case 1:
|
|
282
|
-
items =
|
|
281
|
+
items = _d.sent();
|
|
283
282
|
return [2 /*return*/, items.getItemByIndex(index)];
|
|
284
283
|
}
|
|
285
284
|
});
|
|
@@ -291,11 +290,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
291
290
|
DropdownMenu.prototype.getMenuItemsLocator = function (byText) {
|
|
292
291
|
return __awaiter(this, void 0, void 0, function () {
|
|
293
292
|
var container, items;
|
|
294
|
-
return __generator(this, function (
|
|
295
|
-
switch (
|
|
293
|
+
return __generator(this, function (_d) {
|
|
294
|
+
switch (_d.label) {
|
|
296
295
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
297
296
|
case 1:
|
|
298
|
-
container =
|
|
297
|
+
container = _d.sent();
|
|
299
298
|
items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
|
|
300
299
|
return [2 /*return*/, !byText ? items : items.getByText(byText)];
|
|
301
300
|
}
|
|
@@ -304,15 +303,15 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
304
303
|
};
|
|
305
304
|
DropdownMenu.prototype.getPortalContainer = function () {
|
|
306
305
|
return __awaiter(this, void 0, void 0, function () {
|
|
307
|
-
return __generator(this, function (
|
|
308
|
-
switch (
|
|
306
|
+
return __generator(this, function (_d) {
|
|
307
|
+
switch (_d.label) {
|
|
309
308
|
case 0: return [4 /*yield*/, this.isMenuOpened()];
|
|
310
309
|
case 1:
|
|
311
|
-
if (!!(
|
|
310
|
+
if (!!(_d.sent())) return [3 /*break*/, 3];
|
|
312
311
|
return [4 /*yield*/, this.buttonLocator.click()];
|
|
313
312
|
case 2:
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
_d.sent();
|
|
314
|
+
_d.label = 3;
|
|
316
315
|
case 3: return [2 /*return*/, this.portal.getContainer()];
|
|
317
316
|
}
|
|
318
317
|
});
|
|
@@ -321,4 +320,4 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
321
320
|
return DropdownMenu;
|
|
322
321
|
}(MenuComponent_1.MenuComponent));
|
|
323
322
|
exports.DropdownMenu = DropdownMenu;
|
|
324
|
-
_a = LocatorSymbols_1.toTextElementLocator, _b = LocatorSymbols_1.toItemsElementLocator, _c = LocatorSymbols_1.
|
|
323
|
+
_a = LocatorSymbols_1.toTextElementLocator, _b = LocatorSymbols_1.toItemsElementLocator, _c = LocatorSymbols_1.toFocusableElementLocator;
|
|
@@ -4,13 +4,12 @@ import { MenuItem } from './MenuItem';
|
|
|
4
4
|
import { KebabAssertions } from '../assertions';
|
|
5
5
|
import type { ClickOptions, GetAttributeOptions } from '../options';
|
|
6
6
|
import { MenuComponent } from './MenuComponent';
|
|
7
|
-
import { toControlElementLocator,
|
|
7
|
+
import { toControlElementLocator, toItemsElementLocator } from '../matchers/component/LocatorSymbols';
|
|
8
8
|
export declare class Kebab extends MenuComponent {
|
|
9
9
|
private readonly portal;
|
|
10
10
|
readonly captionLocator: Locator;
|
|
11
11
|
readonly [toControlElementLocator]: () => Locator;
|
|
12
12
|
readonly [toItemsElementLocator]: () => Promise<Locator>;
|
|
13
|
-
readonly [toContainItemElementLocator]: () => Locator;
|
|
14
13
|
constructor(rootLocator: Locator);
|
|
15
14
|
isDisabled(options?: GetAttributeOptions): Promise<boolean>;
|
|
16
15
|
isMenuOpened(): 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
|
|
53
|
+
var _a, _b;
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.Kebab = void 0;
|
|
56
56
|
var react_ui_1 = require("@skbkontur/react-ui");
|
|
@@ -68,17 +68,16 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
68
68
|
var _this = _super.call(this, rootLocator) || this;
|
|
69
69
|
_this[_a] = function () { return _this.rootLocator; };
|
|
70
70
|
_this[_b] = function () { return _this.getItemsLocator(); };
|
|
71
|
-
_this[_c] = function () { return _this.rootLocator; };
|
|
72
71
|
_this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
|
|
73
72
|
_this.captionLocator = rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.KebabDataTids.caption));
|
|
74
73
|
return _this;
|
|
75
74
|
}
|
|
76
75
|
Kebab.prototype.isDisabled = function (options) {
|
|
77
76
|
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
-
return __generator(this, function (
|
|
79
|
-
switch (
|
|
77
|
+
return __generator(this, function (_c) {
|
|
78
|
+
switch (_c.label) {
|
|
80
79
|
case 0: return [4 /*yield*/, this.getAttribute(utils_1.DataVisualState.Disabled, options)];
|
|
81
|
-
case 1: return [2 /*return*/, (
|
|
80
|
+
case 1: return [2 /*return*/, (_c.sent()) !== null];
|
|
82
81
|
}
|
|
83
82
|
});
|
|
84
83
|
});
|
|
@@ -89,14 +88,14 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
89
88
|
Kebab.prototype.selectFirstByText = function (text, options) {
|
|
90
89
|
return __awaiter(this, void 0, void 0, function () {
|
|
91
90
|
var item;
|
|
92
|
-
return __generator(this, function (
|
|
93
|
-
switch (
|
|
91
|
+
return __generator(this, function (_c) {
|
|
92
|
+
switch (_c.label) {
|
|
94
93
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
|
|
95
94
|
case 1:
|
|
96
|
-
item =
|
|
95
|
+
item = _c.sent();
|
|
97
96
|
return [4 /*yield*/, item.first().click(options)];
|
|
98
97
|
case 2:
|
|
99
|
-
|
|
98
|
+
_c.sent();
|
|
100
99
|
return [2 /*return*/];
|
|
101
100
|
}
|
|
102
101
|
});
|
|
@@ -105,14 +104,14 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
105
104
|
Kebab.prototype.selectByIndex = function (index, options) {
|
|
106
105
|
return __awaiter(this, void 0, void 0, function () {
|
|
107
106
|
var items;
|
|
108
|
-
return __generator(this, function (
|
|
109
|
-
switch (
|
|
107
|
+
return __generator(this, function (_c) {
|
|
108
|
+
switch (_c.label) {
|
|
110
109
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
|
|
111
110
|
case 1:
|
|
112
|
-
items =
|
|
111
|
+
items = _c.sent();
|
|
113
112
|
return [4 /*yield*/, items.nth(index).click(options)];
|
|
114
113
|
case 2:
|
|
115
|
-
|
|
114
|
+
_c.sent();
|
|
116
115
|
return [2 /*return*/];
|
|
117
116
|
}
|
|
118
117
|
});
|
|
@@ -121,20 +120,20 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
121
120
|
Kebab.prototype.selectByDataTid = function (dataTid, options) {
|
|
122
121
|
return __awaiter(this, void 0, void 0, function () {
|
|
123
122
|
var container, item;
|
|
124
|
-
return __generator(this, function (
|
|
125
|
-
switch (
|
|
123
|
+
return __generator(this, function (_c) {
|
|
124
|
+
switch (_c.label) {
|
|
126
125
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
127
126
|
case 1:
|
|
128
|
-
container =
|
|
127
|
+
container = _c.sent();
|
|
129
128
|
item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
|
|
130
129
|
return [4 /*yield*/, item.count()];
|
|
131
130
|
case 2:
|
|
132
|
-
if ((
|
|
131
|
+
if ((_c.sent()) > 1) {
|
|
133
132
|
throw Error('DataTid должен быть уникальным');
|
|
134
133
|
}
|
|
135
134
|
return [4 /*yield*/, item.click(options)];
|
|
136
135
|
case 3:
|
|
137
|
-
|
|
136
|
+
_c.sent();
|
|
138
137
|
return [2 /*return*/];
|
|
139
138
|
}
|
|
140
139
|
});
|
|
@@ -142,14 +141,14 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
142
141
|
};
|
|
143
142
|
Kebab.prototype.click = function (options) {
|
|
144
143
|
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
-
return __generator(this, function (
|
|
146
|
-
switch (
|
|
144
|
+
return __generator(this, function (_c) {
|
|
145
|
+
switch (_c.label) {
|
|
147
146
|
case 0: return [4 /*yield*/, this.expect().toBeEnabled()];
|
|
148
147
|
case 1:
|
|
149
|
-
|
|
148
|
+
_c.sent();
|
|
150
149
|
return [4 /*yield*/, this.captionLocator.click(options)];
|
|
151
150
|
case 2:
|
|
152
|
-
|
|
151
|
+
_c.sent();
|
|
153
152
|
return [2 /*return*/];
|
|
154
153
|
}
|
|
155
154
|
});
|
|
@@ -162,11 +161,11 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
162
161
|
Kebab.prototype.getMenuItems = function () {
|
|
163
162
|
return __awaiter(this, void 0, void 0, function () {
|
|
164
163
|
var container;
|
|
165
|
-
return __generator(this, function (
|
|
166
|
-
switch (
|
|
164
|
+
return __generator(this, function (_c) {
|
|
165
|
+
switch (_c.label) {
|
|
167
166
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
168
167
|
case 1:
|
|
169
|
-
container =
|
|
168
|
+
container = _c.sent();
|
|
170
169
|
return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) { return locator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root)); }, function (locator) { return new MenuItem_1.MenuItem(locator); })];
|
|
171
170
|
}
|
|
172
171
|
});
|
|
@@ -176,23 +175,23 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
176
175
|
return __awaiter(this, void 0, void 0, function () {
|
|
177
176
|
var items;
|
|
178
177
|
var _this = this;
|
|
179
|
-
return __generator(this, function (
|
|
180
|
-
switch (
|
|
178
|
+
return __generator(this, function (_c) {
|
|
179
|
+
switch (_c.label) {
|
|
181
180
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
182
181
|
case 1:
|
|
183
|
-
items =
|
|
182
|
+
items = _c.sent();
|
|
184
183
|
return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
185
184
|
var itemText;
|
|
186
|
-
return __generator(this, function (
|
|
187
|
-
switch (
|
|
185
|
+
return __generator(this, function (_c) {
|
|
186
|
+
switch (_c.label) {
|
|
188
187
|
case 0: return [4 /*yield*/, item.getText()];
|
|
189
188
|
case 1:
|
|
190
|
-
itemText =
|
|
189
|
+
itemText = _c.sent();
|
|
191
190
|
return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
|
|
192
191
|
}
|
|
193
192
|
});
|
|
194
193
|
}); })];
|
|
195
|
-
case 2: return [2 /*return*/,
|
|
194
|
+
case 2: return [2 /*return*/, _c.sent()];
|
|
196
195
|
}
|
|
197
196
|
});
|
|
198
197
|
});
|
|
@@ -200,11 +199,11 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
200
199
|
Kebab.prototype.getMenuItemByIndex = function (index) {
|
|
201
200
|
return __awaiter(this, void 0, void 0, function () {
|
|
202
201
|
var items;
|
|
203
|
-
return __generator(this, function (
|
|
204
|
-
switch (
|
|
202
|
+
return __generator(this, function (_c) {
|
|
203
|
+
switch (_c.label) {
|
|
205
204
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
206
205
|
case 1:
|
|
207
|
-
items =
|
|
206
|
+
items = _c.sent();
|
|
208
207
|
return [2 /*return*/, items.getItemByIndex(index)];
|
|
209
208
|
}
|
|
210
209
|
});
|
|
@@ -216,11 +215,11 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
216
215
|
Kebab.prototype.getMenuItemsLocator = function (byText) {
|
|
217
216
|
return __awaiter(this, void 0, void 0, function () {
|
|
218
217
|
var container, items;
|
|
219
|
-
return __generator(this, function (
|
|
220
|
-
switch (
|
|
218
|
+
return __generator(this, function (_c) {
|
|
219
|
+
switch (_c.label) {
|
|
221
220
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
222
221
|
case 1:
|
|
223
|
-
container =
|
|
222
|
+
container = _c.sent();
|
|
224
223
|
items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
|
|
225
224
|
return [2 /*return*/, !byText ? items : items.getByText(byText)];
|
|
226
225
|
}
|
|
@@ -229,15 +228,15 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
229
228
|
};
|
|
230
229
|
Kebab.prototype.getPortalContainer = function () {
|
|
231
230
|
return __awaiter(this, void 0, void 0, function () {
|
|
232
|
-
return __generator(this, function (
|
|
233
|
-
switch (
|
|
231
|
+
return __generator(this, function (_c) {
|
|
232
|
+
switch (_c.label) {
|
|
234
233
|
case 0: return [4 /*yield*/, this.isMenuOpened()];
|
|
235
234
|
case 1:
|
|
236
|
-
if (!!(
|
|
235
|
+
if (!!(_c.sent())) return [3 /*break*/, 3];
|
|
237
236
|
return [4 /*yield*/, this.click()];
|
|
238
237
|
case 2:
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
_c.sent();
|
|
239
|
+
_c.label = 3;
|
|
241
240
|
case 3: return [2 /*return*/, this.portal.getContainer()];
|
|
242
241
|
}
|
|
243
242
|
});
|
|
@@ -246,4 +245,4 @@ var Kebab = /** @class */ (function (_super) {
|
|
|
246
245
|
return Kebab;
|
|
247
246
|
}(MenuComponent_1.MenuComponent));
|
|
248
247
|
exports.Kebab = Kebab;
|
|
249
|
-
_a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toItemsElementLocator
|
|
248
|
+
_a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toItemsElementLocator;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseComponent } from './BaseComponent';
|
|
2
2
|
import type { ComponentList } from './ComponentList';
|
|
3
|
-
import { toItemsElementLocator } from '../matchers/component/LocatorSymbols';
|
|
3
|
+
import { toContainItemElementLocator, toItemsElementLocator } from '../matchers/component/LocatorSymbols';
|
|
4
4
|
import type { MenuItem } from './MenuItem';
|
|
5
5
|
export declare abstract class MenuComponent extends BaseComponent {
|
|
6
6
|
readonly [toItemsElementLocator]: () => Promise<import("playwright-core").Locator>;
|
|
7
|
+
readonly [toContainItemElementLocator]: () => import("playwright-core").Locator;
|
|
7
8
|
abstract getMenuItems(): Promise<ComponentList<MenuItem>>;
|
|
8
9
|
getItemsLocator(): Promise<import("playwright-core").Locator>;
|
|
9
10
|
}
|
|
@@ -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;
|
|
53
|
+
var _a, _b;
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.MenuComponent = void 0;
|
|
56
56
|
var BaseComponent_1 = require("./BaseComponent");
|
|
@@ -60,14 +60,15 @@ var MenuComponent = /** @class */ (function (_super) {
|
|
|
60
60
|
function MenuComponent() {
|
|
61
61
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
62
62
|
_this[_a] = function () { return _this.getItemsLocator(); };
|
|
63
|
+
_this[_b] = function () { return _this.rootLocator; };
|
|
63
64
|
return _this;
|
|
64
65
|
}
|
|
65
66
|
MenuComponent.prototype.getItemsLocator = function () {
|
|
66
67
|
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
return __generator(this, function (
|
|
68
|
-
switch (
|
|
68
|
+
return __generator(this, function (_c) {
|
|
69
|
+
switch (_c.label) {
|
|
69
70
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
70
|
-
case 1: return [2 /*return*/, (
|
|
71
|
+
case 1: return [2 /*return*/, (_c.sent()).itemsLocator];
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
74
|
});
|
|
@@ -75,4 +76,4 @@ var MenuComponent = /** @class */ (function (_super) {
|
|
|
75
76
|
return MenuComponent;
|
|
76
77
|
}(BaseComponent_1.BaseComponent));
|
|
77
78
|
exports.MenuComponent = MenuComponent;
|
|
78
|
-
_a = LocatorSymbols_1.toItemsElementLocator;
|
|
79
|
+
_a = LocatorSymbols_1.toItemsElementLocator, _b = LocatorSymbols_1.toContainItemElementLocator;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AttributeOptions } from '../../options';
|
|
2
|
+
import type { Tab } from '../../components';
|
|
3
|
+
export declare const toBeActiveTab: (this: import("@playwright/test").ExpectMatcherState, component: Tab, args_0?: AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -36,11 +36,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.toBeActiveTab = void 0;
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
41
|
var constants_1 = require("../../utils/constants");
|
|
42
42
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
43
|
-
exports.
|
|
43
|
+
exports.toBeActiveTab = (0, createAsyncMatcher_1.createComponentAsyncMatcher)('toBeActiveTab', function (component) { return component.rootLocator; }, function (_a, options_1) { return __awaiter(void 0, [_a, options_1], void 0, function (_b, options) {
|
|
44
44
|
var expectation;
|
|
45
45
|
var isNot = _b.isNot, locator = _b.locator;
|
|
46
46
|
return __generator(this, function (_c) {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { FxInput } from '../../components';
|
|
2
|
+
import type { VisibleOptions } from '../../options';
|
|
3
|
+
export declare const toBeAutoMode: (this: import("@playwright/test").ExpectMatcherState, component: FxInput, args_0?: VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -36,10 +36,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.toBeAutoMode = void 0;
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
41
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
42
|
-
exports.
|
|
42
|
+
exports.toBeAutoMode = (0, createAsyncMatcher_1.createComponentAsyncMatcher)('toBeAutoMode', function (component) { return component.autoButtonLocator; }, function (_a, options_1) { return __awaiter(void 0, [_a, options_1], void 0, function (_b, options) {
|
|
43
43
|
var isNot = _b.isNot, locator = _b.locator, component = _b.component;
|
|
44
44
|
return __generator(this, function (_c) {
|
|
45
45
|
switch (_c.label) {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RadioGroup } from '../../components';
|
|
2
|
+
import type { CheckedOptions } from '../../options';
|
|
3
|
+
export declare const toBeCheckedByIndex: (this: import("playwright/test").ExpectMatcherState, component: RadioGroup, args_0: number, args_1?: CheckedOptions | undefined) => Promise<import("playwright/test").MatcherReturnType>;
|
|
@@ -36,10 +36,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.toBeCheckedByIndex = void 0;
|
|
40
40
|
var extensions_1 = require("../../extensions");
|
|
41
41
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
42
|
-
exports.
|
|
42
|
+
exports.toBeCheckedByIndex = (0, createAsyncMatcher_1.createComponentAsyncMatcher)('toBeCheckedByIndex', function (component) { return component.rootLocator; }, function (_a, index_1, options_1) { return __awaiter(void 0, [_a, index_1, options_1], void 0, function (_b, index, options) {
|
|
43
43
|
var radio;
|
|
44
44
|
var isNot = _b.isNot, component = _b.component;
|
|
45
45
|
return __generator(this, function (_c) {
|
|
@@ -48,11 +48,11 @@ exports.toBeUncheckedByIndexEx = (0, createAsyncMatcher_1.createComponentAsyncMa
|
|
|
48
48
|
case 1:
|
|
49
49
|
radio = _c.sent();
|
|
50
50
|
if (!isNot) return [3 /*break*/, 3];
|
|
51
|
-
return [4 /*yield*/, (0, extensions_1.expect)(radio).not.
|
|
51
|
+
return [4 /*yield*/, (0, extensions_1.expect)(radio).not.toBeCheckedEx(options)];
|
|
52
52
|
case 2:
|
|
53
53
|
_c.sent();
|
|
54
54
|
return [3 /*break*/, 5];
|
|
55
|
-
case 3: return [4 /*yield*/, (0, extensions_1.expect)(radio).
|
|
55
|
+
case 3: return [4 /*yield*/, (0, extensions_1.expect)(radio).toBeCheckedEx(options)];
|
|
56
56
|
case 4:
|
|
57
57
|
_c.sent();
|
|
58
58
|
_c.label = 5;
|