@skbkontur/playwright-react-ui-components 1.13.2 → 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 +10 -10
- package/build/src/assertions/BaseComponentAssertions.js +11 -11
- package/build/src/assertions/ButtonAssertions.js +9 -9
- package/build/src/assertions/CheckboxAssertions.js +13 -13
- package/build/src/assertions/ComboBoxAssertions.js +17 -111
- package/build/src/assertions/ComponentListAssertions.js +6 -6
- package/build/src/assertions/CurrencyInputAssertions.js +11 -61
- package/build/src/assertions/DateInputAssertions.js +9 -9
- package/build/src/assertions/DatePickerAssertions.js +9 -9
- package/build/src/assertions/DateRangePickerAssertions.js +4 -25
- package/build/src/assertions/DropdownAssertions.js +13 -63
- package/build/src/assertions/DropdownMenuAssertions.js +11 -61
- package/build/src/assertions/FileUploaderAssertions.d.ts +1 -3
- package/build/src/assertions/FileUploaderAssertions.js +5 -22
- package/build/src/assertions/FxInputAssertions.js +11 -14
- package/build/src/assertions/InputAssertions.js +10 -10
- package/build/src/assertions/KebabAssertions.js +7 -58
- package/build/src/assertions/LabelAssertions.js +7 -7
- package/build/src/assertions/LinkAssertions.js +11 -12
- package/build/src/assertions/LoaderAssertions.js +2 -2
- package/build/src/assertions/MenuItemAssertations.js +5 -5
- package/build/src/assertions/PagingAssertions.js +5 -40
- package/build/src/assertions/PortalAssertions.js +3 -3
- package/build/src/assertions/RadioAssertions.js +13 -13
- package/build/src/assertions/RadioGroupAssertions.js +10 -81
- package/build/src/assertions/SelectAssertions.js +15 -64
- package/build/src/assertions/SpinnerAssertions.js +2 -2
- package/build/src/assertions/TabAssertions.js +11 -12
- package/build/src/assertions/TabsAssertions.js +4 -32
- package/build/src/assertions/TextareaAssertions.js +9 -9
- package/build/src/assertions/ToastAssertions.js +2 -2
- package/build/src/assertions/ToggleAssertions.js +11 -11
- package/build/src/assertions/TokenAssertions.js +8 -14
- package/build/src/assertions/TokenInputAssertions.js +8 -28
- package/build/src/assertions/TooltipAssertions.js +5 -5
- package/build/src/components/Autocomplete.d.ts +4 -0
- package/build/src/components/Autocomplete.js +52 -50
- package/build/src/components/BaseComponent.d.ts +4 -0
- package/build/src/components/BaseComponent.js +37 -30
- package/build/src/components/Button.d.ts +4 -0
- package/build/src/components/Button.js +25 -19
- package/build/src/components/Checkbox.d.ts +6 -0
- package/build/src/components/Checkbox.js +28 -36
- package/build/src/components/ComboBox.d.ts +8 -2
- package/build/src/components/ComboBox.js +67 -54
- package/build/src/components/ComponentList.d.ts +6 -3
- package/build/src/components/ComponentList.js +39 -50
- package/build/src/components/CurrencyInput.d.ts +4 -0
- package/build/src/components/CurrencyInput.js +39 -37
- package/build/src/components/DateInput.d.ts +4 -0
- package/build/src/components/DateInput.js +34 -32
- package/build/src/components/DatePicker.d.ts +4 -0
- package/build/src/components/DatePicker.js +35 -33
- package/build/src/components/DateRangePicker.d.ts +2 -0
- package/build/src/components/DateRangePicker.js +14 -10
- package/build/src/components/Dropdown.d.ts +7 -2
- package/build/src/components/Dropdown.js +68 -65
- package/build/src/components/DropdownMenu.d.ts +6 -2
- package/build/src/components/DropdownMenu.js +67 -65
- package/build/src/components/FileUploader.d.ts +3 -1
- package/build/src/components/FileUploader.js +39 -39
- package/build/src/components/FxInput.d.ts +4 -0
- package/build/src/components/FxInput.js +44 -42
- package/build/src/components/Input.d.ts +4 -0
- package/build/src/components/Input.js +37 -35
- package/build/src/components/Kebab.d.ts +5 -2
- package/build/src/components/Kebab.js +49 -48
- package/build/src/components/Label.d.ts +2 -0
- package/build/src/components/Label.js +9 -13
- package/build/src/components/Link.d.ts +4 -0
- package/build/src/components/Link.js +19 -25
- package/build/src/components/Loader.d.ts +2 -0
- package/build/src/components/Loader.js +15 -10
- package/build/src/components/MenuComponent.d.ts +10 -0
- package/build/src/components/MenuComponent.js +79 -0
- package/build/src/components/MenuItem.d.ts +2 -0
- package/build/src/components/MenuItem.js +7 -3
- package/build/src/components/Paging.d.ts +2 -0
- package/build/src/components/Paging.js +59 -52
- package/build/src/components/Portal.d.ts +2 -0
- package/build/src/components/Portal.js +14 -10
- package/build/src/components/Radio.d.ts +6 -0
- package/build/src/components/Radio.js +31 -27
- package/build/src/components/RadioGroup.d.ts +2 -0
- package/build/src/components/RadioGroup.js +51 -47
- package/build/src/components/Select.d.ts +5 -0
- package/build/src/components/Select.js +92 -76
- package/build/src/components/Spinner.d.ts +2 -0
- package/build/src/components/Spinner.js +13 -9
- package/build/src/components/Tab.d.ts +4 -0
- package/build/src/components/Tab.js +17 -27
- package/build/src/components/Textarea.d.ts +4 -0
- package/build/src/components/Textarea.js +33 -39
- package/build/src/components/Toast.d.ts +2 -0
- package/build/src/components/Toast.js +7 -3
- package/build/src/components/Toggle.d.ts +5 -0
- package/build/src/components/Toggle.js +24 -33
- package/build/src/components/Token.d.ts +3 -0
- package/build/src/components/Token.js +14 -9
- package/build/src/components/TokenInput.d.ts +4 -0
- package/build/src/components/TokenInput.js +61 -59
- package/build/src/components/Tooltip.d.ts +2 -0
- package/build/src/components/Tooltip.js +9 -9
- package/build/src/components/index.d.ts +1 -0
- package/build/src/components/index.js +3 -1
- package/build/src/extensions/index.d.ts +1 -0
- package/build/src/extensions/index.js +17 -0
- package/build/src/extensions/mergedExpects.d.ts +5 -0
- package/build/src/extensions/mergedExpects.js +7 -0
- package/build/src/index.d.ts +2 -0
- package/build/src/index.js +2 -0
- package/build/src/matchers/component/LocatorSymbols.d.ts +43 -0
- package/build/src/matchers/component/LocatorSymbols.js +13 -0
- package/build/src/matchers/component/toBeActiveTab.d.ts +3 -0
- package/build/src/matchers/component/toBeActiveTab.js +56 -0
- package/build/src/matchers/component/toBeAutoMode.d.ts +3 -0
- package/build/src/matchers/component/toBeAutoMode.js +62 -0
- package/build/src/matchers/component/toBeCheckedByIndex.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedByIndex.js +62 -0
- package/build/src/matchers/component/toBeCheckedByText.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedByText.js +62 -0
- package/build/src/matchers/component/toBeCheckedByValue.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedByValue.js +62 -0
- package/build/src/matchers/component/toBeCheckedEx.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedEx.js +56 -0
- package/build/src/matchers/component/toBeDisabledEx.d.ts +3 -0
- package/build/src/matchers/component/toBeDisabledEx.js +171 -0
- package/build/src/matchers/component/toBeEmptyEx.d.ts +3 -0
- package/build/src/matchers/component/toBeEmptyEx.js +136 -0
- package/build/src/matchers/component/toBeEnabledEx.d.ts +3 -0
- package/build/src/matchers/component/toBeEnabledEx.js +196 -0
- package/build/src/matchers/component/toBeFocusedEx.d.ts +3 -0
- package/build/src/matchers/component/toBeFocusedEx.js +56 -0
- package/build/src/matchers/component/toBeHiddenEx.d.ts +3 -0
- package/build/src/matchers/component/toBeHiddenEx.js +67 -0
- package/build/src/matchers/component/toBeInactiveTab.d.ts +3 -0
- package/build/src/matchers/component/toBeInactiveTab.js +56 -0
- package/build/src/matchers/component/toBeUnchecked.d.ts +3 -0
- package/build/src/matchers/component/toBeUnchecked.js +56 -0
- package/build/src/matchers/component/toBeUncheckedByIndex.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedByIndex.js +62 -0
- package/build/src/matchers/component/toBeUncheckedByText.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedByText.js +57 -0
- package/build/src/matchers/component/toBeUncheckedByValue.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedByValue.js +57 -0
- package/build/src/matchers/component/toBeVisibleEx.d.ts +3 -0
- package/build/src/matchers/component/toBeVisibleEx.js +67 -0
- package/build/src/matchers/component/toContainFormattedText.d.ts +3 -0
- package/build/src/matchers/component/toContainFormattedText.js +55 -0
- package/build/src/matchers/component/toContainItem.d.ts +4 -0
- package/build/src/matchers/component/toContainItem.js +78 -0
- package/build/src/matchers/component/toContainItems.d.ts +3 -0
- package/build/src/matchers/component/toContainItems.js +63 -0
- package/build/src/matchers/component/toContainSelectValue.d.ts +3 -0
- package/build/src/matchers/component/toContainSelectValue.js +55 -0
- package/build/src/matchers/component/toContainTabs.d.ts +3 -0
- package/build/src/matchers/component/toContainTabs.js +80 -0
- package/build/src/matchers/component/toContainTextEx.d.ts +3 -0
- package/build/src/matchers/component/toContainTextEx.js +56 -0
- package/build/src/matchers/component/toContainTokens.d.ts +4 -0
- package/build/src/matchers/component/toContainTokens.js +80 -0
- package/build/src/matchers/component/toContainUploadedFiles.d.ts +4 -0
- package/build/src/matchers/component/toContainUploadedFiles.js +75 -0
- package/build/src/matchers/component/toHaveActivePage.d.ts +4 -0
- package/build/src/matchers/component/toHaveActivePage.js +78 -0
- package/build/src/matchers/component/toHaveActiveTab.d.ts +2 -0
- package/build/src/matchers/component/toHaveActiveTab.js +62 -0
- package/build/src/matchers/component/toHaveAttributeEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveAttributeEx.js +62 -0
- package/build/src/matchers/component/toHaveCountEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveCountEx.js +56 -0
- package/build/src/matchers/component/toHaveError.d.ts +3 -0
- package/build/src/matchers/component/toHaveError.js +57 -0
- package/build/src/matchers/component/toHaveFormattedText.d.ts +3 -0
- package/build/src/matchers/component/toHaveFormattedText.js +56 -0
- package/build/src/matchers/component/toHaveFormattedValue.d.ts +3 -0
- package/build/src/matchers/component/toHaveFormattedValue.js +56 -0
- package/build/src/matchers/component/toHaveHref.d.ts +3 -0
- package/build/src/matchers/component/toHaveHref.js +55 -0
- package/build/src/matchers/component/toHaveItems.d.ts +3 -0
- package/build/src/matchers/component/toHaveItems.js +63 -0
- package/build/src/matchers/component/toHavePageCount.d.ts +4 -0
- package/build/src/matchers/component/toHavePageCount.js +71 -0
- package/build/src/matchers/component/toHaveTextEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveTextEx.js +56 -0
- package/build/src/matchers/component/toHaveValueEx.d.ts +6 -0
- package/build/src/matchers/component/toHaveValueEx.js +197 -0
- package/build/src/matchers/component/toHaveWarning.d.ts +3 -0
- package/build/src/matchers/component/toHaveWarning.js +57 -0
- package/build/src/matchers/componentMatchers.d.ts +104 -0
- package/build/src/matchers/componentMatchers.js +89 -0
- package/build/src/matchers/createAsyncMatcher.d.ts +72 -0
- package/build/src/matchers/createAsyncMatcher.js +180 -0
- package/build/src/matchers/formattedMatchers.d.ts +15 -31
- package/build/src/matchers/formattedMatchers.js +19 -15
- package/build/src/matchers/index.d.ts +1 -1
- package/build/src/matchers/index.js +1 -3
- package/build/src/utils/getMarcherResult.d.ts +13 -0
- package/build/src/utils/getMarcherResult.js +13 -0
- package/build/src/utils/index.d.ts +3 -0
- package/build/src/utils/index.js +3 -0
- package/build/src/utils/makeMatcher.d.ts +5 -0
- package/build/src/utils/makeMatcher.js +65 -0
- package/build/src/utils/toMatchMessage.d.ts +23 -0
- package/build/src/utils/toMatchMessage.js +89 -0
- package/package.json +1 -1
- package/build/src/matchers/mergedExpects.d.ts +0 -15
- package/build/src/matchers/mergedExpects.js +0 -6
|
@@ -50,46 +50,51 @@ 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
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
55
|
exports.DropdownMenu = void 0;
|
|
55
56
|
var test_1 = require("@playwright/test");
|
|
56
57
|
var react_ui_1 = require("@skbkontur/react-ui");
|
|
57
58
|
var MenuFooter_1 = require("@skbkontur/react-ui/components/MenuFooter");
|
|
58
59
|
var Portal_1 = require("./Portal");
|
|
59
|
-
var BaseComponent_1 = require("./BaseComponent");
|
|
60
60
|
var utils_1 = require("../utils");
|
|
61
61
|
var assertions_1 = require("../assertions");
|
|
62
62
|
var ComponentList_1 = require("./ComponentList");
|
|
63
63
|
var MenuItem_1 = require("./MenuItem");
|
|
64
64
|
var dataTidSelector_1 = require("../utils/dataTidSelector");
|
|
65
|
+
var MenuComponent_1 = require("./MenuComponent");
|
|
66
|
+
var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
|
|
65
67
|
var DropdownMenu = /** @class */ (function (_super) {
|
|
66
68
|
__extends(DropdownMenu, _super);
|
|
67
69
|
function DropdownMenu(rootLocator) {
|
|
68
70
|
var _this = _super.call(this, rootLocator) || this;
|
|
69
71
|
_this.rootLocator = rootLocator;
|
|
72
|
+
_this[_a] = function () { return _this.buttonLocator; };
|
|
73
|
+
_this[_b] = function () { return _this.getItemsLocator(); };
|
|
74
|
+
_this[_c] = function () { return _this.buttonLocator; };
|
|
70
75
|
_this.buttonLocator = rootLocator.locator('button');
|
|
71
76
|
_this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
|
|
72
77
|
return _this;
|
|
73
78
|
}
|
|
74
79
|
DropdownMenu.prototype.getText = function (options) {
|
|
75
80
|
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
-
return __generator(this, function (
|
|
77
|
-
switch (
|
|
81
|
+
return __generator(this, function (_d) {
|
|
82
|
+
switch (_d.label) {
|
|
78
83
|
case 0: return [4 /*yield*/, this.buttonLocator.innerText(options)];
|
|
79
|
-
case 1: return [2 /*return*/,
|
|
84
|
+
case 1: return [2 /*return*/, _d.sent()];
|
|
80
85
|
}
|
|
81
86
|
});
|
|
82
87
|
});
|
|
83
88
|
};
|
|
84
89
|
DropdownMenu.prototype.isMenuOpened = function () {
|
|
85
90
|
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
return __generator(this, function (
|
|
87
|
-
switch (
|
|
91
|
+
return __generator(this, function (_d) {
|
|
92
|
+
switch (_d.label) {
|
|
88
93
|
case 0: return [4 /*yield*/, this.waitFor()];
|
|
89
94
|
case 1:
|
|
90
|
-
|
|
95
|
+
_d.sent();
|
|
91
96
|
return [4 /*yield*/, this.portal.isVisible()];
|
|
92
|
-
case 2: return [2 /*return*/,
|
|
97
|
+
case 2: return [2 /*return*/, _d.sent()];
|
|
93
98
|
}
|
|
94
99
|
});
|
|
95
100
|
});
|
|
@@ -98,21 +103,21 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
98
103
|
return __awaiter(this, arguments, void 0, function (text, options) {
|
|
99
104
|
var items;
|
|
100
105
|
if (options === void 0) { options = { closedAfterSelect: true }; }
|
|
101
|
-
return __generator(this, function (
|
|
102
|
-
switch (
|
|
106
|
+
return __generator(this, function (_d) {
|
|
107
|
+
switch (_d.label) {
|
|
103
108
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
|
|
104
109
|
case 1:
|
|
105
|
-
items =
|
|
110
|
+
items = _d.sent();
|
|
106
111
|
return [4 /*yield*/, items.first().click()];
|
|
107
112
|
case 2:
|
|
108
|
-
|
|
113
|
+
_d.sent();
|
|
109
114
|
if (!options.closedAfterSelect) return [3 /*break*/, 4];
|
|
110
115
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
111
116
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
112
117
|
case 3:
|
|
113
118
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
_d.sent();
|
|
120
|
+
_d.label = 4;
|
|
116
121
|
case 4: return [2 /*return*/];
|
|
117
122
|
}
|
|
118
123
|
});
|
|
@@ -122,27 +127,27 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
122
127
|
return __awaiter(this, arguments, void 0, function (dataTid, options) {
|
|
123
128
|
var container, item;
|
|
124
129
|
if (options === void 0) { options = { closedAfterSelect: true }; }
|
|
125
|
-
return __generator(this, function (
|
|
126
|
-
switch (
|
|
130
|
+
return __generator(this, function (_d) {
|
|
131
|
+
switch (_d.label) {
|
|
127
132
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
128
133
|
case 1:
|
|
129
|
-
container =
|
|
134
|
+
container = _d.sent();
|
|
130
135
|
item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
|
|
131
136
|
return [4 /*yield*/, item.count()];
|
|
132
137
|
case 2:
|
|
133
|
-
if ((
|
|
138
|
+
if ((_d.sent()) > 1) {
|
|
134
139
|
throw Error('DataTid должен быть уникальным');
|
|
135
140
|
}
|
|
136
141
|
return [4 /*yield*/, item.click()];
|
|
137
142
|
case 3:
|
|
138
|
-
|
|
143
|
+
_d.sent();
|
|
139
144
|
if (!options.closedAfterSelect) return [3 /*break*/, 5];
|
|
140
145
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
141
146
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
142
147
|
case 4:
|
|
143
148
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
_d.sent();
|
|
150
|
+
_d.label = 5;
|
|
146
151
|
case 5: return [2 /*return*/];
|
|
147
152
|
}
|
|
148
153
|
});
|
|
@@ -152,21 +157,21 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
152
157
|
return __awaiter(this, arguments, void 0, function (index, options) {
|
|
153
158
|
var items;
|
|
154
159
|
if (options === void 0) { options = { closedAfterSelect: true }; }
|
|
155
|
-
return __generator(this, function (
|
|
156
|
-
switch (
|
|
160
|
+
return __generator(this, function (_d) {
|
|
161
|
+
switch (_d.label) {
|
|
157
162
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
|
|
158
163
|
case 1:
|
|
159
|
-
items =
|
|
164
|
+
items = _d.sent();
|
|
160
165
|
return [4 /*yield*/, items.nth(index).click()];
|
|
161
166
|
case 2:
|
|
162
|
-
|
|
167
|
+
_d.sent();
|
|
163
168
|
if (!options.closedAfterSelect) return [3 /*break*/, 4];
|
|
164
169
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
165
170
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
166
171
|
case 3:
|
|
167
172
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
_d.sent();
|
|
174
|
+
_d.label = 4;
|
|
170
175
|
case 4: return [2 /*return*/];
|
|
171
176
|
}
|
|
172
177
|
});
|
|
@@ -174,11 +179,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
174
179
|
};
|
|
175
180
|
DropdownMenu.prototype.click = function (options) {
|
|
176
181
|
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
-
return __generator(this, function (
|
|
178
|
-
switch (
|
|
182
|
+
return __generator(this, function (_d) {
|
|
183
|
+
switch (_d.label) {
|
|
179
184
|
case 0: return [4 /*yield*/, this.buttonLocator.click(options)];
|
|
180
185
|
case 1:
|
|
181
|
-
|
|
186
|
+
_d.sent();
|
|
182
187
|
return [2 /*return*/];
|
|
183
188
|
}
|
|
184
189
|
});
|
|
@@ -186,14 +191,14 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
186
191
|
};
|
|
187
192
|
DropdownMenu.prototype.focus = function (options) {
|
|
188
193
|
return __awaiter(this, void 0, void 0, function () {
|
|
189
|
-
return __generator(this, function (
|
|
190
|
-
switch (
|
|
194
|
+
return __generator(this, function (_d) {
|
|
195
|
+
switch (_d.label) {
|
|
191
196
|
case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
|
|
192
197
|
case 1:
|
|
193
|
-
|
|
198
|
+
_d.sent();
|
|
194
199
|
return [4 /*yield*/, this.buttonLocator.focus(options)];
|
|
195
200
|
case 2:
|
|
196
|
-
|
|
201
|
+
_d.sent();
|
|
197
202
|
return [2 /*return*/];
|
|
198
203
|
}
|
|
199
204
|
});
|
|
@@ -201,22 +206,18 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
201
206
|
};
|
|
202
207
|
DropdownMenu.prototype.blur = function (options) {
|
|
203
208
|
return __awaiter(this, void 0, void 0, function () {
|
|
204
|
-
return __generator(this, function (
|
|
205
|
-
switch (
|
|
209
|
+
return __generator(this, function (_d) {
|
|
210
|
+
switch (_d.label) {
|
|
206
211
|
case 0: return [4 /*yield*/, this.buttonLocator.blur(options)];
|
|
207
212
|
case 1:
|
|
208
|
-
|
|
213
|
+
_d.sent();
|
|
209
214
|
return [2 /*return*/];
|
|
210
215
|
}
|
|
211
216
|
});
|
|
212
217
|
});
|
|
213
218
|
};
|
|
214
219
|
DropdownMenu.prototype.getTooltip = function (type) {
|
|
215
|
-
return
|
|
216
|
-
return __generator(this, function (_a) {
|
|
217
|
-
return [2 /*return*/, (0, utils_1.getTooltip)(type, this)];
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
+
return (0, utils_1.getTooltip)(type, this);
|
|
220
221
|
};
|
|
221
222
|
/**
|
|
222
223
|
* Возвращает список меню по data-tid'ам из react-ui:
|
|
@@ -227,14 +228,14 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
227
228
|
DropdownMenu.prototype.getMenuItems = function () {
|
|
228
229
|
return __awaiter(this, void 0, void 0, function () {
|
|
229
230
|
var container;
|
|
230
|
-
return __generator(this, function (
|
|
231
|
-
switch (
|
|
231
|
+
return __generator(this, function (_d) {
|
|
232
|
+
switch (_d.label) {
|
|
232
233
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
233
234
|
case 1:
|
|
234
|
-
container =
|
|
235
|
+
container = _d.sent();
|
|
235
236
|
return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
|
|
236
237
|
case 2:
|
|
237
|
-
|
|
238
|
+
_d.sent();
|
|
238
239
|
return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
|
|
239
240
|
return locator
|
|
240
241
|
.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
|
|
@@ -249,23 +250,23 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
249
250
|
return __awaiter(this, void 0, void 0, function () {
|
|
250
251
|
var items;
|
|
251
252
|
var _this = this;
|
|
252
|
-
return __generator(this, function (
|
|
253
|
-
switch (
|
|
253
|
+
return __generator(this, function (_d) {
|
|
254
|
+
switch (_d.label) {
|
|
254
255
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
255
256
|
case 1:
|
|
256
|
-
items =
|
|
257
|
+
items = _d.sent();
|
|
257
258
|
return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
258
259
|
var itemText;
|
|
259
|
-
return __generator(this, function (
|
|
260
|
-
switch (
|
|
260
|
+
return __generator(this, function (_d) {
|
|
261
|
+
switch (_d.label) {
|
|
261
262
|
case 0: return [4 /*yield*/, item.getText()];
|
|
262
263
|
case 1:
|
|
263
|
-
itemText =
|
|
264
|
+
itemText = _d.sent();
|
|
264
265
|
return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
|
|
265
266
|
}
|
|
266
267
|
});
|
|
267
268
|
}); })];
|
|
268
|
-
case 2: return [2 /*return*/,
|
|
269
|
+
case 2: return [2 /*return*/, _d.sent()];
|
|
269
270
|
}
|
|
270
271
|
});
|
|
271
272
|
});
|
|
@@ -273,11 +274,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
273
274
|
DropdownMenu.prototype.getMenuItemByIndex = function (index) {
|
|
274
275
|
return __awaiter(this, void 0, void 0, function () {
|
|
275
276
|
var items;
|
|
276
|
-
return __generator(this, function (
|
|
277
|
-
switch (
|
|
277
|
+
return __generator(this, function (_d) {
|
|
278
|
+
switch (_d.label) {
|
|
278
279
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
279
280
|
case 1:
|
|
280
|
-
items =
|
|
281
|
+
items = _d.sent();
|
|
281
282
|
return [2 /*return*/, items.getItemByIndex(index)];
|
|
282
283
|
}
|
|
283
284
|
});
|
|
@@ -289,11 +290,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
289
290
|
DropdownMenu.prototype.getMenuItemsLocator = function (byText) {
|
|
290
291
|
return __awaiter(this, void 0, void 0, function () {
|
|
291
292
|
var container, items;
|
|
292
|
-
return __generator(this, function (
|
|
293
|
-
switch (
|
|
293
|
+
return __generator(this, function (_d) {
|
|
294
|
+
switch (_d.label) {
|
|
294
295
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
295
296
|
case 1:
|
|
296
|
-
container =
|
|
297
|
+
container = _d.sent();
|
|
297
298
|
items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
|
|
298
299
|
return [2 /*return*/, !byText ? items : items.getByText(byText)];
|
|
299
300
|
}
|
|
@@ -302,20 +303,21 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
302
303
|
};
|
|
303
304
|
DropdownMenu.prototype.getPortalContainer = function () {
|
|
304
305
|
return __awaiter(this, void 0, void 0, function () {
|
|
305
|
-
return __generator(this, function (
|
|
306
|
-
switch (
|
|
306
|
+
return __generator(this, function (_d) {
|
|
307
|
+
switch (_d.label) {
|
|
307
308
|
case 0: return [4 /*yield*/, this.isMenuOpened()];
|
|
308
309
|
case 1:
|
|
309
|
-
if (!!(
|
|
310
|
+
if (!!(_d.sent())) return [3 /*break*/, 3];
|
|
310
311
|
return [4 /*yield*/, this.buttonLocator.click()];
|
|
311
312
|
case 2:
|
|
312
|
-
|
|
313
|
-
|
|
313
|
+
_d.sent();
|
|
314
|
+
_d.label = 3;
|
|
314
315
|
case 3: return [2 /*return*/, this.portal.getContainer()];
|
|
315
316
|
}
|
|
316
317
|
});
|
|
317
318
|
});
|
|
318
319
|
};
|
|
319
320
|
return DropdownMenu;
|
|
320
|
-
}(
|
|
321
|
+
}(MenuComponent_1.MenuComponent));
|
|
321
322
|
exports.DropdownMenu = DropdownMenu;
|
|
323
|
+
_a = LocatorSymbols_1.toTextElementLocator, _b = LocatorSymbols_1.toItemsElementLocator, _c = LocatorSymbols_1.toFocusableElementLocator;
|
|
@@ -5,9 +5,11 @@ import { Label } from './Label';
|
|
|
5
5
|
import { type TooltipType } from '../utils';
|
|
6
6
|
import { FileUploaderAssertions } from '../assertions';
|
|
7
7
|
import type { ClickOptions, IsDisabledOptions, SetInputFilesOptions } from '../options';
|
|
8
|
+
import { toControlElementLocator } from '../matchers/component/LocatorSymbols';
|
|
8
9
|
export declare class FileUploader extends BaseComponent {
|
|
9
|
-
|
|
10
|
+
readonly inputLocator: Locator;
|
|
10
11
|
readonly files: ComponentList<File>;
|
|
12
|
+
readonly [toControlElementLocator]: () => Locator;
|
|
11
13
|
constructor(rootLocator: Locator);
|
|
12
14
|
isDisabled(options?: IsDisabledOptions): Promise<boolean>;
|
|
13
15
|
setInputFiles(files: string | ReadonlyArray<string> | {
|
|
@@ -50,6 +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
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
55
|
exports.FileUploader = void 0;
|
|
55
56
|
var BaseComponent_1 = require("./BaseComponent");
|
|
@@ -58,31 +59,33 @@ var Label_1 = require("./Label");
|
|
|
58
59
|
var utils_1 = require("../utils");
|
|
59
60
|
var assertions_1 = require("../assertions");
|
|
60
61
|
var dataTidSelector_1 = require("../utils/dataTidSelector");
|
|
62
|
+
var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
|
|
61
63
|
var FileUploader = /** @class */ (function (_super) {
|
|
62
64
|
__extends(FileUploader, _super);
|
|
63
65
|
function FileUploader(rootLocator) {
|
|
64
66
|
var _this = _super.call(this, rootLocator) || this;
|
|
67
|
+
_this[_a] = function () { return _this.inputLocator; };
|
|
65
68
|
_this.inputLocator = rootLocator.locator('input');
|
|
66
69
|
_this.files = new ComponentList_1.ComponentList(rootLocator, function (locator) { return locator.locator((0, dataTidSelector_1.getDataTidSelector)('FileUploader__file')); }, function (locator) { return new File(locator); });
|
|
67
70
|
return _this;
|
|
68
71
|
}
|
|
69
72
|
FileUploader.prototype.isDisabled = function (options) {
|
|
70
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
return __generator(this, function (
|
|
72
|
-
switch (
|
|
74
|
+
return __generator(this, function (_b) {
|
|
75
|
+
switch (_b.label) {
|
|
73
76
|
case 0: return [4 /*yield*/, this.inputLocator.isDisabled(options)];
|
|
74
|
-
case 1: return [2 /*return*/,
|
|
77
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
75
78
|
}
|
|
76
79
|
});
|
|
77
80
|
});
|
|
78
81
|
};
|
|
79
82
|
FileUploader.prototype.setInputFiles = function (files, options) {
|
|
80
83
|
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
-
return __generator(this, function (
|
|
82
|
-
switch (
|
|
84
|
+
return __generator(this, function (_b) {
|
|
85
|
+
switch (_b.label) {
|
|
83
86
|
case 0: return [4 /*yield*/, this.inputLocator.setInputFiles(files, options)];
|
|
84
87
|
case 1:
|
|
85
|
-
|
|
88
|
+
_b.sent();
|
|
86
89
|
return [2 /*return*/];
|
|
87
90
|
}
|
|
88
91
|
});
|
|
@@ -91,19 +94,19 @@ var FileUploader = /** @class */ (function (_super) {
|
|
|
91
94
|
FileUploader.prototype.removeAllFiles = function (options) {
|
|
92
95
|
return __awaiter(this, void 0, void 0, function () {
|
|
93
96
|
var files, i;
|
|
94
|
-
return __generator(this, function (
|
|
95
|
-
switch (
|
|
97
|
+
return __generator(this, function (_b) {
|
|
98
|
+
switch (_b.label) {
|
|
96
99
|
case 0: return [4 /*yield*/, this.files.getItems()];
|
|
97
100
|
case 1:
|
|
98
|
-
files =
|
|
101
|
+
files = _b.sent();
|
|
99
102
|
i = files.length - 1;
|
|
100
|
-
|
|
103
|
+
_b.label = 2;
|
|
101
104
|
case 2:
|
|
102
105
|
if (!(i >= 0)) return [3 /*break*/, 5];
|
|
103
106
|
return [4 /*yield*/, files[i].remove(options)];
|
|
104
107
|
case 3:
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
_b.sent();
|
|
109
|
+
_b.label = 4;
|
|
107
110
|
case 4:
|
|
108
111
|
i--;
|
|
109
112
|
return [3 /*break*/, 2];
|
|
@@ -116,24 +119,24 @@ var FileUploader = /** @class */ (function (_super) {
|
|
|
116
119
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
120
|
var file;
|
|
118
121
|
var _this = this;
|
|
119
|
-
return __generator(this, function (
|
|
120
|
-
switch (
|
|
122
|
+
return __generator(this, function (_b) {
|
|
123
|
+
switch (_b.label) {
|
|
121
124
|
case 0: return [4 /*yield*/, this.files.getFirstItemByPredicate(function (file) { return __awaiter(_this, void 0, void 0, function () {
|
|
122
125
|
var fileName;
|
|
123
|
-
return __generator(this, function (
|
|
124
|
-
switch (
|
|
126
|
+
return __generator(this, function (_b) {
|
|
127
|
+
switch (_b.label) {
|
|
125
128
|
case 0: return [4 /*yield*/, file.name.getText()];
|
|
126
129
|
case 1:
|
|
127
|
-
fileName =
|
|
130
|
+
fileName = _b.sent();
|
|
128
131
|
return [2 /*return*/, fileName.toLowerCase() === name.toLowerCase()];
|
|
129
132
|
}
|
|
130
133
|
});
|
|
131
134
|
}); })];
|
|
132
135
|
case 1:
|
|
133
|
-
file =
|
|
136
|
+
file = _b.sent();
|
|
134
137
|
return [4 /*yield*/, file.remove(options)];
|
|
135
138
|
case 2:
|
|
136
|
-
|
|
139
|
+
_b.sent();
|
|
137
140
|
return [2 /*return*/];
|
|
138
141
|
}
|
|
139
142
|
});
|
|
@@ -142,14 +145,14 @@ var FileUploader = /** @class */ (function (_super) {
|
|
|
142
145
|
FileUploader.prototype.removeFileByIndex = function (index, options) {
|
|
143
146
|
return __awaiter(this, void 0, void 0, function () {
|
|
144
147
|
var file;
|
|
145
|
-
return __generator(this, function (
|
|
146
|
-
switch (
|
|
148
|
+
return __generator(this, function (_b) {
|
|
149
|
+
switch (_b.label) {
|
|
147
150
|
case 0: return [4 /*yield*/, this.files.getItemByIndex(index)];
|
|
148
151
|
case 1:
|
|
149
|
-
file =
|
|
152
|
+
file = _b.sent();
|
|
150
153
|
return [4 /*yield*/, file.remove(options)];
|
|
151
154
|
case 2:
|
|
152
|
-
|
|
155
|
+
_b.sent();
|
|
153
156
|
return [2 /*return*/];
|
|
154
157
|
}
|
|
155
158
|
});
|
|
@@ -159,35 +162,32 @@ var FileUploader = /** @class */ (function (_super) {
|
|
|
159
162
|
return __awaiter(this, void 0, void 0, function () {
|
|
160
163
|
var files;
|
|
161
164
|
var _this = this;
|
|
162
|
-
return __generator(this, function (
|
|
163
|
-
switch (
|
|
165
|
+
return __generator(this, function (_b) {
|
|
166
|
+
switch (_b.label) {
|
|
164
167
|
case 0: return [4 /*yield*/, this.files.getItems()];
|
|
165
168
|
case 1:
|
|
166
|
-
files =
|
|
167
|
-
return [4 /*yield*/, Promise.all(files.map(function (file) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (
|
|
168
|
-
switch (
|
|
169
|
+
files = _b.sent();
|
|
170
|
+
return [4 /*yield*/, Promise.all(files.map(function (file) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
|
|
171
|
+
switch (_b.label) {
|
|
169
172
|
case 0: return [4 /*yield*/, file.name.getText()];
|
|
170
|
-
case 1: return [2 /*return*/,
|
|
173
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
171
174
|
}
|
|
172
175
|
}); }); }))];
|
|
173
|
-
case 2: return [2 /*return*/,
|
|
176
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
174
177
|
}
|
|
175
178
|
});
|
|
176
179
|
});
|
|
177
180
|
};
|
|
178
181
|
FileUploader.prototype.getTooltip = function (type) {
|
|
179
|
-
return
|
|
180
|
-
return __generator(this, function (_a) {
|
|
181
|
-
return [2 /*return*/, (0, utils_1.getTooltip)(type, this)];
|
|
182
|
-
});
|
|
183
|
-
});
|
|
182
|
+
return (0, utils_1.getTooltip)(type, this);
|
|
184
183
|
};
|
|
185
184
|
FileUploader.prototype.expect = function () {
|
|
186
|
-
return new assertions_1.FileUploaderAssertions(this
|
|
185
|
+
return new assertions_1.FileUploaderAssertions(this);
|
|
187
186
|
};
|
|
188
187
|
return FileUploader;
|
|
189
188
|
}(BaseComponent_1.BaseComponent));
|
|
190
189
|
exports.FileUploader = FileUploader;
|
|
190
|
+
_a = LocatorSymbols_1.toControlElementLocator;
|
|
191
191
|
var File = /** @class */ (function (_super) {
|
|
192
192
|
__extends(File, _super);
|
|
193
193
|
function File(rootLocator) {
|
|
@@ -199,11 +199,11 @@ var File = /** @class */ (function (_super) {
|
|
|
199
199
|
}
|
|
200
200
|
File.prototype.remove = function (options) {
|
|
201
201
|
return __awaiter(this, void 0, void 0, function () {
|
|
202
|
-
return __generator(this, function (
|
|
203
|
-
switch (
|
|
202
|
+
return __generator(this, function (_b) {
|
|
203
|
+
switch (_b.label) {
|
|
204
204
|
case 0: return [4 /*yield*/, this.icon.click(options)];
|
|
205
205
|
case 1:
|
|
206
|
-
|
|
206
|
+
_b.sent();
|
|
207
207
|
return [2 /*return*/];
|
|
208
208
|
}
|
|
209
209
|
});
|
|
@@ -3,9 +3,13 @@ import { BaseComponent } from './BaseComponent';
|
|
|
3
3
|
import { type TooltipType } from '../utils';
|
|
4
4
|
import { FxInputAssertions } from '../assertions';
|
|
5
5
|
import type { BlurOptions, ClearOptions, ClickOptions, FillOptions, FocusOptions, InputValueOptions, IsDisabledOptions, IsVisibleOptions, PressOptions, PressSequentiallyOptions } from '../options';
|
|
6
|
+
import { toControlElementLocator, toValueElementLocator, toFocusableElementLocator } from '../matchers/component/LocatorSymbols';
|
|
6
7
|
export declare class FxInput extends BaseComponent {
|
|
7
8
|
readonly autoButtonLocator: Locator;
|
|
8
9
|
readonly inputLocator: Locator;
|
|
10
|
+
readonly [toControlElementLocator]: () => Locator;
|
|
11
|
+
readonly [toValueElementLocator]: () => Locator;
|
|
12
|
+
readonly [toFocusableElementLocator]: () => Locator;
|
|
9
13
|
constructor(rootLocator: Locator);
|
|
10
14
|
isDisabled(options?: IsDisabledOptions): Promise<boolean>;
|
|
11
15
|
getValue(options?: InputValueOptions): Promise<string>;
|