Add basic test for creating a thread
This commit is contained in:
parent
122e279256
commit
b650a9f401
4 changed files with 95 additions and 16 deletions
46
tests/browsertests/threads.nim
Normal file
46
tests/browsertests/threads.nim
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import unittest, options, os, common
|
||||
|
||||
import webdriver
|
||||
|
||||
proc test*(session: Session, baseUrl: string) =
|
||||
session.navigate(baseUrl)
|
||||
|
||||
waitForLoad(session)
|
||||
|
||||
login(session, "admin", "admin")
|
||||
|
||||
test "can create thread":
|
||||
let newThreadBtn = session.findElement("#new-thread-btn").get()
|
||||
newThreadBtn.click()
|
||||
|
||||
waitForLoad(session)
|
||||
|
||||
let newThread = session.findElement("#new-thread")
|
||||
check newThread.isSome()
|
||||
|
||||
let createThreadBtn = session.findElement("#create-thread-btn")
|
||||
check createThreadBtn.isSome()
|
||||
|
||||
|
||||
let threadTitle = session.findElement("#thread-title")
|
||||
check threadTitle.isSome()
|
||||
|
||||
let replyBox = session.findElement("#reply-textarea")
|
||||
check replyBox.isSome()
|
||||
|
||||
threadTitle.get().sendKeys("This is a thread title!")
|
||||
replyBox.get().sendKeys("This is content.")
|
||||
|
||||
createThreadBtn.get().click()
|
||||
|
||||
waitForLoad(session)
|
||||
|
||||
let newThreadTitle = session.findElement("#thread-title")
|
||||
check newThreadTitle.isSome()
|
||||
|
||||
check newThreadTitle.get().getText() == "This is a thread title!"
|
||||
|
||||
let content = session.findElement(".original-post div.post-content")
|
||||
check content.isSome()
|
||||
|
||||
check content.get().getText() == "This is content."
|
||||
Loading…
Add table
Add a link
Reference in a new issue