-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtestcases_submit.py
352 lines (318 loc) · 17.6 KB
/
testcases_submit.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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
#=======================================================================
#
# SUBMIT VIDEO TESTS
#
#=======================================================================
#
# Includes the following test cases:
# 1. TestCase_SubmitVideoAsAdmin_471
# 2. TestCase_SubmitVideoAsLoggedUser_472
# 3. TestCase_SubmitVideoAsUnloggedUser_473
# 4. TestCase_SubmitVideoFromAdminPage_474
# 5. TestCase_SubmitDuplicateVideo_475
# 6. TestCase_SubmitVideoWithEmbedCode_476
from selenium import selenium
import unittest, time, re, loginlogout, sitesettings, testvars, queue, submitvideos
import sys
# ----------------------------------------------------------------------
class TestCase_SubmitVideoAsAdmin_471(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()
def test_SubmitVideoAsAdmin_471(self):
sel = self.selenium
# Log in as an Administrator
loginlogout.LogInAsAdmin(self,sel)
theme = 1
sitesettings.ChangeTheme(self,sel,theme)
# Display 'Submit a Video' button on front page
sitesettings.DisplaySubmitVideo(self,sel,theme)
# Set video parameters
testVideoURL = "http://www.youtube.com/watch?v=43scrCjAVHc"
testVideoTitle = "Mozilla Firefox"
titleUnicode = unicode(testVideoTitle)
# Check if the video is in the premoderation queue ("Unapproved")
# If yes, reject it
queue.RejectVideoFromQueue(self,sel,titleUnicode)
# Navigate to the front page
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
for theme in range(1,2):
print ""
print "The current theme is "+str(theme)
# Check if the video is in the current ("Approved") set of videos
# If yes, delete it
submitvideos.RejectVideoFromApproved(self,sel,testVideoTitle)
# Set the theme
sitesettings.ChangeTheme(self,sel,theme)
# Navigate to the front page
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
# Submit a video and check the results
submitvideos.SubmitVideo(self,sel,testVideoURL,theme,"Admin") # as Admin
# 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_SubmitVideoAsLoggedUser_472(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_SubmitVideoAsLoggedUser_472(self):
sel = self.selenium
# Set video parameters
testVideoURL = "http://www.youtube.com/watch?v=MFREixTg4eI"
testVideoTitle = "Miro Video Player"
titleUnicode = unicode(testVideoTitle)
# Log in as an Administrator
loginlogout.LogInAsAdmin(self,sel)
theme = 1
sitesettings.ChangeTheme(self,sel,theme)
# Display 'Submit a Video' button on front page
sitesettings.DisplaySubmitVideo(self,sel,theme)
# Check if the video is in the premoderation queue ("Unapproved")
# If yes, reject it
queue.RejectVideoFromQueue(self,sel,titleUnicode)
# Navigate to the front page
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
# Check if the video is in the current ("Approved") set of videos
# If yes, delete it
submitvideos.RejectVideoFromApproved(self,sel,testVideoTitle)
for theme in range(1,2):
print ""
print "The current theme is "+str(theme)
# Set the theme
sitesettings.ChangeTheme(self,sel,theme)
# Navigate to the front page
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
# Log out
loginlogout.LogOut(self,sel)
# Log in as User
loginlogout.LogInAsUser(self,sel)
# Submit a video and check the results
submitvideos.SubmitVideo(self, sel, testVideoURL, theme, "LoggedUser") # as Admin
# Log out
loginlogout.LogOut(self,sel)
# Log in as Administrator
loginlogout.LogInAsAdmin(self,sel)
# Check if the video is in the premoderation queue ("Unapproved")
# If yes, reject it
queue.RejectVideoFromQueue(self,sel,titleUnicode)
# 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_SubmitVideoAsUnloggedUser_473(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_SubmitVideoAsUnloggedUser_473(self):
sel = self.selenium
# Log in as an Administrator
loginlogout.LogInAsAdmin(self,sel)
theme = 1
sitesettings.ChangeTheme(self,sel,theme)
# Check 'Require Login to Submit Video' on site settings page
sitesettings.UncheckRequireLoginToSubmitVideo(self,sel)
# Set video parameters
testVideoURL = "http://www.youtube.com/watch?v=yjdUr1CATy8"
testVideoTitle = "Go Open Source: Miro"
titleUnicode = unicode(testVideoTitle)
# Check if the video is in the premoderation queue ("Unapproved")
# If yes, reject it
queue.RejectVideoFromQueue(self,sel,titleUnicode)
# Navigate to the front page
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
# Check if the video is in the current ("Approved") set of videos
# If yes, delete it
submitvideos.RejectVideoFromApproved(self,sel,testVideoTitle)
for theme in range(1,2):
print ""
print "The current theme is "+str(theme)
# Set the theme
sitesettings.ChangeTheme(self,sel,theme)
# Navigate to the front page
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
# Log out
loginlogout.LogOut(self,sel)
# Submit a video and check the results
submitvideos.SubmitVideo(self, sel, testVideoURL, theme, "UnloggedUser") # as Admin
# Log in as Administrator
loginlogout.LogInAsAdmin(self,sel)
# Check if the video is in the premoderation queue ("Unapproved")
# If yes, reject it
print titleUnicode
queue.RejectVideoFromQueue(self,sel,titleUnicode)
# 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_SubmitVideoFromAdminPage_474(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_SubmitVideoFromAdminPage_474(self):
sel = self.selenium
# Log in as an Administrator
loginlogout.LogInAsAdmin(self,sel)
theme = 0 # Admin interface
# Set video parameters
testVideoURL = "http://www.youtube.com/watch?v=QIQwMwesb0w"
testVideoTitle = "Miro Demo"
titleUnicode = unicode(testVideoTitle)
# Check if the video is in the premoderation queue ("Unapproved")
# If yes, reject it
queue.RejectVideoFromQueue(self,sel,titleUnicode)
# Navigate to the front page
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
# Check if the video is in the current ("Approved") set of videos
# If yes, delete it
submitvideos.RejectVideoFromApproved(self,sel,testVideoTitle)
# Submit a video and check the results
submitvideos.SubmitVideo(self, sel, testVideoURL, theme, "Admin") # as Admin
# 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_SubmitDuplicateVideo_475(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()
def ChangeThemeAndSubmitDuplicateVideo(self,sel,theme,testVideoURL):
print "Changing theme "+str(theme)
sitesettings.ChangeTheme(self,sel,theme)
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
loginlogout.LogOut(self,sel)
# Submit a video and check the results
submitvideos.SubmitDuplicateVideo(self, sel, testVideoURL, theme)
loginlogout.LogInAsAdmin(self,sel)
# The user actions executed in the test scenario
def test_SubmitDuplicateVideo_475(self):
sel = self.selenium
# Log in as an Administrator
loginlogout.LogInAsAdmin(self,sel)
theme = 1 # List theme
sitesettings.ChangeTheme(self,sel,theme)
sitesettings.UncheckRequireLoginToSubmitVideo(self,sel)
# Set video parameters
testVideoURL = "http://www.youtube.com/watch?v=QIQwMwesb0w"
testVideoTitle = "Miro Demo"
titleUnicode = unicode(testVideoTitle)
# Check if the video is in the premoderation queue ("Unapproved")
print "Looking for the video "+testVideoTitle+" in the premoderation queue"
if queue.FindVideoInQueue(self,sel,testVideoTitle)!=[0,0]:
print "Found the video in the premoderation queue"
for theme in range(1,2):
TestCase_SubmitDuplicateVideo_475.ChangeThemeAndSubmitDuplicateVideo(self,sel,theme,testVideoURL)
else:
print "Could not find the video in the premoderation queue"
# Check if the video is in the current ("Approved") set of videos
if queue.CheckVideoStatus(self,sel,testVideoTitle,"Approved")==False:
print "Could not find the video among the approved videos"
self.fail("The test case demands that a copy of the video already existed in the system. Cannot continue now.")
else:
print "Found the video among the approved videos"
for theme in range(1,2):
TestCase_SubmitDuplicateVideo_475.ChangeThemeAndSubmitDuplicateVideo(self,sel,theme,testVideoURL)
# 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_SubmitVideoWithEmbedCode_476(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_SubmitVideoWithEmbedCode_476(self):
sel = self.selenium
# Log in as an Administrator
loginlogout.LogInAsAdmin(self,sel)
theme = 1 # List theme
role = "Admin"
sitesettings.ChangeTheme(self,sel,theme)
# Display 'Submit a Video' button on front page
sitesettings.DisplaySubmitVideo(self,sel,theme)
# sitesettings.UncheckRequireLoginToSubmitVideo(self,sel)
# Set video parameters
testVideoURL = "http://www.veoh.com/browse/videos/category/technology/watch/v6574185k5jF5K4E"
testVideoTitle = "Veoh Video for Test"
testVideoEmbedCode = r'<object width="410" height="341" id="veohFlashPlayer" name="veohFlashPlayer"><param name="movie" '
testVideoEmbedCode = testVideoEmbedCode + r'value="http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version='
testVideoEmbedCode = testVideoEmbedCode + r'AFrontend.5.5.2.1048&permalinkId=v6574185k5jF5K4E&player=videodetailsembedded&'
testVideoEmbedCode = testVideoEmbedCode + r'videoAutoPlay=0&id=anonymous"></param><param name="allowFullScreen" value="true">'
testVideoEmbedCode = testVideoEmbedCode + r'</param><param name="allowscriptaccess" value="always"></param><embed '
testVideoEmbedCode = testVideoEmbedCode + r'src="http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version='
testVideoEmbedCode = testVideoEmbedCode + r'AFrontend.5.5.2.1048&permalinkId=v6574185k5jF5K4E&player=videodetailsembedded&'
testVideoEmbedCode = testVideoEmbedCode + r'videoAutoPlay=0&id=anonymous" type="application/x-shockwave-flash" allowscriptaccess="always"'
testVideoEmbedCode = testVideoEmbedCode + r'allowfullscreen="true" width="410" height="341" id="veohFlashPlayerEmbed"'
testVideoEmbedCode = testVideoEmbedCode + r' name="veohFlashPlayerEmbed"></embed></object><br /><font size="1">Watch '
testVideoEmbedCode = testVideoEmbedCode + r'<a href="http://www.veoh.com/browse/videos/category/technology/watch/v6574185k5jF5K4E">'
testVideoEmbedCode = testVideoEmbedCode + r'Online Video Distribution Miro Co-Branded Player Offer</a> in '
testVideoEmbedCode = testVideoEmbedCode + r'<a href="http://www.veoh.com/browse/videos/category/technology">Technology'
testVideoEmbedCode = testVideoEmbedCode + r'</a> | View More <a href="http://www.veoh.com">Free Videos Online at Veoh.com'
testVideoEmbedCode = testVideoEmbedCode + r'</a></font>'
testVideoThumbfile = '' #r'D:\TestInput\background1.jpg'
testVideoThumbURL = 'http://ll-appserver.veoh.com/images/veoh.gif?version=AFrontend.5.5.2.1055'
testVideoDescription = 'test description for a Veoh video with embed code'
testVideoTags = 'test veoh'
titleUnicode = unicode(testVideoTitle)
# Check if the video is in the premoderation queue ("Unapproved")
# If yes, reject it
queue.RejectVideoFromQueue(self,sel,titleUnicode)
# Navigate to the front page
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
for theme in range(1,2):
print ""
print "The current theme is "+str(theme)
# Check if the video is in the current ("Approved") set of videos
# If yes, delete it
submitvideos.RejectVideoFromApproved(self,sel,testVideoTitle)
# Set the theme
sitesettings.ChangeTheme(self,sel,theme)
# Navigate to the front page
# sel.click(testvars.MCTestVariables["ViewMainSiteLink"])
sel.open(testvars.MCTestVariables["TestSite"])
sel.wait_for_page_to_load(testvars.MCTestVariables["TimeOut"])
# Submit a video and check the results
submitvideos.SubmitVideoWithEmbed(self,sel,testVideoURL,testVideoTitle,testVideoEmbedCode,testVideoThumbfile,testVideoThumbURL,testVideoDescription,testVideoTags, theme, role)
# 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)