expect-webdriverio 6.0.5 → 6.0.7

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 CHANGED
@@ -1,17 +1,16 @@
1
1
  # 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)
2
2
 
3
-
4
3
  ###### [API](docs/API.md) | [TypeScript / JS Autocomplete](docs/Types.md) | [Examples](docs/Examples.md) | [Extending Matchers](docs/CustomMatchers.md)
5
4
 
6
- > [WebdriverIO](https://webdriver.io/) Assertion library inspired by [expect](https://www.npmjs.com/package/expect)
5
+ > [WebdriverIO](https://webdriver.io/) assertion library inspired by [expect](https://www.npmjs.com/package/expect)
7
6
 
8
7
  ## Key Features
9
8
 
10
- - [Waits](#default-options) for expectation to succeed
11
- - Support single element & multi-elements
9
+ - [Waits](#default-options) for expectations to succeed
10
+ - Supports single element `$()` & multiple elements `$$()`
12
11
  - Detailed [error messages](#error-messages)
13
- - Works in Mocha, Cucumber, Jest, Jasmine
14
- - Builtin [types](docs/Types.md) for TypeScript and JS autocompletion
12
+ - Works in Mocha, Cucumber, Jest, and Jasmine
13
+ - Built-in [types](docs/Types.md) for TypeScript and JS autocompletion
15
14
 
16
15
  ## Installation
17
16
 
@@ -22,24 +21,28 @@
22
21
  - **Cucumber**: `npm install @wdio/cucumber-framework`
23
22
  - **Jest**: No adapter needed — see [Jest Framework section](docs/Framework.md#jest)
24
23
 
25
- NOTE: [WebdriverIO](https://github.com/webdriverio/webdriverio) `v9.0.0` or higher is required!
24
+ **Note:** [WebdriverIO](https://github.com/webdriverio/webdriverio) `v9.0.0` or higher is required!
26
25
 
27
26
  ## Usage
28
27
 
29
28
  ### Using WebdriverIO Testrunner
30
29
 
31
- If you run your tests through the [WDIO testrunner](https://webdriver.io/docs/clioptions) no additional setup is needed. WebdriverIO initialises `expect-webdriverio` and makes `expect` available in the global scope. So you can use it directly in your tests:
30
+ If you run your tests through the [WDIO testrunner](https://webdriver.io/docs/clioptions), no additional setup is needed. WebdriverIO initializes `expect-webdriverio` and makes `expect` available in the global scope so you can use it directly in your tests:
32
31
 
33
32
  ```js
34
- const button = await $('button')
35
- await expect(button).toBeDisplayed()
33
+ await expect($('button')).toBeDisplayed()
34
+ await expect($$('buttons')).toBeDisplayed()
36
35
  ```
37
36
 
38
- See more [Examples](docs/Examples.md)
37
+ See more [Examples](docs/Examples.md).
38
+
39
+ #### Local & Browser Runners
40
+ - **Local Runner**: Fully compatible. You can leverage your test framework adapter as mentioned above.
41
+ - **Browser Runner**: Designed for component frameworks like React, Preact, Vue.js, Svelte, and SolidJS, with a few known limitations. For details, see the [Browser Runner Framework section](docs/Framework.md#browser-runner).
39
42
 
40
- ### Using in a standalone script
43
+ ### Using in Standalone Mode
41
44
 
42
- If you embed WebdriverIO in a standalone (without `@wdio/globals`), make sure you import `expect-webdriverio` before you use it anywhere.
45
+ If you use WebdriverIO in standalone mode (without `@wdio/globals`), make sure you import `expect-webdriverio` before using it anywhere.
43
46
 
44
47
  ```js
45
48
  import { remote } from 'webdriverio'
@@ -63,24 +66,24 @@ import { expect } from 'expect-webdriverio'
63
66
 
64
67
  ## API
65
68
 
66
- Please see [API doc](docs/API.md)
69
+ Please see the [API documentation](docs/API.md).
67
70
 
68
- ## Error messages
71
+ ## Error Messages
69
72
 
70
73
  Error messages are informative out of the box and contain:
71
74
 
72
- - full element selector, like `$('form').$('input')`
73
- - actual and expected values
74
- - highlight the difference (texts assertions)
75
+ - Full element selector, like `$('form')`
76
+ - Actual and expected values
77
+ - Highlighted differences (text assertions)
75
78
 
76
79
  ![toHaveText](/docs/img/errors/text.png?raw=true "toHaveText")
77
80
  ![toHaveElementClass](/docs/img/errors/class.png?raw=true "toHaveElementClass")
78
81
 
79
- ## What's next?
82
+ ## What's Next?
80
83
 
81
- First of all, **feel free to raise an issue with your suggestions or help with PR!**
84
+ First of all, **feel free to raise an issue with your suggestions or help with PRs!**
82
85
 
83
86
  ### Planned
84
87
 
85
- - cookie
86
- - multiremote support (coming)
88
+ - Cookie matchers
89
+ - Multiremote support (in progress)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expect-webdriverio",
3
- "version": "6.0.5",
3
+ "version": "6.0.7",
4
4
  "author": "Mykola Grybyk <mykola.grybyk@gmail.com>",
5
5
  "description": "WebdriverIO Assertion Library",
6
6
  "license": "MIT",
@@ -45,7 +45,10 @@
45
45
  ],
46
46
  "./types": "./types/expect-global.d.ts",
47
47
  "./expect-global": "./types/expect-global.d.ts",
48
- "./api": "./lib/api/index.js"
48
+ "./api": {
49
+ "types": "./types/expect-webdriverio.d.ts",
50
+ "import": "./lib/api/index.js"
51
+ }
49
52
  },
50
53
  "types": "./types/expect-webdriverio.d.ts",
51
54
  "typeScriptVersion": "3.8.3",
@@ -70,6 +73,7 @@
70
73
  "ts:jasmine-global-expect-async": "cd test-types/jasmine-global-expect-async && vitest --typecheck --typecheck.tsconfig ./tsconfig.json --run",
71
74
  "ts:jest:@types-jest": "cd test-types/jest-@types_jest && vitest --typecheck --typecheck.tsconfig ./tsconfig.json --run",
72
75
  "ts:mocha": "cd test-types/mocha && vitest --typecheck --typecheck.tsconfig ./tsconfig.json --run",
76
+ "ts:arethetypeswrong": "npx @arethetypeswrong/cli --pack . --profile esm-only",
73
77
  "checks:all": "npm run build && npm run compile && npm run tsc:root-types && npm run test && npm run ts",
74
78
  "watch": "npm run compile -- --watch",
75
79
  "prepare": "husky",
@@ -85,6 +89,7 @@
85
89
  "jest-matcher-utils": "^30.4.1"
86
90
  },
87
91
  "devDependencies": {
92
+ "@arethetypeswrong/cli": "^0.18.5",
88
93
  "@jest/globals": "^30.4.1",
89
94
  "@types/debug": "^4.1.13",
90
95
  "@types/jasmine": "^5.1.15",
@@ -92,9 +97,9 @@
92
97
  "@types/mocha": "^10.0.10",
93
98
  "@types/node": "^24.13.3",
94
99
  "@vitest/coverage-v8": "^4.1.10",
95
- "@vitest/eslint-plugin": "^1.6.26",
100
+ "@vitest/eslint-plugin": "^1.6.27",
96
101
  "@wdio/eslint": "^0.1.3",
97
- "@wdio/types": "^9.30.1",
102
+ "@wdio/types": "^9.31.1",
98
103
  "eslint": "^9.39.5",
99
104
  "husky": "^9.1.7",
100
105
  "npm-run-all2": "^9.0.3",
@@ -22,7 +22,6 @@ type ExpectLibExpectationResult = import('expect').ExpectationResult
22
22
  type ExpectLibMatcherContext = import('expect').MatcherContext
23
23
  type MatchersObject = Parameters<typeof import('expect').expect.extend>[0]
24
24
  type ExpectLibAnything = ReturnType<typeof expect.any> | ReturnType<typeof expect.anything>
25
- type WdioSome<T> = import('../src/matchers/modifiers/some.js').SomeElementsWrapper<T>
26
25
 
27
26
  // Extracted from the expect library, this is the type of the matcher function used in the expect library.
28
27
  type RawMatcherFn<Context extends ExpectLibMatcherContext = ExpectLibMatcherContext> = {
@@ -30,6 +29,10 @@ type RawMatcherFn<Context extends ExpectLibMatcherContext = ExpectLibMatcherCont
30
29
  (this: Context, actual: any, ...expected: Array<any>): ExpectLibExpectationResult;
31
30
  }
32
31
 
32
+ interface WdioSome<T> {
33
+ readonly elements: T
34
+ }
35
+
33
36
  /**
34
37
  * Indicates that a value can be either one T or an array of T.
35
38
  */