forked from pculture/mirocommunity-testing
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestcases_queue.py
280 lines (233 loc) · 11.3 KB
/
testcases_queue.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#=======================================================================
#
# REVIEW QUEUE TESTS
#
#=======================================================================
#
# Includes the following test cases:
# 1. TestCase_ApproveVideo
# 2. TestCase_FeatureVideo
# 3. TestCase_RejectVideo
# 4. TestCase_ApprovePage
# 5. TestCase_RejectPage
# 6. TestCase_ClearQueue
# 7. TestCase_EditVideoInQueue
# 8. TestCase_RSSVideosAwaitingModeration
from selenium import selenium
import unittest, time, re, sys
import mclib, loginlogout, queue, sitesettings, testvars
# ----------------------------------------------------------------------
class TestCase_ApproveVideo(unittest.TestCase):
# Open the desired browser and set up the test
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", testvars.MCTestVariables["Port"], testvars.MCTestVariables["Browser"], testvars.MCTestVariables["TestSite"])
self.selenium.start()
# The user actions executed in the test scenario
def test_ApproveVideo(self):
sel = self.selenium
loginlogout.LogInAsAdmin(self,sel)
page = "Last"
number = 1
queue.ProcessVideo(self,sel,page,number,"Approved")
# Close the browser, log errors, perform cleanup
def tearDown(self):
self.selenium.stop()
# the command on the previous line should close the browser
self.assertEqual([], self.verificationErrors)
class TestCase_FeatureVideo(unittest.TestCase):
# Open the desired browser and set up the test
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", testvars.MCTestVariables["Port"], testvars.MCTestVariables["Browser"], testvars.MCTestVariables["TestSite"])
self.selenium.start()
# The user actions executed in the test scenario
def test_FeatureVideo(self):
sel = self.selenium
loginlogout.LogInAsAdmin(self,sel)
page = "1"
number = 1
queue.ProcessVideo(self,sel,page,number,"Featured")
# Close the browser, log errors, perform cleanup
def tearDown(self):
self.selenium.stop()
# the command on the previous line should close the browser
self.assertEqual([], self.verificationErrors)
class TestCase_RejectVideo(unittest.TestCase):
# Open the desired browser and set up the test
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", testvars.MCTestVariables["Port"], testvars.MCTestVariables["Browser"], testvars.MCTestVariables["TestSite"])
self.selenium.start()
# The user actions executed in the test scenario
def test_RejectVideo(self):
sel = self.selenium
loginlogout.LogInAsAdmin(self,sel)
page = "1"
number = 1
queue.ProcessVideo(self,sel,page,number,"Rejected")
# Close the browser, log errors, perform cleanup
def tearDown(self):
self.selenium.stop()
# the command on the previous line should close the browser
self.assertEqual([], self.verificationErrors)
class TestCase_ApprovePage(unittest.TestCase):
# Open the desired browser and set up the test
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", testvars.MCTestVariables["Port"], testvars.MCTestVariables["Browser"], testvars.MCTestVariables["TestSite"])
self.selenium.start()
# The user actions executed in the test scenario
def test_ApprovePage(self):
sel = self.selenium
loginlogout.LogInAsAdmin(self,sel)
page = "1"
queue.ApproveVideoPage(self,sel,page)
# Close the browser, log errors, perform cleanup
def tearDown(self):
self.selenium.stop()
# the command on the previous line should close the browser
self.assertEqual([], self.verificationErrors)
class TestCase_RejectPage(unittest.TestCase):
# Open the desired browser and set up the test
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", testvars.MCTestVariables["Port"], testvars.MCTestVariables["Browser"], testvars.MCTestVariables["TestSite"])
self.selenium.start()
# The user actions executed in the test scenario
def test_RejectPage(self):
sel = self.selenium
loginlogout.LogInAsAdmin(self,sel)
page = "1"
videosRejected = queue.RejectVideoPage(self,sel,page)
# Check that videos were rejected
print "Checking that videos were successfully rejected..."
# At present, it is technically impossible to check the status for
# every video on the rejected page because of an issue with
# Bulk Edit page (5 or 6 are the viable limit)
# As a temporary solution until the issue is resolved,
# just three videos will be checked - the first, the last, and one
# from the middle
print "Looking up the following videos:"
videosToCheck = [videosRejected[0],videosRejected[4],videosRejected[9]]
print videosToCheck
# Searching each selected video in the list of Rejected videos
# on Bulk Edit page
for item in videosToCheck:
if item!="None":
newResult=queue.CheckVideoStatus(self,sel,item,"Rejected")
print item+"__________"+str(newResult)
if newResult==False:
mclib.AppendErrorMessage(self,sel,"Could not find video "+item+" in the list of rejected videos.")
sel.click(testvars.MCUI["AdminReviewQueue"])
sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
theme = sitesettings.ThemeScanner(self,sel)
if theme==4:
sel.click(testvars.MCTestVariables["ViewAdminBlueTheme"])
else:
sel.click(testvars.MCTestVariables["ViewAdmin"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
else:
print "None__________None"
# Close the browser, log errors, perform cleanup
def tearDown(self):
self.selenium.stop()
# the command on the previous line should close the browser
self.assertEqual([], self.verificationErrors)
class TestCase_ClearQueue(unittest.TestCase):
# Open the desired browser and set up the test
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", testvars.MCTestVariables["Port"], testvars.MCTestVariables["Browser"], testvars.MCTestVariables["TestSite"])
self.selenium.start()
# The user actions executed in the test scenario
def test_ClearQueue(self):
sel = self.selenium
loginlogout.LogInAsAdmin(self,sel)
# Memorizing
videosRejected = queue.ClearQueue(self,sel)
# Check that videos were rejected
print "Checking that videos were successfully rejected..."
# At present, it is technically impossible to check the status for
# every video on the rejected page because of an issue with
# Bulk Edit page (5 or 6 are the viable limit)
# As a temporary solution until the issue is resolved,
# just three videos will be checked - the first, the last, and one
# from the middle
print "Looking up the following videos:"
last = len(videosRejected)-1
videosToCheck = [videosRejected[0],videosRejected[last/2],videosRejected[last]]
print videosToCheck
# Searching each selected video in the list of Rejected videos
# on Bulk Edit page
for item in videosToCheck:
if item!="None":
newResult=queue.CheckVideoStatus(self,sel,item,"Rejected")
print item+"__________"+str(newResult)
if newResult==False:
mclib.AppendErrorMessage(self,sel,"Could not find video "+item+" in the list of rejected videos.")
sel.click(testvars.MCUI["AdminReviewQueue"])
sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
theme = sitesettings.ThemeScanner(self,sel)
if theme==4:
sel.click(testvars.MCTestVariables["ViewAdminBlueTheme"])
else:
sel.click(testvars.MCTestVariables["ViewAdmin"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
else:
print "None__________None"
# Close the browser, log errors, perform cleanup
def tearDown(self):
self.selenium.stop()
# the command on the previous line should close the browser
self.assertEqual([], self.verificationErrors)
class TestCase_EditVideoInQueue(unittest.TestCase):
# Open the desired browser and set up the test
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", testvars.MCTestVariables["Port"], testvars.MCTestVariables["Browser"], testvars.MCTestVariables["TestSite"])
self.selenium.start()
# The user actions executed in the test scenario
def test_EditVideoInQueue(self):
sel = self.selenium
loginlogout.LogInAsAdmin(self,sel)
page = "Last"
number = 1
title = "Test "+time.strftime("%d-%m-%Y %H:%M:%S", time.localtime())
user = "Selene Test-Admin"
posted = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
thumbnail = testvars.MCTestVariables["GraphicFilesDirectory"]+"\\"+"background3.jpg"
description = "Test Description"
category = "art"
tag = "test"
website = "http://www.youtube.com/watch?v=oCflnfXt4N0"
queue.EditVideoInQueue(self,sel,page,number,title,user,posted,thumbnail,description,category,tag,website)
# Close the browser, log errors, perform cleanup
def tearDown(self):
self.selenium.stop()
# the command on the previous line should close the browser
self.assertEqual([], self.verificationErrors)
class TestCase_RSSVideosAwaitingModeration(unittest.TestCase):
# Open the desired browser and set up the test
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", testvars.MCTestVariables["Port"], testvars.MCTestVariables["Browser"], testvars.MCTestVariables["TestSite"])
self.selenium.start()
# The user actions executed in the test scenario
def test_RSSVideosAwaitingModeration(self):
sel = self.selenium
loginlogout.LogInAsAdmin(self,sel)
currentLink="Unapproved RSS"
print "Clicking "+currentLink+" link"
queue.ViewRSSFeeds(self,sel,currentLink)
print ""
currentLink="Unapproved User RSS"
print "Clicking "+currentLink+" link"
queue.ViewRSSFeeds(self,sel,currentLink)
# Close the browser, log errors, perform cleanup
def tearDown(self):
self.selenium.stop()
# the command on the previous line should close the browser
self.assertEqual([], self.verificationErrors)