-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathduelDuo.test.ts
37 lines (29 loc) · 1.19 KB
/
duelDuo.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Builder, Capabilities, By } from "selenium-webdriver"
require('chromedriver')
const driver = new Builder().withCapabilities(Capabilities.chrome()).build()
beforeEach(async () => {
driver.get('http://54.166.148.154')
})
afterAll(async () => {
driver.quit()
})
test('Title shows up when page loads', async () => {
const title = await driver.findElement(By.id('title'))
const displayed = await title.isDisplayed()
expect(displayed).toBe(true)
})
it('clicks an “Add to Duo” button and displays the div with id player-duo',async() => {
await driver.findElement(By.id('draw')).click()
await driver.sleep(4000)
await driver.findElement(By.xpath('(//button[text() = "Add to Duo"])[1]')).click()
const userDuo = await driver.findElement(By.id('player-duo'))
const display = await userDuo.isDisplayed()
expect(display).toBeTruthy()
})
it('clicks on the draw button and displays the div with id choices', async() => {
await driver.findElement(By.id('draw')).click()
await driver.sleep(4000)
const choiceContainer = await driver.findElement(By.id('choices'))
const display = await choiceContainer.isDisplayed()
expect(display).toBeTruthy()
})