@wdio/globals 8.16.5 → 8.16.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.
Files changed (2) hide show
  1. package/README.md +36 -1
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -3,7 +3,30 @@ WDIO Globals
3
3
 
4
4
  > A helper utility for importing global variables directly
5
5
 
6
- This package can be used to import global variables explicitly, e.g.
6
+ In your test files, WebdriverIO puts each of these methods and objects into the global environment. You don't have to import anything to use them. However, if you prefer explicit imports, you can do `import { browser, $, $$, expect } from '@wdio/globals'` and set `injectGlobals: false` in your WDIO configuration.
7
+
8
+ The following global objects are set if not configured otherwise:
9
+
10
+ - `browser`: WebdriverIO Browser object
11
+ - `driver`: alias to browser (used when running mobile tests)
12
+ - `multiremotebrowser`: alias to browser or driver but only set for Multiremote sessions
13
+ - `$`: command to fetch an element (see more in API docs)
14
+ - `$$`: command to fetch elements (see more in API docs)
15
+ - `expect`: assertion framework for WebdriverIO (see API docs)
16
+
17
+ Note: WebdriverIO has no control of used frameworks (e.g. Mocha or Jasmine) setting global variables when bootstrapping their environment.
18
+
19
+ ## Install
20
+
21
+ To install the package, run:
22
+
23
+ ```sh
24
+ npm i @wdio/globals --save-dev
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ You can implicitly import WebdriverIO primitives as following:
7
30
 
8
31
  ```ts
9
32
  import { browser, $, $$, expect } from '@wdio/globals'
@@ -19,4 +42,16 @@ describe('my test', () => {
19
42
  })
20
43
  ```
21
44
 
45
+ ## TypeScript
46
+
47
+ If you have a TypeScript project you can propagate the WebdriverIO namespace by adding this package to the `types` list, e.g.:
48
+
49
+ ```json title="tsconfig.json"
50
+ {
51
+ "compilerOptions": {
52
+ "types": ["node", "@wdio/globals/types"]
53
+ }
54
+ }
55
+ ```
56
+
22
57
  For more information on WebdriverIO Globals, check out the [docs](https://webdriver.io/docs/api/globals).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/globals",
3
- "version": "8.16.5",
3
+ "version": "8.16.7",
4
4
  "description": "A helper utility for importing global variables directly",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-globals",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "expect-webdriverio": "^4.2.5",
46
- "webdriverio": "8.16.5"
46
+ "webdriverio": "8.16.7"
47
47
  },
48
- "gitHead": "ca2069d80b7804bd4680850b92a6cd7b4fa4499f"
48
+ "gitHead": "15f7f225e6a81ea0e5e7a9ba8067ca59007f09c2"
49
49
  }