@@ -2,26 +2,23 @@ import { remote, Browser } from "webdriverio";
2
2
import { config } from "../wdio.conf" ;
3
3
import sync from "@wdio/sync" ;
4
4
5
- let browser : Browser < "async" > ;
5
+ let asyncBrowser : Browser < 'async' > ;
6
+ let syncBrowser : Browser < 'sync' > ;
6
7
7
8
beforeAll ( async ( ) => {
8
- browser = await remote ( config ) ;
9
+ asyncBrowser = await remote ( config ) ;
10
+ syncBrowser = asyncBrowser as unknown as Browser < 'sync' > ;
9
11
} ) ;
10
12
11
13
afterAll ( async ( ) => {
12
- await browser . deleteSession ( ) ;
14
+ await asyncBrowser . deleteSession ( ) ;
13
15
} ) ;
14
16
15
- /**
16
- * "any" is used here because we are mixing both sync and async in one setup
17
- * this is because this boilerplate is meant to showcase how webdriverio
18
- * can be utilised
19
- */
20
17
test ( "synchronous WebdriverIO test" , ( ) =>
21
18
sync ( ( ) => {
22
- browser . url ( "https://webdriver.io" ) ;
23
- expect ( browser . getTitle ( ) ) . toContain ( "WebdriverIO" ) ;
24
- ( browser . $ ( ".DocSearch-Button" ) as any ) . click ( ) ;
25
- ( browser . $ ( "#docsearch-input" ) as any ) . setValue ( "click" ) ;
26
- ( browser . $ ( ".DocSearch-Hit" ) as any ) . waitForExist ( ) ;
19
+ syncBrowser . url ( "https://webdriver.io" ) ;
20
+ expect ( syncBrowser . getTitle ( ) ) . toContain ( "WebdriverIO" ) ;
21
+ syncBrowser . $ ( ".DocSearch-Button" ) . click ( ) ;
22
+ syncBrowser . $ ( "#docsearch-input" ) . setValue ( "click" ) ;
23
+ syncBrowser . $ ( ".DocSearch-Hit" ) . waitForExist ( ) ;
27
24
} ) ) ;
0 commit comments