* Added isSticky field to `Thread` and in the sql query making a Thread - Modified indices in `data` and `selectUser` to support `isSticky` - Add backend procs for initial sticky logic, modeled after locking threads - Fix indices in selectThread - Fixup posts.json's threadquery to match Thread with sticky field * Implement StickyButton for postbutton.nim and add it to postlist.nim * Fix sticky routes * Order sticky in a way that they actually appear at the top * Add border for isSticky on genThread * Rename stickies to pinned, so professional! * Add pinned tests - Add an id to pin button, and add first attempt at useful tests - Improve pin tests, refactored it into adminTests and userTests - Add an id to pin button, and add first attempt at useful tests - Improve pin tests, refactored it into adminTests and userTests * Make tests more reliable Co-authored-by: Joey Yakimowich-Payne <jyapayne@gmail.com>
43 lines
964 B
Nim
43 lines
964 B
Nim
import unittest, 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
|