11import unittest, common
2-
32import webdriver
43
54let
@@ -71,6 +70,19 @@ proc userTests(session: Session, baseUrl: string) =
7170
7271 checkIsNone " #pin-btn"
7372
73+ test " cannot lock threads" :
74+ with session:
75+ navigate (baseUrl)
76+
77+ click " #new-thread-btn"
78+
79+ sendKeys " #thread-title" , " Locking"
80+ sendkeys " #reply-textarea" , " Cannot lock as an user"
81+
82+ click " #create-thread-btn"
83+
84+ checkIsNone " #lock-btn"
85+
7486 session.logout ()
7587
7688proc anonymousTests (session: Session , baseUrl: string ) =
@@ -173,7 +185,7 @@ proc adminTests(session: Session, baseUrl: string) =
173185 # Make sure the forum post is gone
174186 checkIsNone adminTitleStr, LinkTextSelector
175187
176- test " Can pin a thread" :
188+ test " can pin a thread" :
177189 with session:
178190 click " #new-thread-btn"
179191 sendKeys " #thread-title" , " Pinned post"
@@ -199,7 +211,7 @@ proc adminTests(session: Session, baseUrl: string) =
199211 checkText " #threads-list .thread-1 .thread-title a" , " Pinned post"
200212 checkText " #threads-list .thread-2 .thread-title a" , " Normal post"
201213
202- test " Can unpin a thread" :
214+ test " can unpin a thread" :
203215 with session:
204216 click " Pinned post" , LinkTextSelector
205217 click " #pin-btn"
@@ -212,6 +224,31 @@ proc adminTests(session: Session, baseUrl: string) =
212224 checkText " #threads-list .thread-1 .thread-title a" , " Normal post"
213225 checkText " #threads-list .thread-2 .thread-title a" , " Pinned post"
214226
227+ test " can lock a thread" :
228+ with session:
229+ click " Locking" , LinkTextSelector
230+ click " #lock-btn"
231+
232+ ensureExists " #thread-title i.fas.fa-lock.fa-xs"
233+
234+ test " locked thread appears on frontpage" :
235+ with session:
236+ click " #new-thread-btn"
237+ sendKeys " #thread-title" , " A new locked thread"
238+ sendKeys " #reply-textarea" , " This thread should appear locked on the frontpage"
239+ click " #create-thread-btn"
240+ click " #lock-btn"
241+
242+ navigate (baseUrl)
243+ ensureExists " #threads-list .thread-1 .thread-title i.fas.fa-lock.fa-xs"
244+
245+ test " can unlock a thread" :
246+ with session:
247+ click " Locking" , LinkTextSelector
248+ click " #lock-btn"
249+
250+ checkIsNone " #thread-title i.fas.fa-lock.fa-xs"
251+
215252 session.logout ()
216253
217254proc test * (session: Session , baseUrl: string ) =
0 commit comments