@skbkontur/playwright-react-ui-components 1.18.0-beta.1 → 1.18.0-beta.3
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/CurrencyLabelAssertions.d.ts +8 -0
- package/build/src/{components/ValidationTooltip.js → assertions/CurrencyLabelAssertions.js} +24 -45
- package/build/src/assertions/index.d.ts +1 -0
- package/build/src/assertions/index.js +3 -1
- package/build/src/components/BaseComponent.d.ts +1 -3
- package/build/src/components/BaseComponent.js +0 -15
- package/build/src/components/CurrencyLabel.d.ts +24 -0
- package/build/src/components/CurrencyLabel.js +92 -0
- package/build/src/components/Tooltip.d.ts +10 -8
- package/build/src/components/Tooltip.js +13 -51
- package/build/src/components/index.d.ts +2 -3
- package/build/src/components/index.js +6 -7
- package/build/src/matchers/component/toBeDisabled.d.ts +1 -1
- package/build/src/matchers/component/toHaveValue.d.ts +2 -2
- package/build/src/matchers/component/toHaveValue.js +34 -12
- package/build/src/matchers/componentMatchers.d.ts +8 -8
- package/build/src/options/AssertionOptions.d.ts +8 -0
- package/build/src/utils/currencyLabel.d.ts +3 -0
- package/build/src/utils/currencyLabel.js +24 -0
- package/build/src/utils/tooltipProvider.d.ts +1 -1
- package/build/src/utils/tooltipProvider.js +47 -18
- package/package.json +1 -1
- package/build/src/components/InfoTooltip.d.ts +0 -6
- package/build/src/components/InfoTooltip.js +0 -30
- package/build/src/components/ValidationTooltip.d.ts +0 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseComponentAssertions } from './BaseComponentAssertions';
|
|
2
|
+
import type { CurrencyLabel } from '../components';
|
|
3
|
+
import type { CurrencyLabelAssertionOptions } from '../options';
|
|
4
|
+
export declare class CurrencyLabelAssertions extends BaseComponentAssertions {
|
|
5
|
+
private readonly currencyLabel;
|
|
6
|
+
constructor(currencyLabel: CurrencyLabel);
|
|
7
|
+
toHaveValue(value: string | number, assertionOptions?: CurrencyLabelAssertionOptions): Promise<void>;
|
|
8
|
+
}
|
|
@@ -51,57 +51,36 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var _this = _super.call(this, targetControl) || this;
|
|
64
|
-
_this.portal = new Portal_1.Portal(_this.targetControl.rootLocator.locator('../../noscript'));
|
|
54
|
+
exports.CurrencyLabelAssertions = void 0;
|
|
55
|
+
var extensions_1 = require("../extensions");
|
|
56
|
+
var BaseComponentAssertions_1 = require("./BaseComponentAssertions");
|
|
57
|
+
var currencyLabel_1 = require("../utils/currencyLabel");
|
|
58
|
+
var CurrencyLabelAssertions = /** @class */ (function (_super) {
|
|
59
|
+
__extends(CurrencyLabelAssertions, _super);
|
|
60
|
+
function CurrencyLabelAssertions(currencyLabel) {
|
|
61
|
+
var _this = _super.call(this, currencyLabel) || this;
|
|
62
|
+
_this.currencyLabel = currencyLabel;
|
|
65
63
|
return _this;
|
|
66
64
|
}
|
|
67
|
-
|
|
65
|
+
CurrencyLabelAssertions.prototype.toHaveValue = function (value, assertionOptions) {
|
|
68
66
|
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
var baseOptions, text;
|
|
68
|
+
var _a;
|
|
69
|
+
return __generator(this, function (_b) {
|
|
70
|
+
switch (_b.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
baseOptions = (_a = this.currencyLabel.options) !== null && _a !== void 0 ? _a : {};
|
|
73
|
+
text = (0, currencyLabel_1.getCurrencyLabelExpectedText)(value, baseOptions, assertionOptions);
|
|
74
|
+
return [4 /*yield*/, (0, extensions_1.expect)(this.currencyLabel.rootLocator).toHaveText(text, {
|
|
75
|
+
timeout: assertionOptions === null || assertionOptions === void 0 ? void 0 : assertionOptions.timeout,
|
|
76
|
+
})];
|
|
72
77
|
case 1:
|
|
73
|
-
|
|
74
|
-
if (!isFocusable(this.targetControl)) return [3 /*break*/, 3];
|
|
75
|
-
return [4 /*yield*/, this.targetControl.focus()];
|
|
76
|
-
case 2:
|
|
77
|
-
_a.sent();
|
|
78
|
-
return [3 /*break*/, 5];
|
|
79
|
-
case 3: return [4 /*yield*/, this.targetControl.rootLocator.focus()];
|
|
80
|
-
case 4:
|
|
81
|
-
_a.sent();
|
|
82
|
-
_a.label = 5;
|
|
83
|
-
case 5: return [2 /*return*/];
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
ValidationTooltip.prototype.initAsync = function (customTid) {
|
|
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*/, this.portal.rootLocator.count()];
|
|
93
|
-
case 1:
|
|
94
|
-
if ((_a.sent()) > 1) {
|
|
95
|
-
this.portal = new Portal_1.Portal(this.targetControl.rootLocator.locator('../following-sibling::noscript[1]'));
|
|
96
|
-
}
|
|
97
|
-
return [4 /*yield*/, _super.prototype.initAsync.call(this, customTid)];
|
|
98
|
-
case 2:
|
|
99
|
-
_a.sent();
|
|
78
|
+
_b.sent();
|
|
100
79
|
return [2 /*return*/];
|
|
101
80
|
}
|
|
102
81
|
});
|
|
103
82
|
});
|
|
104
83
|
};
|
|
105
|
-
return
|
|
106
|
-
}(
|
|
107
|
-
exports.
|
|
84
|
+
return CurrencyLabelAssertions;
|
|
85
|
+
}(BaseComponentAssertions_1.BaseComponentAssertions));
|
|
86
|
+
exports.CurrencyLabelAssertions = CurrencyLabelAssertions;
|
|
@@ -11,6 +11,7 @@ export { RadioAssertions } from './RadioAssertions';
|
|
|
11
11
|
export { RadioGroupAssertions } from './RadioGroupAssertions';
|
|
12
12
|
export { InputAssertions } from './InputAssertions';
|
|
13
13
|
export { CurrencyInputAssertions } from './CurrencyInputAssertions';
|
|
14
|
+
export { CurrencyLabelAssertions } from './CurrencyLabelAssertions';
|
|
14
15
|
export { TokenAssertions } from './TokenAssertions';
|
|
15
16
|
export { TokenInputAssertions } from './TokenInputAssertions';
|
|
16
17
|
export { TextareaAssertions } from './TextareaAssertions';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PagingAssertions = exports.KebabAssertions = exports.FxInputAssertions = exports.FileUploaderAssertions = exports.DateInputAssertions = exports.AutocompleteAssertions = exports.SpinnerAssertions = exports.LoaderAssertions = exports.TabAssertions = exports.TabsAssertions = exports.LinkAssertions = exports.ToggleAssertions = exports.SelectAssertions = exports.ToastAssertions = exports.DropdownAssertions = exports.DropdownMenuAssertions = exports.DateRangePickerAssertions = exports.DatePickerAssertions = exports.TextareaAssertions = exports.TokenInputAssertions = exports.TokenAssertions = exports.CurrencyInputAssertions = exports.InputAssertions = exports.RadioGroupAssertions = exports.RadioAssertions = exports.MenuItemAssertations = exports.LabelAssertions = exports.ComponentListAssertions = exports.ComboBoxAssertions = exports.CheckboxAssertions = exports.TooltipAssertions = exports.PortalAssertions = exports.ButtonAssertions = exports.BaseComponentAssertions = void 0;
|
|
3
|
+
exports.PagingAssertions = exports.KebabAssertions = exports.FxInputAssertions = exports.FileUploaderAssertions = exports.DateInputAssertions = exports.AutocompleteAssertions = exports.SpinnerAssertions = exports.LoaderAssertions = exports.TabAssertions = exports.TabsAssertions = exports.LinkAssertions = exports.ToggleAssertions = exports.SelectAssertions = exports.ToastAssertions = exports.DropdownAssertions = exports.DropdownMenuAssertions = exports.DateRangePickerAssertions = exports.DatePickerAssertions = exports.TextareaAssertions = exports.TokenInputAssertions = exports.TokenAssertions = exports.CurrencyLabelAssertions = exports.CurrencyInputAssertions = exports.InputAssertions = exports.RadioGroupAssertions = exports.RadioAssertions = exports.MenuItemAssertations = exports.LabelAssertions = exports.ComponentListAssertions = exports.ComboBoxAssertions = exports.CheckboxAssertions = exports.TooltipAssertions = exports.PortalAssertions = exports.ButtonAssertions = exports.BaseComponentAssertions = void 0;
|
|
4
4
|
var BaseComponentAssertions_1 = require("./BaseComponentAssertions");
|
|
5
5
|
Object.defineProperty(exports, "BaseComponentAssertions", { enumerable: true, get: function () { return BaseComponentAssertions_1.BaseComponentAssertions; } });
|
|
6
6
|
var ButtonAssertions_1 = require("./ButtonAssertions");
|
|
@@ -27,6 +27,8 @@ var InputAssertions_1 = require("./InputAssertions");
|
|
|
27
27
|
Object.defineProperty(exports, "InputAssertions", { enumerable: true, get: function () { return InputAssertions_1.InputAssertions; } });
|
|
28
28
|
var CurrencyInputAssertions_1 = require("./CurrencyInputAssertions");
|
|
29
29
|
Object.defineProperty(exports, "CurrencyInputAssertions", { enumerable: true, get: function () { return CurrencyInputAssertions_1.CurrencyInputAssertions; } });
|
|
30
|
+
var CurrencyLabelAssertions_1 = require("./CurrencyLabelAssertions");
|
|
31
|
+
Object.defineProperty(exports, "CurrencyLabelAssertions", { enumerable: true, get: function () { return CurrencyLabelAssertions_1.CurrencyLabelAssertions; } });
|
|
30
32
|
var TokenAssertions_1 = require("./TokenAssertions");
|
|
31
33
|
Object.defineProperty(exports, "TokenAssertions", { enumerable: true, get: function () { return TokenAssertions_1.TokenAssertions; } });
|
|
32
34
|
var TokenInputAssertions_1 = require("./TokenInputAssertions");
|
|
@@ -2,9 +2,8 @@ import type { Locator, Page } from '@playwright/test';
|
|
|
2
2
|
import { BaseComponentAssertions } from '../assertions';
|
|
3
3
|
import type { ClickOptions, GetAttributeOptions, HoverOptions, IsVisibleOptions, ScrollIntoViewIfNeededOptions, WaitForOptions } from '../options';
|
|
4
4
|
import { toVisibleElementLocator, toRootElementLocator, toHaveAttributeElementLocator } from '../matchers/component/LocatorSymbols';
|
|
5
|
-
import type { Tooltip } from './Tooltip';
|
|
6
5
|
export declare abstract class BaseComponent {
|
|
7
|
-
rootLocator: Locator;
|
|
6
|
+
readonly rootLocator: Locator;
|
|
8
7
|
readonly page: Page;
|
|
9
8
|
readonly [toVisibleElementLocator]: () => Locator;
|
|
10
9
|
readonly [toRootElementLocator]: () => Locator;
|
|
@@ -19,6 +18,5 @@ export declare abstract class BaseComponent {
|
|
|
19
18
|
waitFor(options?: WaitForOptions): Promise<void>;
|
|
20
19
|
hasAttribute(name: string, options?: GetAttributeOptions): Promise<boolean>;
|
|
21
20
|
getAttribute(name: string, options?: GetAttributeOptions): Promise<string | null>;
|
|
22
|
-
getTooltipAsync<TTooltip extends Tooltip>(TooltipClass: new (target: BaseComponent) => TTooltip, customId?: string): Promise<TTooltip>;
|
|
23
21
|
expect(): BaseComponentAssertions;
|
|
24
22
|
}
|
|
@@ -157,21 +157,6 @@ var BaseComponent = /** @class */ (function () {
|
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
159
|
};
|
|
160
|
-
BaseComponent.prototype.getTooltipAsync = function (TooltipClass, customId) {
|
|
161
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
-
var tooltip;
|
|
163
|
-
return __generator(this, function (_d) {
|
|
164
|
-
switch (_d.label) {
|
|
165
|
-
case 0:
|
|
166
|
-
tooltip = new TooltipClass(this);
|
|
167
|
-
return [4 /*yield*/, tooltip.initAsync(customId)];
|
|
168
|
-
case 1:
|
|
169
|
-
_d.sent();
|
|
170
|
-
return [2 /*return*/, tooltip];
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
160
|
BaseComponent.prototype.expect = function () {
|
|
176
161
|
return new assertions_1.BaseComponentAssertions(this);
|
|
177
162
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Locator } from '@playwright/test';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
|
+
import { CurrencyLabelAssertions } from '../assertions';
|
|
4
|
+
import { type TooltipType } from '../utils';
|
|
5
|
+
import type { GetAttributeOptions, InnerTextOptions } from '../options';
|
|
6
|
+
import { toValueElementLocator } from '../matchers/component/LocatorSymbols';
|
|
7
|
+
export type CurrencyLabelOptions = {
|
|
8
|
+
/** Символ валюты */
|
|
9
|
+
currencySymbol?: string;
|
|
10
|
+
/** Минимальное количество отображаемых знаков после запятой */
|
|
11
|
+
fractionDigits?: number;
|
|
12
|
+
/** Убирает лишние нули после запятой */
|
|
13
|
+
hideTrailingZeros?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare class CurrencyLabel extends BaseComponent {
|
|
16
|
+
readonly rootLocator: Locator;
|
|
17
|
+
readonly options: CurrencyLabelOptions;
|
|
18
|
+
readonly [toValueElementLocator]: () => Locator;
|
|
19
|
+
constructor(rootLocator: Locator, options?: CurrencyLabelOptions);
|
|
20
|
+
isDisabled(options?: GetAttributeOptions): Promise<boolean>;
|
|
21
|
+
getText(options?: InnerTextOptions): Promise<string>;
|
|
22
|
+
getTooltip(type: TooltipType): Promise<import("./Tooltip").Tooltip>;
|
|
23
|
+
expect(): CurrencyLabelAssertions;
|
|
24
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var _a;
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.CurrencyLabel = void 0;
|
|
56
|
+
var BaseComponent_1 = require("./BaseComponent");
|
|
57
|
+
var assertions_1 = require("../assertions");
|
|
58
|
+
var utils_1 = require("../utils");
|
|
59
|
+
var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
|
|
60
|
+
var CurrencyLabel = /** @class */ (function (_super) {
|
|
61
|
+
__extends(CurrencyLabel, _super);
|
|
62
|
+
function CurrencyLabel(rootLocator, options) {
|
|
63
|
+
if (options === void 0) { options = {}; }
|
|
64
|
+
var _this = _super.call(this, rootLocator) || this;
|
|
65
|
+
_this.rootLocator = rootLocator;
|
|
66
|
+
_this.options = options;
|
|
67
|
+
_this[_a] = function () { return _this.rootLocator; };
|
|
68
|
+
return _this;
|
|
69
|
+
}
|
|
70
|
+
CurrencyLabel.prototype.isDisabled = function (options) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
return __generator(this, function (_b) {
|
|
73
|
+
switch (_b.label) {
|
|
74
|
+
case 0: return [4 /*yield*/, this.getAttribute(utils_1.DataVisualState.Disabled, options)];
|
|
75
|
+
case 1: return [2 /*return*/, (_b.sent()) !== null];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
CurrencyLabel.prototype.getText = function (options) {
|
|
81
|
+
return this.rootLocator.innerText(options);
|
|
82
|
+
};
|
|
83
|
+
CurrencyLabel.prototype.getTooltip = function (type) {
|
|
84
|
+
return (0, utils_1.getTooltip)(type, this);
|
|
85
|
+
};
|
|
86
|
+
CurrencyLabel.prototype.expect = function () {
|
|
87
|
+
return new assertions_1.CurrencyLabelAssertions(this);
|
|
88
|
+
};
|
|
89
|
+
return CurrencyLabel;
|
|
90
|
+
}(BaseComponent_1.BaseComponent));
|
|
91
|
+
exports.CurrencyLabel = CurrencyLabel;
|
|
92
|
+
_a = LocatorSymbols_1.toValueElementLocator;
|
|
@@ -3,18 +3,20 @@ import { BaseComponent } from './BaseComponent';
|
|
|
3
3
|
import { TooltipAssertions } from '../assertions';
|
|
4
4
|
import type { InnerTextOptions } from '../options';
|
|
5
5
|
import { toTextElementLocator } from '../matchers/component/LocatorSymbols';
|
|
6
|
-
import { Portal } from './Portal';
|
|
7
6
|
export declare class Tooltip extends BaseComponent {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
readonly rootLocator: Locator;
|
|
8
|
+
private readonly closeLocator;
|
|
9
|
+
private readonly contentLocator;
|
|
10
10
|
readonly [toTextElementLocator]: () => Locator;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(rootLocator: Locator);
|
|
12
12
|
getText(options?: InnerTextOptions): Promise<string>;
|
|
13
13
|
getContent(): Locator;
|
|
14
|
-
get contentLocator(): Locator;
|
|
15
|
-
get crossLocator(): Locator;
|
|
16
14
|
close(): Promise<void>;
|
|
17
15
|
expect(): TooltipAssertions;
|
|
18
|
-
protected showAsync(): Promise<void>;
|
|
19
|
-
initAsync(customTid?: string): Promise<void>;
|
|
20
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated createXXXControl feature for migration from '@skbkontur/react-ui-playwright-controls'
|
|
19
|
+
* Task: IF-2498
|
|
20
|
+
*/
|
|
21
|
+
export declare const createTooltipControl: (context: Locator, options?: import("..").DataTIdOption) => Tooltip;
|
|
22
|
+
export type TooltipControl = Tooltip;
|
|
@@ -52,24 +52,21 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
52
52
|
};
|
|
53
53
|
var _a;
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.Tooltip = void 0;
|
|
55
|
+
exports.createTooltipControl = exports.Tooltip = void 0;
|
|
56
56
|
var Tooltip_1 = require("@skbkontur/react-ui/components/Tooltip");
|
|
57
57
|
var BaseComponent_1 = require("./BaseComponent");
|
|
58
58
|
var assertions_1 = require("../assertions");
|
|
59
59
|
var dataTidSelector_1 = require("../utils/dataTidSelector");
|
|
60
60
|
var LocatorSymbols_1 = require("../matchers/component/LocatorSymbols");
|
|
61
|
-
var
|
|
61
|
+
var createComponentFactory_1 = require("../utils/createComponentFactory");
|
|
62
62
|
var Tooltip = /** @class */ (function (_super) {
|
|
63
63
|
__extends(Tooltip, _super);
|
|
64
|
-
function Tooltip(
|
|
65
|
-
var _this = _super.call(this,
|
|
64
|
+
function Tooltip(rootLocator) {
|
|
65
|
+
var _this = _super.call(this, rootLocator) || this;
|
|
66
|
+
_this.rootLocator = rootLocator;
|
|
66
67
|
_this[_a] = function () { return _this.rootLocator; };
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_this.portal = new Portal_1.Portal(exactNoscriptLocator);
|
|
70
|
-
var page = targetControl.rootLocator.page();
|
|
71
|
-
_this.rootLocator = page.locator("[data-tid='PopupContent']");
|
|
72
|
-
_this.targetControl = targetControl;
|
|
68
|
+
_this.contentLocator = rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(Tooltip_1.TooltipDataTids.content));
|
|
69
|
+
_this.closeLocator = rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(Tooltip_1.TooltipDataTids.crossIcon));
|
|
73
70
|
return _this;
|
|
74
71
|
}
|
|
75
72
|
Tooltip.prototype.getText = function (options) {
|
|
@@ -78,25 +75,11 @@ var Tooltip = /** @class */ (function (_super) {
|
|
|
78
75
|
Tooltip.prototype.getContent = function () {
|
|
79
76
|
return this.contentLocator;
|
|
80
77
|
};
|
|
81
|
-
Object.defineProperty(Tooltip.prototype, "contentLocator", {
|
|
82
|
-
get: function () {
|
|
83
|
-
return this.rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(Tooltip_1.TooltipDataTids.content));
|
|
84
|
-
},
|
|
85
|
-
enumerable: false,
|
|
86
|
-
configurable: true
|
|
87
|
-
});
|
|
88
|
-
Object.defineProperty(Tooltip.prototype, "crossLocator", {
|
|
89
|
-
get: function () {
|
|
90
|
-
return this.rootLocator.locator((0, dataTidSelector_1.getDataTidSelector)(Tooltip_1.TooltipDataTids.crossIcon));
|
|
91
|
-
},
|
|
92
|
-
enumerable: false,
|
|
93
|
-
configurable: true
|
|
94
|
-
});
|
|
95
78
|
Tooltip.prototype.close = function () {
|
|
96
79
|
return __awaiter(this, void 0, void 0, function () {
|
|
97
80
|
return __generator(this, function (_b) {
|
|
98
81
|
switch (_b.label) {
|
|
99
|
-
case 0: return [4 /*yield*/, this.
|
|
82
|
+
case 0: return [4 /*yield*/, this.closeLocator.click()];
|
|
100
83
|
case 1:
|
|
101
84
|
_b.sent();
|
|
102
85
|
return [4 /*yield*/, this.waitFor({ state: 'hidden' })];
|
|
@@ -110,33 +93,12 @@ var Tooltip = /** @class */ (function (_super) {
|
|
|
110
93
|
Tooltip.prototype.expect = function () {
|
|
111
94
|
return new assertions_1.TooltipAssertions(this);
|
|
112
95
|
};
|
|
113
|
-
Tooltip.prototype.showAsync = function () {
|
|
114
|
-
return Promise.resolve();
|
|
115
|
-
};
|
|
116
|
-
Tooltip.prototype.initAsync = function (customTid) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
var container, page;
|
|
119
|
-
return __generator(this, function (_b) {
|
|
120
|
-
switch (_b.label) {
|
|
121
|
-
case 0: return [4 /*yield*/, this.showAsync()];
|
|
122
|
-
case 1:
|
|
123
|
-
_b.sent();
|
|
124
|
-
if (!(customTid === undefined || customTid === null)) return [3 /*break*/, 3];
|
|
125
|
-
return [4 /*yield*/, this.portal.getContainer()];
|
|
126
|
-
case 2:
|
|
127
|
-
container = _b.sent();
|
|
128
|
-
this.rootLocator = container.locator("[data-tid='PopupContent']");
|
|
129
|
-
return [3 /*break*/, 4];
|
|
130
|
-
case 3:
|
|
131
|
-
page = this.targetControl.rootLocator.page();
|
|
132
|
-
this.rootLocator = page.locator("[data-tid='".concat(customTid, "']"));
|
|
133
|
-
_b.label = 4;
|
|
134
|
-
case 4: return [2 /*return*/];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
96
|
return Tooltip;
|
|
140
97
|
}(BaseComponent_1.BaseComponent));
|
|
141
98
|
exports.Tooltip = Tooltip;
|
|
142
99
|
_a = LocatorSymbols_1.toTextElementLocator;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated createXXXControl feature for migration from '@skbkontur/react-ui-playwright-controls'
|
|
102
|
+
* Task: IF-2498
|
|
103
|
+
*/
|
|
104
|
+
exports.createTooltipControl = (0, createComponentFactory_1.createComponentTIdFactory)(Tooltip);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
export { BaseComponent } from './BaseComponent';
|
|
2
2
|
export { ComponentList } from './ComponentList';
|
|
3
3
|
export { MenuComponent } from './MenuComponent';
|
|
4
|
-
export { InfoTooltip } from './InfoTooltip';
|
|
5
|
-
export { ValidationTooltip } from './ValidationTooltip';
|
|
6
|
-
export { Tooltip } from './Tooltip';
|
|
7
4
|
export { Button, createButtonControl, type ButtonControl } from './Button';
|
|
5
|
+
export { Tooltip, createTooltipControl, type TooltipControl } from './Tooltip';
|
|
8
6
|
export { Portal, createPortalControl, type PortalControl } from './Portal';
|
|
9
7
|
export { Checkbox, createCheckboxControl, type CheckboxControl } from './Checkbox';
|
|
10
8
|
export { ComboBox, createComboBoxControl, type ComboBoxControl } from './ComboBox';
|
|
11
9
|
export { Label, createLabelControl, type LabelControl } from './Label';
|
|
10
|
+
export { CurrencyLabel } from './CurrencyLabel';
|
|
12
11
|
export { MenuItem, createMenuItemControl, type MenuItemControl } from './MenuItem';
|
|
13
12
|
export { Radio, createRadioControl, type RadioControl } from './Radio';
|
|
14
13
|
export { RadioGroup, createRadioGroupControl, type RadioGroupControl } from './RadioGroup';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTabsControl = exports.Tabs = exports.createLinkControl = exports.Link = exports.createToggleControl = exports.Toggle = exports.createSelectControl = exports.Select = exports.createToastControl = exports.Toast = exports.createDropdownControl = exports.Dropdown = exports.createDropdownMenuControl = exports.DropdownMenu = exports.createTextareaControl = exports.Textarea = exports.createDateRangePickerControl = exports.DateRangePicker = exports.createDatePickerControl = exports.DatePicker = exports.createTokenInputControl = exports.TokenInput = exports.createTokenControl = exports.Token = exports.createCurrencyInputControl = exports.CurrencyInput = exports.createInputControl = exports.Input = exports.createRadioGroupControl = exports.RadioGroup = exports.createRadioControl = exports.Radio = exports.createMenuItemControl = exports.MenuItem = exports.createLabelControl = exports.Label = exports.createComboBoxControl = exports.ComboBox = exports.createCheckboxControl = exports.Checkbox = exports.createPortalControl = exports.Portal = exports.
|
|
3
|
+
exports.createTabsControl = exports.Tabs = exports.createLinkControl = exports.Link = exports.createToggleControl = exports.Toggle = exports.createSelectControl = exports.Select = exports.createToastControl = exports.Toast = exports.createDropdownControl = exports.Dropdown = exports.createDropdownMenuControl = exports.DropdownMenu = exports.createTextareaControl = exports.Textarea = exports.createDateRangePickerControl = exports.DateRangePicker = exports.createDatePickerControl = exports.DatePicker = exports.createTokenInputControl = exports.TokenInput = exports.createTokenControl = exports.Token = exports.createCurrencyInputControl = exports.CurrencyInput = exports.createInputControl = exports.Input = exports.createRadioGroupControl = exports.RadioGroup = exports.createRadioControl = exports.Radio = exports.createMenuItemControl = exports.MenuItem = exports.CurrencyLabel = exports.createLabelControl = exports.Label = exports.createComboBoxControl = exports.ComboBox = exports.createCheckboxControl = exports.Checkbox = exports.createPortalControl = exports.Portal = exports.createTooltipControl = exports.Tooltip = exports.createButtonControl = exports.Button = exports.MenuComponent = exports.ComponentList = exports.BaseComponent = void 0;
|
|
4
4
|
exports.createPagingControl = exports.Paging = exports.createKebabControl = exports.Kebab = exports.createFxInputControl = exports.FxInput = exports.createFileUploaderControl = exports.FileUploader = exports.createDateInputControl = exports.DateInput = exports.createAutocompleteControl = exports.Autocomplete = exports.createSpinnerControl = exports.Spinner = exports.createLoaderControl = exports.Loader = exports.createTabControl = exports.Tab = void 0;
|
|
5
5
|
var BaseComponent_1 = require("./BaseComponent");
|
|
6
6
|
Object.defineProperty(exports, "BaseComponent", { enumerable: true, get: function () { return BaseComponent_1.BaseComponent; } });
|
|
@@ -8,15 +8,12 @@ var ComponentList_1 = require("./ComponentList");
|
|
|
8
8
|
Object.defineProperty(exports, "ComponentList", { enumerable: true, get: function () { return ComponentList_1.ComponentList; } });
|
|
9
9
|
var MenuComponent_1 = require("./MenuComponent");
|
|
10
10
|
Object.defineProperty(exports, "MenuComponent", { enumerable: true, get: function () { return MenuComponent_1.MenuComponent; } });
|
|
11
|
-
var InfoTooltip_1 = require("./InfoTooltip");
|
|
12
|
-
Object.defineProperty(exports, "InfoTooltip", { enumerable: true, get: function () { return InfoTooltip_1.InfoTooltip; } });
|
|
13
|
-
var ValidationTooltip_1 = require("./ValidationTooltip");
|
|
14
|
-
Object.defineProperty(exports, "ValidationTooltip", { enumerable: true, get: function () { return ValidationTooltip_1.ValidationTooltip; } });
|
|
15
|
-
var Tooltip_1 = require("./Tooltip");
|
|
16
|
-
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
|
|
17
11
|
var Button_1 = require("./Button");
|
|
18
12
|
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
|
|
19
13
|
Object.defineProperty(exports, "createButtonControl", { enumerable: true, get: function () { return Button_1.createButtonControl; } });
|
|
14
|
+
var Tooltip_1 = require("./Tooltip");
|
|
15
|
+
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
|
|
16
|
+
Object.defineProperty(exports, "createTooltipControl", { enumerable: true, get: function () { return Tooltip_1.createTooltipControl; } });
|
|
20
17
|
var Portal_1 = require("./Portal");
|
|
21
18
|
Object.defineProperty(exports, "Portal", { enumerable: true, get: function () { return Portal_1.Portal; } });
|
|
22
19
|
Object.defineProperty(exports, "createPortalControl", { enumerable: true, get: function () { return Portal_1.createPortalControl; } });
|
|
@@ -29,6 +26,8 @@ Object.defineProperty(exports, "createComboBoxControl", { enumerable: true, get:
|
|
|
29
26
|
var Label_1 = require("./Label");
|
|
30
27
|
Object.defineProperty(exports, "Label", { enumerable: true, get: function () { return Label_1.Label; } });
|
|
31
28
|
Object.defineProperty(exports, "createLabelControl", { enumerable: true, get: function () { return Label_1.createLabelControl; } });
|
|
29
|
+
var CurrencyLabel_1 = require("./CurrencyLabel");
|
|
30
|
+
Object.defineProperty(exports, "CurrencyLabel", { enumerable: true, get: function () { return CurrencyLabel_1.CurrencyLabel; } });
|
|
32
31
|
var MenuItem_1 = require("./MenuItem");
|
|
33
32
|
Object.defineProperty(exports, "MenuItem", { enumerable: true, get: function () { return MenuItem_1.MenuItem; } });
|
|
34
33
|
Object.defineProperty(exports, "createMenuItemControl", { enumerable: true, get: function () { return MenuItem_1.createMenuItemControl; } });
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AttributeOptions, EnabledOptions } from '../../options';
|
|
2
2
|
import type { ControlElementLocator } from './LocatorSymbols';
|
|
3
|
-
export declare const toBeDisabled: (this: import("@playwright/test").ExpectMatcherState, component: ControlElementLocator, args_0?:
|
|
3
|
+
export declare const toBeDisabled: (this: import("@playwright/test").ExpectMatcherState, component: ControlElementLocator, args_0?: AttributeOptions | EnabledOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ValueOptions } from '../../options';
|
|
1
|
+
import type { CurrencyLabelAssertionOptions, ValueOptions } from '../../options';
|
|
2
2
|
import type { ToWithValueElementLocator } from './LocatorSymbols';
|
|
3
3
|
export declare const toHaveValue: (this: import("@playwright/test").ExpectMatcherState, component: ToWithValueElementLocator, args_0: string | number | RegExp | readonly (string | RegExp)[] | {
|
|
4
4
|
start?: string;
|
|
5
5
|
end?: string;
|
|
6
|
-
}, args_1?: ValueOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
6
|
+
}, args_1?: ValueOptions | CurrencyLabelAssertionOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -40,6 +40,7 @@ exports.toHaveValue = void 0;
|
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
41
|
var components_1 = require("../../components");
|
|
42
42
|
var extensions_1 = require("../../extensions");
|
|
43
|
+
var currencyLabel_1 = require("../../utils/currencyLabel");
|
|
43
44
|
var LocatorSymbols_1 = require("./LocatorSymbols");
|
|
44
45
|
var createAsyncMatcher_1 = require("../createAsyncMatcher");
|
|
45
46
|
exports.toHaveValue = (0, createAsyncMatcher_1.createSymbolMatcher)('toHaveValue', LocatorSymbols_1.toValueElementLocator, function (_a, expected_1, options_1) { return __awaiter(void 0, [_a, expected_1, options_1], void 0, function (_b, expected, options) {
|
|
@@ -53,31 +54,36 @@ exports.toHaveValue = (0, createAsyncMatcher_1.createSymbolMatcher)('toHaveValue
|
|
|
53
54
|
switch (_c) {
|
|
54
55
|
case component instanceof components_1.Select: return [3 /*break*/, 1];
|
|
55
56
|
case component instanceof components_1.CurrencyInput: return [3 /*break*/, 3];
|
|
56
|
-
case component instanceof components_1.
|
|
57
|
-
case component instanceof components_1.
|
|
57
|
+
case component instanceof components_1.CurrencyLabel: return [3 /*break*/, 5];
|
|
58
|
+
case component instanceof components_1.ComboBox: return [3 /*break*/, 7];
|
|
59
|
+
case component instanceof components_1.DateRangePicker: return [3 /*break*/, 9];
|
|
58
60
|
}
|
|
59
|
-
return [3 /*break*/,
|
|
61
|
+
return [3 /*break*/, 11];
|
|
60
62
|
case 1: return [4 /*yield*/, checkSelect(isNot, locator, expected, options)];
|
|
61
63
|
case 2:
|
|
62
64
|
_d.sent();
|
|
63
|
-
return [3 /*break*/,
|
|
65
|
+
return [3 /*break*/, 13];
|
|
64
66
|
case 3: return [4 /*yield*/, checkCurrencyInput(component, isNot, locator, expected, options)];
|
|
65
67
|
case 4:
|
|
66
68
|
_d.sent();
|
|
67
|
-
return [3 /*break*/,
|
|
68
|
-
case 5: return [4 /*yield*/,
|
|
69
|
+
return [3 /*break*/, 13];
|
|
70
|
+
case 5: return [4 /*yield*/, checkCurrencyLabel(component, isNot, locator, expected, options)];
|
|
69
71
|
case 6:
|
|
70
72
|
_d.sent();
|
|
71
|
-
return [3 /*break*/,
|
|
72
|
-
case 7: return [4 /*yield*/,
|
|
73
|
+
return [3 /*break*/, 13];
|
|
74
|
+
case 7: return [4 /*yield*/, checkComboBox(component, isNot, locator, expected, options)];
|
|
73
75
|
case 8:
|
|
74
76
|
_d.sent();
|
|
75
|
-
return [3 /*break*/,
|
|
76
|
-
case 9: return [4 /*yield*/,
|
|
77
|
+
return [3 /*break*/, 13];
|
|
78
|
+
case 9: return [4 /*yield*/, checkDateRangePicker(component, expected)];
|
|
77
79
|
case 10:
|
|
78
80
|
_d.sent();
|
|
79
|
-
|
|
80
|
-
case 11: return [
|
|
81
|
+
return [3 /*break*/, 13];
|
|
82
|
+
case 11: return [4 /*yield*/, expectation.toHaveValue(expected, options)];
|
|
83
|
+
case 12:
|
|
84
|
+
_d.sent();
|
|
85
|
+
_d.label = 13;
|
|
86
|
+
case 13: return [2 /*return*/];
|
|
81
87
|
}
|
|
82
88
|
});
|
|
83
89
|
}); });
|
|
@@ -96,6 +102,22 @@ function checkSelect(isNot, locator, expected, options) {
|
|
|
96
102
|
});
|
|
97
103
|
});
|
|
98
104
|
}
|
|
105
|
+
function checkCurrencyLabel(component, isNot, locator, expectedValue, options) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var expectation, expectedText;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
switch (_a.label) {
|
|
110
|
+
case 0:
|
|
111
|
+
expectation = isNot ? (0, test_1.expect)(locator).not : (0, test_1.expect)(locator);
|
|
112
|
+
expectedText = (0, currencyLabel_1.getCurrencyLabelExpectedText)(expectedValue, component.options, options);
|
|
113
|
+
return [4 /*yield*/, expectation.toHaveText(expectedText, { timeout: options === null || options === void 0 ? void 0 : options.timeout })];
|
|
114
|
+
case 1:
|
|
115
|
+
_a.sent();
|
|
116
|
+
return [2 /*return*/];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
99
121
|
function checkCurrencyInput(component, isNot, locator, expectedValue, options) {
|
|
100
122
|
return __awaiter(this, void 0, void 0, function () {
|
|
101
123
|
var expectation, expectation_1;
|
|
@@ -3,7 +3,7 @@ declare const matchers: {
|
|
|
3
3
|
readonly toBeVisible: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").VisibleElementLocator, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
4
4
|
readonly toBeHidden: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").VisibleElementLocator, args_0?: import("..").HiddenOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
5
5
|
readonly toBeEnabled: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").EnabledOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
6
|
-
readonly toBeDisabled: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").
|
|
6
|
+
readonly toBeDisabled: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").AttributeOptions | import("..").EnabledOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
7
7
|
readonly toBeFocused: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeFocusableElementLocator, args_0?: import("..").FocusedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
8
8
|
readonly toBeChecked: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeCheckableElementLocator, args_0?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
9
9
|
readonly toBeAutoMode: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FxInput, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -20,7 +20,7 @@ declare const matchers: {
|
|
|
20
20
|
readonly toHaveValue: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string | number | RegExp | readonly (string | RegExp)[] | {
|
|
21
21
|
start?: string;
|
|
22
22
|
end?: string;
|
|
23
|
-
}, args_1?: import("..").ValueOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
23
|
+
}, args_1?: import("..").ValueOptions | import("..").CurrencyLabelAssertionOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
24
24
|
readonly toHaveText: (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>;
|
|
25
25
|
readonly toHaveCount: (this: import("@playwright/test").ExpectMatcherState, component: import("..").ComponentList<any>, args_0: number, args_1?: import("..").CountOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
26
26
|
readonly toHaveHref: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Link, args_0: string | RegExp, args_1?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -72,7 +72,7 @@ declare const matchers: {
|
|
|
72
72
|
* @deprecated will be removed in the next major version
|
|
73
73
|
* @see {@link toBeDisabled}
|
|
74
74
|
*/
|
|
75
|
-
readonly toBeDisabledEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").
|
|
75
|
+
readonly toBeDisabledEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").AttributeOptions | import("..").EnabledOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
76
76
|
/**
|
|
77
77
|
* @deprecated will be removed in the next major version
|
|
78
78
|
* @see {@link toBeFocused}
|
|
@@ -95,7 +95,7 @@ declare const matchers: {
|
|
|
95
95
|
readonly toHaveValueEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string | number | RegExp | readonly (string | RegExp)[] | {
|
|
96
96
|
start?: string;
|
|
97
97
|
end?: string;
|
|
98
|
-
}, args_1?: import("..").ValueOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
98
|
+
}, args_1?: import("..").ValueOptions | import("..").CurrencyLabelAssertionOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
99
99
|
/**
|
|
100
100
|
* @deprecated will be removed in the next major version
|
|
101
101
|
* @see {@link toHaveText}
|
|
@@ -133,7 +133,7 @@ export declare const componentMatchers: import("@playwright/test").Expect<{
|
|
|
133
133
|
readonly toBeVisible: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").VisibleElementLocator, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
134
134
|
readonly toBeHidden: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").VisibleElementLocator, args_0?: import("..").HiddenOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
135
135
|
readonly toBeEnabled: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").EnabledOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
136
|
-
readonly toBeDisabled: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").
|
|
136
|
+
readonly toBeDisabled: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").AttributeOptions | import("..").EnabledOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
137
137
|
readonly toBeFocused: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeFocusableElementLocator, args_0?: import("..").FocusedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
138
138
|
readonly toBeChecked: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeCheckableElementLocator, args_0?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
139
139
|
readonly toBeAutoMode: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FxInput, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -150,7 +150,7 @@ export declare const componentMatchers: import("@playwright/test").Expect<{
|
|
|
150
150
|
readonly toHaveValue: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string | number | RegExp | readonly (string | RegExp)[] | {
|
|
151
151
|
start?: string;
|
|
152
152
|
end?: string;
|
|
153
|
-
}, args_1?: import("..").ValueOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
153
|
+
}, args_1?: import("..").ValueOptions | import("..").CurrencyLabelAssertionOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
154
154
|
readonly toHaveText: (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>;
|
|
155
155
|
readonly toHaveCount: (this: import("@playwright/test").ExpectMatcherState, component: import("..").ComponentList<any>, args_0: number, args_1?: import("..").CountOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
156
156
|
readonly toHaveHref: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Link, args_0: string | RegExp, args_1?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
@@ -202,7 +202,7 @@ export declare const componentMatchers: import("@playwright/test").Expect<{
|
|
|
202
202
|
* @deprecated will be removed in the next major version
|
|
203
203
|
* @see {@link toBeDisabled}
|
|
204
204
|
*/
|
|
205
|
-
readonly toBeDisabledEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").
|
|
205
|
+
readonly toBeDisabledEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").AttributeOptions | import("..").EnabledOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
206
206
|
/**
|
|
207
207
|
* @deprecated will be removed in the next major version
|
|
208
208
|
* @see {@link toBeFocused}
|
|
@@ -225,7 +225,7 @@ export declare const componentMatchers: import("@playwright/test").Expect<{
|
|
|
225
225
|
readonly toHaveValueEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string | number | RegExp | readonly (string | RegExp)[] | {
|
|
226
226
|
start?: string;
|
|
227
227
|
end?: string;
|
|
228
|
-
}, args_1?: import("..").ValueOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
228
|
+
}, args_1?: import("..").ValueOptions | import("..").CurrencyLabelAssertionOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
229
229
|
/**
|
|
230
230
|
* @deprecated will be removed in the next major version
|
|
231
231
|
* @see {@link toHaveText}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CurrencyLabelOptions } from '../components/CurrencyLabel';
|
|
1
2
|
export type VisibleOptions = {
|
|
2
3
|
/**
|
|
3
4
|
* Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
|
|
@@ -80,3 +81,10 @@ export type TransformOptions = {
|
|
|
80
81
|
*/
|
|
81
82
|
timeout?: number;
|
|
82
83
|
};
|
|
84
|
+
export type CurrencyLabelAssertionOptions = CurrencyLabelOptions & {
|
|
85
|
+
/**
|
|
86
|
+
* Time to retry the assertion for in milliseconds.
|
|
87
|
+
* Defaults to `timeout` in TestConfig.expect.
|
|
88
|
+
*/
|
|
89
|
+
timeout?: number;
|
|
90
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CurrencyLabelOptions } from '../components/CurrencyLabel';
|
|
2
|
+
import type { CurrencyLabelAssertionOptions } from '../options';
|
|
3
|
+
export declare function getCurrencyLabelExpectedText(value: string | number, baseOptions: CurrencyLabelOptions, assertionOptions?: CurrencyLabelAssertionOptions): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrencyLabelExpectedText = getCurrencyLabelExpectedText;
|
|
4
|
+
var CurrencyHelper_1 = require("@skbkontur/react-ui/components/CurrencyInput/CurrencyHelper");
|
|
5
|
+
/**
|
|
6
|
+
* Если `assertionOptions` не определен или в нем нет такого `key` - берем значение из `baseOptions`
|
|
7
|
+
* Иначе берем значение `key` из `assertionOptions`
|
|
8
|
+
*/
|
|
9
|
+
function pickOption(baseOptions, assertionOptions, key) {
|
|
10
|
+
var _a;
|
|
11
|
+
if (assertionOptions === undefined || !(key in assertionOptions)) {
|
|
12
|
+
return (_a = baseOptions[key]) !== null && _a !== void 0 ? _a : undefined;
|
|
13
|
+
}
|
|
14
|
+
return assertionOptions[key];
|
|
15
|
+
}
|
|
16
|
+
function getCurrencyLabelExpectedText(value, baseOptions, assertionOptions) {
|
|
17
|
+
var format = {
|
|
18
|
+
currencySymbol: pickOption(baseOptions, assertionOptions, 'currencySymbol'),
|
|
19
|
+
fractionDigits: pickOption(baseOptions, assertionOptions, 'fractionDigits'),
|
|
20
|
+
hideTrailingZeros: pickOption(baseOptions, assertionOptions, 'hideTrailingZeros'),
|
|
21
|
+
};
|
|
22
|
+
var formattedValue = typeof value === 'number' ? CurrencyHelper_1.CurrencyHelper.format(value, format) : CurrencyHelper_1.CurrencyHelper.formatString(value, format);
|
|
23
|
+
return format.currencySymbol ? "".concat(formattedValue, "\u00A0").concat(format.currencySymbol) : formattedValue;
|
|
24
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Tooltip } from '../components';
|
|
2
2
|
import type { BaseComponent } from '../components';
|
|
3
3
|
import { TooltipType } from './constants';
|
|
4
4
|
export declare function getTooltip(type: TooltipType, component: BaseComponent): Promise<Tooltip>;
|
|
@@ -37,29 +37,58 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.getTooltip = getTooltip;
|
|
40
|
-
var
|
|
41
|
-
var
|
|
40
|
+
var Popup_1 = require("@skbkontur/react-ui/internal/Popup");
|
|
41
|
+
var components_1 = require("../components");
|
|
42
|
+
var components_2 = require("../components");
|
|
42
43
|
var constants_1 = require("./constants");
|
|
44
|
+
var dataTidSelector_1 = require("./dataTidSelector");
|
|
45
|
+
function isFocusable(value) {
|
|
46
|
+
return typeof (value === null || value === void 0 ? void 0 : value.focus) === 'function';
|
|
47
|
+
}
|
|
43
48
|
function getTooltip(type, component) {
|
|
44
49
|
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
-
var
|
|
46
|
-
return __generator(this, function (
|
|
47
|
-
switch (
|
|
50
|
+
var portal, _a, locator, container;
|
|
51
|
+
return __generator(this, function (_b) {
|
|
52
|
+
switch (_b.label) {
|
|
48
53
|
case 0:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
_a = type;
|
|
55
|
+
switch (_a) {
|
|
56
|
+
case constants_1.TooltipType.Validation: return [3 /*break*/, 1];
|
|
57
|
+
case constants_1.TooltipType.Information: return [3 /*break*/, 8];
|
|
58
|
+
}
|
|
59
|
+
return [3 /*break*/, 9];
|
|
60
|
+
case 1: return [4 /*yield*/, component.rootLocator.press('Tab')];
|
|
61
|
+
case 2:
|
|
62
|
+
_b.sent();
|
|
63
|
+
if (!isFocusable(component)) return [3 /*break*/, 4];
|
|
64
|
+
return [4 /*yield*/, component.focus()];
|
|
65
|
+
case 3:
|
|
66
|
+
_b.sent();
|
|
67
|
+
return [3 /*break*/, 6];
|
|
68
|
+
case 4: return [4 /*yield*/, component.rootLocator.focus()];
|
|
69
|
+
case 5:
|
|
70
|
+
_b.sent();
|
|
71
|
+
_b.label = 6;
|
|
72
|
+
case 6:
|
|
73
|
+
locator = component.rootLocator.locator('../../noscript');
|
|
74
|
+
return [4 /*yield*/, locator.count()];
|
|
75
|
+
case 7:
|
|
76
|
+
if ((_b.sent()) > 1) {
|
|
77
|
+
locator = component.rootLocator.locator('../following-sibling::noscript[1]');
|
|
78
|
+
}
|
|
79
|
+
portal = new components_1.Portal(locator);
|
|
80
|
+
return [3 /*break*/, 10];
|
|
81
|
+
case 8:
|
|
82
|
+
{
|
|
83
|
+
portal = new components_1.Portal(component.rootLocator.locator('../noscript'));
|
|
84
|
+
return [3 /*break*/, 10];
|
|
58
85
|
}
|
|
59
|
-
|
|
60
|
-
case
|
|
61
|
-
|
|
62
|
-
|
|
86
|
+
_b.label = 9;
|
|
87
|
+
case 9: throw new Error("Unknown tooltip type: ".concat(type));
|
|
88
|
+
case 10: return [4 /*yield*/, portal.getContainer()];
|
|
89
|
+
case 11:
|
|
90
|
+
container = _b.sent();
|
|
91
|
+
return [2 /*return*/, new components_2.Tooltip(container.locator((0, dataTidSelector_1.getDataTidSelector)(Popup_1.PopupDataTids.content)))];
|
|
63
92
|
}
|
|
64
93
|
});
|
|
65
94
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/playwright-react-ui-components",
|
|
3
|
-
"version": "1.18.0-beta.
|
|
3
|
+
"version": "1.18.0-beta.3",
|
|
4
4
|
"description": "Пакет для взаимодействия с компонентами @skbkontur/react-ui при тестировании с помощью Playwright",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.InfoTooltip = void 0;
|
|
19
|
-
var Tooltip_1 = require("./Tooltip");
|
|
20
|
-
var InfoTooltip = /** @class */ (function (_super) {
|
|
21
|
-
__extends(InfoTooltip, _super);
|
|
22
|
-
function InfoTooltip(targetControl) {
|
|
23
|
-
return _super.call(this, targetControl) || this;
|
|
24
|
-
}
|
|
25
|
-
InfoTooltip.prototype.showAsync = function () {
|
|
26
|
-
return Promise.resolve();
|
|
27
|
-
};
|
|
28
|
-
return InfoTooltip;
|
|
29
|
-
}(Tooltip_1.Tooltip));
|
|
30
|
-
exports.InfoTooltip = InfoTooltip;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { BaseComponent } from './BaseComponent';
|
|
2
|
-
import { Tooltip } from './Tooltip';
|
|
3
|
-
export declare class ValidationTooltip extends Tooltip {
|
|
4
|
-
constructor(targetControl: BaseComponent);
|
|
5
|
-
protected showAsync(): Promise<void>;
|
|
6
|
-
initAsync(customTid?: string): Promise<void>;
|
|
7
|
-
}
|