@skbkontur/playwright-react-ui-components 1.13.0

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.
Files changed (165) hide show
  1. package/build/index.d.ts +1 -0
  2. package/build/index.js +17 -0
  3. package/build/src/assertions/AutocompleteAssertions.d.ts +19 -0
  4. package/build/src/assertions/AutocompleteAssertions.js +177 -0
  5. package/build/src/assertions/BaseComponentAssertions.d.ts +15 -0
  6. package/build/src/assertions/BaseComponentAssertions.js +158 -0
  7. package/build/src/assertions/ButtonAssertions.d.ts +15 -0
  8. package/build/src/assertions/ButtonAssertions.js +162 -0
  9. package/build/src/assertions/CheckboxAssertions.d.ts +19 -0
  10. package/build/src/assertions/CheckboxAssertions.js +210 -0
  11. package/build/src/assertions/ComboBoxAssertions.d.ts +19 -0
  12. package/build/src/assertions/ComboBoxAssertions.js +304 -0
  13. package/build/src/assertions/ComponentListAssertions.d.ts +13 -0
  14. package/build/src/assertions/ComponentListAssertions.js +126 -0
  15. package/build/src/assertions/CurrencyInputAssertions.d.ts +15 -0
  16. package/build/src/assertions/CurrencyInputAssertions.js +212 -0
  17. package/build/src/assertions/DateInputAssertions.d.ts +15 -0
  18. package/build/src/assertions/DateInputAssertions.js +162 -0
  19. package/build/src/assertions/DatePickerAssertions.d.ts +15 -0
  20. package/build/src/assertions/DatePickerAssertions.js +162 -0
  21. package/build/src/assertions/DateRangePickerAssertions.d.ts +11 -0
  22. package/build/src/assertions/DateRangePickerAssertions.js +111 -0
  23. package/build/src/assertions/DropdownAssertions.d.ts +19 -0
  24. package/build/src/assertions/DropdownAssertions.js +260 -0
  25. package/build/src/assertions/DropdownMenuAssertions.d.ts +17 -0
  26. package/build/src/assertions/DropdownMenuAssertions.js +236 -0
  27. package/build/src/assertions/FileUploaderAssertions.d.ts +14 -0
  28. package/build/src/assertions/FileUploaderAssertions.js +119 -0
  29. package/build/src/assertions/FxInputAssertions.d.ts +17 -0
  30. package/build/src/assertions/FxInputAssertions.js +189 -0
  31. package/build/src/assertions/InputAssertions.d.ts +19 -0
  32. package/build/src/assertions/InputAssertions.js +177 -0
  33. package/build/src/assertions/KebabAssertions.d.ts +13 -0
  34. package/build/src/assertions/KebabAssertions.js +189 -0
  35. package/build/src/assertions/LabelAssertions.d.ts +19 -0
  36. package/build/src/assertions/LabelAssertions.js +144 -0
  37. package/build/src/assertions/LinkAssertions.d.ts +17 -0
  38. package/build/src/assertions/LinkAssertions.js +187 -0
  39. package/build/src/assertions/LoaderAssertions.d.ts +8 -0
  40. package/build/src/assertions/LoaderAssertions.js +78 -0
  41. package/build/src/assertions/MenuItemAssertations.d.ts +11 -0
  42. package/build/src/assertions/MenuItemAssertations.js +114 -0
  43. package/build/src/assertions/PagingAssertions.d.ts +15 -0
  44. package/build/src/assertions/PagingAssertions.js +149 -0
  45. package/build/src/assertions/PortalAssertions.d.ts +9 -0
  46. package/build/src/assertions/PortalAssertions.js +90 -0
  47. package/build/src/assertions/RadioAssertions.d.ts +19 -0
  48. package/build/src/assertions/RadioAssertions.js +210 -0
  49. package/build/src/assertions/RadioGroupAssertions.d.ts +15 -0
  50. package/build/src/assertions/RadioGroupAssertions.js +233 -0
  51. package/build/src/assertions/SelectAssertions.d.ts +15 -0
  52. package/build/src/assertions/SelectAssertions.js +211 -0
  53. package/build/src/assertions/SpinnerAssertions.d.ts +8 -0
  54. package/build/src/assertions/SpinnerAssertions.js +78 -0
  55. package/build/src/assertions/TabAssertions.d.ts +17 -0
  56. package/build/src/assertions/TabAssertions.js +187 -0
  57. package/build/src/assertions/TabsAssertions.d.ts +11 -0
  58. package/build/src/assertions/TabsAssertions.js +130 -0
  59. package/build/src/assertions/TextareaAssertions.d.ts +15 -0
  60. package/build/src/assertions/TextareaAssertions.js +162 -0
  61. package/build/src/assertions/ToastAssertions.d.ts +8 -0
  62. package/build/src/assertions/ToastAssertions.js +78 -0
  63. package/build/src/assertions/ToggleAssertions.d.ts +17 -0
  64. package/build/src/assertions/ToggleAssertions.js +186 -0
  65. package/build/src/assertions/TokenAssertions.d.ts +17 -0
  66. package/build/src/assertions/TokenAssertions.js +159 -0
  67. package/build/src/assertions/TokenInputAssertions.d.ts +16 -0
  68. package/build/src/assertions/TokenInputAssertions.js +170 -0
  69. package/build/src/assertions/TooltipAssertions.d.ts +11 -0
  70. package/build/src/assertions/TooltipAssertions.js +114 -0
  71. package/build/src/assertions/index.d.ts +34 -0
  72. package/build/src/assertions/index.js +71 -0
  73. package/build/src/components/Autocomplete.d.ts +25 -0
  74. package/build/src/components/Autocomplete.js +256 -0
  75. package/build/src/components/BaseComponent.d.ts +18 -0
  76. package/build/src/components/BaseComponent.js +159 -0
  77. package/build/src/components/Button.d.ts +21 -0
  78. package/build/src/components/Button.js +146 -0
  79. package/build/src/components/Checkbox.d.ts +21 -0
  80. package/build/src/components/Checkbox.js +161 -0
  81. package/build/src/components/ComboBox.d.ts +41 -0
  82. package/build/src/components/ComboBox.js +292 -0
  83. package/build/src/components/ComponentList.d.ts +21 -0
  84. package/build/src/components/ComponentList.js +203 -0
  85. package/build/src/components/CurrencyInput.d.ts +21 -0
  86. package/build/src/components/CurrencyInput.js +201 -0
  87. package/build/src/components/DateInput.d.ts +18 -0
  88. package/build/src/components/DateInput.js +195 -0
  89. package/build/src/components/DatePicker.d.ts +20 -0
  90. package/build/src/components/DatePicker.js +205 -0
  91. package/build/src/components/DateRangePicker.d.ts +20 -0
  92. package/build/src/components/DateRangePicker.js +111 -0
  93. package/build/src/components/Dropdown.d.ts +35 -0
  94. package/build/src/components/Dropdown.js +322 -0
  95. package/build/src/components/DropdownMenu.d.ts +40 -0
  96. package/build/src/components/DropdownMenu.js +321 -0
  97. package/build/src/components/FileUploader.d.ts +54 -0
  98. package/build/src/components/FileUploader.js +213 -0
  99. package/build/src/components/FxInput.d.ts +23 -0
  100. package/build/src/components/FxInput.js +217 -0
  101. package/build/src/components/Input.d.ts +21 -0
  102. package/build/src/components/Input.js +192 -0
  103. package/build/src/components/Kebab.d.ts +27 -0
  104. package/build/src/components/Kebab.js +247 -0
  105. package/build/src/components/Label.d.ts +13 -0
  106. package/build/src/components/Label.js +94 -0
  107. package/build/src/components/Link.d.ts +16 -0
  108. package/build/src/components/Link.js +130 -0
  109. package/build/src/components/Loader.d.ts +11 -0
  110. package/build/src/components/Loader.js +103 -0
  111. package/build/src/components/MenuItem.d.ts +13 -0
  112. package/build/src/components/MenuItem.js +84 -0
  113. package/build/src/components/Paging.d.ts +25 -0
  114. package/build/src/components/Paging.js +249 -0
  115. package/build/src/components/Portal.d.ts +11 -0
  116. package/build/src/components/Portal.js +112 -0
  117. package/build/src/components/Radio.d.ts +19 -0
  118. package/build/src/components/Radio.js +156 -0
  119. package/build/src/components/RadioGroup.d.ts +21 -0
  120. package/build/src/components/RadioGroup.js +232 -0
  121. package/build/src/components/Select.d.ts +43 -0
  122. package/build/src/components/Select.js +384 -0
  123. package/build/src/components/Spinner.d.ts +12 -0
  124. package/build/src/components/Spinner.js +103 -0
  125. package/build/src/components/Tab.d.ts +16 -0
  126. package/build/src/components/Tab.js +126 -0
  127. package/build/src/components/Tabs.d.ts +18 -0
  128. package/build/src/components/Tabs.js +136 -0
  129. package/build/src/components/Textarea.d.ts +21 -0
  130. package/build/src/components/Textarea.js +186 -0
  131. package/build/src/components/Toast.d.ts +10 -0
  132. package/build/src/components/Toast.js +79 -0
  133. package/build/src/components/Toggle.d.ts +19 -0
  134. package/build/src/components/Toggle.js +151 -0
  135. package/build/src/components/Token.d.ts +13 -0
  136. package/build/src/components/Token.js +106 -0
  137. package/build/src/components/TokenInput.d.ts +44 -0
  138. package/build/src/components/TokenInput.js +319 -0
  139. package/build/src/components/Tooltip.d.ts +14 -0
  140. package/build/src/components/Tooltip.js +98 -0
  141. package/build/src/components/index.d.ts +34 -0
  142. package/build/src/components/index.js +71 -0
  143. package/build/src/index.d.ts +5 -0
  144. package/build/src/index.js +21 -0
  145. package/build/src/matchers/formattedMatchers.d.ts +37 -0
  146. package/build/src/matchers/formattedMatchers.js +125 -0
  147. package/build/src/matchers/index.d.ts +2 -0
  148. package/build/src/matchers/index.js +20 -0
  149. package/build/src/matchers/mergedExpects.d.ts +25 -0
  150. package/build/src/matchers/mergedExpects.js +6 -0
  151. package/build/src/options/AssertionOptions.d.ts +82 -0
  152. package/build/src/options/AssertionOptions.js +2 -0
  153. package/build/src/options/LocatorOptions.d.ts +342 -0
  154. package/build/src/options/LocatorOptions.js +2 -0
  155. package/build/src/options/index.d.ts +2 -0
  156. package/build/src/options/index.js +18 -0
  157. package/build/src/utils/constants.d.ts +10 -0
  158. package/build/src/utils/constants.js +15 -0
  159. package/build/src/utils/dataTidSelector.d.ts +1 -0
  160. package/build/src/utils/dataTidSelector.js +6 -0
  161. package/build/src/utils/index.d.ts +2 -0
  162. package/build/src/utils/index.js +20 -0
  163. package/build/src/utils/tooltipProvider.d.ts +4 -0
  164. package/build/src/utils/tooltipProvider.js +95 -0
  165. package/package.json +27 -0
