/** * The matchers made from a getter of WebdriverIO, as data: the factories of `getterMatcher.ts` make each * matcher from its descriptor. Only the descriptor of a matcher differs, so these matchers behave the same way. */ export type ElementStringGetterDescriptor = { /** The command of the element that gives the actual value */ getter: keyof WebdriverIO.Element; /** The value in the failure message, e.g. `text` in `Expect $(`sel`) to have text` */ expectation: string; /** The getter gets the options of the matcher, e.g. `getHTML({ includeSelectorTag: false })` */ getterGetsOptions?: true; /** * The argument of the getter: given in the call, before the expected value (`toHaveAttribute(name, value)`, and with no * value, the attribute exists), or fixed (`toHaveId` is `getAttribute('id')`) */ argument?: 'fromCall' | { fixed: string; }; /** The failure message names the argument, e.g. `id` in `Expect $(`sel`) to have attribute id` */ argumentInMessage?: true; /** * The value type, when it is not a string: * - `class`: the attribute has classes separated by ASCII whitespace, and the matcher compares each class; * - `property`: a string property is compared as a string, another value (a number, an object, an array) with * `equals()`, or as its text with the `asString` option. A property can be an object or an array, so a plain object * is a value, not per-instance values, and a list matcher on `$()` compares the property. */ value?: 'class' | 'property'; /** A `property` that is a string (`value`): a plain object is per-instance values, and a list matcher needs `$$()` */ expectsString?: true; /** * The text of a value that does not exist (`null`, or `undefined` for a property): it never matches, also not a matcher * that accepts no value, and the failure message shows this text, e.g. `Received: no attribute` */ missing?: string; }; export type BrowserStringGetterDescriptor = { /** The command of the browser or the browsing context that gives the actual value */ getter: keyof WebdriverIO.Browser & keyof WebdriverIO.BrowsingContext; /** The value in the failure message, e.g. `title` in `Expect browser's window to have title` */ expectation: string; /** `false`: the failure message does not show the URL of the browsing context, e.g. when the URL is the value */ showContextUrl?: false; /** The argument of the getter, given in the call before the expected value: `toHaveCookie(name, value)`; no value: it exists */ argument?: 'fromCall'; /** The failure message names the argument, e.g. `lang` in `Expect browser to have cookie lang` */ argumentInMessage?: true; /** * How the value is read, when it is not the result of the getter: * - `cookie`: the getter gives the cookies with the name of the argument, and the value is the one of the cookie; * - `localStorageItem`: `execute()` reads the item of `localStorage` with the name of the argument; * - `sessionStorageItem`: `execute()` reads the item of `sessionStorage` with the name of the argument; * - `clipboardText`: `execute()` reads the clipboard of the page, after the permission `clipboard-read` of the session. */ value?: 'cookie' | 'localStorageItem' | 'sessionStorageItem' | 'clipboardText'; /** The text of a value that does not exist, in the failure message, e.g. `Received: no cookie` */ missing?: string; /** `browser`: the message names the browser, not its window, e.g. `Expect browser to have cookie lang` */ target?: 'browser'; }; /** The string matchers of `$()`, `$$()` and multi-remote elements */ export declare const elementStringGetters: { readonly toHaveText: { readonly getter: 'getText'; readonly expectation: 'text'; }; readonly toHaveHTML: { readonly getter: 'getHTML'; readonly expectation: 'HTML'; readonly getterGetsOptions: true; }; readonly toHaveComputedLabel: { readonly getter: 'getComputedLabel'; readonly expectation: 'computed label'; }; readonly toHaveComputedRole: { readonly getter: 'getComputedRole'; readonly expectation: 'computed role'; }; readonly toHaveTagName: { readonly getter: 'getTagName'; readonly expectation: 'tag name'; }; readonly toHaveAttribute: { readonly getter: 'getAttribute'; readonly expectation: 'attribute'; readonly argument: 'fromCall'; readonly argumentInMessage: true; readonly missing: 'no attribute'; }; readonly toHaveId: { readonly getter: 'getAttribute'; readonly expectation: 'attribute'; readonly argument: { readonly fixed: 'id'; }; readonly argumentInMessage: true; readonly missing: 'no attribute'; }; readonly toHaveHref: { readonly getter: 'getAttribute'; readonly expectation: 'attribute'; readonly argument: { readonly fixed: 'href'; }; readonly argumentInMessage: true; readonly missing: 'no attribute'; }; readonly toHaveLink: { readonly getter: 'getAttribute'; readonly expectation: 'attribute'; readonly argument: { readonly fixed: 'href'; }; readonly argumentInMessage: true; readonly missing: 'no attribute'; }; readonly toHaveElementClass: { readonly getter: 'getAttribute'; readonly expectation: 'class'; readonly argument: { readonly fixed: 'class'; }; readonly value: 'class'; readonly missing: 'no attribute'; }; readonly toHaveElementProperty: { readonly getter: 'getProperty'; readonly expectation: 'property'; readonly argument: 'fromCall'; readonly argumentInMessage: true; readonly value: 'property'; readonly missing: 'no property'; }; readonly toHaveValue: { readonly getter: 'getProperty'; readonly expectation: 'property'; readonly argument: { readonly fixed: 'value'; }; readonly argumentInMessage: true; readonly value: 'property'; readonly expectsString: true; readonly missing: 'no property'; }; }; /** The string matchers of the browser, a browsing context and the multi-remote browser */ export declare const browserStringGetters: { readonly toHaveTitle: { readonly getter: 'getTitle'; readonly expectation: 'title'; }; readonly toHaveUrl: { readonly getter: 'getUrl'; readonly expectation: 'url'; readonly showContextUrl: false; }; readonly toHaveCookie: { readonly getter: 'getCookies'; readonly expectation: 'cookie'; readonly argument: 'fromCall'; readonly argumentInMessage: true; readonly value: 'cookie'; readonly missing: 'no cookie'; readonly target: 'browser'; }; readonly toHaveLocalStorageItem: { readonly getter: 'execute'; readonly expectation: 'localStorage item'; readonly argument: 'fromCall'; readonly argumentInMessage: true; readonly value: 'localStorageItem'; readonly missing: 'no item'; readonly target: 'browser'; }; readonly toHaveSessionStorageItem: { readonly getter: 'execute'; readonly expectation: 'sessionStorage item'; readonly argument: 'fromCall'; readonly argumentInMessage: true; readonly value: 'sessionStorageItem'; readonly missing: 'no item'; readonly target: 'browser'; }; readonly toHaveClipboardText: { readonly getter: 'execute'; readonly expectation: 'clipboard text'; readonly value: 'clipboardText'; readonly target: 'browser'; }; }; export type ElementBooleanGetterDescriptor = { /** The command of the element that gives the actual value */ getter: keyof WebdriverIO.Element; /** The state in the failure message, e.g. `displayed` in `Expect $(`sel`) to be displayed` */ expectation: string; /** The verb in the failure message, when it is not `be`, e.g. `Expect $(`sel`) to exist` */ verb?: string; /** The matcher checks the opposite of the getter, e.g. `toBeDisabled` with `isEnabled` */ inverse?: true; /** * The argument of the getter, e.g. `isDisplayed({ withinViewport: true })`, or the name of a boolean property, * e.g. `getProperty('required')`: only `true` passes, also not `null` on an element that has no such property */ getterArgument?: object | string; /** The getter gets the display options of the matcher and their defaults, the command options get the rest */ displayOptions?: true; /** An empty `$$()` passes with `.not`: no element means it does not exist */ allowEmptyElements?: true; /** Another name of a matcher: its state and verb replace the ones of the context */ aliasOf?: string; }; /** The boolean matchers of `$()`, `$$()` and multi-remote elements */ export declare const elementBooleanGetters: { readonly toBeDisplayed: { readonly getter: 'isDisplayed'; readonly expectation: 'displayed'; readonly displayOptions: true; }; readonly toBeDisplayedInViewport: { readonly getter: 'isDisplayed'; readonly expectation: 'displayed in viewport'; readonly getterArgument: { readonly withinViewport: true; }; }; readonly toBeClickable: { readonly getter: 'isClickable'; readonly expectation: 'clickable'; }; readonly toBeEnabled: { readonly getter: 'isEnabled'; readonly expectation: 'enabled'; }; readonly toBeDisabled: { readonly getter: 'isEnabled'; readonly expectation: 'disabled'; readonly inverse: true; }; readonly toBeFocused: { readonly getter: 'isFocused'; readonly expectation: 'focused'; }; readonly toBeSelected: { readonly getter: 'isSelected'; readonly expectation: 'selected'; }; readonly toBeChecked: { readonly getter: 'isSelected'; readonly expectation: 'checked'; readonly aliasOf: 'toBeSelected'; }; readonly toBeStable: { readonly getter: 'isStable'; readonly expectation: 'stable'; }; readonly toBeRequired: { readonly getter: 'getProperty'; readonly expectation: 'required'; readonly getterArgument: 'required'; }; readonly toBeReadOnly: { readonly getter: 'getProperty'; readonly expectation: 'read only'; readonly getterArgument: 'readOnly'; }; readonly toExist: { readonly getter: 'isExisting'; readonly expectation: 'exist'; readonly verb: ''; readonly allowEmptyElements: true; }; readonly toBeExisting: { readonly getter: 'isExisting'; readonly expectation: 'existing'; readonly verb: 'be'; readonly allowEmptyElements: true; readonly aliasOf: 'toExist'; }; readonly toBePresent: { readonly getter: 'isExisting'; readonly expectation: 'present'; readonly verb: 'be'; readonly allowEmptyElements: true; readonly aliasOf: 'toExist'; }; }; export type ElementNumberGetterDescriptor = { /** The command of the element that gives the actual value */ getter: keyof WebdriverIO.Element; /** The value in the failure message, e.g. `width` in `Expect $(`sel`) to have width` */ expectation: string; /** A fixed argument of the getter, e.g. `toHaveWidth` is `getSize('width')` */ argument?: { fixed: string; }; /** A size: an object with a number value type in each field (`width`, `height`), compared with deep equality */ value?: 'size'; }; /** The number matchers of `$()`, `$$()` and multi-remote elements, made from a getter */ export declare const elementNumberGetters: { readonly toHaveWidth: { readonly getter: 'getSize'; readonly expectation: 'width'; readonly argument: { readonly fixed: 'width'; }; }; readonly toHaveHeight: { readonly getter: 'getSize'; readonly expectation: 'height'; readonly argument: { readonly fixed: 'height'; }; }; readonly toHaveSize: { readonly getter: 'getSize'; readonly expectation: 'size'; readonly value: 'size'; }; };