Implements "can register" web driver test.
This commit is contained in:
parent
d905a27f0c
commit
40167ef1e4
1 changed files with 48 additions and 1 deletions
|
|
@ -34,7 +34,7 @@ proc test*(session: Session, baseUrl: string) =
|
||||||
check thread.isNone()
|
check thread.isNone()
|
||||||
|
|
||||||
# Logging in
|
# Logging in
|
||||||
test "can login":
|
test "can login/logout":
|
||||||
let logIn = session.findElement("#login-btn").get()
|
let logIn = session.findElement("#login-btn").get()
|
||||||
logIn.click()
|
logIn.click()
|
||||||
|
|
||||||
|
|
@ -66,3 +66,50 @@ proc test*(session: Session, baseUrl: string) =
|
||||||
|
|
||||||
check profileName.getText() == "admin"
|
check profileName.getText() == "admin"
|
||||||
|
|
||||||
|
# Check whether we can log out.
|
||||||
|
let logoutLink = session.findElement(
|
||||||
|
"Logout",
|
||||||
|
LinkTextSelector
|
||||||
|
).get()
|
||||||
|
logoutLink.click()
|
||||||
|
|
||||||
|
# Verify we have logged out by looking for the log in button.
|
||||||
|
check session.findElement("#login-btn").isSome()
|
||||||
|
|
||||||
|
test "can register":
|
||||||
|
let signup = session.findElement("#signup-btn").get()
|
||||||
|
signup.click()
|
||||||
|
|
||||||
|
let emailField = session.findElement(
|
||||||
|
"#signup-form input[name='email']"
|
||||||
|
).get()
|
||||||
|
let usernameField = session.findElement(
|
||||||
|
"#signup-form input[name='username']"
|
||||||
|
).get()
|
||||||
|
let passwordField = session.findElement(
|
||||||
|
"#signup-form input[name='password']"
|
||||||
|
).get()
|
||||||
|
|
||||||
|
emailField.sendKeys("test@test.com")
|
||||||
|
usernameField.sendKeys("test")
|
||||||
|
passwordField.sendKeys("test")
|
||||||
|
|
||||||
|
let createAccount = session.findElement(
|
||||||
|
"#signup-modal .modal-footer .btn-primary"
|
||||||
|
).get()
|
||||||
|
|
||||||
|
createAccount.click()
|
||||||
|
|
||||||
|
waitForLoad(session, 5000)
|
||||||
|
|
||||||
|
# Verify that the user menu has been initialised properly.
|
||||||
|
let profileButton = session.findElement(
|
||||||
|
"#main-navbar figure.avatar"
|
||||||
|
).get()
|
||||||
|
profileButton.click()
|
||||||
|
|
||||||
|
let profileName = session.findElement(
|
||||||
|
"#main-navbar .menu-right div.tile-content"
|
||||||
|
).get()
|
||||||
|
|
||||||
|
check profileName.getText() == "test"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue