Add test for category adding
This commit is contained in:
parent
d5df46823a
commit
0af291dc10
1 changed files with 76 additions and 23 deletions
|
|
@ -9,16 +9,30 @@ proc selectCategory(session: Session, name: string) =
|
||||||
click "#category-selection ." & name
|
click "#category-selection ." & name
|
||||||
|
|
||||||
|
|
||||||
proc categoriesTests(session: Session, baseUrl: string) =
|
proc categoriesUserTests(session: Session, baseUrl: string) =
|
||||||
let
|
let
|
||||||
title = "Category Test"
|
title = "Category Test"
|
||||||
content = "Choosing category test"
|
content = "Choosing category test"
|
||||||
|
|
||||||
|
suite "user tests":
|
||||||
|
|
||||||
with session:
|
with session:
|
||||||
navigate baseUrl
|
navigate baseUrl
|
||||||
wait()
|
wait()
|
||||||
login "user", "user"
|
login "user", "user"
|
||||||
|
|
||||||
|
setup:
|
||||||
|
with session:
|
||||||
|
navigate baseUrl
|
||||||
|
wait()
|
||||||
|
|
||||||
|
test "no category add available":
|
||||||
|
with session:
|
||||||
|
click "#new-thread-btn"
|
||||||
|
wait()
|
||||||
|
|
||||||
|
checkIsNone "#add-category"
|
||||||
|
|
||||||
test "can create category thread":
|
test "can create category thread":
|
||||||
with session:
|
with session:
|
||||||
click "#new-thread-btn"
|
click "#new-thread-btn"
|
||||||
|
|
@ -42,11 +56,50 @@ proc categoriesTests(session: Session, baseUrl: string) =
|
||||||
|
|
||||||
session.logout()
|
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) =
|
proc test*(session: Session, baseUrl: string) =
|
||||||
session.navigate(baseUrl)
|
session.navigate(baseUrl)
|
||||||
session.wait()
|
session.wait()
|
||||||
|
|
||||||
categoriesTests(session, baseUrl)
|
categoriesUserTests(session, baseUrl)
|
||||||
|
categoriesAdminTests(session, baseUrl)
|
||||||
|
|
||||||
session.navigate(baseUrl)
|
session.navigate(baseUrl)
|
||||||
session.wait()
|
session.wait()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue