-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathLoginTest.js
More file actions
34 lines (32 loc) · 1006 Bytes
/
LoginTest.js
File metadata and controls
34 lines (32 loc) · 1006 Bytes
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
const { Builder } = require('selenium-webdriver')
const path = require('path')
const assert = require('assert')
//describe is a method from Mocha
describe('Login', function () {
this.timeout(30000)
let driver
beforeEach(async function () {
/* const vendorDirectory =
path.delimiter + path.join(__dirname, '..', 'vendor')
process.env.PATH += vendorDirectory */
driver = await new Builder().forBrowser('firefox').build();
})
afterEach(async function () {
await driver.quit()
})
it('with valid credentials', async function () {
await driver.get('http://the-internet.herokuapp.com/login')
await driver
.findElement({ id: 'username' })
.sendKeys('tomsmith')
await driver
.findElement({ id: 'password' })
.sendKeys('SuperSecretPassword!')
await driver.findElement({ css: 'button' }).click()
assert(
await driver.findElement({
css: '.flash.success'
}).isDisplayed(), 'Success message not displayed'
)
})
})