This drastically speeds up tests and simplifies test writing by making it so that no explicit calls for waiting are needed. Elements that are queried for now implicitly waits for them to be available. On my machine, tests used to take 3-4 minutes to complete. Now they take ~1 minute to complete.
43 lines
No EOL
976 B
Nim
43 lines
No EOL
976 B
Nim
import unittest, options, os, common
|
|
|
|
import webdriver
|
|
|
|
proc test*(session: Session, baseUrl: string) =
|
|
session.navigate(baseUrl)
|
|
|
|
# Sanity checks
|
|
test "shows sign up":
|
|
session.checkText("#signup-btn", "Sign up")
|
|
|
|
test "shows log in":
|
|
session.checkText("#login-btn", "Log in")
|
|
|
|
test "is empty":
|
|
session.checkIsNone("tr > td.thread-title")
|
|
|
|
# Logging in
|
|
test "can login/logout":
|
|
with session:
|
|
login("admin", "admin")
|
|
|
|
# Check whether we can log out.
|
|
logout()
|
|
# Verify we have logged out by looking for the log in button.
|
|
ensureExists "#login-btn"
|
|
|
|
test "can register":
|
|
with session:
|
|
register("test", "test")
|
|
logout()
|
|
|
|
test "can't register same username with different case":
|
|
with session:
|
|
register "test1", "test1", verify = false
|
|
logout()
|
|
|
|
navigate baseUrl
|
|
|
|
register "TEst1", "test1", verify = false
|
|
|
|
ensureExists "#signup-form .has-error"
|
|
navigate baseUrl |