@skbkontur/playwright-react-ui-components 1.13.2 → 1.14.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/assertions/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 +9 -2
- package/build/src/components/ComboBox.js +68 -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 +8 -2
- package/build/src/components/Dropdown.js +69 -65
- package/build/src/components/DropdownMenu.d.ts +7 -2
- package/build/src/components/DropdownMenu.js +68 -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 +6 -2
- package/build/src/components/Kebab.js +50 -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 +9 -0
- package/build/src/components/MenuComponent.js +78 -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/toBeActiveEx.d.ts +3 -0
- package/build/src/matchers/component/toBeActiveEx.js +56 -0
- package/build/src/matchers/component/toBeAutoEx.d.ts +3 -0
- package/build/src/matchers/component/toBeAutoEx.js +62 -0
- package/build/src/matchers/component/toBeCheckedByIndexEx.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedByIndexEx.js +62 -0
- package/build/src/matchers/component/toBeCheckedByTextEx.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedByTextEx.js +62 -0
- package/build/src/matchers/component/toBeCheckedByValueEx.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedByValueEx.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 +172 -0
- package/build/src/matchers/component/toBeEmptyEx.d.ts +3 -0
- package/build/src/matchers/component/toBeEmptyEx.js +137 -0
- package/build/src/matchers/component/toBeEnabledEx.d.ts +3 -0
- package/build/src/matchers/component/toBeEnabledEx.js +206 -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 +68 -0
- package/build/src/matchers/component/toBeInactiveEx.d.ts +3 -0
- package/build/src/matchers/component/toBeInactiveEx.js +56 -0
- package/build/src/matchers/component/toBeUncheckedByIndexEx.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedByIndexEx.js +62 -0
- package/build/src/matchers/component/toBeUncheckedByTextEx.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedByTextEx.js +57 -0
- package/build/src/matchers/component/toBeUncheckedByValueEx.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedByValueEx.js +57 -0
- package/build/src/matchers/component/toBeUncheckedEx.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedEx.js +56 -0
- package/build/src/matchers/component/toBeVisibleEx.d.ts +3 -0
- package/build/src/matchers/component/toBeVisibleEx.js +68 -0
- package/build/src/matchers/component/toContainFormattedTextEx.d.ts +3 -0
- package/build/src/matchers/component/toContainFormattedTextEx.js +55 -0
- package/build/src/matchers/component/toContainItemEx.d.ts +4 -0
- package/build/src/matchers/component/toContainItemEx.js +79 -0
- package/build/src/matchers/component/toContainItemsEx.d.ts +3 -0
- package/build/src/matchers/component/toContainItemsEx.js +63 -0
- package/build/src/matchers/component/toContainTabsEx.d.ts +3 -0
- package/build/src/matchers/component/toContainTabsEx.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/toContainTokensEx.d.ts +4 -0
- package/build/src/matchers/component/toContainTokensEx.js +80 -0
- package/build/src/matchers/component/toContainUploadedFilesEx.d.ts +4 -0
- package/build/src/matchers/component/toContainUploadedFilesEx.js +75 -0
- package/build/src/matchers/component/toContainValueEx.d.ts +3 -0
- package/build/src/matchers/component/toContainValueEx.js +55 -0
- package/build/src/matchers/component/toHaveActivePageEx.d.ts +4 -0
- package/build/src/matchers/component/toHaveActivePageEx.js +78 -0
- package/build/src/matchers/component/toHaveActiveTabEx.d.ts +2 -0
- package/build/src/matchers/component/toHaveActiveTabEx.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/toHaveErrorEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveErrorEx.js +57 -0
- package/build/src/matchers/component/toHaveFormattedTextEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveFormattedTextEx.js +56 -0
- package/build/src/matchers/component/toHaveFormattedValueEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveFormattedValueEx.js +56 -0
- package/build/src/matchers/component/toHaveHrefEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveHrefEx.js +55 -0
- package/build/src/matchers/component/toHaveItemsEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveItemsEx.js +63 -0
- package/build/src/matchers/component/toHavePageCountEx.d.ts +4 -0
- package/build/src/matchers/component/toHavePageCountEx.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 +198 -0
- package/build/src/matchers/component/toHaveWarningEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveWarningEx.js +57 -0
- package/build/src/matchers/componentMatchers.d.ts +104 -0
- package/build/src/matchers/componentMatchers.js +83 -0
- package/build/src/matchers/createAsyncMatcher.d.ts +47 -0
- package/build/src/matchers/createAsyncMatcher.js +155 -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/is.d.ts +3 -0
- package/build/src/utils/is.js +5 -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 +12 -0
- package/build/src/utils/toMatchMessage.js +78 -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,52 @@ 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
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.rootLocator; };
|
|
75
|
+
_this[_d] = function () { return _this.buttonLocator; };
|
|
70
76
|
_this.buttonLocator = rootLocator.locator('button');
|
|
71
77
|
_this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
|
|
72
78
|
return _this;
|
|
73
79
|
}
|
|
74
80
|
DropdownMenu.prototype.getText = function (options) {
|
|
75
81
|
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
-
return __generator(this, function (
|
|
77
|
-
switch (
|
|
82
|
+
return __generator(this, function (_e) {
|
|
83
|
+
switch (_e.label) {
|
|
78
84
|
case 0: return [4 /*yield*/, this.buttonLocator.innerText(options)];
|
|
79
|
-
case 1: return [2 /*return*/,
|
|
85
|
+
case 1: return [2 /*return*/, _e.sent()];
|
|
80
86
|
}
|
|
81
87
|
});
|
|
82
88
|
});
|
|
83
89
|
};
|
|
84
90
|
DropdownMenu.prototype.isMenuOpened = function () {
|
|
85
91
|
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
return __generator(this, function (
|
|
87
|
-
switch (
|
|
92
|
+
return __generator(this, function (_e) {
|
|
93
|
+
switch (_e.label) {
|
|
88
94
|
case 0: return [4 /*yield*/, this.waitFor()];
|
|
89
95
|
case 1:
|
|
90
|
-
|
|
96
|
+
_e.sent();
|
|
91
97
|
return [4 /*yield*/, this.portal.isVisible()];
|
|
92
|
-
case 2: return [2 /*return*/,
|
|
98
|
+
case 2: return [2 /*return*/, _e.sent()];
|
|
93
99
|
}
|
|
94
100
|
});
|
|
95
101
|
});
|
|
@@ -98,21 +104,21 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
98
104
|
return __awaiter(this, arguments, void 0, function (text, options) {
|
|
99
105
|
var items;
|
|
100
106
|
if (options === void 0) { options = { closedAfterSelect: true }; }
|
|
101
|
-
return __generator(this, function (
|
|
102
|
-
switch (
|
|
107
|
+
return __generator(this, function (_e) {
|
|
108
|
+
switch (_e.label) {
|
|
103
109
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
|
|
104
110
|
case 1:
|
|
105
|
-
items =
|
|
111
|
+
items = _e.sent();
|
|
106
112
|
return [4 /*yield*/, items.first().click()];
|
|
107
113
|
case 2:
|
|
108
|
-
|
|
114
|
+
_e.sent();
|
|
109
115
|
if (!options.closedAfterSelect) return [3 /*break*/, 4];
|
|
110
116
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
111
117
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
112
118
|
case 3:
|
|
113
119
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
_e.sent();
|
|
121
|
+
_e.label = 4;
|
|
116
122
|
case 4: return [2 /*return*/];
|
|
117
123
|
}
|
|
118
124
|
});
|
|
@@ -122,27 +128,27 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
122
128
|
return __awaiter(this, arguments, void 0, function (dataTid, options) {
|
|
123
129
|
var container, item;
|
|
124
130
|
if (options === void 0) { options = { closedAfterSelect: true }; }
|
|
125
|
-
return __generator(this, function (
|
|
126
|
-
switch (
|
|
131
|
+
return __generator(this, function (_e) {
|
|
132
|
+
switch (_e.label) {
|
|
127
133
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
128
134
|
case 1:
|
|
129
|
-
container =
|
|
135
|
+
container = _e.sent();
|
|
130
136
|
item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
|
|
131
137
|
return [4 /*yield*/, item.count()];
|
|
132
138
|
case 2:
|
|
133
|
-
if ((
|
|
139
|
+
if ((_e.sent()) > 1) {
|
|
134
140
|
throw Error('DataTid должен быть уникальным');
|
|
135
141
|
}
|
|
136
142
|
return [4 /*yield*/, item.click()];
|
|
137
143
|
case 3:
|
|
138
|
-
|
|
144
|
+
_e.sent();
|
|
139
145
|
if (!options.closedAfterSelect) return [3 /*break*/, 5];
|
|
140
146
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
141
147
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
142
148
|
case 4:
|
|
143
149
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
144
|
-
|
|
145
|
-
|
|
150
|
+
_e.sent();
|
|
151
|
+
_e.label = 5;
|
|
146
152
|
case 5: return [2 /*return*/];
|
|
147
153
|
}
|
|
148
154
|
});
|
|
@@ -152,21 +158,21 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
152
158
|
return __awaiter(this, arguments, void 0, function (index, options) {
|
|
153
159
|
var items;
|
|
154
160
|
if (options === void 0) { options = { closedAfterSelect: true }; }
|
|
155
|
-
return __generator(this, function (
|
|
156
|
-
switch (
|
|
161
|
+
return __generator(this, function (_e) {
|
|
162
|
+
switch (_e.label) {
|
|
157
163
|
case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
|
|
158
164
|
case 1:
|
|
159
|
-
items =
|
|
165
|
+
items = _e.sent();
|
|
160
166
|
return [4 /*yield*/, items.nth(index).click()];
|
|
161
167
|
case 2:
|
|
162
|
-
|
|
168
|
+
_e.sent();
|
|
163
169
|
if (!options.closedAfterSelect) return [3 /*break*/, 4];
|
|
164
170
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
165
171
|
return [4 /*yield*/, this.portal.expect().toBeHidden()];
|
|
166
172
|
case 3:
|
|
167
173
|
// note: ожидание закрытия меню, чтобы не было гонок
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
_e.sent();
|
|
175
|
+
_e.label = 4;
|
|
170
176
|
case 4: return [2 /*return*/];
|
|
171
177
|
}
|
|
172
178
|
});
|
|
@@ -174,11 +180,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
174
180
|
};
|
|
175
181
|
DropdownMenu.prototype.click = function (options) {
|
|
176
182
|
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
-
return __generator(this, function (
|
|
178
|
-
switch (
|
|
183
|
+
return __generator(this, function (_e) {
|
|
184
|
+
switch (_e.label) {
|
|
179
185
|
case 0: return [4 /*yield*/, this.buttonLocator.click(options)];
|
|
180
186
|
case 1:
|
|
181
|
-
|
|
187
|
+
_e.sent();
|
|
182
188
|
return [2 /*return*/];
|
|
183
189
|
}
|
|
184
190
|
});
|
|
@@ -186,14 +192,14 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
186
192
|
};
|
|
187
193
|
DropdownMenu.prototype.focus = function (options) {
|
|
188
194
|
return __awaiter(this, void 0, void 0, function () {
|
|
189
|
-
return __generator(this, function (
|
|
190
|
-
switch (
|
|
195
|
+
return __generator(this, function (_e) {
|
|
196
|
+
switch (_e.label) {
|
|
191
197
|
case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
|
|
192
198
|
case 1:
|
|
193
|
-
|
|
199
|
+
_e.sent();
|
|
194
200
|
return [4 /*yield*/, this.buttonLocator.focus(options)];
|
|
195
201
|
case 2:
|
|
196
|
-
|
|
202
|
+
_e.sent();
|
|
197
203
|
return [2 /*return*/];
|
|
198
204
|
}
|
|
199
205
|
});
|
|
@@ -201,22 +207,18 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
201
207
|
};
|
|
202
208
|
DropdownMenu.prototype.blur = function (options) {
|
|
203
209
|
return __awaiter(this, void 0, void 0, function () {
|
|
204
|
-
return __generator(this, function (
|
|
205
|
-
switch (
|
|
210
|
+
return __generator(this, function (_e) {
|
|
211
|
+
switch (_e.label) {
|
|
206
212
|
case 0: return [4 /*yield*/, this.buttonLocator.blur(options)];
|
|
207
213
|
case 1:
|
|
208
|
-
|
|
214
|
+
_e.sent();
|
|
209
215
|
return [2 /*return*/];
|
|
210
216
|
}
|
|
211
217
|
});
|
|
212
218
|
});
|
|
213
219
|
};
|
|
214
220
|
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
|
-
});
|
|
221
|
+
return (0, utils_1.getTooltip)(type, this);
|
|
220
222
|
};
|
|
221
223
|
/**
|
|
222
224
|
* Возвращает список меню по data-tid'ам из react-ui:
|
|
@@ -227,14 +229,14 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
227
229
|
DropdownMenu.prototype.getMenuItems = function () {
|
|
228
230
|
return __awaiter(this, void 0, void 0, function () {
|
|
229
231
|
var container;
|
|
230
|
-
return __generator(this, function (
|
|
231
|
-
switch (
|
|
232
|
+
return __generator(this, function (_e) {
|
|
233
|
+
switch (_e.label) {
|
|
232
234
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
233
235
|
case 1:
|
|
234
|
-
container =
|
|
236
|
+
container = _e.sent();
|
|
235
237
|
return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
|
|
236
238
|
case 2:
|
|
237
|
-
|
|
239
|
+
_e.sent();
|
|
238
240
|
return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
|
|
239
241
|
return locator
|
|
240
242
|
.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
|
|
@@ -249,23 +251,23 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
249
251
|
return __awaiter(this, void 0, void 0, function () {
|
|
250
252
|
var items;
|
|
251
253
|
var _this = this;
|
|
252
|
-
return __generator(this, function (
|
|
253
|
-
switch (
|
|
254
|
+
return __generator(this, function (_e) {
|
|
255
|
+
switch (_e.label) {
|
|
254
256
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
255
257
|
case 1:
|
|
256
|
-
items =
|
|
258
|
+
items = _e.sent();
|
|
257
259
|
return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
258
260
|
var itemText;
|
|
259
|
-
return __generator(this, function (
|
|
260
|
-
switch (
|
|
261
|
+
return __generator(this, function (_e) {
|
|
262
|
+
switch (_e.label) {
|
|
261
263
|
case 0: return [4 /*yield*/, item.getText()];
|
|
262
264
|
case 1:
|
|
263
|
-
itemText =
|
|
265
|
+
itemText = _e.sent();
|
|
264
266
|
return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
|
|
265
267
|
}
|
|
266
268
|
});
|
|
267
269
|
}); })];
|
|
268
|
-
case 2: return [2 /*return*/,
|
|
270
|
+
case 2: return [2 /*return*/, _e.sent()];
|
|
269
271
|
}
|
|
270
272
|
});
|
|
271
273
|
});
|
|
@@ -273,11 +275,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
273
275
|
DropdownMenu.prototype.getMenuItemByIndex = function (index) {
|
|
274
276
|
return __awaiter(this, void 0, void 0, function () {
|
|
275
277
|
var items;
|
|
276
|
-
return __generator(this, function (
|
|
277
|
-
switch (
|
|
278
|
+
return __generator(this, function (_e) {
|
|
279
|
+
switch (_e.label) {
|
|
278
280
|
case 0: return [4 /*yield*/, this.getMenuItems()];
|
|
279
281
|
case 1:
|
|
280
|
-
items =
|
|
282
|
+
items = _e.sent();
|
|
281
283
|
return [2 /*return*/, items.getItemByIndex(index)];
|
|
282
284
|
}
|
|
283
285
|
});
|
|
@@ -289,11 +291,11 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
289
291
|
DropdownMenu.prototype.getMenuItemsLocator = function (byText) {
|
|
290
292
|
return __awaiter(this, void 0, void 0, function () {
|
|
291
293
|
var container, items;
|
|
292
|
-
return __generator(this, function (
|
|
293
|
-
switch (
|
|
294
|
+
return __generator(this, function (_e) {
|
|
295
|
+
switch (_e.label) {
|
|
294
296
|
case 0: return [4 /*yield*/, this.getPortalContainer()];
|
|
295
297
|
case 1:
|
|
296
|
-
container =
|
|
298
|
+
container = _e.sent();
|
|
297
299
|
items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
|
|
298
300
|
return [2 /*return*/, !byText ? items : items.getByText(byText)];
|
|
299
301
|
}
|
|
@@ -302,20 +304,21 @@ var DropdownMenu = /** @class */ (function (_super) {
|
|
|
302
304
|
};
|
|
303
305
|
DropdownMenu.prototype.getPortalContainer = function () {
|
|
304
306
|
return __awaiter(this, void 0, void 0, function () {
|
|
305
|
-
return __generator(this, function (
|
|
306
|
-
switch (
|
|
307
|
+
return __generator(this, function (_e) {
|
|
308
|
+
switch (_e.label) {
|
|
307
309
|
case 0: return [4 /*yield*/, this.isMenuOpened()];
|
|
308
310
|
case 1:
|
|
309
|
-
if (!!(
|
|
311
|
+
if (!!(_e.sent())) return [3 /*break*/, 3];
|
|
310
312
|
return [4 /*yield*/, this.buttonLocator.click()];
|
|
311
313
|
case 2:
|
|
312
|
-
|
|
313
|
-
|
|
314
|
+
_e.sent();
|
|
315
|
+
_e.label = 3;
|
|
314
316
|
case 3: return [2 /*return*/, this.portal.getContainer()];
|
|
315
317
|
}
|
|
316
318
|
});
|
|
317
319
|
});
|
|
318
320
|
};
|
|
319
321
|
return DropdownMenu;
|
|
320
|
-
}(
|
|
322
|
+
}(MenuComponent_1.MenuComponent));
|
|
321
323
|
exports.DropdownMenu = DropdownMenu;
|
|
324
|
+
_a = LocatorSymbols_1.toTextElementLocator, _b = LocatorSymbols_1.toItemsElementLocator, _c = LocatorSymbols_1.toContainItemElementLocator, _d = 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>;
|