expect-webdriverio 6.1.0 → 8.0.0-alpha.0
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/README.md +22 -7
- package/jasmine-wdio-expect-async.d.ts +1 -1
- package/jest.d.ts +4 -2
- package/lib/api/index.js +2 -0
- package/lib/constants.js +0 -6
- package/lib/index.js +3 -13
- package/lib/jasmineUtils.js +2 -2
- package/lib/matchers/asymmetrics/asymmetricsUtils.js +10 -0
- package/lib/matchers/asymmetrics/multiRemote.js +36 -0
- package/lib/matchers/asymmetrics/oneOf.js +2 -2
- package/lib/matchers/browser/toHaveClipboardText.js +24 -10
- package/lib/matchers/browser/toHaveLocalStorageItem.js +23 -22
- package/lib/matchers/browser/toHaveTitle.js +16 -6
- package/lib/matchers/browser/toHaveUrl.js +16 -6
- package/lib/matchers/element/toBeClickable.js +3 -2
- package/lib/matchers/element/toBeDisabled.js +3 -2
- package/lib/matchers/element/toBeDisplayed.js +3 -2
- package/lib/matchers/element/toBeDisplayedInViewport.js +3 -2
- package/lib/matchers/element/toBeEnabled.js +3 -2
- package/lib/matchers/element/toBeExisting.js +5 -2
- package/lib/matchers/element/toBeFocused.js +3 -2
- package/lib/matchers/element/toBeSelected.js +4 -4
- package/lib/matchers/element/toHaveAttribute.js +4 -16
- package/lib/matchers/element/toHaveChildren.js +9 -14
- package/lib/matchers/element/toHaveComputedLabel.js +4 -6
- package/lib/matchers/element/toHaveComputedRole.js +4 -6
- package/lib/matchers/element/toHaveElementClass.js +5 -10
- package/lib/matchers/element/toHaveElementProperty.js +4 -9
- package/lib/matchers/element/toHaveHTML.js +6 -8
- package/lib/matchers/element/toHaveHeight.js +6 -7
- package/lib/matchers/element/toHaveHref.js +6 -3
- package/lib/matchers/element/toHaveId.js +3 -2
- package/lib/matchers/element/toHaveSize.js +3 -4
- package/lib/matchers/element/toHaveStyle.js +3 -4
- package/lib/matchers/element/toHaveText.js +5 -8
- package/lib/matchers/element/toHaveValue.js +1 -1
- package/lib/matchers/element/toHaveWidth.js +6 -7
- package/lib/matchers/elements/toBeElementsArrayOfSize.js +71 -6
- package/lib/matchers/mock/toBeRequested.js +1 -1
- package/lib/matchers/mock/toBeRequestedTimes.js +30 -7
- package/lib/matchers/mock/toBeRequestedWith.js +40 -15
- package/lib/matchers/snapshot.js +38 -7
- package/lib/matchers.js +32 -32
- package/lib/snapshot.js +1 -8
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/util/elementsUtil.js +35 -6
- package/lib/util/executeBrowserCommand.js +37 -0
- package/lib/util/executeCommand.js +101 -52
- package/lib/util/formatMessage.js +81 -7
- package/lib/util/multiRemoteUtils.js +93 -0
- package/lib/util/numberOptionsUtil.js +19 -24
- package/lib/util/refetchElements.js +24 -2
- package/lib/utils.js +16 -111
- package/package.json +37 -40
- package/types/expect-global.d.ts +1 -2
- package/types/expect-webdriverio.d.ts +386 -232
|
@@ -21,7 +21,7 @@ type ExpectLibAsyncExpectationResult = import('expect').AsyncExpectationResult
|
|
|
21
21
|
type ExpectLibExpectationResult = import('expect').ExpectationResult
|
|
22
22
|
type ExpectLibMatcherContext = import('expect').MatcherContext
|
|
23
23
|
type MatchersObject = Parameters<typeof import('expect').expect.extend>[0]
|
|
24
|
-
type ExpectLibAnything = ReturnType<typeof expect.any> | ReturnType<typeof expect.anything>
|
|
24
|
+
type ExpectLibAnything = ReturnType<typeof import('expect').expect.any> | ReturnType<typeof import('expect').expect.anything>
|
|
25
25
|
type WdioGetHTMLOptions = NonNullable<Parameters<WebdriverIO.Element['getHTML']>[0]>
|
|
26
26
|
|
|
27
27
|
// Extracted from the expect library, this is the type of the matcher function used in the expect library.
|
|
@@ -54,6 +54,17 @@ type MaybeArrayOrOneOf<T> = T | (T | ExpectWebdriverIO.OneOfPartialMatcher<Exclu
|
|
|
54
54
|
*/
|
|
55
55
|
type MaybeOneOf<T> = T | ExpectWebdriverIO.OneOfPartialMatcher<Exclude<T, ExpectWebdriverIO.PartialMatcherAnything>>
|
|
56
56
|
|
|
57
|
+
type MultiRemoteValues<T> = Record<string, T>
|
|
58
|
+
type MultiRemoteValuesOrOneOf<T> = T | ExpectWebdriverIO.OneOfPartialMatcher<T> | MultiRemoteValues<T | ExpectWebdriverIO.OneOfPartialMatcher<T>> | ExpectWebdriverIO.MultiRemotePartialMatcher<T | ExpectWebdriverIO.OneOfPartialMatcher<T>>
|
|
59
|
+
type MaybeArrayOrMultiRemoteValues<T> = MaybeArray<T> | MultiRemoteValues<T>
|
|
60
|
+
type MaybeArrayOrMultiRemoteValuesOrOneOf<T> = MaybeArray<T | ExpectWebdriverIO.OneOfPartialMatcher<T>> | MultiRemoteValues<T | ExpectWebdriverIO.OneOfPartialMatcher<T>> | ExpectWebdriverIO.OneOfPartialMatcher<T>
|
|
61
|
+
type MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<T> = MaybeArray<T | ExpectWebdriverIO.OneOfPartialMatcher<T>> | MultiRemoteValues<MaybeArray<T | ExpectWebdriverIO.OneOfPartialMatcher<T>>> | ExpectWebdriverIO.OneOfPartialMatcher<T> | ExpectWebdriverIO.MultiRemotePartialMatcher<MaybeArray<T | ExpectWebdriverIO.OneOfPartialMatcher<T>>>
|
|
62
|
+
type ArrayOrMultiRemoteValues<T> = T[] | MultiRemoteValues<T>
|
|
63
|
+
/** Multi-remote $(): one expected value for every instance, or one per instance with `expect.multiRemote()` (e.g. numbers, styles) */
|
|
64
|
+
type SingleOrMultiRemoteMatcher<T> = T | ExpectWebdriverIO.MultiRemotePartialMatcher<T>
|
|
65
|
+
/** Multi-remote $$(): one expected value (or one per element) for every instance, or the same per instance with `expect.multiRemote()` (e.g. numbers, styles) */
|
|
66
|
+
type MaybeArrayOrMultiRemoteMatcher<T> = MaybeArray<T> | ExpectWebdriverIO.MultiRemotePartialMatcher<MaybeArray<T>>
|
|
67
|
+
|
|
57
68
|
/**
|
|
58
69
|
* Real Promise and wdio chainable promise types.
|
|
59
70
|
*/
|
|
@@ -73,14 +84,18 @@ type ArrayOfElementsPromise = Promise<WebdriverIO.Element[]>
|
|
|
73
84
|
*/
|
|
74
85
|
type ElementOrMaybeSomeArrayLike = ElementLike | MaybeSomeElementArrayLike
|
|
75
86
|
type ElementLike = WebdriverIO.Element | ChainablePromiseElement
|
|
76
|
-
type ElementArrayLike = WebdriverIO.ElementArray | ChainablePromiseArray | WebdriverIO.Element[] | ArrayOfElementsPromise | ElementArrayPromise
|
|
77
|
-
type MaybeSomeElementArrayLike = MaybeSome<WebdriverIO.ElementArray | ChainablePromiseArray | WebdriverIO.Element[] | ArrayOfElementsPromise | ElementArrayPromise>
|
|
87
|
+
type ElementArrayLike = WebdriverIO.ElementArray | ChainablePromiseArray | WebdriverIO.Element[] | ArrayOfElementsPromise | ElementArrayPromise | WebdriverIO.MultiRemoteElement[]
|
|
88
|
+
type MaybeSomeElementArrayLike = MaybeSome<WebdriverIO.ElementArray | ChainablePromiseArray | WebdriverIO.Element[] | ArrayOfElementsPromise | ElementArrayPromise | WebdriverIO.MultiRemoteElement[]>
|
|
89
|
+
type MultiRemoteElementOrElements = WebdriverIO.MultiRemoteElement | WebdriverIO.MultiRemoteElement[]
|
|
78
90
|
type MockPromise = Promise<WebdriverIO.Mock>
|
|
91
|
+
/** Multi-remote `mock()`, one mock per instance: every instance's mock must satisfy the network matcher */
|
|
92
|
+
type MultiRemoteMocks = WebdriverIO.Mock[] | Promise<WebdriverIO.Mock[]>
|
|
79
93
|
|
|
80
94
|
/**
|
|
81
95
|
* Type helpers allowing to use the function when the expect(actual: T) is of the expected type T.
|
|
82
96
|
*/
|
|
83
97
|
type FnWhenBrowser<ActualT, Fn> = ActualT extends WebdriverIO.Browser ? Fn : never
|
|
98
|
+
type FnWhenBrowserOrMultiRemote<ActualT, FnBrowser, FnMultiRemote> = ActualT extends WebdriverIO.Browser ? FnBrowser : ActualT extends WebdriverIO.MultiRemoteBrowser ? FnMultiRemote : never
|
|
84
99
|
/**
|
|
85
100
|
* Enables distinct function signatures for single elements versus arrays of elements.
|
|
86
101
|
*
|
|
@@ -89,58 +104,134 @@ type FnWhenBrowser<ActualT, Fn> = ActualT extends WebdriverIO.Browser ? Fn : nev
|
|
|
89
104
|
*
|
|
90
105
|
* Fix: If type inference issues arise, split the implementation into separate interfaces
|
|
91
106
|
*/
|
|
92
|
-
type FnWhenElementOrArrayLike<ActualT, FnElement, FnArray = FnElement> = ActualT extends MaybeSomeElementArrayLike ? FnArray : ActualT extends ElementLike ? FnElement: never
|
|
93
|
-
type FnWhenElementArrayLike<ActualT, Fn> = ActualT extends MaybeSomeElementArrayLike ? Fn : never
|
|
107
|
+
type FnWhenElementOrArrayLike<ActualT, FnElement, FnArray = FnElement, FnMultiRemoteElement = FnElement, FnMultiRemoteElements = FnArray> = ActualT extends WebdriverIO.MultiRemoteElement[] ? FnMultiRemoteElements : ActualT extends WebdriverIO.MultiRemoteElement ? FnMultiRemoteElement : ActualT extends MaybeSomeElementArrayLike ? FnArray : ActualT extends ElementLike ? FnElement : never
|
|
108
|
+
type FnWhenElementArrayLike<ActualT, Fn, FnMultiRemoteElements = Fn> = ActualT extends WebdriverIO.MultiRemoteElement[] ? FnMultiRemoteElements : ActualT extends MaybeSomeElementArrayLike ? Fn : never
|
|
94
109
|
|
|
95
110
|
/**
|
|
96
111
|
* Same as the other but because of Jasmine and it's expectAsync typing which does not force T to be a promise, then we need to account for `WebdriverIO.Mock
|
|
97
112
|
*/
|
|
98
|
-
type FnWhenMock<ActualT, Fn> = ActualT extends MockPromise | WebdriverIO.Mock ? Fn : never
|
|
113
|
+
type FnWhenMock<ActualT, Fn> = ActualT extends MockPromise | WebdriverIO.Mock | MultiRemoteMocks ? Fn : never
|
|
99
114
|
|
|
100
115
|
interface WdioCustomAsymmetricMatchers {
|
|
101
116
|
oneOf(...values: Array<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | null>): ExpectWebdriverIO.OneOfPartialMatcher<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | null>
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* One expected value per multi-remote instance, keyed by instance name. Every instance must be listed.
|
|
120
|
+
* Required for per-instance values of number matchers (`toHaveWidth`, `toHaveHeight`, `toHaveChildren`, `toBeElementsArrayOfSize`)
|
|
121
|
+
* and of matchers whose expected value is itself an object (`toHaveStyle`, `toHaveSize`, `toHaveElementProperty`),
|
|
122
|
+
* and the explicit form of the plain object shorthand for the other matchers.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* await expect(multiRemoteBrowser).toHaveTitle(expect.multiRemote({ chrome: 'Title', firefox: 'Titre' }))
|
|
126
|
+
* await expect(multiRemoteBrowser.$('h1')).toHaveStyle(expect.multiRemote({ chrome: { color: 'red' }, firefox: { color: 'blue' } }))
|
|
127
|
+
*/
|
|
128
|
+
multiRemote<T>(values: MultiRemoteValues<T>): ExpectWebdriverIO.MultiRemotePartialMatcher<T>
|
|
102
129
|
}
|
|
103
130
|
|
|
104
131
|
/**
|
|
105
|
-
* Matchers dedicated to Wdio Browser.
|
|
132
|
+
* Matchers dedicated to Wdio Browser or multi-remote Browser.
|
|
106
133
|
* When asserting on a browser's properties requiring to be awaited, the return type is a Promise.
|
|
107
134
|
* When actual is not a browser, the return type is never, so the function cannot be used.
|
|
108
135
|
*/
|
|
109
136
|
interface WdioBrowserMatchers<_R, ActualT>{
|
|
110
137
|
/**
|
|
111
|
-
*
|
|
138
|
+
* Browser`s url
|
|
112
139
|
*/
|
|
113
|
-
toHaveUrl:
|
|
140
|
+
toHaveUrl: FnWhenBrowserOrMultiRemote<ActualT,
|
|
141
|
+
/**
|
|
142
|
+
* `WebdriverIO.Browser` -> `getUrl`
|
|
143
|
+
*/
|
|
144
|
+
(
|
|
145
|
+
url: string | RegExp | ExpectWebdriverIO.PartialMatcher<string>,
|
|
146
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
147
|
+
) => Promise<void>,
|
|
114
148
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
149
|
+
/**
|
|
150
|
+
* `WebdriverIO.MultiRemoteBrowser` -> `getUrl`
|
|
151
|
+
*/
|
|
152
|
+
(
|
|
153
|
+
url: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
154
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
155
|
+
) => Promise<void>
|
|
156
|
+
>
|
|
119
157
|
|
|
120
158
|
/**
|
|
121
|
-
*
|
|
159
|
+
* Browser`s title
|
|
122
160
|
*/
|
|
123
|
-
|
|
161
|
+
toHaveTitle: FnWhenBrowserOrMultiRemote<ActualT,
|
|
162
|
+
/**
|
|
163
|
+
* `WebdriverIO.Browser` -> `getTitle`
|
|
164
|
+
*/
|
|
165
|
+
(
|
|
166
|
+
title: string | RegExp | ExpectWebdriverIO.PartialMatcher<string>,
|
|
167
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
168
|
+
) => Promise<void>,
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* `WebdriverIO.MultiRemoteBrowser` -> `getTitle`
|
|
172
|
+
*/
|
|
173
|
+
(
|
|
174
|
+
title: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
175
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
176
|
+
) => Promise<void>
|
|
177
|
+
>
|
|
124
178
|
|
|
125
179
|
/**
|
|
126
180
|
* `WebdriverIO.Browser` -> `execute`
|
|
127
181
|
*/
|
|
128
|
-
|
|
182
|
+
toHaveClipboardText: FnWhenBrowserOrMultiRemote<ActualT,
|
|
129
183
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
184
|
+
* `WebdriverIO.Browser` -> `getClipboard`
|
|
185
|
+
*/
|
|
132
186
|
(
|
|
133
|
-
|
|
134
|
-
expectedValue: undefined,
|
|
187
|
+
clipboardText: MaybeOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
135
188
|
options?: ExpectWebdriverIO.StringOptions
|
|
136
|
-
)
|
|
189
|
+
) => Promise<void>,
|
|
137
190
|
|
|
191
|
+
/**
|
|
192
|
+
* `WebdriverIO.MultiRemoteBrowser` -> `getClipboard`
|
|
193
|
+
*/
|
|
138
194
|
(
|
|
139
|
-
|
|
140
|
-
expectedValue?: string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything,
|
|
195
|
+
clipboardText: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything>,
|
|
141
196
|
options?: ExpectWebdriverIO.StringOptions
|
|
142
|
-
)
|
|
143
|
-
|
|
197
|
+
) => Promise<void>
|
|
198
|
+
>
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* `WebdriverIO.Browser` -> `execute`
|
|
202
|
+
*/
|
|
203
|
+
toHaveLocalStorageItem: FnWhenBrowserOrMultiRemote<ActualT,
|
|
204
|
+
/**
|
|
205
|
+
* `WebdriverIO.Browser` -> `getLocalStorageItem`
|
|
206
|
+
*/
|
|
207
|
+
{
|
|
208
|
+
/**
|
|
209
|
+
* Only check that the item exists.
|
|
210
|
+
* Use `toHaveLocalStorageItem(key, expect.anything(), options)` to check it with options.
|
|
211
|
+
*/
|
|
212
|
+
(key: string): Promise<void>
|
|
213
|
+
(
|
|
214
|
+
key: string,
|
|
215
|
+
expectedValue: MaybeOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything>,
|
|
216
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
217
|
+
): Promise<void>
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* `WebdriverIO.MultiRemoteBrowser` -> `getLocalStorageItem`
|
|
222
|
+
*/
|
|
223
|
+
{
|
|
224
|
+
/**
|
|
225
|
+
* Only check that the item exists.
|
|
226
|
+
* Use `toHaveLocalStorageItem(key, expect.anything(), options)` to check it with options.
|
|
227
|
+
*/
|
|
228
|
+
(key: string): Promise<void>
|
|
229
|
+
(
|
|
230
|
+
key: string,
|
|
231
|
+
expectedValue: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything>,
|
|
232
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
233
|
+
): Promise<void>
|
|
234
|
+
}
|
|
144
235
|
>
|
|
145
236
|
}
|
|
146
237
|
|
|
@@ -151,42 +242,35 @@ interface WdioBrowserMatchers<_R, ActualT>{
|
|
|
151
242
|
*/
|
|
152
243
|
interface WdioNetworkMatchers<_R, ActualT> {
|
|
153
244
|
/**
|
|
154
|
-
* Check that `WebdriverIO.Mock` was called
|
|
245
|
+
* Check that `WebdriverIO.Mock` was called.
|
|
246
|
+
* With multi-remote mocks (`multiRemoteBrowser.mock()`), every instance's mock must be called.
|
|
155
247
|
*/
|
|
156
248
|
toBeRequested: FnWhenMock<ActualT, (options?: ExpectWebdriverIO.CommandOptions) => Promise<void>>
|
|
157
249
|
|
|
158
250
|
/**
|
|
159
|
-
* Check that `WebdriverIO.Mock` was called N times
|
|
251
|
+
* Check that `WebdriverIO.Mock` was called N times.
|
|
252
|
+
* With multi-remote mocks (`multiRemoteBrowser.mock()`), every instance's mock must be called N times.
|
|
160
253
|
*/
|
|
161
|
-
toBeRequestedTimes: FnWhenMock<ActualT,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
): Promise<void>
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* @deprecated since v6.0.0, remove in v8.0.0. Use `NumberMatcher` & `CommandOptions` separately `toBeRequestedTimes(NumberMatcher, options)`.
|
|
169
|
-
*/
|
|
170
|
-
(
|
|
171
|
-
times: ExpectWebdriverIO.NumberOptions,
|
|
172
|
-
options?: ExpectWebdriverIO.CommandOptions
|
|
173
|
-
): Promise<void>;
|
|
174
|
-
|
|
175
|
-
}>
|
|
254
|
+
toBeRequestedTimes: FnWhenMock<ActualT, (
|
|
255
|
+
times: number | ExpectWebdriverIO.NumberMatcher,
|
|
256
|
+
options?: ExpectWebdriverIO.CommandOptions
|
|
257
|
+
) => Promise<void>>
|
|
176
258
|
|
|
177
259
|
/**
|
|
178
|
-
* Check that `WebdriverIO.Mock` was called with the specific parameters
|
|
260
|
+
* Check that `WebdriverIO.Mock` was called with the specific parameters.
|
|
261
|
+
* With multi-remote mocks (`multiRemoteBrowser.mock()`), every instance's mock must have such a call.
|
|
179
262
|
*/
|
|
180
263
|
toBeRequestedWith: FnWhenMock<ActualT, (requestedWith: ExpectWebdriverIO.RequestedWith, options?: ExpectWebdriverIO.CommandOptions) => Promise<void>>
|
|
181
264
|
}
|
|
182
265
|
|
|
183
266
|
/**
|
|
184
|
-
* Matchers dedicated to WebdriverIO Element or ElementArray (or chainable)
|
|
267
|
+
* Matchers dedicated to WebdriverIO Element or ElementArray (or chainable) on Browser
|
|
268
|
+
* For Multi-Remote Browser, MultiRemoteElement or MultiRemoteElement[]
|
|
185
269
|
* When asserting on an element or element array's properties requiring to be awaited, the return type is a Promise.
|
|
186
270
|
* When actual is neither of WebdriverIO.Element, WebdriverIO.ElementArray, ChainableElement, ChainableElementArray, the return type is never, so the function cannot be used.
|
|
187
271
|
*/
|
|
188
272
|
interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
189
|
-
// ===== $ or $$ =====
|
|
273
|
+
// ===== $ or $$ with Browser or Multi-Remote Browser=====
|
|
190
274
|
/**
|
|
191
275
|
* `WebdriverIO.Element` -> `isDisplayed`
|
|
192
276
|
*/
|
|
@@ -244,16 +328,7 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
244
328
|
|
|
245
329
|
toHaveAttribute: FnWhenElementOrArrayLike<ActualT, {
|
|
246
330
|
/** Element $() API */
|
|
247
|
-
/**
|
|
248
|
-
* @deprecated since v6.0.0, remove in v8.0.0. Passing explicit `undefined` as a value is deprecated. Omit the second argument entirely or pass options instead: `toHaveAttribute(attribute, options)`.
|
|
249
|
-
*/
|
|
250
|
-
(
|
|
251
|
-
attribute: string,
|
|
252
|
-
value: undefined,
|
|
253
|
-
options?: ExpectWebdriverIO.StringOptions
|
|
254
|
-
): Promise<void>;
|
|
255
|
-
|
|
256
|
-
/** Check ONLY for the presence of the attribute (and optional configuration options) */
|
|
331
|
+
/** Check ONLY for the presence of the attribute. For options, use `toHaveAttribute(attribute, expect.anything(), options)` */
|
|
257
332
|
(
|
|
258
333
|
attribute: string,
|
|
259
334
|
): Promise<void>;
|
|
@@ -266,16 +341,7 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
266
341
|
): Promise<void>;
|
|
267
342
|
}, {
|
|
268
343
|
/** Elements $$() API */
|
|
269
|
-
/**
|
|
270
|
-
* @deprecated Not supported
|
|
271
|
-
*/
|
|
272
|
-
(
|
|
273
|
-
attribute: string,
|
|
274
|
-
value: undefined,
|
|
275
|
-
options?: ExpectWebdriverIO.StringOptions
|
|
276
|
-
): Promise<void>;
|
|
277
|
-
|
|
278
|
-
/** Check ONLY for the presence of the attribute (and optional configuration options) */
|
|
344
|
+
/** Check ONLY for the presence of the attribute. For options, use `toHaveAttribute(attribute, expect.anything(), options)` */
|
|
279
345
|
(
|
|
280
346
|
attribute: string,
|
|
281
347
|
): Promise<void>;
|
|
@@ -286,28 +352,29 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
286
352
|
value: MaybeArrayOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything>,
|
|
287
353
|
options?: ExpectWebdriverIO.StringOptions
|
|
288
354
|
): Promise<void>;
|
|
355
|
+
}, {
|
|
356
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
357
|
+
(
|
|
358
|
+
attribute: string
|
|
359
|
+
): Promise<void>
|
|
360
|
+
(
|
|
361
|
+
attribute: string,
|
|
362
|
+
value: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything>,
|
|
363
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
364
|
+
): Promise<void>
|
|
365
|
+
}, {
|
|
366
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
367
|
+
(
|
|
368
|
+
attribute: string
|
|
369
|
+
): Promise<void>
|
|
370
|
+
(
|
|
371
|
+
attribute: string,
|
|
372
|
+
value: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything>,
|
|
373
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
374
|
+
): Promise<void>
|
|
289
375
|
}
|
|
290
376
|
>
|
|
291
377
|
|
|
292
|
-
/**
|
|
293
|
-
* @deprecated since v6.0.0, removed in v8.0.0. Use `toHaveAttribute` instead.
|
|
294
|
-
* `WebdriverIO.Element` -> `getAttribute`
|
|
295
|
-
*/
|
|
296
|
-
toHaveAttr: FnWhenElementOrArrayLike<ActualT, (
|
|
297
|
-
attribute: string,
|
|
298
|
-
value?: string | RegExp | ExpectWebdriverIO.PartialMatcher<string>,
|
|
299
|
-
options?: ExpectWebdriverIO.StringOptions
|
|
300
|
-
) => Promise<void>>
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* `WebdriverIO.Element` -> `getAttribute` class
|
|
304
|
-
* @deprecated since v1.3.1 - use `toHaveElementClass` instead.
|
|
305
|
-
*/
|
|
306
|
-
toHaveClass: FnWhenElementOrArrayLike<ActualT, (
|
|
307
|
-
className: string | RegExp | ExpectWebdriverIO.PartialMatcher<string>,
|
|
308
|
-
options?: ExpectWebdriverIO.StringOptions
|
|
309
|
-
) => Promise<void>>
|
|
310
|
-
|
|
311
378
|
/**
|
|
312
379
|
* `WebdriverIO.Element` -> `getAttribute` class
|
|
313
380
|
*
|
|
@@ -330,7 +397,7 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
330
397
|
className: string | RegExp | ExpectWebdriverIO.PartialMatcher<string>,
|
|
331
398
|
options?: ExpectWebdriverIO.StringOptions
|
|
332
399
|
) :Promise<void>
|
|
333
|
-
/** @deprecated
|
|
400
|
+
/** @deprecated an array means "has any of these classes", to review in https://github.com/webdriverio/expect-webdriverio/issues/2266 (`expect.oneOf()` compares the full class attribute) */
|
|
334
401
|
(
|
|
335
402
|
className: Array<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
336
403
|
options?: ExpectWebdriverIO.StringOptions
|
|
@@ -341,6 +408,18 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
341
408
|
className: MaybeArray<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
342
409
|
options?: ExpectWebdriverIO.StringOptions
|
|
343
410
|
) :Promise<void>
|
|
411
|
+
}, {
|
|
412
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
413
|
+
(
|
|
414
|
+
className: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
415
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
416
|
+
): Promise<void>
|
|
417
|
+
}, {
|
|
418
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
419
|
+
(
|
|
420
|
+
className: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
421
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
422
|
+
): Promise<void>
|
|
344
423
|
}>
|
|
345
424
|
|
|
346
425
|
toHaveElementProperty: FnWhenElementOrArrayLike<ActualT, {
|
|
@@ -353,16 +432,6 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
353
432
|
property: string,
|
|
354
433
|
): Promise<void>;
|
|
355
434
|
|
|
356
|
-
/**
|
|
357
|
-
* @deprecated since v6.0.0, removed in v8.0.0. Passing explicit `undefined` or `null` as a value is deprecated.
|
|
358
|
-
* Omit the second argument entirely or use expect.anything() with options: `toHaveElementProperty(property, expect.anything(), options)`.
|
|
359
|
-
*/
|
|
360
|
-
(
|
|
361
|
-
property: string,
|
|
362
|
-
value: undefined | null, // Use expect.any(type) or expect.anything() instead of undefined or null
|
|
363
|
-
options?: ExpectWebdriverIO.StringOptions
|
|
364
|
-
): Promise<void>;
|
|
365
|
-
|
|
366
435
|
/** Assert both property name AND a specific expected value */
|
|
367
436
|
(
|
|
368
437
|
property: string,
|
|
@@ -380,31 +449,43 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
380
449
|
property: string,
|
|
381
450
|
): Promise<void>;
|
|
382
451
|
|
|
383
|
-
/**
|
|
384
|
-
* @deprecated Not supported
|
|
385
|
-
* Use `expect.anything()` or `[expect.anything()] as value` to check for the presence of the property with options.
|
|
386
|
-
*/
|
|
452
|
+
/** Assert both property name AND a specific expected value */
|
|
387
453
|
(
|
|
388
454
|
property: string,
|
|
389
|
-
|
|
455
|
+
value: Exclude<MaybeArrayOrOneOf<string | number | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything | null>, null>,
|
|
390
456
|
options?: ExpectWebdriverIO.StringOptions
|
|
391
|
-
): Promise<
|
|
392
|
-
|
|
393
|
-
/**
|
|
457
|
+
): Promise<void>;
|
|
458
|
+
}, {
|
|
459
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
460
|
+
(
|
|
461
|
+
property: string
|
|
462
|
+
): Promise<void>
|
|
394
463
|
(
|
|
395
464
|
property: string,
|
|
396
|
-
value:
|
|
465
|
+
value: SingleOrMultiRemoteMatcher<MaybeOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything> | number>,
|
|
397
466
|
options?: ExpectWebdriverIO.StringOptions
|
|
398
|
-
): Promise<void
|
|
467
|
+
): Promise<void>
|
|
468
|
+
}, {
|
|
469
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
470
|
+
(
|
|
471
|
+
property: string
|
|
472
|
+
): Promise<void>
|
|
473
|
+
(
|
|
474
|
+
property: string,
|
|
475
|
+
value: Exclude<MaybeArrayOrOneOf<string | number | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything | null>, null> | ExpectWebdriverIO.MultiRemotePartialMatcher<MaybeArrayOrOneOf<string | number | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.PartialMatcherAnything | null>>,
|
|
476
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
477
|
+
): Promise<void>
|
|
399
478
|
}>
|
|
400
479
|
|
|
401
480
|
/**
|
|
402
481
|
* `WebdriverIO.Element` -> `getProperty` value
|
|
403
482
|
*/
|
|
404
483
|
toHaveValue: FnWhenElementOrArrayLike<ActualT,
|
|
484
|
+
/**
|
|
485
|
+
* Element(s) API
|
|
486
|
+
*/
|
|
405
487
|
/** Element $() API */
|
|
406
488
|
(
|
|
407
|
-
|
|
408
489
|
value: MaybeOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
409
490
|
options?: ExpectWebdriverIO.StringOptions
|
|
410
491
|
) => Promise<void>,
|
|
@@ -414,6 +495,22 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
414
495
|
|
|
415
496
|
value: MaybeArrayOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
416
497
|
options?: ExpectWebdriverIO.StringOptions
|
|
498
|
+
) => Promise<void>,
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Multi-Remote Elements API
|
|
502
|
+
*/
|
|
503
|
+
/** $() API */
|
|
504
|
+
(
|
|
505
|
+
value: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
506
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
507
|
+
) => Promise<void>,
|
|
508
|
+
|
|
509
|
+
/** $$() API */
|
|
510
|
+
(
|
|
511
|
+
|
|
512
|
+
value: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
513
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
417
514
|
) => Promise<void>
|
|
418
515
|
>
|
|
419
516
|
|
|
@@ -428,15 +525,6 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
428
525
|
* Same as `expect(el).toHaveChildren({ gte: 1 })` or `expect(el).toHaveChildren({ gte: 1 }, options)`.
|
|
429
526
|
*/
|
|
430
527
|
(): Promise<void>;
|
|
431
|
-
/**
|
|
432
|
-
* @deprecated since 6.0.0, remove in v8.0.0.
|
|
433
|
-
* Passing explicit `undefined` or `{ wait : 1 }` (NumberOptions) as a value is deprecated.
|
|
434
|
-
* Use options with `toHaveChildren({ gte: 1 }, options)`.
|
|
435
|
-
*/
|
|
436
|
-
(
|
|
437
|
-
expectedValue: undefined, // {} also deprecated but we cannot use it as a type because it would match any object
|
|
438
|
-
options?: ExpectWebdriverIO.CommandOptions
|
|
439
|
-
): Promise<void>;
|
|
440
528
|
|
|
441
529
|
/**
|
|
442
530
|
* When called with an expected child count or number matcher.
|
|
@@ -445,16 +533,6 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
445
533
|
expectedValue: number | ExpectWebdriverIO.NumberMatcher,
|
|
446
534
|
options?: ExpectWebdriverIO.CommandOptions
|
|
447
535
|
): Promise<void>;
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* @deprecated since 6.0.0, remove in v8.0.0.
|
|
451
|
-
* NumberOptions is no longer supported. Use `expect(el).toHaveChildren(numberMatcher, options)` instead.
|
|
452
|
-
* Instead of `expect(el).toHaveChildren({ wait: 1 })` use `expect(el).toHaveChildren({ gte: 1 }, { wait: 1 })`.
|
|
453
|
-
*/
|
|
454
|
-
(
|
|
455
|
-
expectedValue: ExpectWebdriverIO.NumberOptions,
|
|
456
|
-
options?: ExpectWebdriverIO.CommandOptions
|
|
457
|
-
): Promise<void>;
|
|
458
536
|
}, {
|
|
459
537
|
/** Element $$() API */
|
|
460
538
|
/**
|
|
@@ -463,16 +541,6 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
463
541
|
*/
|
|
464
542
|
(): Promise<void>;
|
|
465
543
|
|
|
466
|
-
/**
|
|
467
|
-
* @deprecated Not supported
|
|
468
|
-
* NumberOptions is no longer supported. Use `expect(el).toHaveChildren(numberMatcher, options)` instead.
|
|
469
|
-
* Instead of `expect(el).toHaveChildren({ wait: 1 })` use `expect(el).toHaveChildren({ gte: 1 }, { wait: 1 })`.
|
|
470
|
-
*/
|
|
471
|
-
(
|
|
472
|
-
expectedValue: undefined,
|
|
473
|
-
options?: ExpectWebdriverIO.CommandOptions
|
|
474
|
-
): Promise<void>;
|
|
475
|
-
|
|
476
544
|
/**
|
|
477
545
|
* When called with an expected child count or number matcher.
|
|
478
546
|
*/
|
|
@@ -480,6 +548,20 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
480
548
|
expectedValue: MaybeArray<number | ExpectWebdriverIO.NumberMatcher>,
|
|
481
549
|
options?: ExpectWebdriverIO.CommandOptions
|
|
482
550
|
): Promise<void>;
|
|
551
|
+
}, {
|
|
552
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
553
|
+
(): Promise<void>
|
|
554
|
+
(
|
|
555
|
+
expectedValue: SingleOrMultiRemoteMatcher<number | ExpectWebdriverIO.NumberMatcher>,
|
|
556
|
+
options?: ExpectWebdriverIO.CommandOptions
|
|
557
|
+
): Promise<void>
|
|
558
|
+
}, {
|
|
559
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
560
|
+
(): Promise<void>
|
|
561
|
+
(
|
|
562
|
+
expectedValue: MaybeArrayOrMultiRemoteMatcher<number | ExpectWebdriverIO.NumberMatcher>,
|
|
563
|
+
options?: ExpectWebdriverIO.CommandOptions
|
|
564
|
+
): Promise<void>
|
|
483
565
|
}>
|
|
484
566
|
|
|
485
567
|
/**
|
|
@@ -497,6 +579,18 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
497
579
|
href: MaybeArrayOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
498
580
|
options?: ExpectWebdriverIO.StringOptions
|
|
499
581
|
) : Promise<void>
|
|
582
|
+
}, {
|
|
583
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
584
|
+
(
|
|
585
|
+
href: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
586
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
587
|
+
): Promise<void>
|
|
588
|
+
}, {
|
|
589
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
590
|
+
(
|
|
591
|
+
href: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
592
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
593
|
+
): Promise<void>
|
|
500
594
|
}>
|
|
501
595
|
|
|
502
596
|
/**
|
|
@@ -514,6 +608,18 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
514
608
|
href: MaybeArrayOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
515
609
|
options?: ExpectWebdriverIO.StringOptions
|
|
516
610
|
) : Promise<void>
|
|
611
|
+
}, {
|
|
612
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
613
|
+
(
|
|
614
|
+
href: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
615
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
616
|
+
): Promise<void>
|
|
617
|
+
}, {
|
|
618
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
619
|
+
(
|
|
620
|
+
href: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
621
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
622
|
+
): Promise<void>
|
|
517
623
|
}>
|
|
518
624
|
|
|
519
625
|
/**
|
|
@@ -530,6 +636,18 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
530
636
|
(
|
|
531
637
|
id: MaybeArrayOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
532
638
|
options?: ExpectWebdriverIO.StringOptions
|
|
639
|
+
) => Promise<void>,
|
|
640
|
+
|
|
641
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
642
|
+
(
|
|
643
|
+
id: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
644
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
645
|
+
) => Promise<void>,
|
|
646
|
+
|
|
647
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
648
|
+
(
|
|
649
|
+
id: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
650
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
533
651
|
) => Promise<void>
|
|
534
652
|
>
|
|
535
653
|
|
|
@@ -554,23 +672,31 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
554
672
|
* ```
|
|
555
673
|
*/
|
|
556
674
|
toHaveText: FnWhenElementOrArrayLike<ActualT, {
|
|
557
|
-
/** Element
|
|
675
|
+
/** Element browser.$() API */
|
|
558
676
|
(
|
|
559
677
|
text: MaybeOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
560
678
|
options?: ExpectWebdriverIO.StringOptions
|
|
561
679
|
) : Promise<void>
|
|
562
|
-
|
|
680
|
+
}, {
|
|
681
|
+
/** Elements browser.$$() API */
|
|
563
682
|
(
|
|
564
|
-
text:
|
|
683
|
+
text: MaybeArrayOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
565
684
|
options?: ExpectWebdriverIO.StringOptions
|
|
566
685
|
) : Promise<void>
|
|
567
686
|
}, {
|
|
568
|
-
/**
|
|
687
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
569
688
|
(
|
|
570
|
-
text:
|
|
689
|
+
text: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
571
690
|
options?: ExpectWebdriverIO.StringOptions
|
|
572
691
|
) : Promise<void>
|
|
573
|
-
}
|
|
692
|
+
}, {
|
|
693
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
694
|
+
(
|
|
695
|
+
text: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
696
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
697
|
+
) : Promise<void>
|
|
698
|
+
}
|
|
699
|
+
>
|
|
574
700
|
|
|
575
701
|
/**
|
|
576
702
|
* `WebdriverIO.Element` -> `getHTML`
|
|
@@ -582,17 +708,24 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
582
708
|
text: MaybeOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
583
709
|
options?: ExpectWebdriverIO.HTMLOptions
|
|
584
710
|
) : Promise<void>
|
|
585
|
-
/** @deprecated to replace by oneOf() or anyOf() when available */
|
|
586
|
-
(
|
|
587
|
-
text: Array<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
588
|
-
options?: ExpectWebdriverIO.HTMLOptions
|
|
589
|
-
) : Promise<void>
|
|
590
711
|
}, {
|
|
591
712
|
/** Elements $$() API */
|
|
592
713
|
(
|
|
593
714
|
text: MaybeArrayOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string> | ExpectWebdriverIO.OneOfPartialMatcher<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>>,
|
|
594
715
|
options?: ExpectWebdriverIO.HTMLOptions
|
|
595
716
|
): Promise<void>
|
|
717
|
+
}, {
|
|
718
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
719
|
+
(
|
|
720
|
+
text: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
721
|
+
options?: ExpectWebdriverIO.HTMLOptions
|
|
722
|
+
): Promise<void>
|
|
723
|
+
}, {
|
|
724
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
725
|
+
(
|
|
726
|
+
text: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
727
|
+
options?: ExpectWebdriverIO.HTMLOptions
|
|
728
|
+
): Promise<void>
|
|
596
729
|
}>
|
|
597
730
|
|
|
598
731
|
/**
|
|
@@ -605,18 +738,24 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
605
738
|
computedLabel: MaybeOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
606
739
|
options?: ExpectWebdriverIO.StringOptions
|
|
607
740
|
) : Promise<void>
|
|
608
|
-
|
|
609
|
-
/** @deprecated use `expect.oneOf()` instead of an array */
|
|
610
|
-
(
|
|
611
|
-
computedLabel: Array<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
612
|
-
options?: ExpectWebdriverIO.StringOptions
|
|
613
|
-
) : Promise<void>
|
|
614
741
|
}, {
|
|
615
742
|
/** Elements $$() API */
|
|
616
743
|
(
|
|
617
744
|
computedLabel: MaybeArrayOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
618
745
|
options?: ExpectWebdriverIO.StringOptions
|
|
619
746
|
) : Promise<void>
|
|
747
|
+
}, {
|
|
748
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
749
|
+
(
|
|
750
|
+
computedLabel: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
751
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
752
|
+
): Promise<void>
|
|
753
|
+
}, {
|
|
754
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
755
|
+
(
|
|
756
|
+
computedLabel: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
757
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
758
|
+
): Promise<void>
|
|
620
759
|
}>
|
|
621
760
|
|
|
622
761
|
/**
|
|
@@ -629,18 +768,24 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
629
768
|
computedRole: MaybeOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
630
769
|
options?: ExpectWebdriverIO.StringOptions
|
|
631
770
|
) : Promise<void>
|
|
632
|
-
|
|
633
|
-
/** @deprecated use `expect.oneOf()` instead of an array */
|
|
634
|
-
(
|
|
635
|
-
computedRole: Array<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
636
|
-
options?: ExpectWebdriverIO.StringOptions
|
|
637
|
-
) : Promise<void>
|
|
638
771
|
}, {
|
|
639
772
|
/** Elements $$() API */
|
|
640
773
|
(
|
|
641
774
|
computedRole: MaybeArrayOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
642
775
|
options?: ExpectWebdriverIO.StringOptions
|
|
643
776
|
) : Promise<void>
|
|
777
|
+
}, {
|
|
778
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
779
|
+
(
|
|
780
|
+
computedRole: MultiRemoteValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
781
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
782
|
+
): Promise<void>
|
|
783
|
+
}, {
|
|
784
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
785
|
+
(
|
|
786
|
+
computedRole: MaybeArrayOrMultiRemoteWithArrayValuesOrOneOf<string | RegExp | ExpectWebdriverIO.PartialMatcher<string>>,
|
|
787
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
788
|
+
): Promise<void>
|
|
644
789
|
}>
|
|
645
790
|
|
|
646
791
|
/**
|
|
@@ -652,21 +797,25 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
652
797
|
(
|
|
653
798
|
width: number | ExpectWebdriverIO.NumberMatcher,
|
|
654
799
|
options?: ExpectWebdriverIO.CommandOptions
|
|
655
|
-
) : Promise<void
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* @deprecated since v6.0.0, remove in v8.0.0. Use `toHaveWidth` with number | NumberMatcher instead. This matcher will be removed in version 8.0.0.
|
|
659
|
-
*/
|
|
660
|
-
(
|
|
661
|
-
size: ExpectWebdriverIO.NumberOptions,
|
|
662
|
-
options?: ExpectWebdriverIO.CommandOptions
|
|
663
|
-
): Promise<void>,
|
|
800
|
+
) : Promise<void>
|
|
664
801
|
}, {
|
|
665
802
|
/** Elements $$() API */
|
|
666
803
|
(
|
|
667
804
|
width: MaybeArray<number | ExpectWebdriverIO.NumberMatcher>,
|
|
668
805
|
options?: ExpectWebdriverIO.CommandOptions
|
|
669
806
|
) : Promise<void>
|
|
807
|
+
}, {
|
|
808
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
809
|
+
(
|
|
810
|
+
width: SingleOrMultiRemoteMatcher<number | ExpectWebdriverIO.NumberMatcher>,
|
|
811
|
+
options?: ExpectWebdriverIO.CommandOptions
|
|
812
|
+
): Promise<void>
|
|
813
|
+
}, {
|
|
814
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
815
|
+
(
|
|
816
|
+
width: MaybeArrayOrMultiRemoteMatcher<number | ExpectWebdriverIO.NumberMatcher>,
|
|
817
|
+
options?: ExpectWebdriverIO.CommandOptions
|
|
818
|
+
): Promise<void>
|
|
670
819
|
}>
|
|
671
820
|
|
|
672
821
|
/**
|
|
@@ -687,20 +836,24 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
687
836
|
height: number | ExpectWebdriverIO.NumberMatcher,
|
|
688
837
|
options?: ExpectWebdriverIO.CommandOptions
|
|
689
838
|
) : Promise<void>
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* @deprecated since v6.0.0, will be removed in version v8.0.0. Use `toHaveHeight` with number | NumberMatcher instead.
|
|
693
|
-
*/
|
|
694
|
-
(
|
|
695
|
-
size: ExpectWebdriverIO.NumberOptions,
|
|
696
|
-
options?: ExpectWebdriverIO.CommandOptions
|
|
697
|
-
): Promise<void>,
|
|
698
839
|
}, {
|
|
699
840
|
/** Elements $$() API */
|
|
700
841
|
(
|
|
701
842
|
height: MaybeArray<number | ExpectWebdriverIO.NumberMatcher>,
|
|
702
843
|
options?: ExpectWebdriverIO.CommandOptions
|
|
703
844
|
) : Promise<void>
|
|
845
|
+
}, {
|
|
846
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
847
|
+
(
|
|
848
|
+
height: SingleOrMultiRemoteMatcher<number | ExpectWebdriverIO.NumberMatcher>,
|
|
849
|
+
options?: ExpectWebdriverIO.CommandOptions
|
|
850
|
+
): Promise<void>
|
|
851
|
+
}, {
|
|
852
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
853
|
+
(
|
|
854
|
+
height: MaybeArrayOrMultiRemoteMatcher<number | ExpectWebdriverIO.NumberMatcher>,
|
|
855
|
+
options?: ExpectWebdriverIO.CommandOptions
|
|
856
|
+
): Promise<void>
|
|
704
857
|
}>
|
|
705
858
|
|
|
706
859
|
/**
|
|
@@ -720,6 +873,18 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
720
873
|
size: MaybeArray<{ height: number; width: number }>,
|
|
721
874
|
options?: ExpectWebdriverIO.CommandOptions
|
|
722
875
|
) : Promise<void>
|
|
876
|
+
}, {
|
|
877
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
878
|
+
(
|
|
879
|
+
size: SingleOrMultiRemoteMatcher<{ height: number; width: number }>,
|
|
880
|
+
options?: ExpectWebdriverIO.CommandOptions
|
|
881
|
+
): Promise<void>
|
|
882
|
+
}, {
|
|
883
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
884
|
+
(
|
|
885
|
+
size: MaybeArrayOrMultiRemoteMatcher<{ height: number; width: number }>,
|
|
886
|
+
options?: ExpectWebdriverIO.CommandOptions
|
|
887
|
+
): Promise<void>
|
|
723
888
|
}>
|
|
724
889
|
|
|
725
890
|
/**
|
|
@@ -737,6 +902,18 @@ interface WdioElementOrArrayMatchers<_R, ActualT = unknown> {
|
|
|
737
902
|
style: MaybeArray<{ [key: string]: string }>,
|
|
738
903
|
options?: ExpectWebdriverIO.StringOptions
|
|
739
904
|
) : Promise<void>
|
|
905
|
+
}, {
|
|
906
|
+
/** Element MultiRemoteBrowser.$() API */
|
|
907
|
+
(
|
|
908
|
+
style: SingleOrMultiRemoteMatcher<{ [key: string]: string }>,
|
|
909
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
910
|
+
): Promise<void>
|
|
911
|
+
}, {
|
|
912
|
+
/** Elements MultiRemoteBrowser.$$() API */
|
|
913
|
+
(
|
|
914
|
+
style: MaybeArrayOrMultiRemoteMatcher<{ [key: string]: string }>,
|
|
915
|
+
options?: ExpectWebdriverIO.StringOptions
|
|
916
|
+
): Promise<void>
|
|
740
917
|
}>
|
|
741
918
|
}
|
|
742
919
|
|
|
@@ -757,12 +934,13 @@ interface WdioElementArrayOnlyMatchers<_R, ActualT = unknown> {
|
|
|
757
934
|
size: number | ExpectWebdriverIO.NumberMatcher,
|
|
758
935
|
options?: ExpectWebdriverIO.CommandOptions
|
|
759
936
|
): Promise<void>,
|
|
760
|
-
|
|
937
|
+
}, {
|
|
761
938
|
/**
|
|
762
|
-
*
|
|
939
|
+
* Elements MultiRemoteBrowser.$$() API: the size is checked per browser instance.
|
|
940
|
+
* A single size applies to every instance, or pass one size per instance, e.g. `expect.multiRemote({ chrome: 2, firefox: { gte: 1 } })`.
|
|
763
941
|
*/
|
|
764
942
|
(
|
|
765
|
-
size: ExpectWebdriverIO.
|
|
943
|
+
size: SingleOrMultiRemoteMatcher<number | ExpectWebdriverIO.NumberMatcher>,
|
|
766
944
|
options?: ExpectWebdriverIO.CommandOptions
|
|
767
945
|
): Promise<void>,
|
|
768
946
|
}>
|
|
@@ -779,15 +957,17 @@ interface WdioElementArrayOnlyMatchers<_R, ActualT = unknown> {
|
|
|
779
957
|
interface WdioJestOverloadedMatchers<R, ActualT> {
|
|
780
958
|
/**
|
|
781
959
|
* snapshot matcher
|
|
960
|
+
* A plain `Element[]` or `MultiRemoteElement[]` is only recognized from its elements, so an empty one is snapshotted synchronously
|
|
782
961
|
* @param label optional snapshot label
|
|
783
962
|
*/
|
|
784
|
-
toMatchSnapshot(label?: string): ActualT extends WdioElementOrPromiseLike ? Promise<void> : R
|
|
963
|
+
toMatchSnapshot(label?: string): ActualT extends WdioElementOrPromiseLike | WebdriverIO.MultiRemoteElement | WebdriverIO.ElementArray ? Promise<void> : ActualT extends WebdriverIO.Element[] | WebdriverIO.MultiRemoteElement[] ? Promise<void> | R : R
|
|
785
964
|
/**
|
|
786
965
|
* inline snapshot matcher
|
|
966
|
+
* A plain `Element[]` or `MultiRemoteElement[]` is only recognized from its elements, so an empty one is snapshotted synchronously
|
|
787
967
|
* @param snapshot snapshot string (autogenerated if not specified)
|
|
788
968
|
* @param label optional snapshot label
|
|
789
969
|
*/
|
|
790
|
-
toMatchInlineSnapshot(snapshot?: string, label?: string): ActualT extends WdioElementOrPromiseLike ? Promise<void> : R
|
|
970
|
+
toMatchInlineSnapshot(snapshot?: string, label?: string): ActualT extends WdioElementOrPromiseLike | WebdriverIO.MultiRemoteElement | WebdriverIO.ElementArray ? Promise<void> : ActualT extends WebdriverIO.Element[] | WebdriverIO.MultiRemoteElement[] ? Promise<void> | R : R
|
|
791
971
|
}
|
|
792
972
|
|
|
793
973
|
/**
|
|
@@ -900,21 +1080,22 @@ declare namespace ExpectWebdriverIO {
|
|
|
900
1080
|
* Used by the webdriverio main project to configure the matchers in the runner.
|
|
901
1081
|
*/
|
|
902
1082
|
function setDefaultOptions(options: DefaultOptions): void
|
|
903
|
-
/** @deprecated since v6.0.0, use setDefaultOptions instead, will be removed in v8.0.0 */
|
|
904
|
-
function setOptions(options: DefaultOptions): void
|
|
905
1083
|
|
|
906
1084
|
/**
|
|
907
|
-
*
|
|
908
|
-
* @param flags
|
|
1085
|
+
* Get the default options set by the user.
|
|
909
1086
|
*/
|
|
910
|
-
function
|
|
1087
|
+
function getDefaultOptions(): DefaultOptions
|
|
911
1088
|
|
|
912
1089
|
/**
|
|
913
|
-
*
|
|
1090
|
+
* The this context available inside each matcher function.
|
|
914
1091
|
*/
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
1092
|
+
interface MatcherContext /* extends ExpectLibMatcherContext */ {
|
|
1093
|
+
verb?: string
|
|
1094
|
+
expectation?: string
|
|
1095
|
+
isNot?: boolean
|
|
1096
|
+
isMultiRemote?: boolean
|
|
1097
|
+
matcherName?: keyof Matchers<void, unknown>
|
|
1098
|
+
}
|
|
918
1099
|
|
|
919
1100
|
/**
|
|
920
1101
|
* The below block are overloaded types from the expect library.
|
|
@@ -954,7 +1135,7 @@ declare namespace ExpectWebdriverIO {
|
|
|
954
1135
|
|
|
955
1136
|
interface AsymmetricMatchers extends WdioAsymmetricMatchers, WdioCustomAsymmetricMatchers {}
|
|
956
1137
|
|
|
957
|
-
interface InverseAsymmetricMatchers extends Omit<ExpectWebdriverIO.AsymmetricMatchers, 'anything' | 'any' | 'oneOf'> {}
|
|
1138
|
+
interface InverseAsymmetricMatchers extends Omit<ExpectWebdriverIO.AsymmetricMatchers, 'anything' | 'any' | 'oneOf' | 'multiRemote'> {}
|
|
958
1139
|
|
|
959
1140
|
/**
|
|
960
1141
|
* End of block overloading types from the expect library.
|
|
@@ -1032,11 +1213,6 @@ declare namespace ExpectWebdriverIO {
|
|
|
1032
1213
|
*/
|
|
1033
1214
|
const wdioCustomMatchers: MatchersObject
|
|
1034
1215
|
|
|
1035
|
-
/**
|
|
1036
|
-
* @deprecated since 5.6.9 use `wdioCustomMatchers` instead, will be removed in v8.0.0?
|
|
1037
|
-
*/
|
|
1038
|
-
const matchers: Map<string, RawMatcherFn>
|
|
1039
|
-
|
|
1040
1216
|
interface AssertionHookParams {
|
|
1041
1217
|
/**
|
|
1042
1218
|
* name of the matcher, e.g. `toHaveText` or `toBeClickable`
|
|
@@ -1057,25 +1233,15 @@ declare namespace ExpectWebdriverIO {
|
|
|
1057
1233
|
/**
|
|
1058
1234
|
* Options that the user has passed in, e.g. `expect(el).toHaveText('foo', { ignoreCase: true })` -> `{ ignoreCase: true }`
|
|
1059
1235
|
*/
|
|
1060
|
-
options: CommandOptions | HTMLOptions | StringOptions
|
|
1236
|
+
options: CommandOptions | HTMLOptions | StringOptions
|
|
1061
1237
|
}
|
|
1062
1238
|
interface AfterAssertionHookParams extends AssertionHookParams {
|
|
1063
1239
|
result: AssertionResult
|
|
1064
1240
|
}
|
|
1065
1241
|
|
|
1066
|
-
interface FeatureFlags {
|
|
1067
|
-
/**
|
|
1068
|
-
* Feature flag to enable the new multi-elements comparison for `toHaveText` matcher, allowing to keep the current behavior without breaking changes.
|
|
1069
|
-
* When enabled, the matcher will compare the text of multiple elements in an indexed exact match manner, rather than using the array as a possible match for any of the elements.
|
|
1070
|
-
*
|
|
1071
|
-
* Will be removed in v6.0.0, as the new behavior will become the default and only behavior for `toHaveText` matcher.
|
|
1072
|
-
*/
|
|
1073
|
-
useToHaveTextStrictMultiElementsCompareStrategy?: boolean
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
1242
|
interface DefaultOptions {
|
|
1077
1243
|
/**
|
|
1078
|
-
* time in ms to wait for expectation to succeed. Default:
|
|
1244
|
+
* time in ms to wait for expectation to succeed. Default: 2000
|
|
1079
1245
|
*/
|
|
1080
1246
|
wait?: number
|
|
1081
1247
|
|
|
@@ -1093,8 +1259,6 @@ declare namespace ExpectWebdriverIO {
|
|
|
1093
1259
|
* hook that gets executed after each assertion, it contains the result of the assertion
|
|
1094
1260
|
*/
|
|
1095
1261
|
afterAssertion?: (params: AfterAssertionHookParams) => Promise<void>
|
|
1096
|
-
|
|
1097
|
-
featureFlags?: FeatureFlags
|
|
1098
1262
|
}
|
|
1099
1263
|
|
|
1100
1264
|
interface CommandOptions extends DefaultOptions {
|
|
@@ -1153,29 +1317,6 @@ declare namespace ExpectWebdriverIO {
|
|
|
1153
1317
|
asString?: boolean
|
|
1154
1318
|
}
|
|
1155
1319
|
|
|
1156
|
-
/**
|
|
1157
|
-
* @deprecated since v6.0.0, remove in v8.0.0. Use `NumberMatcher` & `CommandOptions` as separate parameters instead.
|
|
1158
|
-
* @see NumberMatcher
|
|
1159
|
-
* @see CommandOptions
|
|
1160
|
-
*/
|
|
1161
|
-
interface NumberOptions extends CommandOptions {
|
|
1162
|
-
|
|
1163
|
-
/**
|
|
1164
|
-
* equals
|
|
1165
|
-
*/
|
|
1166
|
-
eq?: number
|
|
1167
|
-
|
|
1168
|
-
/**
|
|
1169
|
-
* less than or equals
|
|
1170
|
-
*/
|
|
1171
|
-
lte?: number
|
|
1172
|
-
|
|
1173
|
-
/**
|
|
1174
|
-
* greater than or equals
|
|
1175
|
-
*/
|
|
1176
|
-
gte?: number
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
1320
|
interface ToBeDisplayedOptions extends CommandOptions {
|
|
1180
1321
|
/**
|
|
1181
1322
|
* `true` to check if the element is within the viewport. false by default.
|
|
@@ -1269,6 +1410,11 @@ declare namespace ExpectWebdriverIO {
|
|
|
1269
1410
|
* Allow to match one of the specified value.
|
|
1270
1411
|
*/
|
|
1271
1412
|
type OneOfPartialMatcher<T> = ExpectWebdriverIO.PartialMatcher<T[]>
|
|
1413
|
+
|
|
1414
|
+
/**
|
|
1415
|
+
* One expected value per multi-remote instance, see `expect.multiRemote()`.
|
|
1416
|
+
*/
|
|
1417
|
+
type MultiRemotePartialMatcher<T> = ExpectWebdriverIO.PartialMatcher<MultiRemoteValues<T>>
|
|
1272
1418
|
}
|
|
1273
1419
|
|
|
1274
1420
|
declare module 'expect-webdriverio' {
|
|
@@ -1292,4 +1438,12 @@ declare module 'expect-webdriverio/api' {
|
|
|
1292
1438
|
export function some<T extends ElementArrayLike>(
|
|
1293
1439
|
elements: T
|
|
1294
1440
|
): WdioSome<T>
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* One expected value per multi-remote instance, keyed by instance name. Same as `expect.multiRemote()`.
|
|
1444
|
+
*
|
|
1445
|
+
* @example
|
|
1446
|
+
* await expect(multiRemoteBrowser.$('h1')).toHaveStyle(multiRemote({ chrome: { color: 'red' }, firefox: { color: 'blue' } }))
|
|
1447
|
+
*/
|
|
1448
|
+
export function multiRemote<T>(values: MultiRemoteValues<T>): ExpectWebdriverIO.MultiRemotePartialMatcher<T>
|
|
1295
1449
|
}
|