Skip to content

Commit 0689878

Browse files
dprevost-LMIchristian-bromannplum117
authored
Enhanced expect wdio typing (#1863)
* Working case with only matchers * Block toHaveUrl on element * Working overloaded snapshot in jest * A good working case with standalone + add back snapshot * A good working version of standalone * Code review + add a toBe with element + chainable ToBe seems fine to not return a promise since I did not find example of forcing to be promises when using element or chainable Code review * Bring back `snapshot.test.ts` * Bring back toBeRequestedWith * Bring back `toBeRequestedWith` * Pretty solid typing for both Jest & mocha (standalone) * Bring back soft assertion + add tsc + code review - Brought back soft assertion with good typing coverage for Jest and mocha (standalone) - Add tsc new script since it was missing - Skip pre-existing tsc error in request network matchers that I'm not sure of * Code review * Code review + add linter in types * Add decent not finished typing for Jasmine + soft assertion * ish working with jasmine expect and matcher + fix unimplemented method - Have some working base line with Jasmine expect and even asyncExpect - Fix expect.unimplemented method not in TS error because of `extends Record<string, any>` on matcher * Use `ExpectWebdriverIO` where we can to be more verbose * Separate Browser, mock and element matcher + better typing * fix rebase + add more UT typing cases * Review test template to be better * Add a working case of custom matchers with types! * Remove this file * Fix rebase * Copy better type testing to mocha + clean package.json - Copied the newer test file from Jest to mocha - Add customMarcher type into Mocha - Need to fix AsymmetricMatcher not working - Review script and have tsc using `--noEmit` instead of using cleaning scripts * Working asymmetric matcher * Apply suggestions from code review * Update types/expect-webdriverio.d.ts * Remove unneeded changes * Use built-in PromiseLike * Have snapshot use await only on promises * More reusable types * Validated that asymmetric matchers previously not included works * ignore not needed anymore! * Fix some missing options pararmter + dig matchers and still not sure! * Moving types into expect-webdriverio.d.ts and remove standalone.d.ts * Move new mocha test to jest, review + simplify jest.d.ts * Simplify further jest.d.ts * Finalize simplification of Jest namespace * Test `ExpectWebdriverIO` for custom matcher when using Jest! * Remove unused code! * Have better tsc check on types but filtering out node_module errors * Brin back tsc on types + exclude file in coverage and review % - To be able to tsc check the lib types, we had to filter out the errors coming from the node_modules with a custom scripts - Adding the script lower the % so we have exclude it from vitest with more files and review the coverage - Fix raise problem in .d.ts - Combine the `toHaveHeight` signature since with the new FN/never pattern we cannot use function overloading! * fix and add UT for custom asymmetric matchers * Review overloaded functions from `expect` lib * Make inverse matcher works under the ExpectWebDriverIO namespace! Add doc around custom matcher support * Make inverse asymmetric matcher works under Jest * Upgrade the ts config to more recent values * Working types under jasmine * Add Jasmine case + force the global expect also for Jasmine * Review jasmine usage in the project * Add support for both `@jest/global` and `@types/jest` + add doc - Have a separate type check for `@jest/global` and `@types/jest` - Add back `jasmine.d.ts` for global `expect` - Add doc on supported configuration and their particularity * Review defined types in package.json * Review doc and fix some type issues * Doc review * Test and document Jasmine typing * Fix impact of supporting Jasmine typing * Use latest Jest with exportable Inverse * Fix Jasmine left over problem * Review some TODOs * Simplify Jasmine augmentation * Add jest types check to the ts command * Review doc by the AI * Review dead link with AI * Add details with Chai * Remove out of scope TODOs * Add back promise matchers! * Review more TODOs * Add finding on augmentation of `@jest/globals` * Update doc following finding requiring registering matcher with Jest * Align `AssertionResult` and `matchers` type with expect library * Add documentation on required configuration * Document more findings around soft assertions Doc soft limitation * Add known limitations for soft assertions * Clarify usage of `expectAsync` * Processing more TODOs - `parent > test 2` snapshot does not exists * Rebase + clean example + Add note on augmentation limitations * Document better limitation of soft assertion with Jasmine * Add cucumber to doc + fix some errors * Simplify node constraints * Have `expect(Promise).toBeDefined()` be void and not a Promise * Even jest does not support `expect.not.anything()` * Force expect under Jasmine to always be async * Finalize jasmine support with typing for wdio expect being asyncrhonous * Revert matchers type breaking changes + better jasmine sync `d.ts` name * Have `InverseAsymmetricMatchers` for easier typing * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Update jasmine-wdio-expect-async.d.ts * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Update docs/Framework.md * Fix merge * fix: align jest versions * fix: use bundler resolution module --------- Co-authored-by: Christian Bromann <[email protected]> Co-authored-by: dprevost <[email protected]>
1 parent ffb5232 commit 0689878

File tree

66 files changed

+7019
-622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+7019
-622
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
!lib/**/*.js
44
!types/**/*.d.ts
55
!jasmine.d.ts
6+
!jasmine-wdio-expect-async.d.ts
67
!jest.d.ts
78
!LICENSE
89
!package.json

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# expect-webdriverio [![Test](https://github.com/webdriverio/expect-webdriverio/actions/workflows/test.yml/badge.svg)](https://github.com/webdriverio/expect-webdriverio/actions/workflows/test.yml)
22

33

4-
###### [API](docs/API.md) | [TypeScript / JS Autocomplete](/docs/Types.md) | [Examples](docs/Examples.md) | [Extending Matchers](/docs/Extend.md)
4+
###### [API](docs/API.md) | [TypeScript / JS Autocomplete](docs/Types.md) | [Examples](docs/Examples.md) | [Extending Matchers](docs/CustomMatchers.md)
55

66
> [WebdriverIO](https://webdriver.io/) Assertion library inspired by [expect](https://www.npmjs.com/package/expect)
77

docs/API.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ When set to `true` (default), the service will automatically assert all soft ass
111111

112112
This is useful if you want full control over when soft assertions are verified or if you want to handle soft assertion failures in a custom way.
113113

114+
### Known limitations
115+
116+
For Jasmine, using `wdio-jasmine-framework` will give a better plug-and-play experiences, else without it, the soft assertion service and custom matchers might not work/be registered correctly.
117+
Moreover, if Jasmine augmentation is used, the soft assertion function are not exposed in the typing, but could still work depending of your configuration. See [this issue](https://github.com/webdriverio/expect-webdriverio/issues/1893) for more details.
118+
114119
## Default Options
115120

116121
These default options below are connected to the [`waitforTimeout`](https://webdriver.io/docs/options#waitfortimeout) and [`waitforInterval`](https://webdriver.io/docs/options#waitforinterval) options set in the config.
@@ -682,7 +687,7 @@ await expect(mock).toBeRequestedTimes({ gte: 5, lte: 10 }) // request called at
682687

683688
Checks that mock was called according to the expected options.
684689

685-
Most of the options supports expect/jasmine partial matchers like [expect.objectContaining](https://jestjs.io/docs/en/expect#expectobjectcontainingobject)
690+
Most of the options supports expect/jasmine partial matchers like [expect.objectContaining](https://jestjs.io/docs/expect#expectobjectcontainingobject)
686691

687692
##### Usage
688693

@@ -873,7 +878,7 @@ await expect(elem).toHaveElementClass(/Container/i)
873878

874879
## Default Matchers
875880

876-
In addition to the `expect-webdriverio` matchers you can use builtin Jest's [expect](https://jestjs.io/docs/en/expect) assertions or [expect/expectAsync](https://jasmine.github.io/api/3.5/global.html#expect) for Jasmine.
881+
In addition to the `expect-webdriverio` matchers you can use builtin Jest's [expect](https://jestjs.io/docs/expect) assertions or [expect/expectAsync](https://jasmine.github.io/api/edge/global.html#expect) for Jasmine.
877882

878883
## Asymmetric Matchers
879884

docs/Extend.md renamed to docs/CustomMatchers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
Similar to how `expect-webdriverio` extends Jasmine/Jest matchers it's possible to add custom matchers.
44

5-
- Jasmine see [custom matchers](https://jasmine.github.io/2.5/custom_matcher.html) doc
6-
- Everyone else see Jest's [expect.extend](https://jestjs.io/docs/en/expect#expectextendmatchers)
5+
- [Jasmine](https://jasmine.github.io/) see [custom matchers](https://jasmine.github.io/tutorials/custom_matchers) doc
6+
- Everyone else see [Jest's expect.extend](https://jestjs.io/docs/expect#expectextendmatchers)
77

88
Custom matchers should be added in wdio `before` hook
99

docs/Examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('suite', () => {
5050
WebdriverIO test runner
5151
- Mocha https://github.com/mgrybyk/webdriverio-devtools
5252
- Cucumber https://gitlab.com/bar_foo/wdio-cucumber-typescript
53-
- Jasmine https://github.com/mgrybyk/wdio-jasmine-boilerplate
53+
- Jasmine https://github.com/webdriverio/jasmine-boilerplate
5454

5555
Standalone
5656
- Jest https://github.com/erwinheitzman/jest-webdriverio-standalone-boilerplate

docs/Framework.md

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
# Expect-WebDriverIO Framework
2+
3+
Expect-WebDriverIO is inspired by [`expect`](https://www.npmjs.com/package/expect) but also extends it. Therefore, we can use everything provided by the expect API with some WebDriverIO enhancements. Yes, this is a package of Jest but it is usable without Jest.
4+
5+
## Compatibility
6+
7+
We can pair `expect-webdriverio` with [Jest](https://jestjs.io/), [Mocha](https://mochajs.org/), and [Jasmine](https://jasmine.github.io/) and even [Cucumber](https://www.npmjs.com/package/@cucumber/cucumber)
8+
9+
It is highly recommended to use it with a [WDIO Testrunner](https://webdriver.io/docs/clioptions) which provides additional auto-configuration for a plug-and-play experience.
10+
11+
When used <u>**outside of [WDIO Testrunner](https://webdriver.io/docs/clioptions)**</u>, types need to be added to your [`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html), and some additional configuration for WDIO matchers, soft assertions, and snapshot service is required.
12+
13+
### Jest
14+
We can use `expect-webdriverio` with [Jest](https://jestjs.io/) using [`@jest/globals`](https://www.npmjs.com/package/@jest/globals) alone (preferred) and optionally [`@types/jest`](https://www.npmjs.com/package/@types/jest) (which has global ambient support).
15+
- Note: Jest maintainers do not support [`@types/jest`](https://www.npmjs.com/package/@types/jest). If this library gets out of date or has problems, support might be dropped.
16+
- Note: With Jest, the matchers `toMatchSnapshot` and `toMatchInlineSnapshot` are overloaded. To resolve the types correctly, `expect-webdriverio/jest` must be last.
17+
18+
#### With `@jest/globals`
19+
When paired only with [`@jest/globals`](https://www.npmjs.com/package/@jest/globals), we should `import` the `expect` function from `expect-webdriverio`.
20+
21+
```ts
22+
import { expect } from 'expect-webdriverio'
23+
import { describe, it, expect as jestExpect } from '@jest/globals'
24+
25+
describe('My tests', async () => {
26+
it('should verify my browser to have the expected url', async () => {
27+
await expect(browser).toHaveUrl('https://example.com')
28+
})
29+
})
30+
```
31+
32+
No `types` are expected in `tsconfig.json`.
33+
Optionally, to avoid needing `import { expect } from 'expect-webdriverio'`, you can use the following:
34+
35+
36+
```json
37+
{
38+
"compilerOptions": {
39+
"types": ["expect-webdriverio/expect-global"]
40+
}
41+
}
42+
```
43+
##### Augmenting `@jest/globals` JestMatchers
44+
Multiple attempts were made to augment `@jest/globals` to support `expect-webdriverio` matchers directly on JestMatchers. However, no namespace is available to augment it; therefore, only module augmentation can be used. This method does not allow adding matchers with the `extends` keyword; instead, they need to be added directly in the interface of the module declaration augmentation, which would create a lot of code duplication.
45+
46+
This [Jest issue](https://github.com/jestjs/jest/issues/12424) seems to target this problem, but it is still in progress.
47+
48+
#### With `@types/jest`
49+
When also paired with [`@types/jest`](https://www.npmjs.com/package/@types/jest), no imports are required. Global ambient types are already defined correctly and you can simply use Jest's `expect` directly.
50+
51+
If you are NOT using WDIO Testrunner, some prerequisite configuration is required.
52+
53+
Option 1: Replace the expect globally with the `expect-webdriverio` one:
54+
```ts
55+
import { expect } from "expect-webdriverio";
56+
(globalThis as any).expect = expect;
57+
```
58+
59+
Option 2: Reconfigure Jest's expect with the custom matchers and the soft assertion:
60+
```ts
61+
// Configure the custom matchers:
62+
import { expect } from "@jest/globals";
63+
import { matchers } from "expect-webdriverio";
64+
65+
beforeAll(async () => {
66+
expect.extend(matchers as Record<string, any>);
67+
});
68+
```
69+
70+
[Optional] For the soft assertion, the `createSoftExpect` is currently not correctly exposed but the below works:
71+
```ts
72+
// @ts-ignore
73+
import * as createSoftExpect from "expect-webdriverio/lib/softExpect";
74+
75+
beforeAll(async () => {
76+
Object.defineProperty(expect, "soft", {
77+
value: <T = unknown>(actual: T) => createSoftExpect.default(actual),
78+
});
79+
80+
// Add soft assertions utility methods
81+
Object.defineProperty(expect, "getSoftFailures", {
82+
value: (testId?: string) => SoftAssertService.getInstance().getFailures(testId),
83+
});
84+
85+
Object.defineProperty(expect, "assertSoftFailures", {
86+
value: (testId?: string) => SoftAssertService.getInstance().assertNoFailures(testId),
87+
});
88+
89+
Object.defineProperty(expect, "clearSoftFailures", {
90+
value: (testId?: string) => SoftAssertService.getInstance().clearFailures(testId),
91+
});
92+
});
93+
```
94+
95+
Then as shown below, no imports are required and we can use WDIO matchers directly on Jest's `expect`:
96+
```ts
97+
describe('My tests', async () => {
98+
it('should verify my browser to have the expected url', async () => {
99+
await expect(browser).toHaveUrl('https://example.com')
100+
})
101+
})
102+
```
103+
104+
Expected in `tsconfig.json`:
105+
```json
106+
{
107+
"compilerOptions": {
108+
"types": [
109+
"@types/jest",
110+
"expect-webdriverio/jest" // Must be last for overloaded matchers `toMatchSnapshot` and `toMatchInlineSnapshot`
111+
]
112+
}
113+
}
114+
```
115+
116+
### Mocha
117+
When paired with [Mocha](https://mochajs.org/), it can be used without (standalone) or with [`chai`](https://www.chaijs.com/) (or any other assertion library).
118+
119+
#### Standalone
120+
No import is required; everything is set globally.
121+
122+
```ts
123+
describe('My tests', async () => {
124+
it('should verify my browser to have the expected url', async () => {
125+
await expect(browser).toHaveUrl('https://example.com')
126+
})
127+
})
128+
```
129+
130+
Expected in `tsconfig.json`:
131+
```json
132+
{
133+
"compilerOptions": {
134+
"types": [
135+
"@types/mocha",
136+
"expect-webdriverio/expect-global"
137+
]
138+
}
139+
}
140+
```
141+
142+
#### Chai
143+
`expect-webdriverio` can coexist with the [Chai](https://www.chaijs.com/) assertion library by importing both libraries explicitly.
144+
See also this [documentation](https://webdriver.io/docs/assertion/#migrating-from-chai).
145+
146+
### Jasmine
147+
When paired with [Jasmine](https://jasmine.github.io/), [`@wdio/jasmine-framework`](https://www.npmjs.com/package/@wdio/jasmine-framework) is also required to configure it correctly, as it needs to force `expect` to be `expectAsync` and also register the WDIO matchers with `addAsyncMatcher` since `expect-webdriverio` only supports the Jest-style `expect.extend` version.
148+
149+
The types `expect-webdriverio/jasmine` are still offered but are subject to removal or being moved into `@wdio/jasmine-framework`. The usage of `expectAsync` is also subject to future removal.
150+
151+
#### Jasmine `expectAsync`
152+
When not using `@wdio/globals/types` or having `@types/jasmine` before it, the Jasmine expect is shown as the global ambient type. Therefore, when also defining `expect-webdriverio/jasmine`, we can use WDIO custom matchers on the `expectAsync`. Without `@wdio/jasmine-framework`, matchers will need to be registered manually.
153+
154+
```ts
155+
describe('My tests', async () => {
156+
it('should verify my browser to have the expected url', async () => {
157+
await expectAsync(browser).toHaveUrl('https://example.com')
158+
await expectAsync(true).toBe(true)
159+
})
160+
})
161+
```
162+
163+
Expected in `tsconfig.json`:
164+
```json
165+
{
166+
"compilerOptions": {
167+
"types": [
168+
"@types/jasmine",
169+
"expect-webdriverio/jasmine"
170+
]
171+
}
172+
}
173+
```
174+
175+
#### Global `expectAsync` force as `expect`
176+
When the global ambiant is the `expect` of wdio but forced to be `expectAsync` under the hood, like when using `@wdio/jasmine-framework`, then even the basic matchers need to be awaited
177+
178+
```ts
179+
describe('My tests', async () => {
180+
it('should verify my browser to have the expected url', async () => {
181+
await expect(browser).toHaveUrl('https://example.com')
182+
183+
// Even basic matchers requires expect since they are promises underneath
184+
await expect(true).toBe(true)
185+
})
186+
})
187+
```
188+
189+
Expected in `tsconfig.json`:
190+
```json
191+
{
192+
"compilerOptions": {
193+
"types": [
194+
"@wdio/globals/types",
195+
"@wdio/jasmine-framework",
196+
"@types/jasmine",
197+
"expect-webdriverio/jasmine-wdio-expect-async", // Force expect to return Promises
198+
]
199+
}
200+
}
201+
```
202+
203+
#### `expect` of `expect-webdriverio`
204+
It is preferable to use the `expect` from `expect-webdriverio` to guarantee future compatibility.
205+
206+
```ts
207+
// Required if we do not force the 'expect-webdriverio' expect globally with `"expect-webdriverio/expect-global"`
208+
import { expect as wdioExpect } from 'expect-webdriverio'
209+
210+
describe('My tests', async () => {
211+
it('should verify my browser to have the expected url', async () => {
212+
await wdioExpect(browser).toHaveUrl('https://example.com')
213+
214+
// No required await
215+
wdioExpect(true).toBe(true)
216+
})
217+
})
218+
219+
220+
Expected in `tsconfig.json`:
221+
```json
222+
{
223+
"compilerOptions": {
224+
"types": [
225+
"@types/jasmine",
226+
// "expect-webdriverio/expect-global", // Optional to have the global ambient expect the one of wdio
227+
]
228+
}
229+
}
230+
```
231+
232+
233+
#### Asymmetric matchers
234+
Asymmetric matchers have limited support. Even though `jasmine.stringContaining` does not produce a typing error, it may not work even with `@wdio/jasmine-framework`. However, the example below should work:
235+
236+
```ts
237+
describe('My tests', async () => {
238+
it('should verify my browser to have the expected url', async () => {
239+
await expectAsync(browser).toHaveUrl(wdioExpect.stringContaining('WebdriverIO'))
240+
})
241+
})
242+
```
243+
244+
245+
### Jest & Jasmine Augmentation Notes
246+
247+
If you are already using Jest or Jasmine globally, using `import { expect } from 'expect-webdriverio'` is the most compatible approach, even though augmentation exists.
248+
It is recommended to build your project using this approach instead of relying on augmentation, to ensure future compatibility and avoid augmentation limitations. See [this issue](https://github.com/webdriverio/expect-webdriverio/issues/1893) for more information.
249+
250+
### Cucumber
251+
252+
More details to come. In short, when paired with `@wdio/cucumber-framework`, you can use WDIO's expect with Cucumber and even [Gherkin](https://www.npmjs.com/package/@cucumber/gherkin).

docs/Types.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
# Types Definition
12
## TypeScript
23

34
If you are using the [WDIO Testrunner](https://webdriver.io/docs/clioptions) everything will be automatically setup. Just follow the [setup guide](https://webdriver.io/docs/typescript#framework-setup) from the docs. However if you run WebdriverIO with a different testrunner or in a simple Node.js script you will need to add `expect-webdriverio` to `types` in the `tsconfig.json`.
45

5-
- `"expect-webdriverio"` for everyone except of Jasmine/Jest users.
6-
- `"expect-webdriverio/jasmine"` Jasmine
7-
- `"expect-webdriverio/jest"` Jest
6+
- `"expect-webdriverio"` for everyone except Jasmine/Jest users.
7+
- `"expect-webdriverio/jasmine"` for [Jasmine](https://jasmine.github.io/)
8+
- `"expect-webdriverio/jest"` for [Jest](https://jestjs.io/)
9+
- `"expect-webdriverio/expect-global"` // Optional, if you wish to use expect of `expect-webdriverio` globally without explicit import
10+
- Note: Same as the former `"expect-webdriverio/types"`, now deprecated!
811

912
## JavaScript (VSCode)
1013

11-
It's required to create `jsconfig.json` in project root and refer to the type definitions to make autocompletion work in vanilla js.
14+
It's required to create [`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) in project root and refer to the type definitions to make autocompletion work in vanilla js.
1215

1316
```json
1417
{
@@ -19,3 +22,15 @@ It's required to create `jsconfig.json` in project root and refer to the type de
1922
]
2023
}
2124
```
25+
26+
## Jasmine special case
27+
[Jasmine](https://jasmine.github.io/) is different from [Jest](https://jestjs.io/) or the standard `expect` definition since it supports promises using `expectAsync` which makes it quite challenging.
28+
29+
Even though this library by itself is not fully Jasmine-ready, it offers the types of the matcher only on the `AsyncMatcher` since using `jasmine.expect` does not work out-of-the-box. However, if you are pulling on the `expect` of `expect-webdriverio`, you will be able to have the WebDriverIO matcher types on `expect`.
30+
31+
Support of `expectAsync` keyword is subject to change and may be dropped in the future!
32+
33+
### Dependency on `@wdio/jasmine-framework`
34+
As mentioned above, this library alone is not working with Jasmine. It is required to manually do some tweaks, or it is strongly recommended to also pair it with `@wdio/jasmine-framework`. See [Framework.md](Framework.md) for more information.
35+
36+
When using [`@wdio/jasmine-framework`](https://www.npmjs.com/package/@wdio/jasmine-framework), since it replaces `jasmine.expect` with `jasmine.expectAsync`, then matchers are usable on the keyword `expect`, but still typing on `expect` directly from [Jasmine](https://jasmine.github.io/) namespace is not supported as of today!

jasmine-wdio-expect-async.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/// <reference types="./types/expect-webdriverio.d.ts"/>
2+
3+
/**
4+
* Overrides the default wdio `expect` for Jasmine case specifically since the `expect` is now completely asynchronous which is not the case under Jest or standalone.
5+
*/
6+
declare namespace ExpectWebdriverIO {
7+
interface Expect extends ExpectWebdriverIO.AsymmetricMatchers, ExpectLibInverse<ExpectWebdriverIO.InverseAsymmetricMatchers>, WdioExpect {
8+
/**
9+
* The `expect` function is used every time you want to test a value.
10+
* You will rarely call `expect` by itself.
11+
*
12+
* expect function declaration contains two generics:
13+
* - T: the type of the actual value, e.g. any type, not just WebdriverIO.Browser or WebdriverIO.Element
14+
* - R: the type of the return value, e.g. Promise<void> or void
15+
*
16+
* Note: The function must stay here in the namespace to overwrite correctly the expect function from the expect library.
17+
*
18+
* @param actual The value to apply matchers against.
19+
*/
20+
<T = unknown>(actual: T): ExpectWebdriverIO.MatchersAndInverse<Promise<void>, T>
21+
}
22+
}

0 commit comments

Comments
 (0)