Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit 4dae7a7

Browse files
committed
test: change to TDD
change 'describe' for 'suit'
1 parent db8bfab commit 4dae7a7

File tree

2 files changed

+24
-30
lines changed

2 files changed

+24
-30
lines changed

test/index.ts

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,30 @@ import * as ScrollUtility from "../"
66
declare const window: Window & { ScrollUtility: typeof ScrollUtility }
77

88
const local_testing_site_url = "http://localhost:8080/"
9-
// const long_timeout = 10000
109

11-
describe("client tests ", async function() {
12-
for (const os in capabilities) {
13-
for (const browser in capabilities[os]) {
14-
const cap: webdriver.Capabilities = capabilities[os][browser]
15-
describe(`${os} ${browser}`, function(this) {
16-
this.timeout(0)
17-
let browser: webdriver.WebDriver = (null as any) as webdriver.WebDriver
18-
before(async function(this) {
19-
browser = await new webdriver.Builder()
20-
.usingServer("https://hub-cloud.browserstack.com/wd/hub")
21-
.withCapabilities(cap)
22-
.build()
23-
await browser.get(local_testing_site_url)
24-
expect(browser).not.toBeNull()
25-
})
26-
describe("something", async function() {
27-
it("should have ScrollUtility", async function() {
28-
const scrollUtility = await browser.executeScript(() => {
29-
return window.ScrollUtility
30-
})
31-
expect(scrollUtility).toBeDefined()
32-
})
33-
testScenarios(() => browser)
34-
})
35-
after(async function() {
36-
await browser.quit()
10+
for (const os in capabilities) {
11+
for (const browser in capabilities[os]) {
12+
const cap: webdriver.Capabilities = capabilities[os][browser]
13+
suite(`${os} ${browser}`, function(this) {
14+
let browser: webdriver.WebDriver = (null as any) as webdriver.WebDriver
15+
suiteSetup(async function(this) {
16+
browser = await new webdriver.Builder()
17+
.usingServer("https://hub-cloud.browserstack.com/wd/hub")
18+
.withCapabilities(cap)
19+
.build()
20+
await browser.get(local_testing_site_url)
21+
expect(browser).not.toBeNull()
22+
})
23+
test("should have ScrollUtility", async function() {
24+
const scrollUtility = await browser.executeScript(() => {
25+
return window.ScrollUtility
3726
})
27+
expect(scrollUtility).toBeDefined()
28+
})
29+
testScenarios(() => browser)
30+
suiteTeardown(async function() {
31+
await browser.quit()
3832
})
39-
}
33+
})
4034
}
41-
})
35+
}

test/tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ declare const window: Window & { ScrollUtility: typeof ScrollUtility }
77
type TestScroll = [string, string, boolean, number, number]
88

99
function someTest(getBrowser: () => webdriver.WebDriver) {
10-
it("center element", async function() {
10+
test("center element", async function() {
1111
await testScroll(getBrowser, "html", "#scrollable", false, 0, 50)
1212
})
1313
}

0 commit comments

Comments
 (0)