@skbkontur/playwright-react-ui-components 1.14.0-beta.3 → 1.14.0-beta.5
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/DateRangePickerAssertions.d.ts +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/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/toHaveWarning.js +2 -2
- package/build/src/matchers/createAsyncMatcher.js +6 -6
- package/build/src/utils/index.d.ts +0 -1
- package/build/src/utils/index.js +0 -1
- package/build/src/utils/makeMatcher.d.ts +1 -2
- package/build/src/utils/makeMatcher.js +3 -2
- package/build/src/utils/toMatchMessage.d.ts +2 -3
- package/build/src/utils/toMatchMessage.js +14 -24
- package/package.json +1 -1
- package/build/src/utils/getMarcherResult.d.ts +0 -13
- package/build/src/utils/getMarcherResult.js +0 -13
|
@@ -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;
|
|
@@ -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*/];
|
|
@@ -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*/];
|
|
@@ -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*/];
|
|
@@ -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))];
|
package/build/src/utils/index.js
CHANGED
|
@@ -19,5 +19,4 @@ var tooltipProvider_1 = require("./tooltipProvider");
|
|
|
19
19
|
Object.defineProperty(exports, "getTooltip", { enumerable: true, get: function () { return tooltipProvider_1.getTooltip; } });
|
|
20
20
|
__exportStar(require("./constants"), exports);
|
|
21
21
|
__exportStar(require("./toMatchMessage"), exports);
|
|
22
|
-
__exportStar(require("./getMarcherResult"), exports);
|
|
23
22
|
__exportStar(require("./makeMatcher"), exports);
|
|
@@ -37,7 +37,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.makeMatcher = void 0;
|
|
40
|
-
var getMarcherResult_1 = require("./getMarcherResult");
|
|
41
40
|
var makeMatcher = function (isNot, matcher) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
41
|
var pass, matcherResult, e_1;
|
|
43
42
|
return __generator(this, function (_a) {
|
|
@@ -51,7 +50,9 @@ var makeMatcher = function (isNot, matcher) { return __awaiter(void 0, void 0, v
|
|
|
51
50
|
return [3 /*break*/, 3];
|
|
52
51
|
case 2:
|
|
53
52
|
e_1 = _a.sent();
|
|
54
|
-
|
|
53
|
+
if (e_1 && typeof e_1 === 'object') {
|
|
54
|
+
matcherResult = e_1.toString();
|
|
55
|
+
}
|
|
55
56
|
pass = false;
|
|
56
57
|
return [3 /*break*/, 3];
|
|
57
58
|
case 3:
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ExpectMatcherState, Locator } from '@playwright/test';
|
|
2
|
-
import type { MatcherResult } from './getMarcherResult';
|
|
3
2
|
export type MatchQueryType = (isNot: boolean, locator: Locator) => Promise<{
|
|
4
3
|
matches: boolean;
|
|
5
|
-
matcherResult?:
|
|
4
|
+
matcherResult?: string;
|
|
6
5
|
}>;
|
|
7
6
|
/**
|
|
8
7
|
* Создает сообщение для ожидания
|
|
@@ -15,7 +14,7 @@ export type MatchQueryType = (isNot: boolean, locator: Locator) => Promise<{
|
|
|
15
14
|
* @param expectedMessage - сообщение для ожидания
|
|
16
15
|
* @param receiverType - тип локатора
|
|
17
16
|
*/
|
|
18
|
-
export declare function toMatchMessage(state: ExpectMatcherState, matcherName: string, receiver: Locator, query: MatchQueryType, expectedMessage?: string | RegExp
|
|
17
|
+
export declare function toMatchMessage(state: ExpectMatcherState, matcherName: string, receiver: Locator, query: MatchQueryType, expectedMessage?: string | RegExp): Promise<{
|
|
19
18
|
message: () => string;
|
|
20
19
|
pass: boolean;
|
|
21
20
|
name: string;
|
|
@@ -49,41 +49,31 @@ exports.toMatchMessage = toMatchMessage;
|
|
|
49
49
|
* @param receiverType - тип локатора
|
|
50
50
|
*/
|
|
51
51
|
function toMatchMessage(state_1, matcherName_1, receiver_1, query_1) {
|
|
52
|
-
return __awaiter(this, arguments, void 0, function (state, matcherName, receiver, query, expectedMessage
|
|
53
|
-
var _a, pass, matcherResult,
|
|
52
|
+
return __awaiter(this, arguments, void 0, function (state, matcherName, receiver, query, expectedMessage) {
|
|
53
|
+
var _a, pass, matcherResult, stringify, customMessage;
|
|
54
54
|
if (expectedMessage === void 0) { expectedMessage = ''; }
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
switch (_c.label) {
|
|
55
|
+
return __generator(this, function (_b) {
|
|
56
|
+
switch (_b.label) {
|
|
58
57
|
case 0: return [4 /*yield*/, query(state.isNot, receiver)];
|
|
59
58
|
case 1:
|
|
60
|
-
_a =
|
|
61
|
-
|
|
59
|
+
_a = _b.sent(), pass = _a.matches, matcherResult = _a.matcherResult;
|
|
60
|
+
stringify = state.utils.stringify;
|
|
61
|
+
customMessage = expectedMessage && "Custom message: ".concat(stringify(expectedMessage), "\n");
|
|
62
62
|
if (typeof matcherResult === 'string') {
|
|
63
63
|
return [2 /*return*/, {
|
|
64
|
-
message: function () { return matcherResult; },
|
|
64
|
+
message: function () { return matcherResult + '\n\n' + customMessage; },
|
|
65
65
|
pass: pass,
|
|
66
66
|
name: matcherName,
|
|
67
67
|
actual: matcherResult,
|
|
68
68
|
}];
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"Expected: ".concat(printExpected(matcherResult === null || matcherResult === void 0 ? void 0 : matcherResult.expected), "\n") +
|
|
77
|
-
"Received: ".concat(printReceived(matcherResult === null || matcherResult === void 0 ? void 0 : matcherResult.actual), "\n") +
|
|
78
|
-
callLogText(matcherResult === null || matcherResult === void 0 ? void 0 : matcherResult.log);
|
|
79
|
-
};
|
|
80
|
-
return [2 /*return*/, { message: message, pass: pass, name: matcherName, actual: matcherResult === null || matcherResult === void 0 ? void 0 : matcherResult.actual }];
|
|
70
|
+
return [2 /*return*/, {
|
|
71
|
+
message: function () { return 'Matcher result is undefined' + '\n\n' + customMessage; },
|
|
72
|
+
pass: pass,
|
|
73
|
+
name: matcherName,
|
|
74
|
+
actual: undefined,
|
|
75
|
+
}];
|
|
81
76
|
}
|
|
82
77
|
});
|
|
83
78
|
});
|
|
84
79
|
}
|
|
85
|
-
var callLogText = function (log) {
|
|
86
|
-
if (!log || !log.some(function (l) { return !!l; }))
|
|
87
|
-
return '';
|
|
88
|
-
return "\nCall log: \n".concat(log.join('\n'), "\n");
|
|
89
|
-
};
|
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.5",
|
|
4
4
|
"description": "Пакет для взаимодействия с компонентами @skbkontur/react-ui при тестировании с помощью Playwright",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type MatcherResult = {
|
|
2
|
-
message: string;
|
|
3
|
-
pass: boolean;
|
|
4
|
-
actual: string;
|
|
5
|
-
name: string;
|
|
6
|
-
expected: string;
|
|
7
|
-
log: string[];
|
|
8
|
-
stack: string;
|
|
9
|
-
} | string | undefined;
|
|
10
|
-
export type WithMatcherResult = {
|
|
11
|
-
matcherResult: MatcherResult;
|
|
12
|
-
};
|
|
13
|
-
export declare const getActualFromError: (e: unknown) => MatcherResult;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getActualFromError = void 0;
|
|
4
|
-
var getActualFromError = function (e) {
|
|
5
|
-
if (e && typeof e === 'object' && 'matcherResult' in e && e.matcherResult) {
|
|
6
|
-
return e.matcherResult;
|
|
7
|
-
}
|
|
8
|
-
if (e && typeof e === 'object') {
|
|
9
|
-
return e.toString();
|
|
10
|
-
}
|
|
11
|
-
return undefined;
|
|
12
|
-
};
|
|
13
|
-
exports.getActualFromError = getActualFromError;
|