@@ -0,0 +1,321 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.DropdownMenu = void 0;
55
+ var test_1 = require("@playwright/test");
56
+ var react_ui_1 = require("@skbkontur/react-ui");
57
+ var MenuFooter_1 = require("@skbkontur/react-ui/components/MenuFooter");
58
+ var Portal_1 = require("./Portal");
59
+ var BaseComponent_1 = require("./BaseComponent");
60
+ var utils_1 = require("../utils");
61
+ var assertions_1 = require("../assertions");
62
+ var ComponentList_1 = require("./ComponentList");
63
+ var MenuItem_1 = require("./MenuItem");
64
+ var dataTidSelector_1 = require("../utils/dataTidSelector");
65
+ var DropdownMenu = /** @class */ (function (_super) {
66
+ __extends(DropdownMenu, _super);
67
+ function DropdownMenu(rootLocator) {
68
+ var _this = _super.call(this, rootLocator) || this;
69
+ _this.rootLocator = rootLocator;
70
+ _this.buttonLocator = rootLocator.locator('button');
71
+ _this.portal = new Portal_1.Portal(rootLocator.locator('noscript'));
72
+ return _this;
73
+ }
74
+ DropdownMenu.prototype.getText = function (options) {
75
+ return __awaiter(this, void 0, void 0, function () {
76
+ return __generator(this, function (_a) {
77
+ switch (_a.label) {
78
+ case 0: return [4 /*yield*/, this.buttonLocator.innerText(options)];
79
+ case 1: return [2 /*return*/, _a.sent()];
80
+ }
81
+ });
82
+ });
83
+ };
84
+ DropdownMenu.prototype.isMenuOpened = function () {
85
+ return __awaiter(this, void 0, void 0, function () {
86
+ return __generator(this, function (_a) {
87
+ switch (_a.label) {
88
+ case 0: return [4 /*yield*/, this.waitFor()];
89
+ case 1:
90
+ _a.sent();
91
+ return [4 /*yield*/, this.portal.isVisible()];
92
+ case 2: return [2 /*return*/, _a.sent()];
93
+ }
94
+ });
95
+ });
96
+ };
97
+ DropdownMenu.prototype.selectFirstByText = function (text_1) {
98
+ return __awaiter(this, arguments, void 0, function (text, options) {
99
+ var items;
100
+ if (options === void 0) { options = { closedAfterSelect: true }; }
101
+ return __generator(this, function (_a) {
102
+ switch (_a.label) {
103
+ case 0: return [4 /*yield*/, this.getMenuItemsLocator(text)];
104
+ case 1:
105
+ items = _a.sent();
106
+ return [4 /*yield*/, items.first().click()];
107
+ case 2:
108
+ _a.sent();
109
+ if (!options.closedAfterSelect) return [3 /*break*/, 4];
110
+ // note: ожидание закрытия меню, чтобы не было гонок
111
+ return [4 /*yield*/, this.portal.expect().toBeHidden()];
112
+ case 3:
113
+ // note: ожидание закрытия меню, чтобы не было гонок
114
+ _a.sent();
115
+ _a.label = 4;
116
+ case 4: return [2 /*return*/];
117
+ }
118
+ });
119
+ });
120
+ };
121
+ DropdownMenu.prototype.selectByDataTid = function (dataTid_1) {
122
+ return __awaiter(this, arguments, void 0, function (dataTid, options) {
123
+ var container, item;
124
+ if (options === void 0) { options = { closedAfterSelect: true }; }
125
+ return __generator(this, function (_a) {
126
+ switch (_a.label) {
127
+ case 0: return [4 /*yield*/, this.getPortalContainer()];
128
+ case 1:
129
+ container = _a.sent();
130
+ item = container.locator((0, dataTidSelector_1.getDataTidSelector)(dataTid));
131
+ return [4 /*yield*/, item.count()];
132
+ case 2:
133
+ if ((_a.sent()) > 1) {
134
+ throw Error('DataTid должен быть уникальным');
135
+ }
136
+ return [4 /*yield*/, item.click()];
137
+ case 3:
138
+ _a.sent();
139
+ if (!options.closedAfterSelect) return [3 /*break*/, 5];
140
+ // note: ожидание закрытия меню, чтобы не было гонок
141
+ return [4 /*yield*/, this.portal.expect().toBeHidden()];
142
+ case 4:
143
+ // note: ожидание закрытия меню, чтобы не было гонок
144
+ _a.sent();
145
+ _a.label = 5;
146
+ case 5: return [2 /*return*/];
147
+ }
148
+ });
149
+ });
150
+ };
151
+ DropdownMenu.prototype.selectByIndex = function (index_1) {
152
+ return __awaiter(this, arguments, void 0, function (index, options) {
153
+ var items;
154
+ if (options === void 0) { options = { closedAfterSelect: true }; }
155
+ return __generator(this, function (_a) {
156
+ switch (_a.label) {
157
+ case 0: return [4 /*yield*/, this.getMenuItemsLocator()];
158
+ case 1:
159
+ items = _a.sent();
160
+ return [4 /*yield*/, items.nth(index).click()];
161
+ case 2:
162
+ _a.sent();
163
+ if (!options.closedAfterSelect) return [3 /*break*/, 4];
164
+ // note: ожидание закрытия меню, чтобы не было гонок
165
+ return [4 /*yield*/, this.portal.expect().toBeHidden()];
166
+ case 3:
167
+ // note: ожидание закрытия меню, чтобы не было гонок
168
+ _a.sent();
169
+ _a.label = 4;
170
+ case 4: return [2 /*return*/];
171
+ }
172
+ });
173
+ });
174
+ };
175
+ DropdownMenu.prototype.click = function (options) {
176
+ return __awaiter(this, void 0, void 0, function () {
177
+ return __generator(this, function (_a) {
178
+ switch (_a.label) {
179
+ case 0: return [4 /*yield*/, this.buttonLocator.click(options)];
180
+ case 1:
181
+ _a.sent();
182
+ return [2 /*return*/];
183
+ }
184
+ });
185
+ });
186
+ };
187
+ DropdownMenu.prototype.focus = function (options) {
188
+ return __awaiter(this, void 0, void 0, function () {
189
+ return __generator(this, function (_a) {
190
+ switch (_a.label) {
191
+ case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
192
+ case 1:
193
+ _a.sent();
194
+ return [4 /*yield*/, this.buttonLocator.focus(options)];
195
+ case 2:
196
+ _a.sent();
197
+ return [2 /*return*/];
198
+ }
199
+ });
200
+ });
201
+ };
202
+ DropdownMenu.prototype.blur = function (options) {
203
+ return __awaiter(this, void 0, void 0, function () {
204
+ return __generator(this, function (_a) {
205
+ switch (_a.label) {
206
+ case 0: return [4 /*yield*/, this.buttonLocator.blur(options)];
207
+ case 1:
208
+ _a.sent();
209
+ return [2 /*return*/];
210
+ }
211
+ });
212
+ });
213
+ };
214
+ DropdownMenu.prototype.getTooltip = function (type) {
215
+ return __awaiter(this, void 0, void 0, function () {
216
+ return __generator(this, function (_a) {
217
+ return [2 /*return*/, (0, utils_1.getTooltip)(type, this)];
218
+ });
219
+ });
220
+ };
221
+ /**
222
+ * Возвращает список меню по data-tid'ам из react-ui:
223
+ * - MenuItemDataTids.root
224
+ * - MenuHeaderDataTids.root
225
+ * - MenuFooterDataTids.root
226
+ */
227
+ DropdownMenu.prototype.getMenuItems = function () {
228
+ return __awaiter(this, void 0, void 0, function () {
229
+ var container;
230
+ return __generator(this, function (_a) {
231
+ switch (_a.label) {
232
+ case 0: return [4 /*yield*/, this.getPortalContainer()];
233
+ case 1:
234
+ container = _a.sent();
235
+ return [4 /*yield*/, container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root)).waitFor({ state: 'hidden' })];
236
+ case 2:
237
+ _a.sent();
238
+ return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
239
+ return locator
240
+ .locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root))
241
+ .or(locator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuHeaderDataTids.root)))
242
+ .or(locator.locator((0, dataTidSelector_1.getDataTidSelector)(MenuFooter_1.MenuFooterDataTids.root)));
243
+ }, function (locator) { return new MenuItem_1.MenuItem(locator); })];
244
+ }
245
+ });
246
+ });
247
+ };
248
+ DropdownMenu.prototype.getMenuItemByText = function (text) {
249
+ return __awaiter(this, void 0, void 0, function () {
250
+ var items;
251
+ var _this = this;
252
+ return __generator(this, function (_a) {
253
+ switch (_a.label) {
254
+ case 0: return [4 /*yield*/, this.getMenuItems()];
255
+ case 1:
256
+ items = _a.sent();
257
+ return [4 /*yield*/, items.getFirstItemByPredicate(function (item) { return __awaiter(_this, void 0, void 0, function () {
258
+ var itemText;
259
+ return __generator(this, function (_a) {
260
+ switch (_a.label) {
261
+ case 0: return [4 /*yield*/, item.getText()];
262
+ case 1:
263
+ itemText = _a.sent();
264
+ return [2 /*return*/, itemText.toLowerCase() === text.toLowerCase()];
265
+ }
266
+ });
267
+ }); })];
268
+ case 2: return [2 /*return*/, _a.sent()];
269
+ }
270
+ });
271
+ });
272
+ };
273
+ DropdownMenu.prototype.getMenuItemByIndex = function (index) {
274
+ return __awaiter(this, void 0, void 0, function () {
275
+ var items;
276
+ return __generator(this, function (_a) {
277
+ switch (_a.label) {
278
+ case 0: return [4 /*yield*/, this.getMenuItems()];
279
+ case 1:
280
+ items = _a.sent();
281
+ return [2 /*return*/, items.getItemByIndex(index)];
282
+ }
283
+ });
284
+ });
285
+ };
286
+ DropdownMenu.prototype.expect = function () {
287
+ return new assertions_1.DropdownMenuAssertions(this);
288
+ };
289
+ DropdownMenu.prototype.getMenuItemsLocator = function (byText) {
290
+ return __awaiter(this, void 0, void 0, function () {
291
+ var container, items;
292
+ return __generator(this, function (_a) {
293
+ switch (_a.label) {
294
+ case 0: return [4 /*yield*/, this.getPortalContainer()];
295
+ case 1:
296
+ container = _a.sent();
297
+ items = container.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.root));
298
+ return [2 /*return*/, !byText ? items : items.getByText(byText)];
299
+ }
300
+ });
301
+ });
302
+ };
303
+ DropdownMenu.prototype.getPortalContainer = function () {
304
+ return __awaiter(this, void 0, void 0, function () {
305
+ return __generator(this, function (_a) {
306
+ switch (_a.label) {
307
+ case 0: return [4 /*yield*/, this.isMenuOpened()];
308
+ case 1:
309
+ if (!!(_a.sent())) return [3 /*break*/, 3];
310
+ return [4 /*yield*/, this.buttonLocator.click()];
311
+ case 2:
312
+ _a.sent();
313
+ _a.label = 3;
314
+ case 3: return [2 /*return*/, this.portal.getContainer()];
315
+ }
316
+ });
317
+ });
318
+ };
319
+ return DropdownMenu;
320
+ }(BaseComponent_1.BaseComponent));
321
+ exports.DropdownMenu = DropdownMenu;
@@ -0,0 +1,54 @@
1
+ import type { Locator } from '@playwright/test';
2
+ import { BaseComponent } from './BaseComponent';
3
+ import { ComponentList } from './ComponentList';
4
+ import { Label } from './Label';
5
+ import { type TooltipType } from '../utils';
6
+ import { FileUploaderAssertions } from '../assertions';
7
+ import type { ClickOptions, IsDisabledOptions, SetInputFilesOptions } from '../options';
8
+ export declare class FileUploader extends BaseComponent {
9
+ private readonly inputLocator;
10
+ readonly files: ComponentList<File>;
11
+ constructor(rootLocator: Locator);
12
+ isDisabled(options?: IsDisabledOptions): Promise<boolean>;
13
+ setInputFiles(files: string | ReadonlyArray<string> | {
14
+ /**
15
+ * File name
16
+ */
17
+ name: string;
18
+ /**
19
+ * File type
20
+ */
21
+ mimeType: string;
22
+ /**
23
+ * File content
24
+ */
25
+ buffer: Buffer;
26
+ } | ReadonlyArray<{
27
+ /**
28
+ * File name
29
+ */
30
+ name: string;
31
+ /**
32
+ * File type
33
+ */
34
+ mimeType: string;
35
+ /**
36
+ * File content
37
+ */
38
+ buffer: Buffer;
39
+ }>, options?: SetInputFilesOptions): Promise<void>;
40
+ removeAllFiles(options?: ClickOptions): Promise<void>;
41
+ removeFileByName(name: string, options?: ClickOptions): Promise<void>;
42
+ removeFileByIndex(index: number, options?: ClickOptions): Promise<void>;
43
+ getUploadedFileNames(): Promise<string[]>;
44
+ getTooltip(type: TooltipType): Promise<import("./Tooltip").Tooltip>;
45
+ expect(): FileUploaderAssertions;
46
+ }
47
+ declare class File extends BaseComponent {
48
+ readonly name: Label;
49
+ readonly size: Label;
50
+ readonly icon: Label;
51
+ constructor(rootLocator: Locator);
52
+ remove(options?: ClickOptions): Promise<void>;
53
+ }
54
+ export {};
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.FileUploader = void 0;
55
+ var BaseComponent_1 = require("./BaseComponent");
56
+ var ComponentList_1 = require("./ComponentList");
57
+ var Label_1 = require("./Label");
58
+ var utils_1 = require("../utils");
59
+ var assertions_1 = require("../assertions");
60
+ var dataTidSelector_1 = require("../utils/dataTidSelector");
61
+ var FileUploader = /** @class */ (function (_super) {
62
+ __extends(FileUploader, _super);
63
+ function FileUploader(rootLocator) {
64
+ var _this = _super.call(this, rootLocator) || this;
65
+ _this.inputLocator = rootLocator.locator('input');
66
+ _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
+ return _this;
68
+ }
69
+ FileUploader.prototype.isDisabled = function (options) {
70
+ return __awaiter(this, void 0, void 0, function () {
71
+ return __generator(this, function (_a) {
72
+ switch (_a.label) {
73
+ case 0: return [4 /*yield*/, this.inputLocator.isDisabled(options)];
74
+ case 1: return [2 /*return*/, _a.sent()];
75
+ }
76
+ });
77
+ });
78
+ };
79
+ FileUploader.prototype.setInputFiles = function (files, options) {
80
+ return __awaiter(this, void 0, void 0, function () {
81
+ return __generator(this, function (_a) {
82
+ switch (_a.label) {
83
+ case 0: return [4 /*yield*/, this.inputLocator.setInputFiles(files, options)];
84
+ case 1:
85
+ _a.sent();
86
+ return [2 /*return*/];
87
+ }
88
+ });
89
+ });
90
+ };
91
+ FileUploader.prototype.removeAllFiles = function (options) {
92
+ return __awaiter(this, void 0, void 0, function () {
93
+ var files, i;
94
+ return __generator(this, function (_a) {
95
+ switch (_a.label) {
96
+ case 0: return [4 /*yield*/, this.files.getItems()];
97
+ case 1:
98
+ files = _a.sent();
99
+ i = files.length - 1;
100
+ _a.label = 2;
101
+ case 2:
102
+ if (!(i >= 0)) return [3 /*break*/, 5];
103
+ return [4 /*yield*/, files[i].remove(options)];
104
+ case 3:
105
+ _a.sent();
106
+ _a.label = 4;
107
+ case 4:
108
+ i--;
109
+ return [3 /*break*/, 2];
110
+ case 5: return [2 /*return*/];
111
+ }
112
+ });
113
+ });
114
+ };
115
+ FileUploader.prototype.removeFileByName = function (name, options) {
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var file;
118
+ var _this = this;
119
+ return __generator(this, function (_a) {
120
+ switch (_a.label) {
121
+ case 0: return [4 /*yield*/, this.files.getFirstItemByPredicate(function (file) { return __awaiter(_this, void 0, void 0, function () {
122
+ var fileName;
123
+ return __generator(this, function (_a) {
124
+ switch (_a.label) {
125
+ case 0: return [4 /*yield*/, file.name.getText()];
126
+ case 1:
127
+ fileName = _a.sent();
128
+ return [2 /*return*/, fileName.toLowerCase() === name.toLowerCase()];
129
+ }
130
+ });
131
+ }); })];
132
+ case 1:
133
+ file = _a.sent();
134
+ return [4 /*yield*/, file.remove(options)];
135
+ case 2:
136
+ _a.sent();
137
+ return [2 /*return*/];
138
+ }
139
+ });
140
+ });
141
+ };
142
+ FileUploader.prototype.removeFileByIndex = function (index, options) {
143
+ return __awaiter(this, void 0, void 0, function () {
144
+ var file;
145
+ return __generator(this, function (_a) {
146
+ switch (_a.label) {
147
+ case 0: return [4 /*yield*/, this.files.getItemByIndex(index)];
148
+ case 1:
149
+ file = _a.sent();
150
+ return [4 /*yield*/, file.remove(options)];
151
+ case 2:
152
+ _a.sent();
153
+ return [2 /*return*/];
154
+ }
155
+ });
156
+ });
157
+ };
158
+ FileUploader.prototype.getUploadedFileNames = function () {
159
+ return __awaiter(this, void 0, void 0, function () {
160
+ var files;
161
+ var _this = this;
162
+ return __generator(this, function (_a) {
163
+ switch (_a.label) {
164
+ case 0: return [4 /*yield*/, this.files.getItems()];
165
+ case 1:
166
+ files = _a.sent();
167
+ return [4 /*yield*/, Promise.all(files.map(function (file) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
168
+ switch (_a.label) {
169
+ case 0: return [4 /*yield*/, file.name.getText()];
170
+ case 1: return [2 /*return*/, _a.sent()];
171
+ }
172
+ }); }); }))];
173
+ case 2: return [2 /*return*/, _a.sent()];
174
+ }
175
+ });
176
+ });
177
+ };
178
+ FileUploader.prototype.getTooltip = function (type) {
179
+ return __awaiter(this, void 0, void 0, function () {
180
+ return __generator(this, function (_a) {
181
+ return [2 /*return*/, (0, utils_1.getTooltip)(type, this)];
182
+ });
183
+ });
184
+ };
185
+ FileUploader.prototype.expect = function () {
186
+ return new assertions_1.FileUploaderAssertions(this, this.inputLocator);
187
+ };
188
+ return FileUploader;
189
+ }(BaseComponent_1.BaseComponent));
190
+ exports.FileUploader = FileUploader;
191
+ var File = /** @class */ (function (_super) {
192
+ __extends(File, _super);
193
+ function File(rootLocator) {
194
+ var _this = _super.call(this, rootLocator) || this;
195
+ _this.name = new Label_1.Label(rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)('FileUploader__fileName')));
196
+ _this.size = new Label_1.Label(rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)('FileUploader__fileSize')));
197
+ _this.icon = new Label_1.Label(rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)('FileUploader__fileIcon')));
198
+ return _this;
199
+ }
200
+ File.prototype.remove = function (options) {
201
+ return __awaiter(this, void 0, void 0, function () {
202
+ return __generator(this, function (_a) {
203
+ switch (_a.label) {
204
+ case 0: return [4 /*yield*/, this.icon.click(options)];
205
+ case 1:
206
+ _a.sent();
207
+ return [2 /*return*/];
208
+ }
209
+ });
210
+ });
211
+ };
212
+ return File;
213
+ }(BaseComponent_1.BaseComponent));
@@ -0,0 +1,23 @@
1
+ import type { Locator } from '@playwright/test';
2
+ import { BaseComponent } from './BaseComponent';
3
+ import { type TooltipType } from '../utils';
4
+ import { FxInputAssertions } from '../assertions';
5
+ import type { BlurOptions, ClearOptions, ClickOptions, FillOptions, FocusOptions, InputValueOptions, IsDisabledOptions, IsVisibleOptions, PressOptions, PressSequentiallyOptions } from '../options';
6
+ export declare class FxInput extends BaseComponent {
7
+ readonly autoButtonLocator: Locator;
8
+ readonly inputLocator: Locator;
9
+ constructor(rootLocator: Locator);
10
+ isDisabled(options?: IsDisabledOptions): Promise<boolean>;
11
+ getValue(options?: InputValueOptions): Promise<string>;
12
+ fill(value: string, options?: FillOptions): Promise<void>;
13
+ press(value: string, options?: PressOptions): Promise<void>;
14
+ pressSequentially(value: string, options?: PressSequentiallyOptions): Promise<void>;
15
+ clear(options?: ClearOptions): Promise<void>;
16
+ focus(options?: FocusOptions): Promise<void>;
17
+ blur(options?: BlurOptions): Promise<void>;
18
+ click(options?: ClickOptions): Promise<void>;
19
+ getTooltip(type: TooltipType): Promise<import("./Tooltip").Tooltip>;
20
+ isAuto(options?: IsVisibleOptions): Promise<boolean>;
21
+ setAuto(options?: ClickOptions): Promise<void>;
22
+ expect(): FxInputAssertions;
23
+ }