@skbkontur/playwright-react-ui-components 1.13.1 → 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.
Files changed (210) hide show
  1. package/build/src/assertions/AutocompleteAssertions.js +10 -10
  2. package/build/src/assertions/BaseComponentAssertions.js +11 -11
  3. package/build/src/assertions/ButtonAssertions.js +9 -9
  4. package/build/src/assertions/CheckboxAssertions.js +13 -13
  5. package/build/src/assertions/ComboBoxAssertions.js +17 -111
  6. package/build/src/assertions/ComponentListAssertions.js +6 -6
  7. package/build/src/assertions/CurrencyInputAssertions.js +11 -61
  8. package/build/src/assertions/DateInputAssertions.js +9 -9
  9. package/build/src/assertions/DatePickerAssertions.js +9 -9
  10. package/build/src/assertions/DateRangePickerAssertions.js +4 -25
  11. package/build/src/assertions/DropdownAssertions.js +13 -63
  12. package/build/src/assertions/DropdownMenuAssertions.js +11 -61
  13. package/build/src/assertions/FileUploaderAssertions.d.ts +1 -3
  14. package/build/src/assertions/FileUploaderAssertions.js +5 -22
  15. package/build/src/assertions/FxInputAssertions.js +11 -14
  16. package/build/src/assertions/InputAssertions.js +10 -10
  17. package/build/src/assertions/KebabAssertions.js +7 -58
  18. package/build/src/assertions/LabelAssertions.js +7 -7
  19. package/build/src/assertions/LinkAssertions.js +11 -12
  20. package/build/src/assertions/LoaderAssertions.js +2 -2
  21. package/build/src/assertions/MenuItemAssertations.js +5 -5
  22. package/build/src/assertions/PagingAssertions.js +5 -40
  23. package/build/src/assertions/PortalAssertions.js +3 -3
  24. package/build/src/assertions/RadioAssertions.js +13 -13
  25. package/build/src/assertions/RadioGroupAssertions.js +10 -81
  26. package/build/src/assertions/SelectAssertions.js +15 -64
  27. package/build/src/assertions/SpinnerAssertions.js +2 -2
  28. package/build/src/assertions/TabAssertions.js +11 -12
  29. package/build/src/assertions/TabsAssertions.js +4 -32
  30. package/build/src/assertions/TextareaAssertions.js +9 -9
  31. package/build/src/assertions/ToastAssertions.js +2 -2
  32. package/build/src/assertions/ToggleAssertions.js +11 -11
  33. package/build/src/assertions/TokenAssertions.js +8 -14
  34. package/build/src/assertions/TokenInputAssertions.js +8 -28
  35. package/build/src/assertions/TooltipAssertions.js +5 -5
  36. package/build/src/components/Autocomplete.d.ts +4 -0
  37. package/build/src/components/Autocomplete.js +52 -50
  38. package/build/src/components/BaseComponent.d.ts +4 -0
  39. package/build/src/components/BaseComponent.js +37 -30
  40. package/build/src/components/Button.d.ts +4 -0
  41. package/build/src/components/Button.js +25 -19
  42. package/build/src/components/Checkbox.d.ts +6 -0
  43. package/build/src/components/Checkbox.js +28 -36
  44. package/build/src/components/ComboBox.d.ts +9 -2
  45. package/build/src/components/ComboBox.js +68 -54
  46. package/build/src/components/ComponentList.d.ts +25 -3
  47. package/build/src/components/ComponentList.js +58 -50
  48. package/build/src/components/CurrencyInput.d.ts +4 -0
  49. package/build/src/components/CurrencyInput.js +39 -37
  50. package/build/src/components/DateInput.d.ts +4 -0
  51. package/build/src/components/DateInput.js +34 -32
  52. package/build/src/components/DatePicker.d.ts +4 -0
  53. package/build/src/components/DatePicker.js +35 -33
  54. package/build/src/components/DateRangePicker.d.ts +2 -0
  55. package/build/src/components/DateRangePicker.js +14 -10
  56. package/build/src/components/Dropdown.d.ts +8 -2
  57. package/build/src/components/Dropdown.js +69 -65
  58. package/build/src/components/DropdownMenu.d.ts +7 -2
  59. package/build/src/components/DropdownMenu.js +68 -65
  60. package/build/src/components/FileUploader.d.ts +3 -1
  61. package/build/src/components/FileUploader.js +39 -39
  62. package/build/src/components/FxInput.d.ts +4 -0
  63. package/build/src/components/FxInput.js +44 -42
  64. package/build/src/components/Input.d.ts +4 -0
  65. package/build/src/components/Input.js +37 -35
  66. package/build/src/components/Kebab.d.ts +6 -2
  67. package/build/src/components/Kebab.js +50 -48
  68. package/build/src/components/Label.d.ts +2 -0
  69. package/build/src/components/Label.js +9 -13
  70. package/build/src/components/Link.d.ts +4 -0
  71. package/build/src/components/Link.js +19 -25
  72. package/build/src/components/Loader.d.ts +2 -0
  73. package/build/src/components/Loader.js +15 -10
  74. package/build/src/components/MenuComponent.d.ts +9 -0
  75. package/build/src/components/MenuComponent.js +78 -0
  76. package/build/src/components/MenuItem.d.ts +2 -0
  77. package/build/src/components/MenuItem.js +7 -3
  78. package/build/src/components/Paging.d.ts +2 -0
  79. package/build/src/components/Paging.js +59 -52
  80. package/build/src/components/Portal.d.ts +2 -0
  81. package/build/src/components/Portal.js +14 -10
  82. package/build/src/components/Radio.d.ts +6 -0
  83. package/build/src/components/Radio.js +31 -27
  84. package/build/src/components/RadioGroup.d.ts +2 -0
  85. package/build/src/components/RadioGroup.js +51 -47
  86. package/build/src/components/Select.d.ts +5 -0
  87. package/build/src/components/Select.js +92 -76
  88. package/build/src/components/Spinner.d.ts +2 -0
  89. package/build/src/components/Spinner.js +13 -9
  90. package/build/src/components/Tab.d.ts +4 -0
  91. package/build/src/components/Tab.js +17 -27
  92. package/build/src/components/Textarea.d.ts +4 -0
  93. package/build/src/components/Textarea.js +33 -39
  94. package/build/src/components/Toast.d.ts +2 -0
  95. package/build/src/components/Toast.js +7 -3
  96. package/build/src/components/Toggle.d.ts +5 -0
  97. package/build/src/components/Toggle.js +24 -33
  98. package/build/src/components/Token.d.ts +3 -0
  99. package/build/src/components/Token.js +14 -9
  100. package/build/src/components/TokenInput.d.ts +4 -0
  101. package/build/src/components/TokenInput.js +61 -59
  102. package/build/src/components/Tooltip.d.ts +2 -0
  103. package/build/src/components/Tooltip.js +9 -9
  104. package/build/src/components/index.d.ts +1 -0
  105. package/build/src/components/index.js +3 -1
  106. package/build/src/extensions/index.d.ts +1 -0
  107. package/build/src/extensions/index.js +17 -0
  108. package/build/src/extensions/mergedExpects.d.ts +5 -0
  109. package/build/src/extensions/mergedExpects.js +7 -0
  110. package/build/src/index.d.ts +2 -0
  111. package/build/src/index.js +2 -0
  112. package/build/src/matchers/component/LocatorSymbols.d.ts +43 -0
  113. package/build/src/matchers/component/LocatorSymbols.js +13 -0
  114. package/build/src/matchers/component/toBeActiveEx.d.ts +3 -0
  115. package/build/src/matchers/component/toBeActiveEx.js +56 -0
  116. package/build/src/matchers/component/toBeAutoEx.d.ts +3 -0
  117. package/build/src/matchers/component/toBeAutoEx.js +62 -0
  118. package/build/src/matchers/component/toBeCheckedByIndexEx.d.ts +3 -0
  119. package/build/src/matchers/component/toBeCheckedByIndexEx.js +62 -0
  120. package/build/src/matchers/component/toBeCheckedByTextEx.d.ts +3 -0
  121. package/build/src/matchers/component/toBeCheckedByTextEx.js +62 -0
  122. package/build/src/matchers/component/toBeCheckedByValueEx.d.ts +3 -0
  123. package/build/src/matchers/component/toBeCheckedByValueEx.js +62 -0
  124. package/build/src/matchers/component/toBeCheckedEx.d.ts +3 -0
  125. package/build/src/matchers/component/toBeCheckedEx.js +56 -0
  126. package/build/src/matchers/component/toBeDisabledEx.d.ts +3 -0
  127. package/build/src/matchers/component/toBeDisabledEx.js +172 -0
  128. package/build/src/matchers/component/toBeEmptyEx.d.ts +3 -0
  129. package/build/src/matchers/component/toBeEmptyEx.js +137 -0
  130. package/build/src/matchers/component/toBeEnabledEx.d.ts +3 -0
  131. package/build/src/matchers/component/toBeEnabledEx.js +206 -0
  132. package/build/src/matchers/component/toBeFocusedEx.d.ts +3 -0
  133. package/build/src/matchers/component/toBeFocusedEx.js +56 -0
  134. package/build/src/matchers/component/toBeHiddenEx.d.ts +3 -0
  135. package/build/src/matchers/component/toBeHiddenEx.js +68 -0
  136. package/build/src/matchers/component/toBeInactiveEx.d.ts +3 -0
  137. package/build/src/matchers/component/toBeInactiveEx.js +56 -0
  138. package/build/src/matchers/component/toBeUncheckedByIndexEx.d.ts +3 -0
  139. package/build/src/matchers/component/toBeUncheckedByIndexEx.js +62 -0
  140. package/build/src/matchers/component/toBeUncheckedByTextEx.d.ts +3 -0
  141. package/build/src/matchers/component/toBeUncheckedByTextEx.js +57 -0
  142. package/build/src/matchers/component/toBeUncheckedByValueEx.d.ts +3 -0
  143. package/build/src/matchers/component/toBeUncheckedByValueEx.js +57 -0
  144. package/build/src/matchers/component/toBeUncheckedEx.d.ts +3 -0
  145. package/build/src/matchers/component/toBeUncheckedEx.js +56 -0
  146. package/build/src/matchers/component/toBeVisibleEx.d.ts +3 -0
  147. package/build/src/matchers/component/toBeVisibleEx.js +68 -0
  148. package/build/src/matchers/component/toContainFormattedTextEx.d.ts +3 -0
  149. package/build/src/matchers/component/toContainFormattedTextEx.js +55 -0
  150. package/build/src/matchers/component/toContainItemEx.d.ts +4 -0
  151. package/build/src/matchers/component/toContainItemEx.js +79 -0
  152. package/build/src/matchers/component/toContainItemsEx.d.ts +3 -0
  153. package/build/src/matchers/component/toContainItemsEx.js +63 -0
  154. package/build/src/matchers/component/toContainTabsEx.d.ts +3 -0
  155. package/build/src/matchers/component/toContainTabsEx.js +80 -0
  156. package/build/src/matchers/component/toContainTextEx.d.ts +3 -0
  157. package/build/src/matchers/component/toContainTextEx.js +56 -0
  158. package/build/src/matchers/component/toContainTokensEx.d.ts +4 -0
  159. package/build/src/matchers/component/toContainTokensEx.js +80 -0
  160. package/build/src/matchers/component/toContainUploadedFilesEx.d.ts +4 -0
  161. package/build/src/matchers/component/toContainUploadedFilesEx.js +75 -0
  162. package/build/src/matchers/component/toContainValueEx.d.ts +3 -0
  163. package/build/src/matchers/component/toContainValueEx.js +55 -0
  164. package/build/src/matchers/component/toHaveActivePageEx.d.ts +4 -0
  165. package/build/src/matchers/component/toHaveActivePageEx.js +78 -0
  166. package/build/src/matchers/component/toHaveActiveTabEx.d.ts +2 -0
  167. package/build/src/matchers/component/toHaveActiveTabEx.js +62 -0
  168. package/build/src/matchers/component/toHaveAttributeEx.d.ts +3 -0
  169. package/build/src/matchers/component/toHaveAttributeEx.js +62 -0
  170. package/build/src/matchers/component/toHaveCountEx.d.ts +3 -0
  171. package/build/src/matchers/component/toHaveCountEx.js +56 -0
  172. package/build/src/matchers/component/toHaveErrorEx.d.ts +3 -0
  173. package/build/src/matchers/component/toHaveErrorEx.js +57 -0
  174. package/build/src/matchers/component/toHaveFormattedTextEx.d.ts +3 -0
  175. package/build/src/matchers/component/toHaveFormattedTextEx.js +56 -0
  176. package/build/src/matchers/component/toHaveFormattedValueEx.d.ts +3 -0
  177. package/build/src/matchers/component/toHaveFormattedValueEx.js +56 -0
  178. package/build/src/matchers/component/toHaveHrefEx.d.ts +3 -0
  179. package/build/src/matchers/component/toHaveHrefEx.js +55 -0
  180. package/build/src/matchers/component/toHaveItemsEx.d.ts +3 -0
  181. package/build/src/matchers/component/toHaveItemsEx.js +63 -0
  182. package/build/src/matchers/component/toHavePageCountEx.d.ts +4 -0
  183. package/build/src/matchers/component/toHavePageCountEx.js +71 -0
  184. package/build/src/matchers/component/toHaveTextEx.d.ts +3 -0
  185. package/build/src/matchers/component/toHaveTextEx.js +56 -0
  186. package/build/src/matchers/component/toHaveValueEx.d.ts +6 -0
  187. package/build/src/matchers/component/toHaveValueEx.js +198 -0
  188. package/build/src/matchers/component/toHaveWarningEx.d.ts +3 -0
  189. package/build/src/matchers/component/toHaveWarningEx.js +57 -0
  190. package/build/src/matchers/componentMatchers.d.ts +104 -0
  191. package/build/src/matchers/componentMatchers.js +83 -0
  192. package/build/src/matchers/createAsyncMatcher.d.ts +47 -0
  193. package/build/src/matchers/createAsyncMatcher.js +155 -0
  194. package/build/src/matchers/formattedMatchers.d.ts +15 -31
  195. package/build/src/matchers/formattedMatchers.js +19 -15
  196. package/build/src/matchers/index.d.ts +1 -1
  197. package/build/src/matchers/index.js +1 -3
  198. package/build/src/utils/getMarcherResult.d.ts +13 -0
  199. package/build/src/utils/getMarcherResult.js +13 -0
  200. package/build/src/utils/index.d.ts +3 -0
  201. package/build/src/utils/index.js +3 -0
  202. package/build/src/utils/is.d.ts +3 -0
  203. package/build/src/utils/is.js +5 -0
  204. package/build/src/utils/makeMatcher.d.ts +5 -0
  205. package/build/src/utils/makeMatcher.js +65 -0
  206. package/build/src/utils/toMatchMessage.d.ts +12 -0
  207. package/build/src/utils/toMatchMessage.js +78 -0
  208. package/package.json +1 -1
  209. package/build/src/matchers/mergedExpects.d.ts +0 -15
  210. package/build/src/matchers/mergedExpects.js +0 -6
