Add test for category adding
This commit is contained in:
parent
d5df46823a
commit
0af291dc10
1 changed files with 76 additions and 23 deletions
|
|
@ -9,44 +9,97 @@ proc selectCategory(session: Session, name: string) =
|
|||
click "#category-selection ." & name
|
||||
|
||||
|
||||
proc categoriesTests(session: Session, baseUrl: string) =
|
||||
proc categoriesUserTests(session: Session, baseUrl: string) =
|
||||
let
|
||||
title = "Category Test"
|
||||
content = "Choosing category test"
|
||||
|
||||
with session:
|
||||
navigate baseUrl
|
||||
wait()
|
||||
login "user", "user"
|
||||
suite "user tests":
|
||||
|
||||
test "can create category thread":
|
||||
with session:
|
||||
click "#new-thread-btn"
|
||||
wait()
|
||||
|
||||
sendKeys "#thread-title", title
|
||||
|
||||
selectCategory "fun"
|
||||
|
||||
sendKeys "#reply-textarea", content
|
||||
|
||||
click "#create-thread-btn"
|
||||
wait()
|
||||
|
||||
checkText "#thread-title .category", "Fun"
|
||||
|
||||
navigate baseUrl
|
||||
wait()
|
||||
login "user", "user"
|
||||
|
||||
ensureExists title, LinkTextSelector
|
||||
setup:
|
||||
with session:
|
||||
navigate baseUrl
|
||||
wait()
|
||||
|
||||
session.logout()
|
||||
test "no category add available":
|
||||
with session:
|
||||
click "#new-thread-btn"
|
||||
wait()
|
||||
|
||||
checkIsNone "#add-category"
|
||||
|
||||
test "can create category thread":
|
||||
with session:
|
||||
click "#new-thread-btn"
|
||||
wait()
|
||||
|
||||
sendKeys "#thread-title", title
|
||||
|
||||
selectCategory "fun"
|
||||
|
||||
sendKeys "#reply-textarea", content
|
||||
|
||||
click "#create-thread-btn"
|
||||
wait()
|
||||
|
||||
checkText "#thread-title .category", "Fun"
|
||||
|
||||
navigate baseUrl
|
||||
wait()
|
||||
|
||||
ensureExists title, LinkTextSelector
|
||||
|
||||
session.logout()
|
||||
|
||||
proc categoriesAdminTests(session: Session, baseUrl: string) =
|
||||
let
|
||||
name = "Category Test"
|
||||
color = "Creating category test"
|
||||
description = "This is a description"
|
||||
|
||||
suite "admin tests":
|
||||
with session:
|
||||
navigate baseUrl
|
||||
wait()
|
||||
login "admin", "admin"
|
||||
|
||||
test "can create category":
|
||||
with session:
|
||||
click "#new-thread-btn"
|
||||
wait()
|
||||
|
||||
ensureExists "#add-category"
|
||||
|
||||
click "#add-category .plus-btn"
|
||||
wait()
|
||||
|
||||
clear "#add-category input[name='name']"
|
||||
clear "#add-category input[name='color']"
|
||||
clear "#add-category input[name='description']"
|
||||
|
||||
|
||||
sendKeys "#add-category input[name='name']", name
|
||||
sendKeys "#add-category input[name='color']", color
|
||||
sendKeys "#add-category input[name='description']", description
|
||||
|
||||
click "#add-category #add-category-btn"
|
||||
wait()
|
||||
|
||||
checkText "#category-selection .selected-category", name
|
||||
|
||||
session.logout()
|
||||
|
||||
proc test*(session: Session, baseUrl: string) =
|
||||
session.navigate(baseUrl)
|
||||
session.wait()
|
||||
|
||||
categoriesTests(session, baseUrl)
|
||||
categoriesUserTests(session, baseUrl)
|
||||
categoriesAdminTests(session, baseUrl)
|
||||
|
||||
session.navigate(baseUrl)
|
||||
session.wait()
|
||||
Loading…
Add table
Add a link
Reference in a new issue