@skbkontur/playwright-react-ui-components 1.14.0-beta.2 → 1.14.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/assertions/AutocompleteAssertions.js +1 -1
- package/build/src/assertions/DateRangePickerAssertions.d.ts +1 -1
- package/build/src/assertions/InputAssertions.js +1 -1
- package/build/src/assertions/LabelAssertions.js +2 -2
- package/build/src/assertions/TokenAssertions.js +1 -1
- package/build/src/extensions/mergedExpects.d.ts +2 -2
- package/build/src/extensions/mergedExpects.js +3 -3
- package/build/src/matchers/component/toBeActiveTab.js +2 -2
- package/build/src/matchers/component/toBeDisabledEx.js +3 -3
- package/build/src/matchers/component/toBeEmptyEx.js +6 -3
- package/build/src/matchers/component/toBeEnabledEx.js +4 -4
- package/build/src/matchers/component/toBeInactiveTab.js +2 -2
- package/build/src/matchers/component/toContainFormattedTextEx.d.ts +3 -0
- package/build/src/matchers/component/{toContainFormattedText.js → toContainFormattedTextEx.js} +2 -2
- package/build/src/matchers/component/toHaveActivePage.js +2 -2
- package/build/src/matchers/component/toHaveCountEx.js +5 -2
- package/build/src/matchers/component/toHaveError.js +2 -2
- package/build/src/matchers/component/toHaveFormattedTextEx.d.ts +3 -0
- package/build/src/matchers/component/{toHaveFormattedText.js → toHaveFormattedTextEx.js} +2 -2
- package/build/src/matchers/component/toHaveFormattedValueEx.d.ts +3 -0
- package/build/src/matchers/component/{toHaveFormattedValue.js → toHaveFormattedValueEx.js} +2 -2
- package/build/src/matchers/component/toHaveWarning.js +2 -2
- package/build/src/matchers/componentMatchers.d.ts +6 -6
- package/build/src/matchers/componentMatchers.js +6 -6
- package/build/src/matchers/createAsyncMatcher.js +6 -6
- package/build/src/utils/getMarcherResult.d.ts +4 -2
- package/build/src/utils/getMarcherResult.js +17 -1
- package/build/src/utils/toMatchMessage.js +23 -8
- package/package.json +1 -1
- package/build/src/matchers/component/toContainFormattedText.d.ts +0 -3
- package/build/src/matchers/component/toHaveFormattedText.d.ts +0 -3
- package/build/src/matchers/component/toHaveFormattedValue.d.ts +0 -3
|
@@ -116,7 +116,7 @@ var AutocompleteAssertions = /** @class */ (function (_super) {
|
|
|
116
116
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
117
|
return __generator(this, function (_a) {
|
|
118
118
|
switch (_a.label) {
|
|
119
|
-
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.autocomplete).
|
|
119
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.autocomplete).toHaveFormattedValueEx(value, options)];
|
|
120
120
|
case 1:
|
|
121
121
|
_a.sent();
|
|
122
122
|
return [2 /*return*/];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseComponentAssertions } from './BaseComponentAssertions';
|
|
2
2
|
import type { DateRangePicker } from '../components';
|
|
3
3
|
export declare class DateRangePickerAssertions extends BaseComponentAssertions {
|
|
4
|
-
private dateRangePicker;
|
|
4
|
+
private readonly dateRangePicker;
|
|
5
5
|
constructor(dateRangePicker: DateRangePicker);
|
|
6
6
|
toHaveValues(values: {
|
|
7
7
|
start?: string;
|
|
@@ -116,7 +116,7 @@ var InputAssertions = /** @class */ (function (_super) {
|
|
|
116
116
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
117
|
return __generator(this, function (_a) {
|
|
118
118
|
switch (_a.label) {
|
|
119
|
-
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.input).
|
|
119
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.input).toHaveFormattedValueEx(value, options)];
|
|
120
120
|
case 1:
|
|
121
121
|
_a.sent();
|
|
122
122
|
return [2 /*return*/];
|
|
@@ -116,7 +116,7 @@ var LabelAssertions = /** @class */ (function (_super) {
|
|
|
116
116
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
117
|
return __generator(this, function (_a) {
|
|
118
118
|
switch (_a.label) {
|
|
119
|
-
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.label).
|
|
119
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.label).toHaveFormattedTextEx(text, options)];
|
|
120
120
|
case 1:
|
|
121
121
|
_a.sent();
|
|
122
122
|
return [2 /*return*/];
|
|
@@ -131,7 +131,7 @@ var LabelAssertions = /** @class */ (function (_super) {
|
|
|
131
131
|
return __awaiter(this, void 0, void 0, function () {
|
|
132
132
|
return __generator(this, function (_a) {
|
|
133
133
|
switch (_a.label) {
|
|
134
|
-
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.label).
|
|
134
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.label).toContainFormattedTextEx(text, options)];
|
|
135
135
|
case 1:
|
|
136
136
|
_a.sent();
|
|
137
137
|
return [2 /*return*/];
|
|
@@ -116,7 +116,7 @@ var TokenAssertions = /** @class */ (function (_super) {
|
|
|
116
116
|
return __awaiter(this, void 0, void 0, function () {
|
|
117
117
|
return __generator(this, function (_a) {
|
|
118
118
|
switch (_a.label) {
|
|
119
|
-
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.token).
|
|
119
|
+
case 0: return [4 /*yield*/, (0, extensions_1.expect)(this.token).toHaveFormattedTextEx(text, options)];
|
|
120
120
|
case 1:
|
|
121
121
|
_a.sent();
|
|
122
122
|
return [2 /*return*/];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Expect } from '@playwright/test';
|
|
2
|
-
import { type FormattedMatchers } from '../matchers
|
|
3
|
-
import { type ComponentMatchers } from '../matchers
|
|
2
|
+
import { type FormattedMatchers } from '../matchers';
|
|
3
|
+
import { type ComponentMatchers } from '../matchers';
|
|
4
4
|
export type ExtendedExpect = Expect<FormattedMatchers & ComponentMatchers>;
|
|
5
5
|
export declare const expect: ExtendedExpect;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.expect = void 0;
|
|
4
4
|
var test_1 = require("@playwright/test");
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
exports.expect = (0, test_1.mergeExpects)(test_1.expect,
|
|
5
|
+
var matchers_1 = require("../matchers");
|
|
6
|
+
var matchers_2 = require("../matchers");
|
|
7
|
+
exports.expect = (0, test_1.mergeExpects)(test_1.expect, matchers_1.formattedMatchers, matchers_2.componentMatchers);
|
|
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.toBeActiveTab = void 0;
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
|
-
var
|
|
41
|
+
var utils_1 = require("../../utils");
|
|
42
42
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
43
43
|
exports.toBeActiveTab = (0, createAsyncMatcher_1.createComponentAsyncMatcher)('toBeActiveTab', function (component) { return component.rootLocator; }, function (_a, options_1) { return __awaiter(void 0, [_a, options_1], void 0, function (_b, options) {
|
|
44
44
|
var expectation;
|
|
@@ -47,7 +47,7 @@ exports.toBeActiveTab = (0, createAsyncMatcher_1.createComponentAsyncMatcher)('t
|
|
|
47
47
|
switch (_c.label) {
|
|
48
48
|
case 0:
|
|
49
49
|
expectation = isNot ? (0, test_1.expect)(locator).not : (0, test_1.expect)(locator);
|
|
50
|
-
return [4 /*yield*/, expectation.toHaveAttribute(
|
|
50
|
+
return [4 /*yield*/, expectation.toHaveAttribute(utils_1.DataVisualState.Active, options)];
|
|
51
51
|
case 1:
|
|
52
52
|
_c.sent();
|
|
53
53
|
return [2 /*return*/];
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.toBeDisabledEx = void 0;
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
41
|
var components_1 = require("../../components");
|
|
42
|
-
var
|
|
42
|
+
var utils_1 = require("../../utils");
|
|
43
43
|
var extensions_1 = require("../../extensions");
|
|
44
44
|
var LocatorSymbols_1 = require("./LocatorSymbols");
|
|
45
45
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
@@ -96,7 +96,7 @@ function checkSelect(component, isNot, locator, options) {
|
|
|
96
96
|
return [4 /*yield*/, component.isLinkSelect()];
|
|
97
97
|
case 1:
|
|
98
98
|
if (!_a.sent()) return [3 /*break*/, 3];
|
|
99
|
-
return [4 /*yield*/, expectation.toHaveAttribute(
|
|
99
|
+
return [4 /*yield*/, expectation.toHaveAttribute(utils_1.DataVisualState.Disabled, options)];
|
|
100
100
|
case 2:
|
|
101
101
|
_a.sent();
|
|
102
102
|
return [3 /*break*/, 5];
|
|
@@ -161,7 +161,7 @@ function checkAttribute(component, isNot, options) {
|
|
|
161
161
|
switch (_a.label) {
|
|
162
162
|
case 0:
|
|
163
163
|
expectation = isNot ? (0, extensions_1.expect)(component).not : (0, extensions_1.expect)(component);
|
|
164
|
-
return [4 /*yield*/, expectation.toHaveAttributeEx(
|
|
164
|
+
return [4 /*yield*/, expectation.toHaveAttributeEx(utils_1.DataVisualState.Disabled, undefined, options)];
|
|
165
165
|
case 1:
|
|
166
166
|
_a.sent();
|
|
167
167
|
return [2 /*return*/];
|
|
@@ -64,7 +64,7 @@ exports.toBeEmptyEx = (0, createAsyncMatcher_1.createAsyncMatcher)('toBeEmptyEx'
|
|
|
64
64
|
case 4:
|
|
65
65
|
_d.sent();
|
|
66
66
|
return [3 /*break*/, 9];
|
|
67
|
-
case 5: return [4 /*yield*/, checkComponentList(isNot, locator, options)];
|
|
67
|
+
case 5: return [4 /*yield*/, checkComponentList(isNot, component, locator, options)];
|
|
68
68
|
case 6:
|
|
69
69
|
_d.sent();
|
|
70
70
|
return [3 /*break*/, 9];
|
|
@@ -119,15 +119,18 @@ function checkDateRangePicker(component) {
|
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
function checkComponentList(isNot, locator, options) {
|
|
122
|
+
function checkComponentList(isNot, component, locator, options) {
|
|
123
123
|
return __awaiter(this, void 0, void 0, function () {
|
|
124
124
|
var expectation;
|
|
125
125
|
return __generator(this, function (_a) {
|
|
126
126
|
switch (_a.label) {
|
|
127
127
|
case 0:
|
|
128
128
|
expectation = isNot ? (0, test_1.expect)(locator).not : (0, test_1.expect)(locator);
|
|
129
|
-
return [4 /*yield*/,
|
|
129
|
+
return [4 /*yield*/, component.waitFor({ state: 'attached' })];
|
|
130
130
|
case 1:
|
|
131
|
+
_a.sent();
|
|
132
|
+
return [4 /*yield*/, expectation.toHaveCount(0, options)];
|
|
133
|
+
case 2:
|
|
131
134
|
_a.sent();
|
|
132
135
|
return [2 /*return*/];
|
|
133
136
|
}
|
|
@@ -50,7 +50,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
50
50
|
exports.toBeEnabledEx = void 0;
|
|
51
51
|
var test_1 = require("@playwright/test");
|
|
52
52
|
var components_1 = require("../../components");
|
|
53
|
-
var
|
|
53
|
+
var utils_1 = require("../../utils");
|
|
54
54
|
var extensions_1 = require("../../extensions");
|
|
55
55
|
var LocatorSymbols_1 = require("./LocatorSymbols");
|
|
56
56
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
@@ -107,7 +107,7 @@ function checkSelect(component, isNot, locator, options) {
|
|
|
107
107
|
return [4 /*yield*/, component.isLinkSelect()];
|
|
108
108
|
case 1:
|
|
109
109
|
if (!_a.sent()) return [3 /*break*/, 3];
|
|
110
|
-
return [4 /*yield*/, expectation.not.toHaveAttribute(
|
|
110
|
+
return [4 /*yield*/, expectation.not.toHaveAttribute(utils_1.DataVisualState.Disabled, options)];
|
|
111
111
|
case 2:
|
|
112
112
|
_a.sent();
|
|
113
113
|
return [3 /*break*/, 5];
|
|
@@ -181,11 +181,11 @@ function checkAttribute(component, isNot, options) {
|
|
|
181
181
|
switch (_a.label) {
|
|
182
182
|
case 0:
|
|
183
183
|
if (!isNot) return [3 /*break*/, 2];
|
|
184
|
-
return [4 /*yield*/, (0, extensions_1.expect)(component).toHaveAttributeEx(
|
|
184
|
+
return [4 /*yield*/, (0, extensions_1.expect)(component).toHaveAttributeEx(utils_1.DataVisualState.Disabled, undefined, options)];
|
|
185
185
|
case 1:
|
|
186
186
|
_a.sent();
|
|
187
187
|
return [3 /*break*/, 4];
|
|
188
|
-
case 2: return [4 /*yield*/, (0, extensions_1.expect)(component).not.toHaveAttributeEx(
|
|
188
|
+
case 2: return [4 /*yield*/, (0, extensions_1.expect)(component).not.toHaveAttributeEx(utils_1.DataVisualState.Disabled, undefined, options)];
|
|
189
189
|
case 3:
|
|
190
190
|
_a.sent();
|
|
191
191
|
_a.label = 4;
|
|
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.toBeInactiveTab = void 0;
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
|
-
var
|
|
41
|
+
var utils_1 = require("../../utils");
|
|
42
42
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
43
43
|
exports.toBeInactiveTab = (0, createAsyncMatcher_1.createComponentAsyncMatcher)('toBeInactiveTab', function (component) { return component.rootLocator; }, function (_a, options_1) { return __awaiter(void 0, [_a, options_1], void 0, function (_b, options) {
|
|
44
44
|
var expectation;
|
|
@@ -47,7 +47,7 @@ exports.toBeInactiveTab = (0, createAsyncMatcher_1.createComponentAsyncMatcher)(
|
|
|
47
47
|
switch (_c.label) {
|
|
48
48
|
case 0:
|
|
49
49
|
expectation = isNot ? (0, test_1.expect)(locator).not : (0, test_1.expect)(locator);
|
|
50
|
-
return [4 /*yield*/, expectation.not.toHaveAttribute(
|
|
50
|
+
return [4 /*yield*/, expectation.not.toHaveAttribute(utils_1.DataVisualState.Active, options)];
|
|
51
51
|
case 1:
|
|
52
52
|
_c.sent();
|
|
53
53
|
return [2 /*return*/];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Label } from '../../components';
|
|
2
|
+
import type { TransformOptions } from '../../options';
|
|
3
|
+
export declare const toContainFormattedTextEx: (this: import("playwright/test").ExpectMatcherState, component: Label, args_0: string, args_1?: TransformOptions | undefined) => Promise<import("playwright/test").MatcherReturnType>;
|
package/build/src/matchers/component/{toContainFormattedText.js → toContainFormattedTextEx.js}
RENAMED
|
@@ -36,10 +36,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.toContainFormattedTextEx = void 0;
|
|
40
40
|
var extensions_1 = require("../../extensions");
|
|
41
41
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
42
|
-
exports.
|
|
42
|
+
exports.toContainFormattedTextEx = (0, createAsyncMatcher_1.createComponentAsyncMatcher)('toContainFormattedTextEx', function (component) { return component.rootLocator; }, function (_a, expected_1, options_1) { return __awaiter(void 0, [_a, expected_1, options_1], void 0, function (_b, expected, options) {
|
|
43
43
|
var expectation;
|
|
44
44
|
var isNot = _b.isNot, locator = _b.locator;
|
|
45
45
|
return __generator(this, function (_c) {
|
|
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.toHaveActivePage = void 0;
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
|
-
var
|
|
41
|
+
var utils_1 = require("../../utils");
|
|
42
42
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
43
43
|
exports.toHaveActivePage = (0, createAsyncMatcher_1.createComponentAsyncMatcher)('toHaveActivePage', function (component) { return component.rootLocator; }, function (_a, expectedPageNumber_1, options_1) { return __awaiter(void 0, [_a, expectedPageNumber_1, options_1], void 0, function (_b, expectedPageNumber, options) {
|
|
44
44
|
var expectation;
|
|
@@ -52,7 +52,7 @@ exports.toHaveActivePage = (0, createAsyncMatcher_1.createComponentAsyncMatcher)
|
|
|
52
52
|
switch (_a.label) {
|
|
53
53
|
case 0: return [4 /*yield*/, component.pages.getFirstItemByPredicate(function (x) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
54
54
|
switch (_a.label) {
|
|
55
|
-
case 0: return [4 /*yield*/, x.hasAttribute(
|
|
55
|
+
case 0: return [4 /*yield*/, x.hasAttribute(utils_1.DataVisualState.Active)];
|
|
56
56
|
case 1: return [2 /*return*/, _a.sent()];
|
|
57
57
|
}
|
|
58
58
|
}); }); })];
|
|
@@ -42,13 +42,16 @@ var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
43
|
exports.toHaveCountEx = (0, createAsyncMatcher_1.createComponentAsyncMatcher)('toHaveCountEx', function (component) { return component.itemsLocator; }, function (_a, count_1, options_1) { return __awaiter(void 0, [_a, count_1, options_1], void 0, function (_b, count, options) {
|
|
44
44
|
var expectation;
|
|
45
|
-
var isNot = _b.isNot, locator = _b.locator;
|
|
45
|
+
var isNot = _b.isNot, component = _b.component, locator = _b.locator;
|
|
46
46
|
return __generator(this, function (_c) {
|
|
47
47
|
switch (_c.label) {
|
|
48
48
|
case 0:
|
|
49
49
|
expectation = isNot ? (0, test_1.expect)(locator).not : (0, test_1.expect)(locator);
|
|
50
|
-
return [4 /*yield*/,
|
|
50
|
+
return [4 /*yield*/, component.waitFor({ state: 'attached' })];
|
|
51
51
|
case 1:
|
|
52
|
+
_c.sent();
|
|
53
|
+
return [4 /*yield*/, expectation.toHaveCount(count, options)];
|
|
54
|
+
case 2:
|
|
52
55
|
_c.sent();
|
|
53
56
|
return [2 /*return*/];
|
|
54
57
|
}
|
|
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.toHaveError = void 0;
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
|
-
var
|
|
41
|
+
var utils_1 = require("../../utils");
|
|
42
42
|
var LocatorSymbols_1 = require("./LocatorSymbols");
|
|
43
43
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
44
44
|
exports.toHaveError = (0, createAsyncMatcher_1.createAsyncMatcher)('toHaveError', function (component) { return component[LocatorSymbols_1.toRootElementLocator](); }, function (_a, options_1) { return __awaiter(void 0, [_a, options_1], void 0, function (_b, options) {
|
|
@@ -48,7 +48,7 @@ exports.toHaveError = (0, createAsyncMatcher_1.createAsyncMatcher)('toHaveError'
|
|
|
48
48
|
switch (_c.label) {
|
|
49
49
|
case 0:
|
|
50
50
|
expectation = isNot ? (0, test_1.expect)(locator).not : (0, test_1.expect)(locator);
|
|
51
|
-
return [4 /*yield*/, expectation.toHaveAttribute(
|
|
51
|
+
return [4 /*yield*/, expectation.toHaveAttribute(utils_1.DataVisualState.Error, options)];
|
|
52
52
|
case 1:
|
|
53
53
|
_c.sent();
|
|
54
54
|
return [2 /*return*/];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { TransformOptions } from '../../options';
|
|
2
|
+
import type { ToTextElementLocator } from './LocatorSymbols';
|
|
3
|
+
export declare const toHaveFormattedTextEx: (this: import("playwright/test").ExpectMatcherState, component: ToTextElementLocator, args_0: string, args_1?: TransformOptions | undefined) => Promise<import("playwright/test").MatcherReturnType>;
|
|
@@ -36,11 +36,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.toHaveFormattedTextEx = void 0;
|
|
40
40
|
var extensions_1 = require("../../extensions");
|
|
41
41
|
var LocatorSymbols_1 = require("./LocatorSymbols");
|
|
42
42
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
43
|
-
exports.
|
|
43
|
+
exports.toHaveFormattedTextEx = (0, createAsyncMatcher_1.createAsyncMatcher)('toHaveFormattedTextEx', function (component) { return component[LocatorSymbols_1.toTextElementLocator](); }, function (_a, expected_1, options_1) { return __awaiter(void 0, [_a, expected_1, options_1], void 0, function (_b, expected, options) {
|
|
44
44
|
var expectation;
|
|
45
45
|
var isNot = _b.isNot, locator = _b.locator;
|
|
46
46
|
return __generator(this, function (_c) {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { TransformOptions } from '../../options';
|
|
2
|
+
import { type ToWithValueElementLocator } from './LocatorSymbols';
|
|
3
|
+
export declare const toHaveFormattedValueEx: (this: import("playwright/test").ExpectMatcherState, component: ToWithValueElementLocator, args_0: string, args_1?: TransformOptions | undefined) => Promise<import("playwright/test").MatcherReturnType>;
|
|
@@ -36,11 +36,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.toHaveFormattedValueEx = void 0;
|
|
40
40
|
var extensions_1 = require("../../extensions");
|
|
41
41
|
var LocatorSymbols_1 = require("./LocatorSymbols");
|
|
42
42
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
43
|
-
exports.
|
|
43
|
+
exports.toHaveFormattedValueEx = (0, createAsyncMatcher_1.createAsyncMatcher)('toHaveFormattedValueEx', function (component) { return component[LocatorSymbols_1.toValueElementLocator](); }, function (_a, expected_1, options_1) { return __awaiter(void 0, [_a, expected_1, options_1], void 0, function (_b, expected, options) {
|
|
44
44
|
var expectation;
|
|
45
45
|
var isNot = _b.isNot, locator = _b.locator;
|
|
46
46
|
return __generator(this, function (_c) {
|
|
@@ -38,7 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.toHaveWarning = void 0;
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
|
-
var
|
|
41
|
+
var utils_1 = require("../../utils");
|
|
42
42
|
var LocatorSymbols_1 = require("./LocatorSymbols");
|
|
43
43
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
44
44
|
exports.toHaveWarning = (0, createAsyncMatcher_1.createAsyncMatcher)('toHaveWarning', function (component) { return component[LocatorSymbols_1.toRootElementLocator](); }, function (_a, options_1) { return __awaiter(void 0, [_a, options_1], void 0, function (_b, options) {
|
|
@@ -48,7 +48,7 @@ exports.toHaveWarning = (0, createAsyncMatcher_1.createAsyncMatcher)('toHaveWarn
|
|
|
48
48
|
switch (_c.label) {
|
|
49
49
|
case 0:
|
|
50
50
|
expectation = isNot ? (0, test_1.expect)(locator).not : (0, test_1.expect)(locator);
|
|
51
|
-
return [4 /*yield*/, expectation.toHaveAttribute(
|
|
51
|
+
return [4 /*yield*/, expectation.toHaveAttribute(utils_1.DataVisualState.Warning, options)];
|
|
52
52
|
case 1:
|
|
53
53
|
_c.sent();
|
|
54
54
|
return [2 /*return*/];
|
|
@@ -13,7 +13,10 @@ declare const matchers: {
|
|
|
13
13
|
}, args_1?: import("..").ValueOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
14
14
|
readonly toHaveTextEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToTextElementLocator, args_0: string | RegExp | readonly (string | RegExp)[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
15
15
|
readonly toHaveCountEx: (this: import("@playwright/test").ExpectMatcherState, component: import("..").ComponentList<any>, args_0: number, args_1?: import("..").CountOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
16
|
+
readonly toHaveFormattedValueEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
17
|
+
readonly toHaveFormattedTextEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToTextElementLocator, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
16
18
|
readonly toContainTextEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToTextElementLocator, args_0: string | RegExp | readonly (string | RegExp)[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
19
|
+
readonly toContainFormattedTextEx: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Label, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
17
20
|
readonly toBeAutoMode: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FxInput, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
18
21
|
readonly toBeUnchecked: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeCheckableElementLocator, args_0?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
19
22
|
readonly toBeActiveTab: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tab, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -35,8 +38,6 @@ declare const matchers: {
|
|
|
35
38
|
readonly toHaveActivePage: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Paging, args_0: number, args_1?: {
|
|
36
39
|
timeout?: number;
|
|
37
40
|
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
38
|
-
readonly toHaveFormattedValue: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
39
|
-
readonly toHaveFormattedText: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToTextElementLocator, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
40
41
|
readonly toContainItems: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToHaveItemsElementLocator, args_0: string[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
41
42
|
readonly toContainItem: (this: import("@playwright/test").ExpectMatcherState, component: import("..").MenuComponent & import("./component/LocatorSymbols").ToContainItemElementLocator, args_0: string, args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
42
43
|
readonly toContainTokens: (this: import("@playwright/test").ExpectMatcherState, component: import("..").TokenInput, args_0: string[], args_1?: {
|
|
@@ -44,7 +45,6 @@ declare const matchers: {
|
|
|
44
45
|
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
45
46
|
readonly toContainTabs: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tabs, args_0: string[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
46
47
|
readonly toContainSelectValue: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Select, args_0: string | RegExp | readonly (string | RegExp)[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
47
|
-
readonly toContainFormattedText: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Label, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
48
48
|
readonly toContainUploadedFiles: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FileUploader, args_0: string[], args_1?: {
|
|
49
49
|
timeout?: number;
|
|
50
50
|
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -65,7 +65,10 @@ export declare const componentMatchers: import("@playwright/test").Expect<{
|
|
|
65
65
|
}, args_1?: import("..").ValueOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
66
66
|
readonly toHaveTextEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToTextElementLocator, args_0: string | RegExp | readonly (string | RegExp)[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
67
67
|
readonly toHaveCountEx: (this: import("@playwright/test").ExpectMatcherState, component: import("..").ComponentList<any>, args_0: number, args_1?: import("..").CountOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
68
|
+
readonly toHaveFormattedValueEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
69
|
+
readonly toHaveFormattedTextEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToTextElementLocator, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
68
70
|
readonly toContainTextEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToTextElementLocator, args_0: string | RegExp | readonly (string | RegExp)[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
71
|
+
readonly toContainFormattedTextEx: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Label, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
69
72
|
readonly toBeAutoMode: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FxInput, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
70
73
|
readonly toBeUnchecked: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeCheckableElementLocator, args_0?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
71
74
|
readonly toBeActiveTab: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tab, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -87,8 +90,6 @@ export declare const componentMatchers: import("@playwright/test").Expect<{
|
|
|
87
90
|
readonly toHaveActivePage: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Paging, args_0: number, args_1?: {
|
|
88
91
|
timeout?: number;
|
|
89
92
|
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
90
|
-
readonly toHaveFormattedValue: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
91
|
-
readonly toHaveFormattedText: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToTextElementLocator, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
92
93
|
readonly toContainItems: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToHaveItemsElementLocator, args_0: string[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
93
94
|
readonly toContainItem: (this: import("@playwright/test").ExpectMatcherState, component: import("..").MenuComponent & import("./component/LocatorSymbols").ToContainItemElementLocator, args_0: string, args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
94
95
|
readonly toContainTokens: (this: import("@playwright/test").ExpectMatcherState, component: import("..").TokenInput, args_0: string[], args_1?: {
|
|
@@ -96,7 +97,6 @@ export declare const componentMatchers: import("@playwright/test").Expect<{
|
|
|
96
97
|
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
97
98
|
readonly toContainTabs: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tabs, args_0: string[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
98
99
|
readonly toContainSelectValue: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Select, args_0: string | RegExp | readonly (string | RegExp)[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
99
|
-
readonly toContainFormattedText: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Label, args_0: string, args_1?: import("..").TransformOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
100
100
|
readonly toContainUploadedFiles: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FileUploader, args_0: string[], args_1?: {
|
|
101
101
|
timeout?: number;
|
|
102
102
|
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -15,6 +15,9 @@ var toBeUnchecked_1 = require("./component/toBeUnchecked");
|
|
|
15
15
|
var toHaveTextEx_1 = require("./component/toHaveTextEx");
|
|
16
16
|
var toContainTextEx_1 = require("./component/toContainTextEx");
|
|
17
17
|
var toHaveCountEx_1 = require("./component/toHaveCountEx");
|
|
18
|
+
var toContainFormattedTextEx_1 = require("./component/toContainFormattedTextEx");
|
|
19
|
+
var toHaveFormattedValueEx_1 = require("./component/toHaveFormattedValueEx");
|
|
20
|
+
var toHaveFormattedTextEx_1 = require("./component/toHaveFormattedTextEx");
|
|
18
21
|
var toHaveItems_1 = require("./component/toHaveItems");
|
|
19
22
|
var toContainItems_1 = require("./component/toContainItems");
|
|
20
23
|
var toContainItem_1 = require("./component/toContainItem");
|
|
@@ -24,7 +27,6 @@ var toBeAutoMode_1 = require("./component/toBeAutoMode");
|
|
|
24
27
|
var toHaveError_1 = require("./component/toHaveError");
|
|
25
28
|
var toHaveWarning_1 = require("./component/toHaveWarning");
|
|
26
29
|
var toContainUploadedFiles_1 = require("./component/toContainUploadedFiles");
|
|
27
|
-
var toContainFormattedText_1 = require("./component/toContainFormattedText");
|
|
28
30
|
var toContainTokens_1 = require("./component/toContainTokens");
|
|
29
31
|
var toHaveActiveTab_1 = require("./component/toHaveActiveTab");
|
|
30
32
|
var toContainTabs_1 = require("./component/toContainTabs");
|
|
@@ -38,8 +40,6 @@ var toContainSelectValue_1 = require("./component/toContainSelectValue");
|
|
|
38
40
|
var toBeCheckedByText_1 = require("./component/toBeCheckedByText");
|
|
39
41
|
var toBeUncheckedByText_1 = require("./component/toBeUncheckedByText");
|
|
40
42
|
var toHaveActivePage_1 = require("./component/toHaveActivePage");
|
|
41
|
-
var toHaveFormattedValue_1 = require("./component/toHaveFormattedValue");
|
|
42
|
-
var toHaveFormattedText_1 = require("./component/toHaveFormattedText");
|
|
43
43
|
var matchers = {
|
|
44
44
|
/*
|
|
45
45
|
NOTE: некоторые кастомные матчеры содержат суффикс "Ex",
|
|
@@ -58,7 +58,10 @@ var matchers = {
|
|
|
58
58
|
toHaveValueEx: toHaveValueEx_1.toHaveValueEx,
|
|
59
59
|
toHaveTextEx: toHaveTextEx_1.toHaveTextEx,
|
|
60
60
|
toHaveCountEx: toHaveCountEx_1.toHaveCountEx,
|
|
61
|
+
toHaveFormattedValueEx: toHaveFormattedValueEx_1.toHaveFormattedValueEx,
|
|
62
|
+
toHaveFormattedTextEx: toHaveFormattedTextEx_1.toHaveFormattedTextEx,
|
|
61
63
|
toContainTextEx: toContainTextEx_1.toContainTextEx,
|
|
64
|
+
toContainFormattedTextEx: toContainFormattedTextEx_1.toContainFormattedTextEx,
|
|
62
65
|
toBeAutoMode: toBeAutoMode_1.toBeAutoMode,
|
|
63
66
|
toBeUnchecked: toBeUnchecked_1.toBeUnchecked,
|
|
64
67
|
toBeActiveTab: toBeActiveTab_1.toBeActiveTab,
|
|
@@ -76,14 +79,11 @@ var matchers = {
|
|
|
76
79
|
toHaveActiveTab: toHaveActiveTab_1.toHaveActiveTab,
|
|
77
80
|
toHavePageCount: toHavePageCount_1.toHavePageCount,
|
|
78
81
|
toHaveActivePage: toHaveActivePage_1.toHaveActivePage,
|
|
79
|
-
toHaveFormattedValue: toHaveFormattedValue_1.toHaveFormattedValue,
|
|
80
|
-
toHaveFormattedText: toHaveFormattedText_1.toHaveFormattedText,
|
|
81
82
|
toContainItems: toContainItems_1.toContainItems,
|
|
82
83
|
toContainItem: toContainItem_1.toContainItem,
|
|
83
84
|
toContainTokens: toContainTokens_1.toContainTokens,
|
|
84
85
|
toContainTabs: toContainTabs_1.toContainTabs,
|
|
85
86
|
toContainSelectValue: toContainSelectValue_1.toContainSelectValue,
|
|
86
|
-
toContainFormattedText: toContainFormattedText_1.toContainFormattedText,
|
|
87
87
|
toContainUploadedFiles: toContainUploadedFiles_1.toContainUploadedFiles,
|
|
88
88
|
};
|
|
89
89
|
exports.componentMatchers = test_1.expect.extend(matchers);
|
|
@@ -47,8 +47,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.createComponentAsyncMatcher = createComponentAsyncMatcher;
|
|
49
49
|
exports.createAsyncMatcher = createAsyncMatcher;
|
|
50
|
-
var
|
|
51
|
-
var
|
|
50
|
+
var utils_1 = require("../utils");
|
|
51
|
+
var utils_2 = require("../utils");
|
|
52
52
|
/**
|
|
53
53
|
* Создает асинхронный матчер для конкретного компонента
|
|
54
54
|
*
|
|
@@ -89,12 +89,12 @@ function createComponentAsyncMatcher(matcherName, getLocator, createMatcherLogic
|
|
|
89
89
|
return __generator(this, function (_c) {
|
|
90
90
|
switch (_c.label) {
|
|
91
91
|
case 0:
|
|
92
|
-
_a =
|
|
92
|
+
_a = utils_2.toMatchMessage;
|
|
93
93
|
_b = [this,
|
|
94
94
|
matcherName];
|
|
95
95
|
return [4 /*yield*/, getLocator(component)];
|
|
96
96
|
case 1: return [2 /*return*/, _a.apply(void 0, _b.concat([_c.sent(), function (isNot, locator) {
|
|
97
|
-
return (0,
|
|
97
|
+
return (0, utils_1.makeMatcher)(isNot, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
98
98
|
return __generator(this, function (_a) {
|
|
99
99
|
switch (_a.label) {
|
|
100
100
|
case 0: return [4 /*yield*/, createMatcherLogicAsync.apply(void 0, __spreadArray([{ isNot: isNot, locator: locator, component: component }], args, false))];
|
|
@@ -157,12 +157,12 @@ function createAsyncMatcher(matcherName, getLocator, createMatcherLogicAsync, cr
|
|
|
157
157
|
return __generator(this, function (_c) {
|
|
158
158
|
switch (_c.label) {
|
|
159
159
|
case 0:
|
|
160
|
-
_a =
|
|
160
|
+
_a = utils_2.toMatchMessage;
|
|
161
161
|
_b = [this,
|
|
162
162
|
matcherName];
|
|
163
163
|
return [4 /*yield*/, getLocator(component)];
|
|
164
164
|
case 1: return [2 /*return*/, _a.apply(void 0, _b.concat([_c.sent(), function (isNot, locator) {
|
|
165
|
-
return (0,
|
|
165
|
+
return (0, utils_1.makeMatcher)(isNot, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
166
166
|
return __generator(this, function (_a) {
|
|
167
167
|
switch (_a.label) {
|
|
168
168
|
case 0: return [4 /*yield*/, createMatcherLogicAsync.apply(void 0, __spreadArray([{ isNot: isNot, locator: locator, component: component }], args, false))];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type ErrorResult = {
|
|
2
2
|
message: string;
|
|
3
3
|
pass: boolean;
|
|
4
4
|
actual: string;
|
|
@@ -6,7 +6,9 @@ export type MatcherResult = {
|
|
|
6
6
|
expected: string;
|
|
7
7
|
log: string[];
|
|
8
8
|
stack: string;
|
|
9
|
-
|
|
9
|
+
expectError: string;
|
|
10
|
+
};
|
|
11
|
+
export type MatcherResult = ErrorResult | string | undefined;
|
|
10
12
|
export type WithMatcherResult = {
|
|
11
13
|
matcherResult: MatcherResult;
|
|
12
14
|
};
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.getActualFromError = void 0;
|
|
4
15
|
var getActualFromError = function (e) {
|
|
16
|
+
var _a;
|
|
5
17
|
if (e && typeof e === 'object' && 'matcherResult' in e && e.matcherResult) {
|
|
6
|
-
|
|
18
|
+
var diffLines = (_a = e.toString()) === null || _a === void 0 ? void 0 : _a.split('\n');
|
|
19
|
+
var expectError = diffLines[0].split('Error: ')[1];
|
|
20
|
+
var expectedLine = diffLines[3];
|
|
21
|
+
var receivedLine = diffLines[4];
|
|
22
|
+
return __assign(__assign({}, e.matcherResult), { expected: expectedLine, actual: receivedLine, expectError: expectError });
|
|
7
23
|
}
|
|
8
24
|
if (e && typeof e === 'object') {
|
|
9
25
|
return e.toString();
|
|
@@ -50,15 +50,15 @@ exports.toMatchMessage = toMatchMessage;
|
|
|
50
50
|
*/
|
|
51
51
|
function toMatchMessage(state_1, matcherName_1, receiver_1, query_1) {
|
|
52
52
|
return __awaiter(this, arguments, void 0, function (state, matcherName, receiver, query, expectedMessage, receiverType) {
|
|
53
|
-
var _a, pass, matcherResult, _b,
|
|
53
|
+
var _a, pass, matcherResult, stringify, customExpectedMessage, _b, expected, expectedValue, _c, received, receivedValue, message;
|
|
54
54
|
if (expectedMessage === void 0) { expectedMessage = ''; }
|
|
55
55
|
if (receiverType === void 0) { receiverType = 'Locator'; }
|
|
56
|
-
return __generator(this, function (
|
|
57
|
-
switch (
|
|
56
|
+
return __generator(this, function (_d) {
|
|
57
|
+
switch (_d.label) {
|
|
58
58
|
case 0: return [4 /*yield*/, query(state.isNot, receiver)];
|
|
59
59
|
case 1:
|
|
60
|
-
_a =
|
|
61
|
-
|
|
60
|
+
_a = _d.sent(), pass = _a.matches, matcherResult = _a.matcherResult;
|
|
61
|
+
stringify = state.utils.stringify;
|
|
62
62
|
if (typeof matcherResult === 'string') {
|
|
63
63
|
return [2 /*return*/, {
|
|
64
64
|
message: function () { return matcherResult; },
|
|
@@ -68,13 +68,23 @@ function toMatchMessage(state_1, matcherName_1, receiver_1, query_1) {
|
|
|
68
68
|
}];
|
|
69
69
|
}
|
|
70
70
|
customExpectedMessage = expectedMessage && "Custom expected message: ".concat(stringify(expectedMessage), "\n");
|
|
71
|
+
if (!matcherResult) {
|
|
72
|
+
return [2 /*return*/, {
|
|
73
|
+
message: function () { return 'Matcher result is undefined'; },
|
|
74
|
+
pass: pass,
|
|
75
|
+
name: matcherName,
|
|
76
|
+
actual: undefined,
|
|
77
|
+
}];
|
|
78
|
+
}
|
|
79
|
+
_b = matcherResult.expected.split(':'), expected = _b[0], expectedValue = _b[1];
|
|
80
|
+
_c = matcherResult.actual.split(':'), received = _c[0], receivedValue = _c[1];
|
|
71
81
|
message = function () {
|
|
72
|
-
return
|
|
82
|
+
return "".concat(matcherResult === null || matcherResult === void 0 ? void 0 : matcherResult.expectError, "\n") +
|
|
73
83
|
'\n\n' +
|
|
74
84
|
"".concat(receiverType, ": ").concat(receiver, "\n") +
|
|
75
85
|
"".concat(customExpectedMessage) +
|
|
76
|
-
"
|
|
77
|
-
"
|
|
86
|
+
"".concat(expected, ": ").concat(getCleanValue(expectedValue), "\n") +
|
|
87
|
+
"".concat(received, ": ").concat(getCleanValue(receivedValue), "\n") +
|
|
78
88
|
callLogText(matcherResult === null || matcherResult === void 0 ? void 0 : matcherResult.log);
|
|
79
89
|
};
|
|
80
90
|
return [2 /*return*/, { message: message, pass: pass, name: matcherName, actual: matcherResult === null || matcherResult === void 0 ? void 0 : matcherResult.actual }];
|
|
@@ -87,3 +97,8 @@ var callLogText = function (log) {
|
|
|
87
97
|
return '';
|
|
88
98
|
return "\nCall log: \n".concat(log.join('\n'), "\n");
|
|
89
99
|
};
|
|
100
|
+
function getCleanValue(value) {
|
|
101
|
+
if (!value)
|
|
102
|
+
return '';
|
|
103
|
+
return value.trim();
|
|
104
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/playwright-react-ui-components",
|
|
3
|
-
"version": "1.14.0-beta.
|
|
3
|
+
"version": "1.14.0-beta.4",
|
|
4
4
|
"description": "Пакет для взаимодействия с компонентами @skbkontur/react-ui при тестировании с помощью Playwright",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { Label } from '../../components';
|
|
2
|
-
import type { TransformOptions } from '../../options';
|
|
3
|
-
export declare const toContainFormattedText: (this: import("playwright/test").ExpectMatcherState, component: Label, args_0: string, args_1?: TransformOptions | undefined) => Promise<import("playwright/test").MatcherReturnType>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { TransformOptions } from '../../options';
|
|
2
|
-
import type { ToTextElementLocator } from './LocatorSymbols';
|
|
3
|
-
export declare const toHaveFormattedText: (this: import("playwright/test").ExpectMatcherState, component: ToTextElementLocator, args_0: string, args_1?: TransformOptions | undefined) => Promise<import("playwright/test").MatcherReturnType>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { TransformOptions } from '../../options';
|
|
2
|
-
import { type ToWithValueElementLocator } from './LocatorSymbols';
|
|
3
|
-
export declare const toHaveFormattedValue: (this: import("playwright/test").ExpectMatcherState, component: ToWithValueElementLocator, args_0: string, args_1?: TransformOptions | undefined) => Promise<import("playwright/test").MatcherReturnType>;
|