@@ -3,8 +3,10 @@ import { BaseComponent } from './BaseComponent';
3
3
  import { LabelAssertions } from '../assertions';
4
4
  import { type TooltipType } from '../utils';
5
5
  import type { GetAttributeOptions, InnerTextOptions } from '../options';
6
+ import { toTextElementLocator } from '../matchers/component/LocatorSymbols';
6
7
  export declare class Label extends BaseComponent {
7
8
  readonly rootLocator: Locator;
9
+ readonly [toTextElementLocator]: () => Locator;
8
10
  constructor(rootLocator: Locator);
9
11
  isDisabled(options?: GetAttributeOptions): Promise<boolean>;
10
12
  getText(options?: InnerTextOptions): Promise<string>;
@@ -50,41 +50,36 @@ 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.Label = void 0;
55
56
  var BaseComponent_1 = require("./BaseComponent");
56
57
  var assertions_1 = require("../assertions");
57
58
  var utils_1 = require("../utils");
59
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
58
60
  var Label = /** @class */ (function (_super) {
59
61
  __extends(Label, _super);
60
62
  function Label(rootLocator) {
61
63
  var _this = _super.call(this, rootLocator) || this;
62
64
  _this.rootLocator = rootLocator;
65
+ _this[_a] = function () { return _this.rootLocator; };
63
66
  return _this;
64
67
  }
65
68
  Label.prototype.isDisabled = function (options) {
66
69
  return __awaiter(this, void 0, void 0, function () {
67
- return __generator(this, function (_a) {
68
- switch (_a.label) {
70
+ return __generator(this, function (_b) {
71
+ switch (_b.label) {
69
72
  case 0: return [4 /*yield*/, this.getAttribute(utils_1.DataVisualState.Disabled, options)];
70
- case 1: return [2 /*return*/, (_a.sent()) !== null];
73
+ case 1: return [2 /*return*/, (_b.sent()) !== null];
71
74
  }
72
75
  });
73
76
  });
74
77
  };
75
78
  Label.prototype.getText = function (options) {
76
- return __awaiter(this, void 0, void 0, function () {
77
- return __generator(this, function (_a) {
78
- return [2 /*return*/, this.rootLocator.innerText(options)];
79
- });
80
- });
79
+ return this.rootLocator.innerText(options);
81
80
  };
82
81
  Label.prototype.getTooltip = function (type) {
83
- return __awaiter(this, void 0, void 0, function () {
84
- return __generator(this, function (_a) {
85
- return [2 /*return*/, (0, utils_1.getTooltip)(type, this)];
86
- });
87
- });
82
+ return (0, utils_1.getTooltip)(type, this);
88
83
  };
89
84
  Label.prototype.expect = function () {
90
85
  return new assertions_1.LabelAssertions(this);
@@ -92,3 +87,4 @@ var Label = /** @class */ (function (_super) {
92
87
  return Label;
93
88
  }(BaseComponent_1.BaseComponent));
94
89
  exports.Label = Label;
90
+ _a = LocatorSymbols_1.toTextElementLocator;
@@ -3,8 +3,12 @@ import { BaseComponent } from './BaseComponent';
3
3
  import type { TooltipType } from '../utils';
4
4
  import { LinkAssertions } from '../assertions';
5
5
  import type { BlurOptions, FocusOptions, GetAttributeOptions, InnerTextOptions } from '../options';
6
+ import { toControlElementLocator, toFocusableElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
6
7
  export declare class Link extends BaseComponent {
7
8
  readonly rootLocator: Locator;
9
+ readonly [toControlElementLocator]: () => Locator;
10
+ readonly [toTextElementLocator]: () => Locator;
11
+ readonly [toFocusableElementLocator]: () => Locator;
8
12
  constructor(rootLocator: Locator);
9
13
  isDisabled(options?: GetAttributeOptions): Promise<boolean>;
10
14
  getText(options?: InnerTextOptions): Promise<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, _b, _c;
53
54
  Object.defineProperty(exports, "__esModule", { value: true });
54
55
  exports.Link = void 0;
55
56
  var test_1 = require("@playwright/test");
@@ -57,47 +58,43 @@ var BaseComponent_1 = require("./BaseComponent");
57
58
  var utils_1 = require("../utils");
58
59
  var utils_2 = require("../utils");
59
60
  var assertions_1 = require("../assertions");
61
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
60
62
  var Link = /** @class */ (function (_super) {
61
63
  __extends(Link, _super);
62
64
  function Link(rootLocator) {
63
65
  var _this = _super.call(this, rootLocator) || this;
64
66
  _this.rootLocator = rootLocator;
67
+ _this[_a] = function () { return _this.rootLocator; };
68
+ _this[_b] = function () { return _this.rootLocator; };
69
+ _this[_c] = function () { return _this.rootLocator; };
65
70
  return _this;
66
71
  }
67
72
  Link.prototype.isDisabled = function (options) {
68
73
  return __awaiter(this, void 0, void 0, function () {
69
- return __generator(this, function (_a) {
70
- switch (_a.label) {
74
+ return __generator(this, function (_d) {
75
+ switch (_d.label) {
71
76
  case 0: return [4 /*yield*/, this.getAttribute(utils_1.DataVisualState.Disabled, options)];
72
- case 1: return [2 /*return*/, (_a.sent()) !== null];
77
+ case 1: return [2 /*return*/, (_d.sent()) !== null];
73
78
  }
74
79
  });
75
80
  });
76
81
  };
77
82
  Link.prototype.getText = function (options) {
78
- return __awaiter(this, void 0, void 0, function () {
79
- return __generator(this, function (_a) {
80
- return [2 /*return*/, this.rootLocator.innerText(options)];
81
- });
82
- });
83
+ return this.rootLocator.innerText(options);
83
84
  };
84
85
  Link.prototype.getUrl = function (options) {
85
- return __awaiter(this, void 0, void 0, function () {
86
- return __generator(this, function (_a) {
87
- return [2 /*return*/, this.getAttribute('href', options)];
88
- });
89
- });
86
+ return this.getAttribute('href', options);
90
87
  };
91
88
  Link.prototype.focus = function (options) {
92
89
  return __awaiter(this, void 0, void 0, function () {
93
- return __generator(this, function (_a) {
94
- switch (_a.label) {
90
+ return __generator(this, function (_d) {
91
+ switch (_d.label) {
95
92
  case 0: return [4 /*yield*/, (0, test_1.expect)(this.rootLocator).not.toHaveAttribute(utils_1.DataVisualState.Disabled)];
96
93
  case 1:
97
- _a.sent();
94
+ _d.sent();
98
95
  return [4 /*yield*/, this.rootLocator.focus(options)];
99
96
  case 2:
100
- _a.sent();
97
+ _d.sent();
101
98
  return [2 /*return*/];
102
99
  }
103
100
  });
@@ -105,22 +102,18 @@ var Link = /** @class */ (function (_super) {
105
102
  };
106
103
  Link.prototype.blur = function (options) {
107
104
  return __awaiter(this, void 0, void 0, function () {
108
- return __generator(this, function (_a) {
109
- switch (_a.label) {
105
+ return __generator(this, function (_d) {
106
+ switch (_d.label) {
110
107
  case 0: return [4 /*yield*/, this.rootLocator.blur(options)];
111
108
  case 1:
112
- _a.sent();
109
+ _d.sent();
113
110
  return [2 /*return*/];
114
111
  }
115
112
  });
116
113
  });
117
114
  };
118
115
  Link.prototype.getTooltip = function (type) {
119
- return __awaiter(this, void 0, void 0, function () {
120
- return __generator(this, function (_a) {
121
- return [2 /*return*/, (0, utils_2.getTooltip)(type, this)];
122
- });
123
- });
116
+ return (0, utils_2.getTooltip)(type, this);
124
117
  };
125
118
  Link.prototype.expect = function () {
126
119
  return new assertions_1.LinkAssertions(this);
@@ -128,3 +121,4 @@ var Link = /** @class */ (function (_super) {
128
121
  return Link;
129
122
  }(BaseComponent_1.BaseComponent));
130
123
  exports.Link = Link;
124
+ _a = LocatorSymbols_1.toControlElementLocator, _b = LocatorSymbols_1.toTextElementLocator, _c = LocatorSymbols_1.toFocusableElementLocator;
@@ -2,7 +2,9 @@ import type { Locator } from '@playwright/test';
2
2
  import { BaseComponent } from './BaseComponent';
3
3
  import { LoaderAssertions } from '../assertions';
4
4
  import type { InnerTextOptions } from '../options';
5
+ import { toTextElementLocator } from '../matchers/component/LocatorSymbols';
5
6
  export declare class Loader extends BaseComponent {
7
+ readonly [toTextElementLocator]: () => Locator;
6
8
  constructor(rootLocator: Locator);
7
9
  getText(options?: InnerTextOptions): Promise<string>;
8
10
  waitLoading(options?: {
@@ -50,34 +50,38 @@ 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.Loader = void 0;
55
56
  var react_ui_1 = require("@skbkontur/react-ui");
56
57
  var BaseComponent_1 = require("./BaseComponent");
57
58
  var assertions_1 = require("../assertions");
58
59
  var dataTidSelector_1 = require("../utils/dataTidSelector");
60
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
59
61
  var Loader = /** @class */ (function (_super) {
60
62
  __extends(Loader, _super);
61
63
  function Loader(rootLocator) {
62
- return _super.call(this, rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root))) || this;
64
+ var _this = _super.call(this, rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root))) || this;
65
+ _this[_a] = function () { return _this.rootLocator; };
66
+ return _this;
63
67
  }
64
68
  Loader.prototype.getText = function (options) {
65
69
  return __awaiter(this, void 0, void 0, function () {
66
- return __generator(this, function (_a) {
67
- switch (_a.label) {
70
+ return __generator(this, function (_b) {
71
+ switch (_b.label) {
68
72
  case 0: return [4 /*yield*/, this.rootLocator.innerText(options)];
69
- case 1: return [2 /*return*/, _a.sent()];
73
+ case 1: return [2 /*return*/, _b.sent()];
70
74
  }
71
75
  });
72
76
  });
73
77
  };
74
78
  Loader.prototype.waitLoading = function (options) {
75
79
  return __awaiter(this, void 0, void 0, function () {
76
- return __generator(this, function (_a) {
77
- switch (_a.label) {
80
+ return __generator(this, function (_b) {
81
+ switch (_b.label) {
78
82
  case 0: return [4 /*yield*/, this.waitFor(options)];
79
83
  case 1:
80
- _a.sent();
84
+ _b.sent();
81
85
  return [2 /*return*/];
82
86
  }
83
87
  });
@@ -85,11 +89,11 @@ var Loader = /** @class */ (function (_super) {
85
89
  };
86
90
  Loader.prototype.waitLoaded = function (options) {
87
91
  return __awaiter(this, void 0, void 0, function () {
88
- return __generator(this, function (_a) {
89
- switch (_a.label) {
92
+ return __generator(this, function (_b) {
93
+ switch (_b.label) {
90
94
  case 0: return [4 /*yield*/, this.waitFor({ state: 'hidden', timeout: options === null || options === void 0 ? void 0 : options.timeout })];
91
95
  case 1:
92
- _a.sent();
96
+ _b.sent();
93
97
  return [2 /*return*/];
94
98
  }
95
99
  });
@@ -101,3 +105,4 @@ var Loader = /** @class */ (function (_super) {
101
105
  return Loader;
102
106
  }(BaseComponent_1.BaseComponent));
103
107
  exports.Loader = Loader;
108
+ _a = LocatorSymbols_1.toTextElementLocator;
@@ -0,0 +1,9 @@
1
+ import { BaseComponent } from './BaseComponent';
2
+ import type { ComponentList } from './ComponentList';
3
+ import { toItemsElementLocator } from '../matchers/component/LocatorSymbols';
4
+ import type { MenuItem } from './MenuItem';
5
+ export declare abstract class MenuComponent extends BaseComponent {
6
+ readonly [toItemsElementLocator]: () => Promise<import("playwright-core").Locator>;
7
+ abstract getMenuItems(): Promise<ComponentList<MenuItem>>;
8
+ getItemsLocator(): Promise<import("playwright-core").Locator>;
9
+ }
@@ -0,0 +1,78 @@
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
+ var _a;
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.MenuComponent = void 0;
56
+ var BaseComponent_1 = require("./BaseComponent");
57
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
58
+ var MenuComponent = /** @class */ (function (_super) {
59
+ __extends(MenuComponent, _super);
60
+ function MenuComponent() {
61
+ var _this = _super !== null && _super.apply(this, arguments) || this;
62
+ _this[_a] = function () { return _this.getItemsLocator(); };
63
+ return _this;
64
+ }
65
+ MenuComponent.prototype.getItemsLocator = function () {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ return __generator(this, function (_b) {
68
+ switch (_b.label) {
69
+ case 0: return [4 /*yield*/, this.getMenuItems()];
70
+ case 1: return [2 /*return*/, (_b.sent()).itemsLocator];
71
+ }
72
+ });
73
+ });
74
+ };
75
+ return MenuComponent;
76
+ }(BaseComponent_1.BaseComponent));
77
+ exports.MenuComponent = MenuComponent;
78
+ _a = LocatorSymbols_1.toItemsElementLocator;
@@ -3,10 +3,12 @@ import { BaseComponent } from './BaseComponent';
3
3
  import { MenuItemAssertations } from '../assertions';
4
4
  import { Label } from './Label';
5
5
  import type { InnerTextOptions } from '../options';
6
+ import { toTextElementLocator } from '../matchers/component/LocatorSymbols';
6
7
  export declare class MenuItem extends BaseComponent {
7
8
  readonly rootLocator: Locator;
8
9
  readonly contentLocator: Locator;
9
10
  readonly comment: Label;
11
+ readonly [toTextElementLocator]: () => Locator;
10
12
  constructor(rootLocator: Locator);
11
13
  getText(options?: InnerTextOptions): Promise<string>;
12
14
  expect(): MenuItemAssertations;
@@ -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.MenuItem = void 0;
55
56
  var react_ui_1 = require("@skbkontur/react-ui");
@@ -57,21 +58,23 @@ var BaseComponent_1 = require("./BaseComponent");
57
58
  var assertions_1 = require("../assertions");
58
59
  var Label_1 = require("./Label");
59
60
  var dataTidSelector_1 = require("../utils/dataTidSelector");
61
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
60
62
  var MenuItem = /** @class */ (function (_super) {
61
63
  __extends(MenuItem, _super);
62
64
  function MenuItem(rootLocator) {
63
65
  var _this = _super.call(this, rootLocator) || this;
64
66
  _this.rootLocator = rootLocator;
67
+ _this[_a] = function () { return _this.rootLocator; };
65
68
  _this.contentLocator = rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.content));
66
69
  _this.comment = new Label_1.Label(rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.MenuItemDataTids.comment)));
67
70
  return _this;
68
71
  }
69
72
  MenuItem.prototype.getText = function (options) {
70
73
  return __awaiter(this, void 0, void 0, function () {
71
- return __generator(this, function (_a) {
72
- switch (_a.label) {
74
+ return __generator(this, function (_b) {
75
+ switch (_b.label) {
73
76
  case 0: return [4 /*yield*/, this.rootLocator.innerText(options)];
74
- case 1: return [2 /*return*/, _a.sent()];
77
+ case 1: return [2 /*return*/, _b.sent()];
75
78
  }
76
79
  });
77
80
  });
@@ -82,3 +85,4 @@ var MenuItem = /** @class */ (function (_super) {
82
85
  return MenuItem;
83
86
  }(BaseComponent_1.BaseComponent));
84
87
  exports.MenuItem = MenuItem;
88
+ _a = LocatorSymbols_1.toTextElementLocator;
@@ -4,9 +4,11 @@ import { Label } from './Label';
4
4
  import { ComponentList } from './ComponentList';
5
5
  import { PagingAssertions } from '../assertions';
6
6
  import type { GetAttributeOptions } from '../options';
7
+ import { toControlElementLocator } from '../matchers/component/LocatorSymbols';
7
8
  export declare class Paging extends BaseComponent {
8
9
  private readonly nextPage;
9
10
  readonly pages: ComponentList<Page>;
11
+ readonly [toControlElementLocator]: () => Locator;
10
12
  constructor(rootLocator: Locator);
11
13
  isDisabled(options?: GetAttributeOptions): Promise<boolean>;
12
14
  getPagesCount(): Promise<number>;
@@ -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.Paging = void 0;
55
56
  var react_ui_1 = require("@skbkontur/react-ui");
@@ -59,39 +60,41 @@ var ComponentList_1 = require("./ComponentList");
59
60
  var utils_1 = require("../utils");
60
61
  var assertions_1 = require("../assertions");
61
62
  var dataTidSelector_1 = require("../utils/dataTidSelector");
63
+ var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
62
64
  var Paging = /** @class */ (function (_super) {
63
65
  __extends(Paging, _super);
64
66
  function Paging(rootLocator) {
65
67
  var _this = _super.call(this, rootLocator) || this;
68
+ _this[_a] = function () { return _this.rootLocator; };
66
69
  _this.pages = new ComponentList_1.ComponentList(rootLocator, function (locator) { return locator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.PagingDataTids.pageLinkWrapper)); }, function (locator) { return new Page(locator); });
67
70
  _this.nextPage = new Label_1.Label(rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.PagingDataTids.forwardLink)));
68
71
  return _this;
69
72
  }
70
73
  Paging.prototype.isDisabled = function (options) {
71
74
  return __awaiter(this, void 0, void 0, function () {
72
- return __generator(this, function (_a) {
73
- switch (_a.label) {
75
+ return __generator(this, function (_b) {
76
+ switch (_b.label) {
74
77
  case 0: return [4 /*yield*/, this.getAttribute(utils_1.DataVisualState.Disabled, options)];
75
- case 1: return [2 /*return*/, (_a.sent()) !== null];
78
+ case 1: return [2 /*return*/, (_b.sent()) !== null];
76
79
  }
77
80
  });
78
81
  });
79
82
  };
80
83
  Paging.prototype.getPagesCount = function () {
81
84
  return __awaiter(this, void 0, void 0, function () {
82
- var lastPage, _a;
83
- return __generator(this, function (_b) {
84
- switch (_b.label) {
85
+ var lastPage, _b;
86
+ return __generator(this, function (_c) {
87
+ switch (_c.label) {
85
88
  case 0: return [4 /*yield*/, this.pages.getLastItem()];
86
89
  case 1:
87
- lastPage = _b.sent();
88
- _b.label = 2;
90
+ lastPage = _c.sent();
91
+ _c.label = 2;
89
92
  case 2:
90
- _b.trys.push([2, 4, , 5]);
93
+ _c.trys.push([2, 4, , 5]);
91
94
  return [4 /*yield*/, lastPage.getNumber()];
92
- case 3: return [2 /*return*/, _b.sent()];
95
+ case 3: return [2 /*return*/, _c.sent()];
93
96
  case 4:
94
- _a = _b.sent();
97
+ _b = _c.sent();
95
98
  throw new Error('Не удалось получить количество страниц');
96
99
  case 5: return [2 /*return*/];
97
100
  }
@@ -100,30 +103,30 @@ var Paging = /** @class */ (function (_super) {
100
103
  };
101
104
  Paging.prototype.goToPage = function (pageNumber) {
102
105
  return __awaiter(this, void 0, void 0, function () {
103
- var page, _a;
106
+ var page, _b;
104
107
  var _this = this;
105
- return __generator(this, function (_b) {
106
- switch (_b.label) {
108
+ return __generator(this, function (_c) {
109
+ switch (_c.label) {
107
110
  case 0: return [4 /*yield*/, this.checkPageConstraint(pageNumber)];
108
111
  case 1:
109
- _b.sent();
110
- _b.label = 2;
112
+ _c.sent();
113
+ _c.label = 2;
111
114
  case 2:
112
- _b.trys.push([2, 5, , 6]);
113
- return [4 /*yield*/, this.pages.getFirstItemByPredicate(function (x) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
114
- switch (_a.label) {
115
+ _c.trys.push([2, 5, , 6]);
116
+ return [4 /*yield*/, this.pages.getFirstItemByPredicate(function (x) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
117
+ switch (_b.label) {
115
118
  case 0: return [4 /*yield*/, x.getText()];
116
- case 1: return [2 /*return*/, (_a.sent()) === pageNumber.toString()];
119
+ case 1: return [2 /*return*/, (_b.sent()) === pageNumber.toString()];
117
120
  }
118
121
  }); }); })];
119
122
  case 3:
120
- page = _b.sent();
123
+ page = _c.sent();
121
124
  return [4 /*yield*/, page.click()];
122
125
  case 4:
123
- _b.sent();
126
+ _c.sent();
124
127
  return [3 /*break*/, 6];
125
128
  case 5:
126
- _a = _b.sent();
129
+ _b = _c.sent();
127
130
  throw new Error("\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u044B \u0441 \u043D\u043E\u043C\u0435\u0440\u043E\u043C ".concat(pageNumber, " \u043D\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442"));
128
131
  case 6: return [2 /*return*/];
129
132
  }
@@ -132,27 +135,27 @@ var Paging = /** @class */ (function (_super) {
132
135
  };
133
136
  Paging.prototype.goToLastPage = function () {
134
137
  return __awaiter(this, void 0, void 0, function () {
135
- var lastPage, lastPageNumber, _a;
136
- return __generator(this, function (_b) {
137
- switch (_b.label) {
138
+ var lastPage, lastPageNumber, _b;
139
+ return __generator(this, function (_c) {
140
+ switch (_c.label) {
138
141
  case 0: return [4 /*yield*/, this.pages.getLastItem()];
139
142
  case 1:
140
- lastPage = _b.sent();
141
- _b.label = 2;
143
+ lastPage = _c.sent();
144
+ _c.label = 2;
142
145
  case 2:
143
- _b.trys.push([2, 6, , 7]);
146
+ _c.trys.push([2, 6, , 7]);
144
147
  return [4 /*yield*/, lastPage.getNumber()];
145
148
  case 3:
146
- lastPageNumber = _b.sent();
149
+ lastPageNumber = _c.sent();
147
150
  return [4 /*yield*/, this.checkPageConstraint(lastPageNumber)];
148
151
  case 4:
149
- _b.sent();
152
+ _c.sent();
150
153
  return [4 /*yield*/, lastPage.click()];
151
154
  case 5:
152
- _b.sent();
155
+ _c.sent();
153
156
  return [3 /*break*/, 7];
154
157
  case 6:
155
- _a = _b.sent();
158
+ _b = _c.sent();
156
159
  throw new Error('Не удалось получить номер последней страницы');
157
160
  case 7: return [2 /*return*/];
158
161
  }
@@ -163,31 +166,34 @@ var Paging = /** @class */ (function (_super) {
163
166
  return __awaiter(this, void 0, void 0, function () {
164
167
  var pageItem;
165
168
  var _this = this;
166
- return __generator(this, function (_a) {
167
- switch (_a.label) {
168
- case 0: return [4 /*yield*/, this.pages.getFirstItemByPredicate(function (x) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
169
- return [2 /*return*/, x.hasAttribute(utils_1.DataVisualState.Active)];
169
+ return __generator(this, function (_b) {
170
+ switch (_b.label) {
171
+ case 0: return [4 /*yield*/, this.pages.getFirstItemByPredicate(function (x) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
172
+ switch (_b.label) {
173
+ case 0: return [4 /*yield*/, x.hasAttribute(utils_1.DataVisualState.Active)];
174
+ case 1: return [2 /*return*/, _b.sent()];
175
+ }
170
176
  }); }); })];
171
177
  case 1:
172
- pageItem = _a.sent();
178
+ pageItem = _b.sent();
173
179
  return [4 /*yield*/, pageItem.getNumber()];
174
- case 2: return [2 /*return*/, _a.sent()];
180
+ case 2: return [2 /*return*/, _b.sent()];
175
181
  }
176
182
  });
177
183
  });
178
184
  };
179
185
  Paging.prototype.goToNextPage = function () {
180
186
  return __awaiter(this, void 0, void 0, function () {
181
- return __generator(this, function (_a) {
182
- switch (_a.label) {
187
+ return __generator(this, function (_b) {
188
+ switch (_b.label) {
183
189
  case 0: return [4 /*yield*/, this.nextPage.isDisabled()];
184
190
  case 1:
185
- if (_a.sent()) {
191
+ if (_b.sent()) {
186
192
  throw new Error('Нельзя перейти на следующую страницу. Текущая страница последняя');
187
193
  }
188
194
  return [4 /*yield*/, this.nextPage.click()];
189
195
  case 2:
190
- _a.sent();
196
+ _b.sent();
191
197
  return [2 /*return*/];
192
198
  }
193
199
  });
@@ -198,11 +204,11 @@ var Paging = /** @class */ (function (_super) {
198
204
  };
199
205
  Paging.prototype.checkPageConstraint = function (pageNumber) {
200
206
  return __awaiter(this, void 0, void 0, function () {
201
- return __generator(this, function (_a) {
202
- switch (_a.label) {
207
+ return __generator(this, function (_b) {
208
+ switch (_b.label) {
203
209
  case 0: return [4 /*yield*/, this.getActivePageNumber()];
204
210
  case 1:
205
- if ((_a.sent()) === pageNumber) {
211
+ if ((_b.sent()) === pageNumber) {
206
212
  throw new Error('Нельзя перейти на страницу, на которой уже находишься');
207
213
  }
208
214
  return [2 /*return*/];
@@ -213,6 +219,7 @@ var Paging = /** @class */ (function (_super) {
213
219
  return Paging;
214
220
  }(BaseComponent_1.BaseComponent));
215
221
  exports.Paging = Paging;
222
+ _a = LocatorSymbols_1.toControlElementLocator;
216
223
  var Page = /** @class */ (function (_super) {
217
224
  __extends(Page, _super);
218
225
  function Page(rootLocator) {
@@ -220,10 +227,10 @@ var Page = /** @class */ (function (_super) {
220
227
  }
221
228
  Page.prototype.isActive = function () {
222
229
  return __awaiter(this, void 0, void 0, function () {
223
- return __generator(this, function (_a) {
224
- switch (_a.label) {
230
+ return __generator(this, function (_b) {
231
+ switch (_b.label) {
225
232
  case 0: return [4 /*yield*/, this.getAttribute(utils_1.DataVisualState.Active)];
226
- case 1: return [2 /*return*/, (_a.sent()) !== null];
233
+ case 1: return [2 /*return*/, (_b.sent()) !== null];
227
234
  }
228
235
  });
229
236
  });
@@ -231,11 +238,11 @@ var Page = /** @class */ (function (_super) {
231
238
  Page.prototype.getNumber = function () {
232
239
  return __awaiter(this, void 0, void 0, function () {
233
240
  var pageNumber, number;
234
- return __generator(this, function (_a) {
235
- switch (_a.label) {
241
+ return __generator(this, function (_b) {
242
+ switch (_b.label) {
236
243
  case 0: return [4 /*yield*/, this.rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.PagingDataTids.pageLink)).innerText()];
237
244
  case 1:
238
- pageNumber = _a.sent();
245
+ pageNumber = _b.sent();
239
246
  number = Number(pageNumber);
240
247
  if (!isNaN(number)) {
241
248
  return [2 /*return*/, number];