@wdio/globals 8.0.0-alpha.214 → 8.0.0-alpha.219

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/build/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
+ /// <reference types="./standalone" />
1
2
  /// <reference types="types" />
2
- declare type SupportedGlobals = 'browser' | 'driver' | 'multiremotebrowser' | '$' | '$$';
3
+ declare type SupportedGlobals = 'browser' | 'driver' | 'multiremotebrowser' | '$' | '$$' | 'expect';
3
4
  export declare const browser: WebdriverIO.Browser;
4
5
  export declare const driver: WebdriverIO.Browser;
5
6
  export declare const multiremotebrowser: WebdriverIO.MultiRemoteBrowser;
6
7
  export declare const $: WebdriverIO.Browser['$'];
7
8
  export declare const $$: WebdriverIO.Browser['$$'];
9
+ export declare const expect: ExpectWebdriverIO.Expect;
8
10
  /**
9
11
  * allows to set global property to be imported and used later on
10
12
  * @param key global key
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,aAAK,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,oBAAoB,GAAG,GAAG,GAAG,IAAI,CAAA;AAiBhF,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,OAGjC,CAAA;AACD,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,OAGhC,CAAA;AACD,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,kBAG5C,CAAA;AACD,eAAO,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,CAKtC,CAAA;AACD,eAAO,MAAM,EAAE,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAKxC,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,UAAO,QAO9E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA,aAAK,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,oBAAoB,GAAG,GAAG,GAAG,IAAI,GAAG,QAAQ,CAAA;AAiB3F,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,OAGjC,CAAA;AACD,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,OAGhC,CAAA;AACD,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,kBAG5C,CAAA;AACD,eAAO,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,CAKtC,CAAA;AACD,eAAO,MAAM,EAAE,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAKxC,CAAA;AACD,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,MAKT,CAAA;AAE9B;;;;;GAKG;AACH,wBAAgB,UAAU,CAAE,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,UAAO,QAO9E"}
package/build/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference path="../types.d.ts" />
2
2
  const globals = new Map();
3
- const GLOBALS_ERROR_MESSAGE = 'Don\'t import @wdio/globals outside of the WDIO testrunner context';
3
+ const GLOBALS_ERROR_MESSAGE = 'No browser instance registered. Don\'t import @wdio/globals outside of the WDIO testrunner context. Or you have two two different "@wdio/globals" packages installed.';
4
4
  function proxyHandler(key) {
5
5
  return {
6
6
  get: (self, prop) => {
@@ -29,6 +29,12 @@ export const $$ = (...args) => {
29
29
  }
30
30
  return globals.get('$$')(...args);
31
31
  };
32
+ export const expect = ((...args) => {
33
+ if (!globals.has('expect')) {
34
+ throw new Error(GLOBALS_ERROR_MESSAGE);
35
+ }
36
+ return globals.get('expect')(...args);
37
+ });
32
38
  /**
33
39
  * allows to set global property to be imported and used later on
34
40
  * @param key global key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/globals",
3
- "version": "8.0.0-alpha.214+fada97c78",
3
+ "version": "8.0.0-alpha.219+4aab2cef1",
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",
@@ -28,7 +28,8 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "webdriverio": "7.20.7"
31
+ "expect-webdriverio": "^4.0.0-alpha.3",
32
+ "webdriverio": "8.0.0-alpha.219+4aab2cef1"
32
33
  },
33
- "gitHead": "fada97c788183c810b20025ca69680ae5a8ed45b"
34
+ "gitHead": "4aab2cef1b8b195ac8cc611f28b1fd54e4ba3443"
34
35
  }
package/types.d.ts CHANGED
@@ -2,6 +2,7 @@ type BrowserType = import('webdriverio').Browser<'async'>
2
2
  type ElementType = import('webdriverio').Element<'async'>
3
3
  type ElementArrayType = import('webdriverio').ElementArray
4
4
  type MultiRemoteBrowserType = import('webdriverio').MultiRemoteBrowser<'async'>
5
+ type ExpectWebdriverIO = import('expect-webdriverio')
5
6
 
6
7
  declare namespace WebdriverIOAsync {
7
8
  interface Browser {}
@@ -23,6 +24,7 @@ declare module NodeJS {
23
24
  browser: WebdriverIO.Browser
24
25
  driver: WebdriverIO.Browser
25
26
  multiremotebrowser: WebdriverIO.MultiRemoteBrowser
27
+ expect: ExpectWebdriverIO.Expect
26
28
  }
27
29
  }
28
30
 
@@ -31,3 +33,4 @@ declare function $$(...args: Parameters<WebdriverIO.Browser['$$']>): ReturnType<
31
33
  declare const browser: WebdriverIO.Browser
32
34
  declare const driver: WebdriverIO.Browser
33
35
  declare const multiremotebrowser: WebdriverIO.MultiRemoteBrowser
36
+ declare const expect: ExpectWebdriverIO.Expect