def test_613(self): """Submit a video and add to team. http://litmus.pculture.org/show_test.cgi?id=613. """ sel = self.selenium sel.set_timeout(testvars.timeout) #login website.SiteLogIn(self,sel,testvars.siteuser,testvars.passw) #create team team = "miro"+time.strftime("%m%d%H%M%S", time.gmtime()) team_logo_path = os.path.join(testvars.MSTestVariables["DataDirectory"],"sheep.png") website.open_teams_page(self,sel) sel.click(testvars.start_team) sel.wait_for_page_to_load(testvars.timeout) website.create_team(self,sel,team,team_logo_path) #submit video sel.window_maximize() test_video_url = website.submit_random_youtube(self,sel) print test_video_url mslib.wait_for_element_present(self,sel,"css=span.sort_label strong:contains('Add video')") vid_title = sel.get_text(testvars.vid_title) #add video to team and verify values teamli = "add/video/"+team sel.click(testvars.video_add_to_team) ## sel.click_at("css=span.sort_label strong:contains('Add video')","") sel.click_at("css=a[href*='"+teamli+"']","") sel.wait_for_page_to_load(testvars.timeout) print "verifying the inital add page" if sel.is_element_present("css=.errorlist")== True: print "error adding video to team" self.fail() else: mslib.wait_for_text_present(self,sel,"Video language") sel.select("id_language", "value=en") sel.click(testvars.teams_save) sel.wait_for_page_to_load(testvars.timeout) self.assertTrue(sel.is_element_present("css=li.active a:contains('"+team+"')")) sel.click(testvars.teams_video_tab) sel.wait_for_page_to_load(testvars.timeout) print "verifying team videos list" self.assertTrue(sel.is_element_present("css=tr.video-container td a[href*='"+test_video_url+"info/']"),"test_video_url error") # self.assertTrue(sel.is_element_present("css=tr.video-container td:contains('"+vid_title[0:10]+"')"),"vid_title error") # delete the video from the team sel.click("css=td a:contains('"+vid_title[0:10]+"') +div +div +div.small.grey a.remove-video") self.failUnless(re.search(r"^Remove this video[\s\S]$", sel.get_confirmation())) # logout sel.click(testvars.WebsiteUI["Logout_Button"])
def test_507(self): """Invalid or unsupported formats http://litmus.pculture.org/show_test.cgi?id=507 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) try: #get a video and open page website.SiteLogIn(self, sel, testvars.siteuser, testvars.passw) test_video_url = website.submit_random_youtube(self, sel) print test_video_url sel.open(test_video_url) #Original is the default tab when video opened. print "1. invalid ttml" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_fakesub.xml") website.upload_subtitles(self, sel, sub_file) mslib.wait_for_element_present(self, sel, "css=p.error_list") self.assertTrue( sel.is_element_present( "css=p.error_list:contains('Can not detect file encoding')" )) sel.click("css=a.close") print "2. invalid srt" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_invalid.srt") website.upload_subtitles(self, sel, sub_file) time.sleep(5) mslib.wait_for_element_present(self, sel, "css=p.error_list") self.assertTrue( sel.is_element_present( "css=p.error_list:contains('Incorrect subtitles format')")) sel.click("css=a.close") print "3. unsupported format" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_text.txt") website.upload_subtitles(self, sel, sub_file) time.sleep(5) mslib.wait_for_element_present(self, sel, "css=p.error_list") self.assertTrue( sel.is_element_present( "css=p.error_list:contains('Incorrect format.')")) sel.click("css=a.close") finally: # check for Site Error notification and submit website.handle_error_page(self, sel, self.id())
def test_506(self): """Upload subtitle files sbv format. http://litmus.pculture.org/show_test.cgi?id=506 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) #get a video and open page try: website.SiteLogIn(self, sel, testvars.siteuser, testvars.passw) test_video_url = website.submit_random_youtube(self, sel) print test_video_url sel.open(test_video_url) #Original is the default tab when video opened. print "1. english sbv upload" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_en_subs.sbv") sub_text = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_en_subs.txt") website.upload_subtitles(self, sel, sub_file) website.verify_sub_upload(self, sel, sub_text) print "2. polish sbv upload" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_pl_subs.sbv") sub_text = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_pl_subs.txt") website.upload_subtitles(self, sel, sub_file, lang="pl") website.verify_sub_upload(self, sel, sub_text, lang="Polish") print "3. arabic sbv upload" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_ar_subs.sbv") sub_text = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_ar_subs.txt") website.upload_subtitles(self, sel, sub_file, lang="ar") website.verify_sub_upload(self, sel, sub_text, lang="Arabic") print "4. macedonian sbv upload" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_mk_subs.sbv") sub_text = os.path.join(testvars.MSTestVariables["DataDirectory"], "sg81_mk_subs.txt") website.upload_subtitles(self, sel, sub_file, lang="mk") website.verify_sub_upload(self, sel, sub_text, lang="Macedonian") finally: # check for Site Error notification and submit website.handle_error_page(self, sel, self.id())
def test_508(self): """Must login to upload subs http://litmus.pculture.org/show_test.cgi?id=508 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) #get a video and open page test_video_url = website.submit_random_youtube(self,sel) print test_video_url vid = test_video_url.split("/")[-2] sel.open("en/logout/?next=/") #verify logged out. sel.open(test_video_url) #Original is the default tab when video opened. sel.click(testvars.video_upload_subtitles) mslib.wait_for_element_present(self,sel,"css=div.msg_modal") self.assertTrue(sel.is_element_present("css=div.msg_modal a:contains('Login')")) sel.click("css=div#upload_subs-div a.close")
def test_506(self): """Upload subtitle files sbv format. http://litmus.pculture.org/show_test.cgi?id=506 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) #get a video and open page try: website.SiteLogIn(self,sel,testvars.siteuser,testvars.passw) test_video_url = website.submit_random_youtube(self,sel) print test_video_url sel.open(test_video_url) #Original is the default tab when video opened. print "1. english sbv upload" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_en_subs.sbv") sub_text = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_en_subs.txt") website.upload_subtitles(self,sel,sub_file) website.verify_sub_upload(self,sel,sub_text) print "2. polish sbv upload" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_pl_subs.sbv") sub_text = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_pl_subs.txt") website.upload_subtitles(self,sel,sub_file,lang="pl") website.verify_sub_upload(self,sel,sub_text, lang="Polish") print "3. arabic sbv upload" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_ar_subs.sbv") sub_text = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_ar_subs.txt") website.upload_subtitles(self,sel,sub_file,lang="ar") website.verify_sub_upload(self,sel,sub_text, lang="Arabic") print "4. macedonian sbv upload" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_mk_subs.sbv") sub_text = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_mk_subs.txt") website.upload_subtitles(self,sel,sub_file,lang="mk") website.verify_sub_upload(self,sel,sub_text, lang="Macedonian") finally: # check for Site Error notification and submit website.handle_error_page(self,sel,self.id())
def test_508(self): """Must login to upload subs http://litmus.pculture.org/show_test.cgi?id=508 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) #get a video and open page test_video_url = website.submit_random_youtube(self, sel) print test_video_url vid = test_video_url.split("/")[-2] sel.open("en/logout/?next=/") #verify logged out. sel.open(test_video_url) #Original is the default tab when video opened. sel.click(testvars.video_upload_subtitles) mslib.wait_for_element_present(self, sel, "css=div.msg_modal") self.assertTrue( sel.is_element_present("css=div.msg_modal a:contains('Login')")) sel.click("css=div#upload_subs-div a.close")
def test_507(self): """Invalid or unsupported formats http://litmus.pculture.org/show_test.cgi?id=507 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) try: #get a video and open page website.SiteLogIn(self,sel,testvars.siteuser,testvars.passw) test_video_url = website.submit_random_youtube(self,sel) print test_video_url sel.open(test_video_url) #Original is the default tab when video opened. print "1. invalid ttml" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_fakesub.xml") website.upload_subtitles(self,sel,sub_file) mslib.wait_for_element_present(self,sel,"css=p.error_list") self.assertTrue(sel.is_element_present("css=p.error_list:contains('Can not detect file encoding')")) sel.click("css=a.close") print "2. invalid srt" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_invalid.srt") website.upload_subtitles(self,sel,sub_file) time.sleep(5) mslib.wait_for_element_present(self,sel,"css=p.error_list") self.assertTrue(sel.is_element_present("css=p.error_list:contains('Incorrect subtitles format')")) sel.click("css=a.close") print "3. unsupported format" sub_file = os.path.join(testvars.MSTestVariables["DataDirectory"],"sg81_text.txt") website.upload_subtitles(self,sel,sub_file) time.sleep(5) mslib.wait_for_element_present(self,sel,"css=p.error_list") self.assertTrue(sel.is_element_present("css=p.error_list:contains('Incorrect format.')")) sel.click("css=a.close") finally: # check for Site Error notification and submit website.handle_error_page(self,sel,self.id())
def test_613(self): """Submit a video and add to team. http://litmus.pculture.org/show_test.cgi?id=613. """ sel = self.selenium sel.set_timeout(testvars.timeout) #login website.SiteLogIn(self, sel, testvars.siteuser, testvars.passw) #create team team = "miro" + time.strftime("%m%d%H%M%S", time.gmtime()) team_logo_path = os.path.join( testvars.MSTestVariables["DataDirectory"], "sheep.png") website.open_teams_page(self, sel) sel.click(testvars.start_team) sel.wait_for_page_to_load(testvars.timeout) website.create_team(self, sel, team, team_logo_path) #submit video sel.window_maximize() test_video_url = website.submit_random_youtube(self, sel) print test_video_url mslib.wait_for_element_present( self, sel, "css=span.sort_label strong:contains('Add video')") vid_title = sel.get_text(testvars.vid_title) #add video to team and verify values teamli = "add/video/" + team sel.click(testvars.video_add_to_team) ## sel.click_at("css=span.sort_label strong:contains('Add video')","") sel.click_at("css=a[href*='" + teamli + "']", "") sel.wait_for_page_to_load(testvars.timeout) print "verifying the inital add page" if sel.is_element_present("css=.errorlist") == True: print "error adding video to team" self.fail() else: mslib.wait_for_text_present(self, sel, "Video language") sel.select("id_language", "value=en") sel.click(testvars.teams_save) sel.wait_for_page_to_load(testvars.timeout) self.assertTrue( sel.is_element_present("css=li.active a:contains('" + team + "')")) sel.click(testvars.teams_video_tab) sel.wait_for_page_to_load(testvars.timeout) print "verifying team videos list" self.assertTrue( sel.is_element_present("css=tr.video-container td a[href*='" + test_video_url + "info/']"), "test_video_url error") # self.assertTrue(sel.is_element_present("css=tr.video-container td:contains('"+vid_title[0:10]+"')"),"vid_title error") # delete the video from the team sel.click("css=td a:contains('" + vid_title[0:10] + "') +div +div +div.small.grey a.remove-video") self.failUnless( re.search(r"^Remove this video[\s\S]$", sel.get_confirmation())) # logout sel.click(testvars.WebsiteUI["Logout_Button"])