@skbkontur/playwright-react-ui-components 1.18.0 → 1.19.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/ComponentListAssertions.d.ts +6 -1
- package/build/src/assertions/ComponentListAssertions.js +60 -0
- package/build/src/assertions/FileUploaderAssertions.d.ts +2 -4
- package/build/src/assertions/PagingAssertions.d.ts +2 -2
- package/build/src/assertions/TabsAssertions.d.ts +5 -3
- package/build/src/assertions/TabsAssertions.js +36 -0
- package/build/src/assertions/TokenInputAssertions.d.ts +5 -4
- package/build/src/assertions/TokenInputAssertions.js +36 -0
- package/build/src/components/Autocomplete.js +3 -3
- package/build/src/components/BaseComponent.js +3 -3
- package/build/src/components/Button.d.ts +2 -1
- package/build/src/components/Button.js +35 -1
- package/build/src/components/Checkbox.js +1 -1
- package/build/src/components/ComboBox.d.ts +7 -3
- package/build/src/components/ComboBox.js +21 -19
- package/build/src/components/ComponentList.d.ts +5 -2
- package/build/src/components/ComponentList.js +38 -32
- package/build/src/components/CurrencyInput.js +5 -5
- package/build/src/components/DateInput.js +4 -4
- package/build/src/components/DatePicker.js +5 -5
- package/build/src/components/Dropdown.d.ts +9 -3
- package/build/src/components/Dropdown.js +22 -32
- package/build/src/components/DropdownMenu.d.ts +12 -3
- package/build/src/components/DropdownMenu.js +24 -34
- package/build/src/components/FileUploader.js +6 -19
- package/build/src/components/FxInput.js +4 -4
- package/build/src/components/Input.js +3 -3
- package/build/src/components/Kebab.d.ts +12 -4
- package/build/src/components/Kebab.js +16 -16
- package/build/src/components/Link.js +1 -1
- package/build/src/components/MenuComponent.d.ts +3 -1
- package/build/src/components/Paging.d.ts +4 -4
- package/build/src/components/Paging.js +22 -24
- package/build/src/components/Portal.d.ts +3 -1
- package/build/src/components/Portal.js +5 -5
- package/build/src/components/Radio.js +1 -1
- package/build/src/components/RadioGroup.d.ts +6 -5
- package/build/src/components/RadioGroup.js +12 -36
- package/build/src/components/Select.d.ts +9 -3
- package/build/src/components/Select.js +21 -21
- package/build/src/components/Tab.js +1 -1
- package/build/src/components/Tabs.d.ts +3 -3
- package/build/src/components/Tabs.js +3 -38
- package/build/src/components/Textarea.js +3 -3
- package/build/src/components/Toggle.js +1 -1
- package/build/src/components/Token.d.ts +1 -1
- package/build/src/components/Token.js +2 -2
- package/build/src/components/TokenInput.d.ts +5 -3
- package/build/src/components/TokenInput.js +27 -39
- package/build/src/components/Tooltip.d.ts +3 -1
- package/build/src/components/Tooltip.js +3 -3
- package/build/src/matchers/component/toBeCheckedByIndex.js +9 -10
- package/build/src/matchers/component/toBeCheckedByText.js +9 -10
- package/build/src/matchers/component/toBeUncheckedByIndex.js +9 -10
- package/build/src/matchers/component/toBeUncheckedByText.js +3 -4
- package/build/src/matchers/component/toContainFormattedText.js +2 -3
- package/build/src/matchers/component/toContainItem.d.ts +1 -2
- package/build/src/matchers/component/toContainItem.js +30 -32
- package/build/src/matchers/component/toContainTab.d.ts +3 -0
- package/build/src/matchers/component/toContainTab.js +59 -0
- package/build/src/matchers/component/toContainTabs.d.ts +1 -1
- package/build/src/matchers/component/toContainTabs.js +2 -20
- package/build/src/matchers/component/toContainToken.d.ts +3 -0
- package/build/src/matchers/component/toContainToken.js +59 -0
- package/build/src/matchers/component/toContainTokens.d.ts +2 -2
- package/build/src/matchers/component/toContainTokens.js +2 -20
- package/build/src/matchers/component/toContainUploadedFiles.d.ts +2 -3
- package/build/src/matchers/component/toContainUploadedFiles.js +2 -15
- package/build/src/matchers/component/toHaveActivePage.d.ts +2 -2
- package/build/src/matchers/component/toHaveActivePage.js +5 -21
- package/build/src/matchers/component/toHaveActiveTab.js +9 -10
- package/build/src/matchers/component/toHaveFormattedText.js +2 -3
- package/build/src/matchers/component/toHaveFormattedValue.js +2 -3
- package/build/src/matchers/component/toHaveItemsByPredicate.d.ts +3 -0
- package/build/src/matchers/component/toHaveItemsByPredicate.js +64 -0
- package/build/src/matchers/component/toHaveTabs.d.ts +3 -0
- package/build/src/matchers/component/toHaveTabs.js +62 -0
- package/build/src/matchers/component/toHaveTokens.d.ts +3 -0
- package/build/src/matchers/component/toHaveTokens.js +62 -0
- package/build/src/matchers/componentMatchers.d.ts +14 -8
- package/build/src/matchers/componentMatchers.js +10 -0
- package/build/src/options/LocatorOptions.d.ts +39 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseComponentAssertions } from './BaseComponentAssertions';
|
|
2
2
|
import type { ComponentList } from '../components';
|
|
3
3
|
import type { BaseComponent } from '../components';
|
|
4
|
-
import type { HiddenOptions, VisibleOptions, CountOptions } from '../options';
|
|
4
|
+
import type { HiddenOptions, VisibleOptions, CountOptions, TextOptions } from '../options';
|
|
5
5
|
export declare class ComponentListAssertions<TItem extends BaseComponent> extends BaseComponentAssertions {
|
|
6
6
|
private readonly componentList;
|
|
7
7
|
constructor(componentList: ComponentList<TItem>);
|
|
@@ -10,4 +10,9 @@ export declare class ComponentListAssertions<TItem extends BaseComponent> extend
|
|
|
10
10
|
toHaveCount(count: number, options?: CountOptions): Promise<void>;
|
|
11
11
|
toBeEmpty(options?: CountOptions): Promise<void>;
|
|
12
12
|
notToBeEmpty(options?: CountOptions): Promise<void>;
|
|
13
|
+
toHaveItems(itemsText: string[], options?: TextOptions): Promise<void>;
|
|
14
|
+
toContainItems(itemsText: string[], options?: TextOptions): Promise<void>;
|
|
15
|
+
toContainItem(itemText: string, options?: TextOptions): Promise<void>;
|
|
16
|
+
notToContainItem(itemText: string, options?: TextOptions): Promise<void>;
|
|
17
|
+
toHaveItemsByPredicate<TResult extends BaseComponent>(itemsText: string[], selector: (item: TItem) => TResult, options?: TextOptions): Promise<void>;
|
|
13
18
|
}
|
|
@@ -121,6 +121,66 @@ var ComponentListAssertions = /** @class */ (function (_super) {
|
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
123
|
};
|
|
124
|
+
ComponentListAssertions.prototype.toHaveItems = function (itemsText, options) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.componentList).toHaveItems(itemsText, options)];
|
|
129
|
+
case 1:
|
|
130
|
+
_a.sent();
|
|
131
|
+
return [2 /*return*/];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
ComponentListAssertions.prototype.toContainItems = function (itemsText, options) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
138
|
+
return __generator(this, function (_a) {
|
|
139
|
+
switch (_a.label) {
|
|
140
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.componentList).toContainItems(itemsText, options)];
|
|
141
|
+
case 1:
|
|
142
|
+
_a.sent();
|
|
143
|
+
return [2 /*return*/];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
ComponentListAssertions.prototype.toContainItem = function (itemText, options) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
+
return __generator(this, function (_a) {
|
|
151
|
+
switch (_a.label) {
|
|
152
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.componentList).toContainItem(itemText, options)];
|
|
153
|
+
case 1:
|
|
154
|
+
_a.sent();
|
|
155
|
+
return [2 /*return*/];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
ComponentListAssertions.prototype.notToContainItem = function (itemText, options) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.componentList).not.toContainItem(itemText, options)];
|
|
165
|
+
case 1:
|
|
166
|
+
_a.sent();
|
|
167
|
+
return [2 /*return*/];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
ComponentListAssertions.prototype.toHaveItemsByPredicate = function (itemsText, selector, options) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
return __generator(this, function (_a) {
|
|
175
|
+
switch (_a.label) {
|
|
176
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.componentList).toHaveItemsByPredicate(itemsText, selector, options)];
|
|
177
|
+
case 1:
|
|
178
|
+
_a.sent();
|
|
179
|
+
return [2 /*return*/];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
124
184
|
return ComponentListAssertions;
|
|
125
185
|
}(BaseComponentAssertions_1.BaseComponentAssertions));
|
|
126
186
|
exports.ComponentListAssertions = ComponentListAssertions;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { BaseComponentAssertions } from './BaseComponentAssertions';
|
|
2
2
|
import type { FileUploader } from '../components';
|
|
3
|
-
import type { EnabledOptions } from '../options';
|
|
3
|
+
import type { EnabledOptions, TextOptions } from '../options';
|
|
4
4
|
export declare class FileUploaderAssertions extends BaseComponentAssertions {
|
|
5
5
|
private readonly fileUploader;
|
|
6
6
|
constructor(fileUploader: FileUploader);
|
|
7
7
|
toBeEnabled(options?: EnabledOptions): Promise<void>;
|
|
8
8
|
toBeDisabled(options?: EnabledOptions): Promise<void>;
|
|
9
|
-
toContainUploadedFiles(fileNames: string[], options?:
|
|
10
|
-
timeout: number;
|
|
11
|
-
}): Promise<void>;
|
|
9
|
+
toContainUploadedFiles(fileNames: string[], options?: TextOptions): Promise<void>;
|
|
12
10
|
}
|
|
@@ -7,9 +7,9 @@ export declare class PagingAssertions extends BaseComponentAssertions {
|
|
|
7
7
|
toBeEnabled(options?: AttributeOptions): Promise<void>;
|
|
8
8
|
toBeDisabled(options?: AttributeOptions): Promise<void>;
|
|
9
9
|
toHavePageCount(count: number, options?: {
|
|
10
|
-
timeout
|
|
10
|
+
timeout?: number;
|
|
11
11
|
}): Promise<void>;
|
|
12
12
|
toHaveActivePage(activePageNumber: number, options?: {
|
|
13
|
-
timeout
|
|
13
|
+
timeout?: number;
|
|
14
14
|
}): Promise<void>;
|
|
15
15
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { BaseComponentAssertions } from './BaseComponentAssertions';
|
|
2
2
|
import type { Tabs } from '../components';
|
|
3
|
+
import type { TextOptions } from '../options';
|
|
3
4
|
export declare class TabsAssertions extends BaseComponentAssertions {
|
|
4
5
|
private readonly tabs;
|
|
5
6
|
constructor(tabs: Tabs);
|
|
6
7
|
toHaveActiveTab(tabName: string | RegExp): Promise<void>;
|
|
7
8
|
notToHaveActiveTab(tabName: string | RegExp): Promise<void>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
toHaveTabs(tabNames: string[], options?: TextOptions): Promise<void>;
|
|
10
|
+
toContainTabs(tabNames: string[], options?: TextOptions): Promise<void>;
|
|
11
|
+
toContainTab(tabName: string, options?: TextOptions): Promise<void>;
|
|
12
|
+
notToContainTab(tabName: string, options?: TextOptions): Promise<void>;
|
|
11
13
|
}
|
|
@@ -85,6 +85,18 @@ var TabsAssertions = /** @class */ (function (_super) {
|
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
};
|
|
88
|
+
TabsAssertions.prototype.toHaveTabs = function (tabNames, options) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.tabs).toHaveTabs(tabNames, options)];
|
|
93
|
+
case 1:
|
|
94
|
+
_a.sent();
|
|
95
|
+
return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
};
|
|
88
100
|
TabsAssertions.prototype.toContainTabs = function (tabNames, options) {
|
|
89
101
|
return __awaiter(this, void 0, void 0, function () {
|
|
90
102
|
return __generator(this, function (_a) {
|
|
@@ -97,6 +109,30 @@ var TabsAssertions = /** @class */ (function (_super) {
|
|
|
97
109
|
});
|
|
98
110
|
});
|
|
99
111
|
};
|
|
112
|
+
TabsAssertions.prototype.toContainTab = function (tabName, options) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
return __generator(this, function (_a) {
|
|
115
|
+
switch (_a.label) {
|
|
116
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.tabs).toContainTab(tabName, options)];
|
|
117
|
+
case 1:
|
|
118
|
+
_a.sent();
|
|
119
|
+
return [2 /*return*/];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
TabsAssertions.prototype.notToContainTab = function (tabName, options) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.tabs).not.toContainTab(tabName, options)];
|
|
129
|
+
case 1:
|
|
130
|
+
_a.sent();
|
|
131
|
+
return [2 /*return*/];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
};
|
|
100
136
|
return TabsAssertions;
|
|
101
137
|
}(BaseComponentAssertions_1.BaseComponentAssertions));
|
|
102
138
|
exports.TabsAssertions = TabsAssertions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseComponentAssertions } from './BaseComponentAssertions';
|
|
2
|
-
import type { CountOptions, EnabledOptions, FocusedOptions } from '../options';
|
|
2
|
+
import type { CountOptions, EnabledOptions, FocusedOptions, TextOptions } from '../options';
|
|
3
3
|
import type { TokenInput } from '../components';
|
|
4
4
|
export declare class TokenInputAssertions extends BaseComponentAssertions {
|
|
5
5
|
private readonly tokenInput;
|
|
@@ -10,7 +10,8 @@ export declare class TokenInputAssertions extends BaseComponentAssertions {
|
|
|
10
10
|
notToBeEmpty(options?: CountOptions): Promise<void>;
|
|
11
11
|
toBeFocused(options?: FocusedOptions): Promise<void>;
|
|
12
12
|
notToBeFocused(options?: FocusedOptions): Promise<void>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
toHaveTokens(tokenNames: string[], options?: TextOptions): Promise<void>;
|
|
14
|
+
toContainTokens(tokenNames: string[], options?: TextOptions): Promise<void>;
|
|
15
|
+
toContainToken(tokenName: string, options?: TextOptions): Promise<void>;
|
|
16
|
+
notToContainToken(tokenName: string, options?: TextOptions): Promise<void>;
|
|
16
17
|
}
|
|
@@ -133,6 +133,18 @@ var TokenInputAssertions = /** @class */ (function (_super) {
|
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
|
+
TokenInputAssertions.prototype.toHaveTokens = function (tokenNames, options) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
138
|
+
return __generator(this, function (_a) {
|
|
139
|
+
switch (_a.label) {
|
|
140
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.tokenInput).toHaveTokens(tokenNames, options)];
|
|
141
|
+
case 1:
|
|
142
|
+
_a.sent();
|
|
143
|
+
return [2 /*return*/];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
};
|
|
136
148
|
TokenInputAssertions.prototype.toContainTokens = function (tokenNames, options) {
|
|
137
149
|
return __awaiter(this, void 0, void 0, function () {
|
|
138
150
|
return __generator(this, function (_a) {
|
|
@@ -145,6 +157,30 @@ var TokenInputAssertions = /** @class */ (function (_super) {
|
|
|
145
157
|
});
|
|
146
158
|
});
|
|
147
159
|
};
|
|
160
|
+
TokenInputAssertions.prototype.toContainToken = function (tokenName, options) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.tokenInput).toContainToken(tokenName, options)];
|
|
165
|
+
case 1:
|
|
166
|
+
_a.sent();
|
|
167
|
+
return [2 /*return*/];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
TokenInputAssertions.prototype.notToContainToken = function (tokenName, options) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
return __generator(this, function (_a) {
|
|
175
|
+
switch (_a.label) {
|
|
176
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.tokenInput).not.toContainToken(tokenName, options)];
|
|
177
|
+
case 1:
|
|
178
|
+
_a.sent();
|
|
179
|
+
return [2 /*return*/];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
148
184
|
return TokenInputAssertions;
|
|
149
185
|
}(BaseComponentAssertions_1.BaseComponentAssertions));
|
|
150
186
|
exports.TokenInputAssertions = TokenInputAssertions;
|
|
@@ -97,10 +97,10 @@ var Autocomplete = /** @class */ (function (_super) {
|
|
|
97
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
98
|
return __generator(this, function (_d) {
|
|
99
99
|
switch (_d.label) {
|
|
100
|
-
case 0: return [4 /*yield*/, this.focus()];
|
|
100
|
+
case 0: return [4 /*yield*/, this.focus(options)];
|
|
101
101
|
case 1:
|
|
102
102
|
_d.sent();
|
|
103
|
-
return [4 /*yield*/, this.clear()];
|
|
103
|
+
return [4 /*yield*/, this.clear(options)];
|
|
104
104
|
case 2:
|
|
105
105
|
_d.sent();
|
|
106
106
|
return [4 /*yield*/, this.inputLocator.fill(value, options)];
|
|
@@ -151,7 +151,7 @@ var Autocomplete = /** @class */ (function (_super) {
|
|
|
151
151
|
return __awaiter(this, void 0, void 0, function () {
|
|
152
152
|
return __generator(this, function (_d) {
|
|
153
153
|
switch (_d.label) {
|
|
154
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.inputLocator).toBeEnabled()];
|
|
154
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.inputLocator).toBeEnabled(options)];
|
|
155
155
|
case 1:
|
|
156
156
|
_d.sent();
|
|
157
157
|
return [4 /*yield*/, this.inputLocator.focus(options)];
|
|
@@ -64,7 +64,7 @@ var BaseComponent = /** @class */ (function () {
|
|
|
64
64
|
return __awaiter(this, void 0, void 0, function () {
|
|
65
65
|
return __generator(this, function (_d) {
|
|
66
66
|
switch (_d.label) {
|
|
67
|
-
case 0: return [4 /*yield*/, this.waitFor()];
|
|
67
|
+
case 0: return [4 /*yield*/, this.waitFor(options)];
|
|
68
68
|
case 1:
|
|
69
69
|
_d.sent();
|
|
70
70
|
return [4 /*yield*/, this.hasAttribute(utils_1.DataVisualState.Error, options)];
|
|
@@ -77,7 +77,7 @@ var BaseComponent = /** @class */ (function () {
|
|
|
77
77
|
return __awaiter(this, void 0, void 0, function () {
|
|
78
78
|
return __generator(this, function (_d) {
|
|
79
79
|
switch (_d.label) {
|
|
80
|
-
case 0: return [4 /*yield*/, this.waitFor()];
|
|
80
|
+
case 0: return [4 /*yield*/, this.waitFor(options)];
|
|
81
81
|
case 1:
|
|
82
82
|
_d.sent();
|
|
83
83
|
return [4 /*yield*/, this.hasAttribute(utils_1.DataVisualState.Warning, options)];
|
|
@@ -138,7 +138,7 @@ var BaseComponent = /** @class */ (function () {
|
|
|
138
138
|
return __awaiter(this, void 0, void 0, function () {
|
|
139
139
|
return __generator(this, function (_d) {
|
|
140
140
|
switch (_d.label) {
|
|
141
|
-
case 0: return [4 /*yield*/, this.waitFor()];
|
|
141
|
+
case 0: return [4 /*yield*/, this.waitFor(options)];
|
|
142
142
|
case 1:
|
|
143
143
|
_d.sent();
|
|
144
144
|
return [4 /*yield*/, this.getAttribute(name, options)];
|
|
@@ -2,7 +2,7 @@ import { type Locator } from '@playwright/test';
|
|
|
2
2
|
import { BaseComponent } from './BaseComponent';
|
|
3
3
|
import { ButtonAssertions } from '../assertions';
|
|
4
4
|
import type { TooltipType } from '../utils';
|
|
5
|
-
import type { BlurOptions, ClickOptions, FocusOptions, InnerTextOptions, IsDisabledOptions } from '../options';
|
|
5
|
+
import type { BlurOptions, ClickOptions, FocusOptions, HoverOptions, InnerTextOptions, IsDisabledOptions } from '../options';
|
|
6
6
|
import { toControlElementLocator, toFocusableElementLocator, toTextElementLocator } from '../matchers/component/LocatorSymbols';
|
|
7
7
|
/**
|
|
8
8
|
* Button можно использовать как для @skbkontur/react-ui, так и для react
|
|
@@ -20,6 +20,7 @@ export declare class Button extends BaseComponent {
|
|
|
20
20
|
click(options?: ClickOptions): Promise<void>;
|
|
21
21
|
focus(options?: FocusOptions): Promise<void>;
|
|
22
22
|
blur(options?: BlurOptions): Promise<void>;
|
|
23
|
+
hover(options?: HoverOptions): Promise<void>;
|
|
23
24
|
getTooltip(type: TooltipType): Promise<import("./Tooltip").Tooltip>;
|
|
24
25
|
expect(): ButtonAssertions;
|
|
25
26
|
}
|
|
@@ -14,6 +14,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
17
28
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
29
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
30
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -111,7 +122,7 @@ var Button = /** @class */ (function (_super) {
|
|
|
111
122
|
return __awaiter(this, void 0, void 0, function () {
|
|
112
123
|
return __generator(this, function (_d) {
|
|
113
124
|
switch (_d.label) {
|
|
114
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled()];
|
|
125
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.buttonLocator).toBeEnabled(options)];
|
|
115
126
|
case 1:
|
|
116
127
|
_d.sent();
|
|
117
128
|
return [4 /*yield*/, this.buttonLocator.focus(options)];
|
|
@@ -134,6 +145,29 @@ var Button = /** @class */ (function (_super) {
|
|
|
134
145
|
});
|
|
135
146
|
});
|
|
136
147
|
};
|
|
148
|
+
Button.prototype.hover = function (options) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
+
return __generator(this, function (_d) {
|
|
151
|
+
switch (_d.label) {
|
|
152
|
+
case 0: return [4 /*yield*/, this.waitFor()];
|
|
153
|
+
case 1:
|
|
154
|
+
_d.sent();
|
|
155
|
+
return [4 /*yield*/, this.isDisabled()];
|
|
156
|
+
case 2:
|
|
157
|
+
if (!_d.sent()) return [3 /*break*/, 4];
|
|
158
|
+
return [4 /*yield*/, this.buttonLocator.hover(__assign(__assign({}, options), { force: true }))];
|
|
159
|
+
case 3:
|
|
160
|
+
_d.sent();
|
|
161
|
+
return [3 /*break*/, 6];
|
|
162
|
+
case 4: return [4 /*yield*/, this.buttonLocator.hover(options)];
|
|
163
|
+
case 5:
|
|
164
|
+
_d.sent();
|
|
165
|
+
_d.label = 6;
|
|
166
|
+
case 6: return [2 /*return*/];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
};
|
|
137
171
|
Button.prototype.getTooltip = function (type) {
|
|
138
172
|
return __awaiter(this, void 0, void 0, function () {
|
|
139
173
|
return __generator(this, function (_d) {
|
|
@@ -119,7 +119,7 @@ var Checkbox = /** @class */ (function (_super) {
|
|
|
119
119
|
return __awaiter(this, void 0, void 0, function () {
|
|
120
120
|
return __generator(this, function (_f) {
|
|
121
121
|
switch (_f.label) {
|
|
122
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.inputLocator).toBeEnabled()];
|
|
122
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.inputLocator).toBeEnabled(options)];
|
|
123
123
|
case 1:
|
|
124
124
|
_f.sent();
|
|
125
125
|
return [4 /*yield*/, this.inputLocator.focus(options)];
|
|
@@ -19,7 +19,9 @@ export declare class ComboBox extends MenuComponent {
|
|
|
19
19
|
private getInputLocator;
|
|
20
20
|
isDisabled(options?: IsDisabledOptions): Promise<boolean>;
|
|
21
21
|
isFocused(options?: GetAttributeOptions): Promise<boolean>;
|
|
22
|
-
getSelectedValue(
|
|
22
|
+
getSelectedValue(options?: {
|
|
23
|
+
timeout?: number;
|
|
24
|
+
}): Promise<string>;
|
|
23
25
|
/**
|
|
24
26
|
* Этот метод только выбирает элемент из списка.
|
|
25
27
|
*
|
|
@@ -39,7 +41,7 @@ export declare class ComboBox extends MenuComponent {
|
|
|
39
41
|
clear(options?: ClearOptions): Promise<void>;
|
|
40
42
|
focus(options?: FocusOptions): Promise<void>;
|
|
41
43
|
blur(options?: BlurOptions): Promise<void>;
|
|
42
|
-
click(): Promise<void>;
|
|
44
|
+
click(options?: ClickOptions): Promise<void>;
|
|
43
45
|
getTooltip(type: TooltipType): Promise<import("./Tooltip").Tooltip>;
|
|
44
46
|
/**
|
|
45
47
|
* Возвращает список меню по data-tid'ам из react-ui:
|
|
@@ -50,7 +52,9 @@ export declare class ComboBox extends MenuComponent {
|
|
|
50
52
|
* - MenuHeaderDataTids.root
|
|
51
53
|
* - MenuFooterDataTids.root
|
|
52
54
|
*/
|
|
53
|
-
getMenuItems(
|
|
55
|
+
getMenuItems(options?: {
|
|
56
|
+
timeout?: number;
|
|
57
|
+
}): Promise<ComponentList<MenuItem>>;
|
|
54
58
|
expect(): ComboBoxAssertions;
|
|
55
59
|
private getComboBoxMenuItemsLocator;
|
|
56
60
|
}
|
|
@@ -112,16 +112,16 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
|
-
ComboBox.prototype.getSelectedValue = function () {
|
|
115
|
+
ComboBox.prototype.getSelectedValue = function (options) {
|
|
116
116
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
117
|
return __generator(this, function (_e) {
|
|
118
118
|
switch (_e.label) {
|
|
119
119
|
case 0: return [4 /*yield*/, this.isFocused()];
|
|
120
120
|
case 1:
|
|
121
121
|
if (!_e.sent()) return [3 /*break*/, 3];
|
|
122
|
-
return [4 /*yield*/, this.nativeInputLocator.inputValue()];
|
|
122
|
+
return [4 /*yield*/, this.nativeInputLocator.inputValue(options)];
|
|
123
123
|
case 2: return [2 /*return*/, _e.sent()];
|
|
124
|
-
case 3: return [4 /*yield*/, this.inputLikeTextLocator.innerText()];
|
|
124
|
+
case 3: return [4 /*yield*/, this.inputLikeTextLocator.innerText(options)];
|
|
125
125
|
case 4: return [2 /*return*/, _e.sent()];
|
|
126
126
|
}
|
|
127
127
|
});
|
|
@@ -140,7 +140,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
140
140
|
var items;
|
|
141
141
|
return __generator(this, function (_e) {
|
|
142
142
|
switch (_e.label) {
|
|
143
|
-
case 0: return [4 /*yield*/, this.getComboBoxMenuItemsLocator(value)];
|
|
143
|
+
case 0: return [4 /*yield*/, this.getComboBoxMenuItemsLocator(value, options)];
|
|
144
144
|
case 1:
|
|
145
145
|
items = _e.sent();
|
|
146
146
|
return [4 /*yield*/, items.first().click(options)];
|
|
@@ -161,10 +161,10 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
161
161
|
var items;
|
|
162
162
|
return __generator(this, function (_e) {
|
|
163
163
|
switch (_e.label) {
|
|
164
|
-
case 0: return [4 /*yield*/, this.getComboBoxMenuItemsLocator(value)];
|
|
164
|
+
case 0: return [4 /*yield*/, this.getComboBoxMenuItemsLocator(value, options)];
|
|
165
165
|
case 1:
|
|
166
166
|
items = _e.sent();
|
|
167
|
-
return [4 /*yield*/, (0, test_1.expect)(items).toHaveCount(1)];
|
|
167
|
+
return [4 /*yield*/, (0, test_1.expect)(items).toHaveCount(1, options)];
|
|
168
168
|
case 2:
|
|
169
169
|
_e.sent();
|
|
170
170
|
return [4 /*yield*/, items.click(options)];
|
|
@@ -179,7 +179,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
179
179
|
return __awaiter(this, void 0, void 0, function () {
|
|
180
180
|
return __generator(this, function (_e) {
|
|
181
181
|
switch (_e.label) {
|
|
182
|
-
case 0: return [4 /*yield*/, this.focus()];
|
|
182
|
+
case 0: return [4 /*yield*/, this.focus(options)];
|
|
183
183
|
case 1:
|
|
184
184
|
_e.sent();
|
|
185
185
|
return [4 /*yield*/, this.nativeInputLocator.fill(value, options)];
|
|
@@ -194,7 +194,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
194
194
|
return __awaiter(this, void 0, void 0, function () {
|
|
195
195
|
return __generator(this, function (_e) {
|
|
196
196
|
switch (_e.label) {
|
|
197
|
-
case 0: return [4 /*yield*/, this.focus()];
|
|
197
|
+
case 0: return [4 /*yield*/, this.focus(options)];
|
|
198
198
|
case 1:
|
|
199
199
|
_e.sent();
|
|
200
200
|
return [4 /*yield*/, this.nativeInputLocator.clear(options)];
|
|
@@ -209,7 +209,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
209
209
|
return __awaiter(this, void 0, void 0, function () {
|
|
210
210
|
return __generator(this, function (_e) {
|
|
211
211
|
switch (_e.label) {
|
|
212
|
-
case 0: return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
|
|
212
|
+
case 0: return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled(options)];
|
|
213
213
|
case 1:
|
|
214
214
|
_e.sent();
|
|
215
215
|
return [4 /*yield*/, this.rootLocator
|
|
@@ -227,7 +227,7 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
227
227
|
return __awaiter(this, void 0, void 0, function () {
|
|
228
228
|
return __generator(this, function (_e) {
|
|
229
229
|
switch (_e.label) {
|
|
230
|
-
case 0: return [4 /*yield*/, this.nativeInputLocator.press('Tab',
|
|
230
|
+
case 0: return [4 /*yield*/, this.nativeInputLocator.press('Tab', options)];
|
|
231
231
|
case 1:
|
|
232
232
|
_e.sent();
|
|
233
233
|
return [2 /*return*/];
|
|
@@ -235,17 +235,17 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
235
235
|
});
|
|
236
236
|
});
|
|
237
237
|
};
|
|
238
|
-
ComboBox.prototype.click = function () {
|
|
238
|
+
ComboBox.prototype.click = function (options) {
|
|
239
239
|
return __awaiter(this, void 0, void 0, function () {
|
|
240
240
|
return __generator(this, function (_e) {
|
|
241
241
|
switch (_e.label) {
|
|
242
242
|
case 0:
|
|
243
243
|
// NOTE: rootLocator всегда в состоянии enabled, даже если ComboBox disabled
|
|
244
|
-
return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled()];
|
|
244
|
+
return [4 /*yield*/, (0, test_1.expect)(this.nativeInputLocator).toBeEnabled(options)];
|
|
245
245
|
case 1:
|
|
246
246
|
// NOTE: rootLocator всегда в состоянии enabled, даже если ComboBox disabled
|
|
247
247
|
_e.sent();
|
|
248
|
-
return [4 /*yield*/, _super.prototype.click.call(this)];
|
|
248
|
+
return [4 /*yield*/, _super.prototype.click.call(this, options)];
|
|
249
249
|
case 2:
|
|
250
250
|
_e.sent();
|
|
251
251
|
return [2 /*return*/];
|
|
@@ -265,18 +265,20 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
265
265
|
* - MenuHeaderDataTids.root
|
|
266
266
|
* - MenuFooterDataTids.root
|
|
267
267
|
*/
|
|
268
|
-
ComboBox.prototype.getMenuItems = function () {
|
|
268
|
+
ComboBox.prototype.getMenuItems = function (options) {
|
|
269
269
|
return __awaiter(this, void 0, void 0, function () {
|
|
270
270
|
var container;
|
|
271
271
|
return __generator(this, function (_e) {
|
|
272
272
|
switch (_e.label) {
|
|
273
|
-
case 0: return [4 /*yield*/, this.focus()];
|
|
273
|
+
case 0: return [4 /*yield*/, this.focus(options)];
|
|
274
274
|
case 1:
|
|
275
275
|
_e.sent();
|
|
276
|
-
return [4 /*yield*/, this.portal.getContainer()];
|
|
276
|
+
return [4 /*yield*/, this.portal.getContainer(options)];
|
|
277
277
|
case 2:
|
|
278
278
|
container = _e.sent();
|
|
279
|
-
return [4 /*yield*/, container
|
|
279
|
+
return [4 /*yield*/, container
|
|
280
|
+
.locator((0, dataTidSelector_1.getDataTidSelector)(react_ui_1.SpinnerDataTids.root))
|
|
281
|
+
.waitFor({ state: 'hidden', timeout: options === null || options === void 0 ? void 0 : options.timeout })];
|
|
280
282
|
case 3:
|
|
281
283
|
_e.sent();
|
|
282
284
|
return [2 /*return*/, new ComponentList_1.ComponentList(container, function (locator) {
|
|
@@ -295,12 +297,12 @@ var ComboBox = /** @class */ (function (_super) {
|
|
|
295
297
|
ComboBox.prototype.expect = function () {
|
|
296
298
|
return new assertions_1.ComboBoxAssertions(this);
|
|
297
299
|
};
|
|
298
|
-
ComboBox.prototype.getComboBoxMenuItemsLocator = function (byText) {
|
|
300
|
+
ComboBox.prototype.getComboBoxMenuItemsLocator = function (byText, options) {
|
|
299
301
|
return __awaiter(this, void 0, void 0, function () {
|
|
300
302
|
var container, items;
|
|
301
303
|
return __generator(this, function (_e) {
|
|
302
304
|
switch (_e.label) {
|
|
303
|
-
case 0: return [4 /*yield*/, this.portal.getContainer()];
|
|
305
|
+
case 0: return [4 /*yield*/, this.portal.getContainer(options)];
|
|
304
306
|
case 1:
|
|
305
307
|
container = _e.sent();
|
|
306
308
|
items = container.locator((0, dataTidSelector_1.getDataTidSelector)(CustomComboBox_1.ComboBoxMenuDataTids.item));
|
|
@@ -2,14 +2,16 @@ import type { Locator } from '@playwright/test';
|
|
|
2
2
|
import { BaseComponent } from './BaseComponent';
|
|
3
3
|
import { ComponentListAssertions } from '../assertions';
|
|
4
4
|
import { type TooltipType } from '../utils';
|
|
5
|
-
import type { IsVisibleOptions } from '../options';
|
|
6
|
-
import { toVisibleElementLocator, toValueElementLocator } from '../matchers/component/LocatorSymbols';
|
|
5
|
+
import type { FilterOptions, IsVisibleOptions } from '../options';
|
|
6
|
+
import { toVisibleElementLocator, toValueElementLocator, toItemsElementLocator, toContainItemElementLocator } from '../matchers/component/LocatorSymbols';
|
|
7
7
|
export declare class ComponentList<TItem extends BaseComponent> extends BaseComponent {
|
|
8
8
|
readonly rootLocator: Locator;
|
|
9
9
|
private readonly itemFactory;
|
|
10
10
|
readonly itemsLocator: Locator;
|
|
11
11
|
readonly [toVisibleElementLocator]: () => Locator;
|
|
12
12
|
readonly [toValueElementLocator]: () => Locator;
|
|
13
|
+
readonly [toItemsElementLocator]: () => Locator;
|
|
14
|
+
readonly [toContainItemElementLocator]: () => Locator;
|
|
13
15
|
constructor(rootLocator: Locator, itemsLocator: (rootLocator: Locator) => Locator, itemFactory: (locator: Locator) => TItem);
|
|
14
16
|
isVisible(options?: IsVisibleOptions): Promise<boolean>;
|
|
15
17
|
/**
|
|
@@ -20,6 +22,7 @@ export declare class ComponentList<TItem extends BaseComponent> extends BaseComp
|
|
|
20
22
|
* Когда список элементов стабилен, но загружается динамически, необходимо дождаться полной загрузки списка перед вызовом getItems
|
|
21
23
|
*/
|
|
22
24
|
getItems(): Promise<TItem[]>;
|
|
25
|
+
filter(options?: FilterOptions): ComponentList<TItem>;
|
|
23
26
|
/**
|
|
24
27
|
* Поведение метода идентично вызову locator.nth(0)
|
|
25
28
|
*/
|