Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Proposed changes webdriverio types are async by default. webdriverio sync types are in @wdio/sync package ## Types of changes - [x] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [x] Breaking change (fix or feature that would cause existing functionality to not work as expected) ## Checklist - [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc - [ ] I have added tests that prove my fix is effective or that my feature works - [x] I have added necessary documentation (if appropriate) ## Further comments - In order to make this PR work webdriverio, webdriver and @wdio/sync packages have to be released - Please note that it is a braking change for existing TypeScript users that work in sync mode ### Reviewers: @webdriverio/technical-committee @CrispusDH
- Loading branch information
1 parent
792f089
commit c36d1f7
Showing
8 changed files
with
105 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference types="./webdriverio-core"/> | ||
|
||
type BrowserObject = WebDriver.ClientOptions & WebDriver.Client & WebdriverIO.Browser; | ||
|
||
declare namespace WebdriverIO { | ||
function remote( | ||
options?: WebDriver.Options, | ||
modifier?: (...args: any[]) => any | ||
): BrowserObject; | ||
|
||
function multiremote( | ||
options: WebdriverIO.MultiRemoteOptions | ||
): WebDriver.Client; | ||
} | ||
|
||
declare var browser: BrowserObject; | ||
declare function $(selector: string | Function): WebdriverIO.Element; | ||
declare function $$(selector: string | Function): WebdriverIO.Element[]; | ||
|
||
declare module "@wdio/sync" { | ||
export = WebdriverIO | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/// <reference types="./webdriverio-core"/> | ||
|
||
type BrowserObject = WebDriver.ClientOptions & WebDriver.ClientAsync & WebdriverIOAsync.Browser; | ||
|
||
// Element commands that should be wrapper with Promise | ||
type ElementPromise = Omit<WebdriverIO.Element, 'addCommand'>; | ||
|
||
// Element commands wrapper with Promise | ||
type ElementAsync = { | ||
[K in keyof ElementPromise]: WrapWithPromise<WebdriverIO.Element[K]> | ||
} | ||
// Element commands that should not be wrapper with promise | ||
type ElementStatic = Pick<WebdriverIO.Element, 'addCommand'> | ||
|
||
// Browser commands that should be wrapper with Promise | ||
type BrowserPromise = Omit<WebdriverIO.Browser, 'addCommand' | 'options'>; | ||
|
||
// Browser commands wrapper with Promise | ||
type BrowserAsync = { | ||
[K in keyof BrowserPromise]: WrapWithPromise<WebdriverIO.Browser[K]> | ||
} | ||
|
||
// Browser commands that should not be wrapper with promise | ||
type BrowserStatic = Pick<WebdriverIO.Browser, 'addCommand' | 'options'>; | ||
declare namespace WebdriverIOAsync { | ||
function remote( | ||
options?: WebDriver.Options, | ||
modifier?: (...args: any[]) => any | ||
): BrowserObject; | ||
|
||
function multiremote( | ||
options: WebdriverIO.MultiRemoteOptions | ||
): WebDriver.ClientAsync; | ||
|
||
interface Browser extends BrowserAsync, BrowserStatic { } | ||
interface Element extends ElementAsync, ElementStatic { } | ||
} | ||
|
||
declare var browser: BrowserObject; | ||
declare function $(selector: string | Function): Promise<WebdriverIOAsync.Element>; | ||
declare function $$(selector: string | Function): Promise<WebdriverIOAsync.Element[]>; | ||
|
||
declare module "webdriverio" { | ||
export = WebdriverIOAsync | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters