Skip to content

Commit 0366207

Browse files
Merge pull request #16 from erwinheitzman/version-1.4.1
updated deps, simplified types
2 parents afd488e + 407aadf commit 0366207

File tree

5 files changed

+556
-498
lines changed

5 files changed

+556
-498
lines changed

__tests__/sync.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,23 @@ import { remote, Browser } from "webdriverio";
22
import { config } from "../wdio.conf";
33
import sync from "@wdio/sync";
44

5-
let browser: Browser<"async">;
5+
let asyncBrowser: Browser<'async'>;
6+
let syncBrowser: Browser<'sync'>;
67

78
beforeAll(async () => {
8-
browser = await remote(config);
9+
asyncBrowser = await remote(config);
10+
syncBrowser = asyncBrowser as unknown as Browser<'sync'>;
911
});
1012

1113
afterAll(async () => {
12-
await browser.deleteSession();
14+
await asyncBrowser.deleteSession();
1315
});
1416

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-
*/
2017
test("synchronous WebdriverIO test", () =>
2118
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();
2724
}));

__tests__/wiremock-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Browser, remote } from "webdriverio";
22
import { config } from "../wdio.conf";
3-
import nodeFetch from "node-fetch";
3+
import nodeFetch, { Response } from "node-fetch";
44

55
let browser: Browser<"async">;
66

@@ -45,7 +45,7 @@ test(`a mocked api response created using WireMock's HTTP API`, async () => {
4545
});
4646

4747
await nodeFetch("http://localhost:8080/new_data")
48-
.then((res: any) => res.json())
49-
.then((body: any) => expect(body).toEqual(expectedRes));
48+
.then((res: Response) => res.json())
49+
.then((body: object) => expect(body).toEqual(expectedRes));
5050
});
5151
});

0 commit comments

Comments
 (0)