@skbkontur/playwright-react-ui-components 1.13.2 → 1.14.0-beta.2
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 +10 -10
- package/build/src/assertions/BaseComponentAssertions.js +11 -11
- package/build/src/assertions/ButtonAssertions.js +9 -9
- package/build/src/assertions/CheckboxAssertions.js +13 -13
- package/build/src/assertions/ComboBoxAssertions.js +17 -111
- package/build/src/assertions/ComponentListAssertions.js +6 -6
- package/build/src/assertions/CurrencyInputAssertions.js +11 -61
- package/build/src/assertions/DateInputAssertions.js +9 -9
- package/build/src/assertions/DatePickerAssertions.js +9 -9
- package/build/src/assertions/DateRangePickerAssertions.js +4 -25
- package/build/src/assertions/DropdownAssertions.js +13 -63
- package/build/src/assertions/DropdownMenuAssertions.js +11 -61
- package/build/src/assertions/FileUploaderAssertions.d.ts +1 -3
- package/build/src/assertions/FileUploaderAssertions.js +5 -22
- package/build/src/assertions/FxInputAssertions.js +11 -14
- package/build/src/assertions/InputAssertions.js +10 -10
- package/build/src/assertions/KebabAssertions.js +7 -58
- package/build/src/assertions/LabelAssertions.js +7 -7
- package/build/src/assertions/LinkAssertions.js +11 -12
- package/build/src/assertions/LoaderAssertions.js +2 -2
- package/build/src/assertions/MenuItemAssertations.js +5 -5
- package/build/src/assertions/PagingAssertions.js +5 -40
- package/build/src/assertions/PortalAssertions.js +3 -3
- package/build/src/assertions/RadioAssertions.js +13 -13
- package/build/src/assertions/RadioGroupAssertions.js +10 -81
- package/build/src/assertions/SelectAssertions.js +15 -64
- package/build/src/assertions/SpinnerAssertions.js +2 -2
- package/build/src/assertions/TabAssertions.js +11 -12
- package/build/src/assertions/TabsAssertions.js +4 -32
- package/build/src/assertions/TextareaAssertions.js +9 -9
- package/build/src/assertions/ToastAssertions.js +2 -2
- package/build/src/assertions/ToggleAssertions.js +11 -11
- package/build/src/assertions/TokenAssertions.js +8 -14
- package/build/src/assertions/TokenInputAssertions.js +8 -28
- package/build/src/assertions/TooltipAssertions.js +5 -5
- package/build/src/components/Autocomplete.d.ts +4 -0
- package/build/src/components/Autocomplete.js +52 -50
- package/build/src/components/BaseComponent.d.ts +4 -0
- package/build/src/components/BaseComponent.js +37 -30
- package/build/src/components/Button.d.ts +4 -0
- package/build/src/components/Button.js +25 -19
- package/build/src/components/Checkbox.d.ts +6 -0
- package/build/src/components/Checkbox.js +28 -36
- package/build/src/components/ComboBox.d.ts +8 -2
- package/build/src/components/ComboBox.js +67 -54
- package/build/src/components/ComponentList.d.ts +6 -3
- package/build/src/components/ComponentList.js +39 -50
- package/build/src/components/CurrencyInput.d.ts +4 -0
- package/build/src/components/CurrencyInput.js +39 -37
- package/build/src/components/DateInput.d.ts +4 -0
- package/build/src/components/DateInput.js +34 -32
- package/build/src/components/DatePicker.d.ts +4 -0
- package/build/src/components/DatePicker.js +35 -33
- package/build/src/components/DateRangePicker.d.ts +2 -0
- package/build/src/components/DateRangePicker.js +14 -10
- package/build/src/components/Dropdown.d.ts +7 -2
- package/build/src/components/Dropdown.js +68 -65
- package/build/src/components/DropdownMenu.d.ts +6 -2
- package/build/src/components/DropdownMenu.js +67 -65
- package/build/src/components/FileUploader.d.ts +3 -1
- package/build/src/components/FileUploader.js +39 -39
- package/build/src/components/FxInput.d.ts +4 -0
- package/build/src/components/FxInput.js +44 -42
- package/build/src/components/Input.d.ts +4 -0
- package/build/src/components/Input.js +37 -35
- package/build/src/components/Kebab.d.ts +5 -2
- package/build/src/components/Kebab.js +49 -48
- package/build/src/components/Label.d.ts +2 -0
- package/build/src/components/Label.js +9 -13
- package/build/src/components/Link.d.ts +4 -0
- package/build/src/components/Link.js +19 -25
- package/build/src/components/Loader.d.ts +2 -0
- package/build/src/components/Loader.js +15 -10
- package/build/src/components/MenuComponent.d.ts +10 -0
- package/build/src/components/MenuComponent.js +79 -0
- package/build/src/components/MenuItem.d.ts +2 -0
- package/build/src/components/MenuItem.js +7 -3
- package/build/src/components/Paging.d.ts +2 -0
- package/build/src/components/Paging.js +59 -52
- package/build/src/components/Portal.d.ts +2 -0
- package/build/src/components/Portal.js +14 -10
- package/build/src/components/Radio.d.ts +6 -0
- package/build/src/components/Radio.js +31 -27
- package/build/src/components/RadioGroup.d.ts +2 -0
- package/build/src/components/RadioGroup.js +51 -47
- package/build/src/components/Select.d.ts +5 -0
- package/build/src/components/Select.js +92 -76
- package/build/src/components/Spinner.d.ts +2 -0
- package/build/src/components/Spinner.js +13 -9
- package/build/src/components/Tab.d.ts +4 -0
- package/build/src/components/Tab.js +17 -27
- package/build/src/components/Textarea.d.ts +4 -0
- package/build/src/components/Textarea.js +33 -39
- package/build/src/components/Toast.d.ts +2 -0
- package/build/src/components/Toast.js +7 -3
- package/build/src/components/Toggle.d.ts +5 -0
- package/build/src/components/Toggle.js +24 -33
- package/build/src/components/Token.d.ts +3 -0
- package/build/src/components/Token.js +14 -9
- package/build/src/components/TokenInput.d.ts +4 -0
- package/build/src/components/TokenInput.js +61 -59
- package/build/src/components/Tooltip.d.ts +2 -0
- package/build/src/components/Tooltip.js +9 -9
- package/build/src/components/index.d.ts +1 -0
- package/build/src/components/index.js +3 -1
- package/build/src/extensions/index.d.ts +1 -0
- package/build/src/extensions/index.js +17 -0
- package/build/src/extensions/mergedExpects.d.ts +5 -0
- package/build/src/extensions/mergedExpects.js +7 -0
- package/build/src/index.d.ts +2 -0
- package/build/src/index.js +2 -0
- package/build/src/matchers/component/LocatorSymbols.d.ts +43 -0
- package/build/src/matchers/component/LocatorSymbols.js +13 -0
- package/build/src/matchers/component/toBeActiveTab.d.ts +3 -0
- package/build/src/matchers/component/toBeActiveTab.js +56 -0
- package/build/src/matchers/component/toBeAutoMode.d.ts +3 -0
- package/build/src/matchers/component/toBeAutoMode.js +62 -0
- package/build/src/matchers/component/toBeCheckedByIndex.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedByIndex.js +62 -0
- package/build/src/matchers/component/toBeCheckedByText.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedByText.js +62 -0
- package/build/src/matchers/component/toBeCheckedByValue.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedByValue.js +62 -0
- package/build/src/matchers/component/toBeCheckedEx.d.ts +3 -0
- package/build/src/matchers/component/toBeCheckedEx.js +56 -0
- package/build/src/matchers/component/toBeDisabledEx.d.ts +3 -0
- package/build/src/matchers/component/toBeDisabledEx.js +171 -0
- package/build/src/matchers/component/toBeEmptyEx.d.ts +3 -0
- package/build/src/matchers/component/toBeEmptyEx.js +136 -0
- package/build/src/matchers/component/toBeEnabledEx.d.ts +3 -0
- package/build/src/matchers/component/toBeEnabledEx.js +196 -0
- package/build/src/matchers/component/toBeFocusedEx.d.ts +3 -0
- package/build/src/matchers/component/toBeFocusedEx.js +56 -0
- package/build/src/matchers/component/toBeHiddenEx.d.ts +3 -0
- package/build/src/matchers/component/toBeHiddenEx.js +67 -0
- package/build/src/matchers/component/toBeInactiveTab.d.ts +3 -0
- package/build/src/matchers/component/toBeInactiveTab.js +56 -0
- package/build/src/matchers/component/toBeUnchecked.d.ts +3 -0
- package/build/src/matchers/component/toBeUnchecked.js +56 -0
- package/build/src/matchers/component/toBeUncheckedByIndex.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedByIndex.js +62 -0
- package/build/src/matchers/component/toBeUncheckedByText.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedByText.js +57 -0
- package/build/src/matchers/component/toBeUncheckedByValue.d.ts +3 -0
- package/build/src/matchers/component/toBeUncheckedByValue.js +57 -0
- package/build/src/matchers/component/toBeVisibleEx.d.ts +3 -0
- package/build/src/matchers/component/toBeVisibleEx.js +67 -0
- package/build/src/matchers/component/toContainFormattedText.d.ts +3 -0
- package/build/src/matchers/component/toContainFormattedText.js +55 -0
- package/build/src/matchers/component/toContainItem.d.ts +4 -0
- package/build/src/matchers/component/toContainItem.js +78 -0
- package/build/src/matchers/component/toContainItems.d.ts +3 -0
- package/build/src/matchers/component/toContainItems.js +63 -0
- package/build/src/matchers/component/toContainSelectValue.d.ts +3 -0
- package/build/src/matchers/component/toContainSelectValue.js +55 -0
- package/build/src/matchers/component/toContainTabs.d.ts +3 -0
- package/build/src/matchers/component/toContainTabs.js +80 -0
- package/build/src/matchers/component/toContainTextEx.d.ts +3 -0
- package/build/src/matchers/component/toContainTextEx.js +56 -0
- package/build/src/matchers/component/toContainTokens.d.ts +4 -0
- package/build/src/matchers/component/toContainTokens.js +80 -0
- package/build/src/matchers/component/toContainUploadedFiles.d.ts +4 -0
- package/build/src/matchers/component/toContainUploadedFiles.js +75 -0
- package/build/src/matchers/component/toHaveActivePage.d.ts +4 -0
- package/build/src/matchers/component/toHaveActivePage.js +78 -0
- package/build/src/matchers/component/toHaveActiveTab.d.ts +2 -0
- package/build/src/matchers/component/toHaveActiveTab.js +62 -0
- package/build/src/matchers/component/toHaveAttributeEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveAttributeEx.js +62 -0
- package/build/src/matchers/component/toHaveCountEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveCountEx.js +56 -0
- package/build/src/matchers/component/toHaveError.d.ts +3 -0
- package/build/src/matchers/component/toHaveError.js +57 -0
- package/build/src/matchers/component/toHaveFormattedText.d.ts +3 -0
- package/build/src/matchers/component/toHaveFormattedText.js +56 -0
- package/build/src/matchers/component/toHaveFormattedValue.d.ts +3 -0
- package/build/src/matchers/component/toHaveFormattedValue.js +56 -0
- package/build/src/matchers/component/toHaveHref.d.ts +3 -0
- package/build/src/matchers/component/toHaveHref.js +55 -0
- package/build/src/matchers/component/toHaveItems.d.ts +3 -0
- package/build/src/matchers/component/toHaveItems.js +63 -0
- package/build/src/matchers/component/toHavePageCount.d.ts +4 -0
- package/build/src/matchers/component/toHavePageCount.js +71 -0
- package/build/src/matchers/component/toHaveTextEx.d.ts +3 -0
- package/build/src/matchers/component/toHaveTextEx.js +56 -0
- package/build/src/matchers/component/toHaveValueEx.d.ts +6 -0
- package/build/src/matchers/component/toHaveValueEx.js +197 -0
- package/build/src/matchers/component/toHaveWarning.d.ts +3 -0
- package/build/src/matchers/component/toHaveWarning.js +57 -0
- package/build/src/matchers/componentMatchers.d.ts +104 -0
- package/build/src/matchers/componentMatchers.js +89 -0
- package/build/src/matchers/createAsyncMatcher.d.ts +72 -0
- package/build/src/matchers/createAsyncMatcher.js +180 -0
- package/build/src/matchers/formattedMatchers.d.ts +15 -31
- package/build/src/matchers/formattedMatchers.js +19 -15
- package/build/src/matchers/index.d.ts +1 -1
- package/build/src/matchers/index.js +1 -3
- package/build/src/utils/getMarcherResult.d.ts +13 -0
- package/build/src/utils/getMarcherResult.js +13 -0
- package/build/src/utils/index.d.ts +3 -0
- package/build/src/utils/index.js +3 -0
- package/build/src/utils/makeMatcher.d.ts +5 -0
- package/build/src/utils/makeMatcher.js +65 -0
- package/build/src/utils/toMatchMessage.d.ts +23 -0
- package/build/src/utils/toMatchMessage.js +89 -0
- package/package.json +1 -1
- package/build/src/matchers/mergedExpects.d.ts +0 -15
- package/build/src/matchers/mergedExpects.js +0 -6
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
declare const matchers: {
|
|
2
|
+
readonly toBeEmptyEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0?: import("..").EmptyOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
3
|
+
readonly toBeVisibleEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").VisibleElementLocator, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
4
|
+
readonly toBeHiddenEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").VisibleElementLocator, args_0?: import("..").HiddenOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
5
|
+
readonly toBeEnabledEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").EnabledOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
6
|
+
readonly toBeDisabledEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").EnabledOptions | import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
7
|
+
readonly toBeFocusedEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeFocusableElementLocator, args_0?: import("..").FocusedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
8
|
+
readonly toBeCheckedEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeCheckableElementLocator, args_0?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
9
|
+
readonly toHaveAttributeEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToHaveAttributeElementLocator, args_0: string, args_1?: string | RegExp | undefined, args_2?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
10
|
+
readonly toHaveValueEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string | number | RegExp | readonly (string | RegExp)[] | {
|
|
11
|
+
start?: string;
|
|
12
|
+
end?: string;
|
|
13
|
+
}, args_1?: import("..").ValueOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
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
|
+
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 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>;
|
|
17
|
+
readonly toBeAutoMode: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FxInput, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
18
|
+
readonly toBeUnchecked: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeCheckableElementLocator, args_0?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
19
|
+
readonly toBeActiveTab: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tab, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
20
|
+
readonly toBeInactiveTab: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tab, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
21
|
+
readonly toBeCheckedByValue: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: string | RegExp, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
22
|
+
readonly toBeCheckedByIndex: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: number, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
23
|
+
readonly toBeUncheckedByValue: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: string | RegExp, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
24
|
+
readonly toBeUncheckedByIndex: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: number, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
25
|
+
readonly toBeCheckedByText: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: string | RegExp, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
26
|
+
readonly toBeUncheckedByText: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: string | RegExp, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
27
|
+
readonly toHaveHref: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Link, args_0: string | RegExp, args_1?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
28
|
+
readonly toHaveItems: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToHaveItemsElementLocator, args_0: string[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
29
|
+
readonly toHaveError: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").RootSymbolLocator, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
30
|
+
readonly toHaveWarning: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").RootSymbolLocator, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
31
|
+
readonly toHaveActiveTab: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tabs, args_0: string | RegExp) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
32
|
+
readonly toHavePageCount: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Paging, args_0: number, args_1?: {
|
|
33
|
+
timeout?: number;
|
|
34
|
+
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
35
|
+
readonly toHaveActivePage: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Paging, args_0: number, args_1?: {
|
|
36
|
+
timeout?: number;
|
|
37
|
+
} | 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
|
+
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
|
+
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
|
+
readonly toContainTokens: (this: import("@playwright/test").ExpectMatcherState, component: import("..").TokenInput, args_0: string[], args_1?: {
|
|
43
|
+
timeout?: number;
|
|
44
|
+
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
45
|
+
readonly toContainTabs: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tabs, args_0: string[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
46
|
+
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
|
+
readonly toContainUploadedFiles: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FileUploader, args_0: string[], args_1?: {
|
|
49
|
+
timeout?: number;
|
|
50
|
+
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
51
|
+
};
|
|
52
|
+
export type ComponentMatchers = typeof matchers;
|
|
53
|
+
export declare const componentMatchers: import("@playwright/test").Expect<{
|
|
54
|
+
readonly toBeEmptyEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0?: import("..").EmptyOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
55
|
+
readonly toBeVisibleEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").VisibleElementLocator, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
56
|
+
readonly toBeHiddenEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").VisibleElementLocator, args_0?: import("..").HiddenOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
57
|
+
readonly toBeEnabledEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").EnabledOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
58
|
+
readonly toBeDisabledEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ControlElementLocator, args_0?: import("..").EnabledOptions | import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
59
|
+
readonly toBeFocusedEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeFocusableElementLocator, args_0?: import("..").FocusedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
60
|
+
readonly toBeCheckedEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeCheckableElementLocator, args_0?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
61
|
+
readonly toHaveAttributeEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToHaveAttributeElementLocator, args_0: string, args_1?: string | RegExp | undefined, args_2?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
62
|
+
readonly toHaveValueEx: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToWithValueElementLocator, args_0: string | number | RegExp | readonly (string | RegExp)[] | {
|
|
63
|
+
start?: string;
|
|
64
|
+
end?: string;
|
|
65
|
+
}, args_1?: import("..").ValueOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
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
|
+
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 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>;
|
|
69
|
+
readonly toBeAutoMode: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FxInput, args_0?: import("..").VisibleOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
70
|
+
readonly toBeUnchecked: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToBeCheckableElementLocator, args_0?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
71
|
+
readonly toBeActiveTab: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tab, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
72
|
+
readonly toBeInactiveTab: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tab, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
73
|
+
readonly toBeCheckedByValue: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: string | RegExp, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
74
|
+
readonly toBeCheckedByIndex: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: number, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
75
|
+
readonly toBeUncheckedByValue: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: string | RegExp, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
76
|
+
readonly toBeUncheckedByIndex: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: number, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
77
|
+
readonly toBeCheckedByText: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: string | RegExp, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
78
|
+
readonly toBeUncheckedByText: (this: import("@playwright/test").ExpectMatcherState, component: import("..").RadioGroup, args_0: string | RegExp, args_1?: import("..").CheckedOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
79
|
+
readonly toHaveHref: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Link, args_0: string | RegExp, args_1?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
80
|
+
readonly toHaveItems: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").ToHaveItemsElementLocator, args_0: string[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
81
|
+
readonly toHaveError: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").RootSymbolLocator, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
82
|
+
readonly toHaveWarning: (this: import("@playwright/test").ExpectMatcherState, component: import("./component/LocatorSymbols").RootSymbolLocator, args_0?: import("..").AttributeOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
83
|
+
readonly toHaveActiveTab: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tabs, args_0: string | RegExp) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
84
|
+
readonly toHavePageCount: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Paging, args_0: number, args_1?: {
|
|
85
|
+
timeout?: number;
|
|
86
|
+
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
87
|
+
readonly toHaveActivePage: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Paging, args_0: number, args_1?: {
|
|
88
|
+
timeout?: number;
|
|
89
|
+
} | 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
|
+
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
|
+
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
|
+
readonly toContainTokens: (this: import("@playwright/test").ExpectMatcherState, component: import("..").TokenInput, args_0: string[], args_1?: {
|
|
95
|
+
timeout?: number;
|
|
96
|
+
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
97
|
+
readonly toContainTabs: (this: import("@playwright/test").ExpectMatcherState, component: import("..").Tabs, args_0: string[], args_1?: import("..").TextOptions | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
98
|
+
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
|
+
readonly toContainUploadedFiles: (this: import("@playwright/test").ExpectMatcherState, component: import("..").FileUploader, args_0: string[], args_1?: {
|
|
101
|
+
timeout?: number;
|
|
102
|
+
} | undefined) => Promise<import("@playwright/test").MatcherReturnType>;
|
|
103
|
+
}>;
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentMatchers = void 0;
|
|
4
|
+
var test_1 = require("@playwright/test");
|
|
5
|
+
var toBeEmptyEx_1 = require("./component/toBeEmptyEx");
|
|
6
|
+
var toBeVisibleEx_1 = require("./component/toBeVisibleEx");
|
|
7
|
+
var toBeHiddenEx_1 = require("./component/toBeHiddenEx");
|
|
8
|
+
var toBeEnabledEx_1 = require("./component/toBeEnabledEx");
|
|
9
|
+
var toBeDisabledEx_1 = require("./component/toBeDisabledEx");
|
|
10
|
+
var toHaveAttributeEx_1 = require("./component/toHaveAttributeEx");
|
|
11
|
+
var toHaveValueEx_1 = require("./component/toHaveValueEx");
|
|
12
|
+
var toBeFocusedEx_1 = require("./component/toBeFocusedEx");
|
|
13
|
+
var toBeCheckedEx_1 = require("./component/toBeCheckedEx");
|
|
14
|
+
var toBeUnchecked_1 = require("./component/toBeUnchecked");
|
|
15
|
+
var toHaveTextEx_1 = require("./component/toHaveTextEx");
|
|
16
|
+
var toContainTextEx_1 = require("./component/toContainTextEx");
|
|
17
|
+
var toHaveCountEx_1 = require("./component/toHaveCountEx");
|
|
18
|
+
var toHaveItems_1 = require("./component/toHaveItems");
|
|
19
|
+
var toContainItems_1 = require("./component/toContainItems");
|
|
20
|
+
var toContainItem_1 = require("./component/toContainItem");
|
|
21
|
+
var toBeActiveTab_1 = require("./component/toBeActiveTab");
|
|
22
|
+
var toBeInactiveTab_1 = require("./component/toBeInactiveTab");
|
|
23
|
+
var toBeAutoMode_1 = require("./component/toBeAutoMode");
|
|
24
|
+
var toHaveError_1 = require("./component/toHaveError");
|
|
25
|
+
var toHaveWarning_1 = require("./component/toHaveWarning");
|
|
26
|
+
var toContainUploadedFiles_1 = require("./component/toContainUploadedFiles");
|
|
27
|
+
var toContainFormattedText_1 = require("./component/toContainFormattedText");
|
|
28
|
+
var toContainTokens_1 = require("./component/toContainTokens");
|
|
29
|
+
var toHaveActiveTab_1 = require("./component/toHaveActiveTab");
|
|
30
|
+
var toContainTabs_1 = require("./component/toContainTabs");
|
|
31
|
+
var toHaveHref_1 = require("./component/toHaveHref");
|
|
32
|
+
var toHavePageCount_1 = require("./component/toHavePageCount");
|
|
33
|
+
var toBeCheckedByValue_1 = require("./component/toBeCheckedByValue");
|
|
34
|
+
var toBeCheckedByIndex_1 = require("./component/toBeCheckedByIndex");
|
|
35
|
+
var toBeUncheckedByValue_1 = require("./component/toBeUncheckedByValue");
|
|
36
|
+
var toBeUncheckedByIndex_1 = require("./component/toBeUncheckedByIndex");
|
|
37
|
+
var toContainSelectValue_1 = require("./component/toContainSelectValue");
|
|
38
|
+
var toBeCheckedByText_1 = require("./component/toBeCheckedByText");
|
|
39
|
+
var toBeUncheckedByText_1 = require("./component/toBeUncheckedByText");
|
|
40
|
+
var toHaveActivePage_1 = require("./component/toHaveActivePage");
|
|
41
|
+
var toHaveFormattedValue_1 = require("./component/toHaveFormattedValue");
|
|
42
|
+
var toHaveFormattedText_1 = require("./component/toHaveFormattedText");
|
|
43
|
+
var matchers = {
|
|
44
|
+
/*
|
|
45
|
+
NOTE: некоторые кастомные матчеры содержат суффикс "Ex",
|
|
46
|
+
для того чтобы не переопределять стандартные матчеры playwright,
|
|
47
|
+
тк. уже есть матчеры с такими же именами 'toBeEmpty' и тд и при extend они мутируются и перезаписываются { ...matchers, ...customMatchers }
|
|
48
|
+
https://playwright.dev/docs/test-assertions#auto-retrying-assertions
|
|
49
|
+
*/
|
|
50
|
+
toBeEmptyEx: toBeEmptyEx_1.toBeEmptyEx,
|
|
51
|
+
toBeVisibleEx: toBeVisibleEx_1.toBeVisibleEx,
|
|
52
|
+
toBeHiddenEx: toBeHiddenEx_1.toBeHiddenEx,
|
|
53
|
+
toBeEnabledEx: toBeEnabledEx_1.toBeEnabledEx,
|
|
54
|
+
toBeDisabledEx: toBeDisabledEx_1.toBeDisabledEx,
|
|
55
|
+
toBeFocusedEx: toBeFocusedEx_1.toBeFocusedEx,
|
|
56
|
+
toBeCheckedEx: toBeCheckedEx_1.toBeCheckedEx,
|
|
57
|
+
toHaveAttributeEx: toHaveAttributeEx_1.toHaveAttributeEx,
|
|
58
|
+
toHaveValueEx: toHaveValueEx_1.toHaveValueEx,
|
|
59
|
+
toHaveTextEx: toHaveTextEx_1.toHaveTextEx,
|
|
60
|
+
toHaveCountEx: toHaveCountEx_1.toHaveCountEx,
|
|
61
|
+
toContainTextEx: toContainTextEx_1.toContainTextEx,
|
|
62
|
+
toBeAutoMode: toBeAutoMode_1.toBeAutoMode,
|
|
63
|
+
toBeUnchecked: toBeUnchecked_1.toBeUnchecked,
|
|
64
|
+
toBeActiveTab: toBeActiveTab_1.toBeActiveTab,
|
|
65
|
+
toBeInactiveTab: toBeInactiveTab_1.toBeInactiveTab,
|
|
66
|
+
toBeCheckedByValue: toBeCheckedByValue_1.toBeCheckedByValue,
|
|
67
|
+
toBeCheckedByIndex: toBeCheckedByIndex_1.toBeCheckedByIndex,
|
|
68
|
+
toBeUncheckedByValue: toBeUncheckedByValue_1.toBeUncheckedByValue,
|
|
69
|
+
toBeUncheckedByIndex: toBeUncheckedByIndex_1.toBeUncheckedByIndex,
|
|
70
|
+
toBeCheckedByText: toBeCheckedByText_1.toBeCheckedByText,
|
|
71
|
+
toBeUncheckedByText: toBeUncheckedByText_1.toBeUncheckedByText,
|
|
72
|
+
toHaveHref: toHaveHref_1.toHaveHref,
|
|
73
|
+
toHaveItems: toHaveItems_1.toHaveItems,
|
|
74
|
+
toHaveError: toHaveError_1.toHaveError,
|
|
75
|
+
toHaveWarning: toHaveWarning_1.toHaveWarning,
|
|
76
|
+
toHaveActiveTab: toHaveActiveTab_1.toHaveActiveTab,
|
|
77
|
+
toHavePageCount: toHavePageCount_1.toHavePageCount,
|
|
78
|
+
toHaveActivePage: toHaveActivePage_1.toHaveActivePage,
|
|
79
|
+
toHaveFormattedValue: toHaveFormattedValue_1.toHaveFormattedValue,
|
|
80
|
+
toHaveFormattedText: toHaveFormattedText_1.toHaveFormattedText,
|
|
81
|
+
toContainItems: toContainItems_1.toContainItems,
|
|
82
|
+
toContainItem: toContainItem_1.toContainItem,
|
|
83
|
+
toContainTokens: toContainTokens_1.toContainTokens,
|
|
84
|
+
toContainTabs: toContainTabs_1.toContainTabs,
|
|
85
|
+
toContainSelectValue: toContainSelectValue_1.toContainSelectValue,
|
|
86
|
+
toContainFormattedText: toContainFormattedText_1.toContainFormattedText,
|
|
87
|
+
toContainUploadedFiles: toContainUploadedFiles_1.toContainUploadedFiles,
|
|
88
|
+
};
|
|
89
|
+
exports.componentMatchers = test_1.expect.extend(matchers);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ExpectMatcherState, Locator, MatcherReturnType } from '@playwright/test';
|
|
2
|
+
import type { LocatorType, LocatorTypeFn } from './component/LocatorSymbols';
|
|
3
|
+
export interface CreateMatcherLogicParams<TComponent> {
|
|
4
|
+
isNot: boolean;
|
|
5
|
+
locator: Locator;
|
|
6
|
+
component: TComponent;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Создает асинхронный матчер для конкретного компонента
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @param matcherName - уникальное имя матчера
|
|
13
|
+
* @param getLocator - функция для получения локатора
|
|
14
|
+
* @param createMatcherLogicAsync - функция для создания логики матчера
|
|
15
|
+
* @param createExpectMessage - функция для создания сообщения для ожидания
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* Дженерик аргументы:
|
|
20
|
+
*
|
|
21
|
+
* createComponentAsyncMatcher<Component, TArgs>
|
|
22
|
+
* - Component - тип компонента
|
|
23
|
+
* - TArgs - массив аргументов матчера
|
|
24
|
+
*
|
|
25
|
+
* const toExampleEx = createComponentAsyncMatcher<Component, [AttributeOptions?]>(
|
|
26
|
+
* 'toExampleEx',
|
|
27
|
+
* component => component.rootLocator,
|
|
28
|
+
* async ({ isNot, locator, component }, options) => {
|
|
29
|
+
* await component.waitFor();
|
|
30
|
+
* const expectation = isNot ? baseExpect(locator).not : baseExpect(locator);
|
|
31
|
+
* await expectation.toBeEmpty();
|
|
32
|
+
* },
|
|
33
|
+
* isNot => (isNot ? 'not to be example' : 'to be example'),
|
|
34
|
+
* );
|
|
35
|
+
*/
|
|
36
|
+
export declare function createComponentAsyncMatcher<TComponent, TArgs extends unknown[]>(matcherName: string, getLocator: (component: TComponent) => LocatorType, createMatcherLogicAsync: (params: CreateMatcherLogicParams<TComponent>, ...args: TArgs) => Promise<void>, createExpectMessage?: (isNot: boolean, ...args: TArgs) => string): (this: ExpectMatcherState, component: TComponent, ...args: TArgs) => Promise<MatcherReturnType>;
|
|
37
|
+
/**
|
|
38
|
+
* Создает асинхронный типизированный матчер для компонента с символом локатора
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* @param matcherName - уникальное имя матчера
|
|
42
|
+
* @param getLocator - функция для получения локатора
|
|
43
|
+
* @param createMatcherLogicAsync - асинхронная функция для создания логики матчера
|
|
44
|
+
* @param createExpectMessage - функция для создания сообщения для ожидания
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* export type ToExampleExLocator = {
|
|
48
|
+
* [toExampleExLocator]: () => Locator;
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* export const toExampleExLocator = Symbol.for('toExampleExLocator');
|
|
52
|
+
*
|
|
53
|
+
* Дженерик аргументы:
|
|
54
|
+
*
|
|
55
|
+
* createAsyncMatcher<TLocatorSymbolInterface, TArgs, Component>
|
|
56
|
+
* - TLocatorSymbolInterface - тип с символом локатора
|
|
57
|
+
* - TArgs - массив аргументов матчера
|
|
58
|
+
* - TComponent - тип компонента
|
|
59
|
+
*
|
|
60
|
+
*
|
|
61
|
+
* const toExampleEx = createAsyncMatcher<ToExampleExLocator, [AttributeOptions?], Component>(
|
|
62
|
+
* 'toExampleEx',
|
|
63
|
+
* component => component[toExampleExLocator](),
|
|
64
|
+
* async ({ isNot, locator, component }, options) => {
|
|
65
|
+
* await component.waitFor();
|
|
66
|
+
* const expectation = isNot ? baseExpect(locator).not : baseExpect(locator);
|
|
67
|
+
* await expectation.toBeEmpty();
|
|
68
|
+
* },
|
|
69
|
+
* isNot => (isNot ? 'not to be example' : 'to be example'),
|
|
70
|
+
* );
|
|
71
|
+
*/
|
|
72
|
+
export declare function createAsyncMatcher<TLocatorSymbolInterface extends Record<symbol, LocatorTypeFn>, TArgs extends unknown[], TComponent = unknown>(matcherName: string, getLocator: (component: TComponent & TLocatorSymbolInterface) => LocatorType, createMatcherLogicAsync: (params: CreateMatcherLogicParams<TComponent>, ...args: TArgs) => Promise<void>, createExpectMessage?: (isNot: boolean, ...args: TArgs) => string): (this: ExpectMatcherState, component: TComponent & TLocatorSymbolInterface, ...args: TArgs) => Promise<MatcherReturnType>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
+
if (ar || !(i in from)) {
|
|
41
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
+
ar[i] = from[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.createComponentAsyncMatcher = createComponentAsyncMatcher;
|
|
49
|
+
exports.createAsyncMatcher = createAsyncMatcher;
|
|
50
|
+
var makeMatcher_1 = require("../utils/makeMatcher");
|
|
51
|
+
var toMatchMessage_1 = require("../utils/toMatchMessage");
|
|
52
|
+
/**
|
|
53
|
+
* Создает асинхронный матчер для конкретного компонента
|
|
54
|
+
*
|
|
55
|
+
*
|
|
56
|
+
* @param matcherName - уникальное имя матчера
|
|
57
|
+
* @param getLocator - функция для получения локатора
|
|
58
|
+
* @param createMatcherLogicAsync - функция для создания логики матчера
|
|
59
|
+
* @param createExpectMessage - функция для создания сообщения для ожидания
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
*
|
|
63
|
+
* Дженерик аргументы:
|
|
64
|
+
*
|
|
65
|
+
* createComponentAsyncMatcher<Component, TArgs>
|
|
66
|
+
* - Component - тип компонента
|
|
67
|
+
* - TArgs - массив аргументов матчера
|
|
68
|
+
*
|
|
69
|
+
* const toExampleEx = createComponentAsyncMatcher<Component, [AttributeOptions?]>(
|
|
70
|
+
* 'toExampleEx',
|
|
71
|
+
* component => component.rootLocator,
|
|
72
|
+
* async ({ isNot, locator, component }, options) => {
|
|
73
|
+
* await component.waitFor();
|
|
74
|
+
* const expectation = isNot ? baseExpect(locator).not : baseExpect(locator);
|
|
75
|
+
* await expectation.toBeEmpty();
|
|
76
|
+
* },
|
|
77
|
+
* isNot => (isNot ? 'not to be example' : 'to be example'),
|
|
78
|
+
* );
|
|
79
|
+
*/
|
|
80
|
+
function createComponentAsyncMatcher(matcherName, getLocator, createMatcherLogicAsync, createExpectMessage) {
|
|
81
|
+
return function matcher(component) {
|
|
82
|
+
var args = [];
|
|
83
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
84
|
+
args[_i - 1] = arguments[_i];
|
|
85
|
+
}
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
var _this = this;
|
|
89
|
+
return __generator(this, function (_c) {
|
|
90
|
+
switch (_c.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
_a = toMatchMessage_1.toMatchMessage;
|
|
93
|
+
_b = [this,
|
|
94
|
+
matcherName];
|
|
95
|
+
return [4 /*yield*/, getLocator(component)];
|
|
96
|
+
case 1: return [2 /*return*/, _a.apply(void 0, _b.concat([_c.sent(), function (isNot, locator) {
|
|
97
|
+
return (0, makeMatcher_1.makeMatcher)(isNot, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
98
|
+
return __generator(this, function (_a) {
|
|
99
|
+
switch (_a.label) {
|
|
100
|
+
case 0: return [4 /*yield*/, createMatcherLogicAsync.apply(void 0, __spreadArray([{ isNot: isNot, locator: locator, component: component }], args, false))];
|
|
101
|
+
case 1:
|
|
102
|
+
_a.sent();
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}); });
|
|
107
|
+
}, createExpectMessage === null || createExpectMessage === void 0 ? void 0 : createExpectMessage.apply(void 0, __spreadArray([this.isNot], args, false))]))];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Создает асинхронный типизированный матчер для компонента с символом локатора
|
|
115
|
+
*
|
|
116
|
+
*
|
|
117
|
+
* @param matcherName - уникальное имя матчера
|
|
118
|
+
* @param getLocator - функция для получения локатора
|
|
119
|
+
* @param createMatcherLogicAsync - асинхронная функция для создания логики матчера
|
|
120
|
+
* @param createExpectMessage - функция для создания сообщения для ожидания
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* export type ToExampleExLocator = {
|
|
124
|
+
* [toExampleExLocator]: () => Locator;
|
|
125
|
+
* }
|
|
126
|
+
*
|
|
127
|
+
* export const toExampleExLocator = Symbol.for('toExampleExLocator');
|
|
128
|
+
*
|
|
129
|
+
* Дженерик аргументы:
|
|
130
|
+
*
|
|
131
|
+
* createAsyncMatcher<TLocatorSymbolInterface, TArgs, Component>
|
|
132
|
+
* - TLocatorSymbolInterface - тип с символом локатора
|
|
133
|
+
* - TArgs - массив аргументов матчера
|
|
134
|
+
* - TComponent - тип компонента
|
|
135
|
+
*
|
|
136
|
+
*
|
|
137
|
+
* const toExampleEx = createAsyncMatcher<ToExampleExLocator, [AttributeOptions?], Component>(
|
|
138
|
+
* 'toExampleEx',
|
|
139
|
+
* component => component[toExampleExLocator](),
|
|
140
|
+
* async ({ isNot, locator, component }, options) => {
|
|
141
|
+
* await component.waitFor();
|
|
142
|
+
* const expectation = isNot ? baseExpect(locator).not : baseExpect(locator);
|
|
143
|
+
* await expectation.toBeEmpty();
|
|
144
|
+
* },
|
|
145
|
+
* isNot => (isNot ? 'not to be example' : 'to be example'),
|
|
146
|
+
* );
|
|
147
|
+
*/
|
|
148
|
+
function createAsyncMatcher(matcherName, getLocator, createMatcherLogicAsync, createExpectMessage) {
|
|
149
|
+
return function matcher(component) {
|
|
150
|
+
var args = [];
|
|
151
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
152
|
+
args[_i - 1] = arguments[_i];
|
|
153
|
+
}
|
|
154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
+
var _a, _b;
|
|
156
|
+
var _this = this;
|
|
157
|
+
return __generator(this, function (_c) {
|
|
158
|
+
switch (_c.label) {
|
|
159
|
+
case 0:
|
|
160
|
+
_a = toMatchMessage_1.toMatchMessage;
|
|
161
|
+
_b = [this,
|
|
162
|
+
matcherName];
|
|
163
|
+
return [4 /*yield*/, getLocator(component)];
|
|
164
|
+
case 1: return [2 /*return*/, _a.apply(void 0, _b.concat([_c.sent(), function (isNot, locator) {
|
|
165
|
+
return (0, makeMatcher_1.makeMatcher)(isNot, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
166
|
+
return __generator(this, function (_a) {
|
|
167
|
+
switch (_a.label) {
|
|
168
|
+
case 0: return [4 /*yield*/, createMatcherLogicAsync.apply(void 0, __spreadArray([{ isNot: isNot, locator: locator, component: component }], args, false))];
|
|
169
|
+
case 1:
|
|
170
|
+
_a.sent();
|
|
171
|
+
return [2 /*return*/];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}); });
|
|
175
|
+
}, createExpectMessage === null || createExpectMessage === void 0 ? void 0 : createExpectMessage.apply(void 0, __spreadArray([this.isNot], args, false))]))];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
}
|
|
@@ -1,37 +1,21 @@
|
|
|
1
|
-
import type { Locator, ExpectMatcherState } from '@playwright/test';
|
|
1
|
+
import type { Locator, ExpectMatcherState, MatcherReturnType } from '@playwright/test';
|
|
2
|
+
import type { TransformOptions } from '../options';
|
|
2
3
|
export type Transform = (value: string) => string;
|
|
4
|
+
declare const matchers: {
|
|
5
|
+
readonly toHaveFormattedValue: typeof toHaveFormattedValue;
|
|
6
|
+
readonly toHaveFormattedText: typeof toHaveFormattedText;
|
|
7
|
+
readonly toContainFormattedText: typeof toContainFormattedText;
|
|
8
|
+
};
|
|
9
|
+
export type FormattedMatchers = typeof matchers;
|
|
3
10
|
/**
|
|
4
11
|
* Набор проверок, которые игнорируют форматирование значения. По-умолчанию игнорируют пробелы.
|
|
5
12
|
*/
|
|
6
13
|
export declare const formattedMatchers: import("@playwright/test").Expect<{
|
|
7
|
-
toHaveFormattedValue
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}): Promise<{
|
|
11
|
-
message: () => string;
|
|
12
|
-
pass: boolean;
|
|
13
|
-
name: string;
|
|
14
|
-
expected: string;
|
|
15
|
-
actual: unknown;
|
|
16
|
-
}>;
|
|
17
|
-
toHaveFormattedText(this: ExpectMatcherState, locator: Locator, expected: string, options?: {
|
|
18
|
-
timeout?: number;
|
|
19
|
-
transform?: Transform;
|
|
20
|
-
}): Promise<{
|
|
21
|
-
message: () => string;
|
|
22
|
-
pass: boolean;
|
|
23
|
-
name: string;
|
|
24
|
-
expected: string;
|
|
25
|
-
actual: unknown;
|
|
26
|
-
}>;
|
|
27
|
-
toContainFormattedText(this: ExpectMatcherState, locator: Locator, expected: string, options?: {
|
|
28
|
-
timeout?: number;
|
|
29
|
-
transform?: Transform;
|
|
30
|
-
}): Promise<{
|
|
31
|
-
message: () => string;
|
|
32
|
-
pass: boolean;
|
|
33
|
-
name: string;
|
|
34
|
-
expected: string;
|
|
35
|
-
actual: unknown;
|
|
36
|
-
}>;
|
|
14
|
+
readonly toHaveFormattedValue: typeof toHaveFormattedValue;
|
|
15
|
+
readonly toHaveFormattedText: typeof toHaveFormattedText;
|
|
16
|
+
readonly toContainFormattedText: typeof toContainFormattedText;
|
|
37
17
|
}>;
|
|
18
|
+
declare function toHaveFormattedValue(this: ExpectMatcherState, locator: Locator, expected: string, options?: TransformOptions): Promise<MatcherReturnType>;
|
|
19
|
+
declare function toHaveFormattedText(this: ExpectMatcherState, locator: Locator, expected: string, options?: TransformOptions): Promise<MatcherReturnType>;
|
|
20
|
+
declare function toContainFormattedText(this: ExpectMatcherState, locator: Locator, expected: string, options?: TransformOptions): Promise<MatcherReturnType>;
|
|
21
|
+
export {};
|
|
@@ -39,21 +39,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.formattedMatchers = void 0;
|
|
40
40
|
var test_1 = require("@playwright/test");
|
|
41
41
|
var removeSpaces = function (value) { return value.replace(/\s/g, ''); };
|
|
42
|
+
var matchers = {
|
|
43
|
+
toHaveFormattedValue: toHaveFormattedValue,
|
|
44
|
+
toHaveFormattedText: toHaveFormattedText,
|
|
45
|
+
toContainFormattedText: toContainFormattedText,
|
|
46
|
+
};
|
|
42
47
|
/**
|
|
43
48
|
* Набор проверок, которые игнорируют форматирование значения. По-умолчанию игнорируют пробелы.
|
|
44
49
|
*/
|
|
45
|
-
exports.formattedMatchers = test_1.expect.extend(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function toHaveFormatted(getter, assertionName, context, strictExpect) {
|
|
50
|
+
exports.formattedMatchers = test_1.expect.extend(matchers);
|
|
51
|
+
function toHaveFormattedValue(locator, expected, options) {
|
|
52
|
+
return toHaveFormatted(this, 'toHaveFormattedValue', function (locator) { return locator.inputValue(); })(locator, expected, options);
|
|
53
|
+
}
|
|
54
|
+
function toHaveFormattedText(locator, expected, options) {
|
|
55
|
+
return toHaveFormatted(this, 'toHaveFormattedText', function (locator) { return locator.textContent(); })(locator, expected, options);
|
|
56
|
+
}
|
|
57
|
+
function toContainFormattedText(locator, expected, options) {
|
|
58
|
+
return toHaveFormatted(this, 'toContainFormattedText', function (locator) { return locator.textContent(); }, false)(locator, expected, options);
|
|
59
|
+
}
|
|
60
|
+
function toHaveFormatted(context, matcherName, getter, strictExpect) {
|
|
57
61
|
var _this = this;
|
|
58
62
|
if (strictExpect === void 0) { strictExpect = true; }
|
|
59
63
|
return function (locator, expected, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -99,14 +103,14 @@ function toHaveFormatted(getter, assertionName, context, strictExpect) {
|
|
|
99
103
|
case 7:
|
|
100
104
|
message = pass
|
|
101
105
|
? function () {
|
|
102
|
-
return context.utils.matcherHint(
|
|
106
|
+
return context.utils.matcherHint(matcherName, undefined, undefined, { isNot: context.isNot }) +
|
|
103
107
|
'\n\n' +
|
|
104
108
|
"Locator: ".concat(locator, "\n") +
|
|
105
109
|
"Expected: ".concat(context.isNot ? 'not' : '').concat(context.utils.printExpected(expected), "\n") +
|
|
106
110
|
(actual ? "Received: ".concat(context.utils.printReceived(actual)) : '');
|
|
107
111
|
}
|
|
108
112
|
: function () {
|
|
109
|
-
return context.utils.matcherHint(
|
|
113
|
+
return context.utils.matcherHint(matcherName, undefined, undefined, { isNot: context.isNot }) +
|
|
110
114
|
'\n\n' +
|
|
111
115
|
"Locator: ".concat(locator, "\n") +
|
|
112
116
|
"Expected: ".concat(context.utils.printExpected(expected), "\n") +
|
|
@@ -115,7 +119,7 @@ function toHaveFormatted(getter, assertionName, context, strictExpect) {
|
|
|
115
119
|
return [2 /*return*/, {
|
|
116
120
|
message: message,
|
|
117
121
|
pass: pass,
|
|
118
|
-
name:
|
|
122
|
+
name: matcherName,
|
|
119
123
|
expected: expected,
|
|
120
124
|
actual: actual,
|
|
121
125
|
}];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './formattedMatchers';
|
|
2
|
-
export
|
|
2
|
+
export * from './componentMatchers';
|
|
@@ -14,7 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.mergedExpects = void 0;
|
|
18
17
|
__exportStar(require("./formattedMatchers"), exports);
|
|
19
|
-
|
|
20
|
-
Object.defineProperty(exports, "mergedExpects", { enumerable: true, get: function () { return mergedExpects_1.mergedExpects; } });
|
|
18
|
+
__exportStar(require("./componentMatchers"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|