def test_741(self): """widgetizer on MC site html5 mp4. http://litmus.pculture.org/show_test.cgi?id=741 Video with widget embedded on Miro Community test page. """ print self.shortDescription() sel = self.selenium mc_page = "widgetizer_tests" test_page = selvars.set_unisubs_mc_page(self,mc_page) sel.open(test_page) sel.wait_for_page_to_load(testvars.timeout) mslib.wait_for_element_present(self, sel,"body#video_page div.unisubs-videoTab:nth-child(2) > a.unisubs-subtitleMeLink span.unisubs-tabTextchoose") time.sleep(3) sel.get_eval('this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[1].openMenu()') time.sleep(2) if sel.is_element_present(testvars.WebsiteUI["AddSubtitles_menuitem"]) == True: print "has subtitles - edit and revert" subtextfile = "subs.txt" orig_rev = store_subs(self,sel) sel.open(test_page) sel.wait_for_page_to_load(testvars.timeout) mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(3) sel.get_eval('this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[1].openMenu()') widget.starter_dialog_edit_orig(self,sel) edit_subs(self,sel,orig_rev,subtextfile) else: make_new_subs(self,sel,subtextfile)
def test_623(self): """offsite widget on MC site. video url: http://www.youtube.com/watch?v=FNEImAIM4L4 http://litmus.pculture.org/show_test.cgi?id=623 Video with widget embedded on Miro Community test page. """ mc_page = "hunter" vid_pos = "css=p.pElementTest span span.unisubs-widget div.unisubs-videoTab a span.unisubs-tabTextchoose" vid_title = "hunter.s.thompson.avi" print self.shortDescription() sel = self.selenium test_page = selvars.set_unisubs_mc_page(self,mc_page) sel.open(test_page) sel.wait_for_page_to_load(testvars.timeout) mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(3) sel.get_eval('this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[0].openMenu()') time.sleep(2) if sel.is_element_present(testvars.WebsiteUI["AddSubtitles_menuitem"]) == True: print "has subtitles - edit and revert" subtextfile = "subs.txt" orig_rev = store_subs(self,sel) sel.open(test_page) sel.wait_for_page_to_load(testvars.timeout) mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(3) sel.get_eval('this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[0].openMenu()') widget.starter_dialog_edit_orig(self,sel) edit_subs(self,sel,orig_rev,subtextfile) else: make_new_subs(self,sel,subtextfile)
def test_623(self): """offsite widget on MC site. video url: http://www.youtube.com/watch?v=FNEImAIM4L4 http://litmus.pculture.org/show_test.cgi?id=623 Video with widget embedded on Miro Community test page. """ mc_page = "hunter" vid_pos = "css=p.pElementTest span span.unisubs-widget div.unisubs-videoTab a span.unisubs-tabTextchoose" vid_title = "hunter.s.thompson.avi" print self.shortDescription() sel = self.selenium test_page = selvars.set_unisubs_mc_page(self, mc_page) sel.open(test_page) sel.wait_for_page_to_load(testvars.timeout) mslib.wait_for_element_present(self, sel, testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(3) sel.get_eval("this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[0].openMenu()") time.sleep(2) if sel.is_element_present(testvars.WebsiteUI["AddSubtitles_menuitem"]) == True: print "has subtitles - edit and revert" subtextfile = "subs.txt" orig_rev = store_subs(self, sel) sel.open(test_page) sel.wait_for_page_to_load(testvars.timeout) mslib.wait_for_element_present(self, sel, testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(3) sel.get_eval("this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[0].openMenu()") widget.starter_dialog_edit_orig(self, sel) edit_subs(self, sel, orig_rev, subtextfile) else: make_new_subs(self, sel, subtextfile)
def test_689(self): """Pagedemo New York Times video 1 - edit original subs http://litmus.pculture.org/show_test.cgi?id=689 """ test_id = 689 sel = self.selenium testpage = "/pagedemo/nytimes_youtube_embed" subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"],"OctopusGarden.txt") sel.open(testpage) sel.wait_for_page_to_load(testvars.timeout) sel.window_maximize() mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(5) sel.get_eval('this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[0].openMenu()') widget.starter_dialog_edit_orig(self,sel) widget.goto_step(self,sel,step="2") widget.edit_text(self,sel,subtextfile) #Login if sel.is_element_present("css=div div.unisubs-needLogin a"): sel.click("css=div div.unisubs-needLogin a") mslib.wait_for_element_present(self,sel,"css=.unisubs-modal-login") sel.click("css=.unisubs-log") widget.site_login_auth(self,sel) sel.select_window("null") widget.submit_sub_edits(self,sel,offsite=True)
def test_486(self): """Revisions - edit subtitles timing and verify in history table. http://litmus.pculture.org/show_test.cgi?id=486 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) sel.open("/") subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"], "OctopusGarden.txt") print "submitting a youtube video, format: " vid_url = offsite.get_youtube_video_url(self) # Submit Video print "logging in and submitting video" website.SiteLogIn(self, sel, testvars.siteuser, testvars.passw) website.submit_video(self, sel, vid_url) # Verify embed and player print "verifying embed" unisubs_url = website.verify_submitted_video(self, sel, vid_url, embed_type="youtube") # Start sub widget print "starting sub widget" website.start_sub_widget(self, sel) # Transcribe print "transcribing video" widget.transcribe_video(self, sel, subtextfile) # Sync print "syncing video" widget.sync_video(self, sel, subtextfile) # Review print "review step - just submitting video" widget.submit_sub_edits(self, sel) mslib.wait_for_element_present(self, sel, testvars.video_video_info) sel.select_frame("relative=top") sel.click(testvars.video_original) sel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) # Verify subtitles website.verify_subs(self, sel, subtextfile) sel.click(testvars.video_add_translation) widget.starter_dialog_edit_orig(self, sel) widget.goto_step(self, sel, "2") widget.resync_video(self, sel, subtextfile) widget.submit_sub_edits(self, sel) time.sleep(2) sel.select_frame("relative=top") # Click History tab sel.click(testvars.video_original) sel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) sel.click(testvars.history_tab) rev_num = website.get_current_rev(self, sel) website.verify_latest_history(self, sel, rev=str(rev_num), user="******", tm="100%", text="0%") website.admin_delete_video(self, sel, unisubs_url)
def test_693(self): """Launch widget from Teams page. Currently testing on al-jazeera teams page. """ sel = self.selenium sel.set_timeout(testvars.timeout) #login website.SiteLogIn(self, sel, testvars.siteuser, testvars.passw) team = "al-jazeera" subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"], "OctopusGarden.txt") #Edit original language print "testing edit original lang" sel.open("/teams/" + team) sel.wait_for_page_to_load(testvars.timeout) # website.teampage_lang_select(self,sel) mslib.wait_for_element_present(self, sel, testvars.vid_add_subs_button) sel.click(testvars.vid_add_subs_button) time.sleep(5) widget.starter_dialog_edit_orig(self, sel) widget.transcribe_video(self, sel, subtextfile) widget.close_sub_widget(self, sel) #Edit translation print "testing edit translation" sel.open("/teams/" + team) sel.wait_for_page_to_load(testvars.timeout) # website.teampage_lang_select(self,sel) mslib.wait_for_element_present(self, sel, testvars.vid_add_subs_button) sel.click(testvars.vid_add_subs_button) time.sleep(5) widget.starter_dialog_translate_from_orig(self, sel, to_lang='hr') widget.edit_translation(self, sel, subtextfile) widget.close_sub_widget(self, sel) #New fork print "testing new fork" sel.open("teams/" + team) sel.wait_for_page_to_load(testvars.timeout) # website.teampage_lang_select(self,sel) mslib.wait_for_element_present(self, sel, testvars.vid_add_subs_button) sel.click(testvars.vid_add_subs_button) time.sleep(5) widget.starter_dialog_fork(self, sel, to_lang='pl') print "transcribing video" widget.transcribe_video(self, sel, subtextfile) # Sync print "syncing video" widget.sync_video(self, sel, subtextfile, 3, 4) # Review print "review step - just submitting video" widget.submit_sub_edits(self, sel, offsite=True)
def test_693(self): """Launch widget from Teams page. Currently testing on al-jazeera teams page. """ sel = self.selenium sel.set_timeout(testvars.timeout) #login website.SiteLogIn(self,sel,testvars.siteuser,testvars.passw) team = "al-jazeera" subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"],"OctopusGarden.txt") #Edit original language print "testing edit original lang" sel.open("/teams/"+team) sel.wait_for_page_to_load(testvars.timeout) # website.teampage_lang_select(self,sel) mslib.wait_for_element_present(self,sel,testvars.vid_add_subs_button) sel.click(testvars.vid_add_subs_button) time.sleep(5) widget.starter_dialog_edit_orig(self,sel) widget.transcribe_video(self,sel,subtextfile) widget.close_sub_widget(self,sel) #Edit translation print "testing edit translation" sel.open("/teams/"+team) sel.wait_for_page_to_load(testvars.timeout) # website.teampage_lang_select(self,sel) mslib.wait_for_element_present(self,sel,testvars.vid_add_subs_button) sel.click(testvars.vid_add_subs_button) time.sleep(5) widget.starter_dialog_translate_from_orig(self,sel,to_lang='hr') widget.edit_translation(self,sel,subtextfile) widget.close_sub_widget(self,sel) #New fork print "testing new fork" sel.open("teams/"+team) sel.wait_for_page_to_load(testvars.timeout) # website.teampage_lang_select(self,sel) mslib.wait_for_element_present(self,sel,testvars.vid_add_subs_button) sel.click(testvars.vid_add_subs_button) time.sleep(5) widget.starter_dialog_fork(self,sel,to_lang='pl') print "transcribing video" widget.transcribe_video(self,sel,subtextfile) # Sync print "syncing video" widget.sync_video(self,sel,subtextfile,3,4) # Review print "review step - just submitting video" widget.submit_sub_edits(self,sel,offsite=True)
def start_sub_widget(self, sel, skip="True", edit_type='orig', sec_lang=None, login=False): """Start the Subtitle Widget using the Subtitle Me menu. This will handle the language choice for demo or submitted videos. skip is set to true by default and gets passed to widget.close_howto_video to prevent further how-to video displays. Choice for edit_type: orig, trans_orig, trans_other (requires sec_lang), forkit. Pre-condition: On a page where the widget is present. Video with or without subs. Post-condition: the widget is launched and you will be on step 1 or Edit step """ sel.window_maximize() mslib.wait_for_element_present(self, sel, testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(5) sel.click(testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(5) if sel.is_element_present(testvars.WidgetUI["Select_language"]) == False: if sel.is_element_present(testvars.WebsiteUI["AddSubtitles_menuitem"]): sel.click(testvars.WebsiteUI["AddSubtitles_menuitem"]) elif sel.is_element_present( testvars.WebsiteUI['NewTranslation_menuitem']): sel.click(testvars.WebsiteUI["AddSubtitles_menuitem"]) else: print "widget opened" widget.close_howto_video(self, sel) mslib.wait_for_element_present(self, sel, "css=.unisubs-help-heading") time.sleep(5) if sel.is_element_present(testvars.WidgetUI["Select_language"]): if edit_type == 'orig': widget.starter_dialog_edit_orig(self, sel) elif edit_type == 'trans_orig': widget.starter_dialog_translate_from_orig(self, sel) elif edit_type == 'trans_other': if sec_lang == None: self.fail("must provide from lang code in sec_lang") else: widget.starter_dialog_translate_from_not_orig( self, sel, from_lang=sec_lang) elif edit_type == 'forkit': widget.starter_dialog_fork(self, sel) else: print "not sure what I'm doing in started dialog" else: print "widget opened immediately" widget.close_howto_video(self, sel) mslib.wait_for_element_present(self, sel, "css=.unisubs-help-heading")
def test_602(self): """Revisions - edit subtitles text and verify in history table. http://litmus.pculture.org/show_test.cgi?id=602 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) sel.open("/") subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"],"OctopusGarden.txt") print "submitting a youtube video, format: " vid_url = offsite.get_youtube_video_url(self) # Submit Video print "logging in and submitting video" website.SiteLogIn(self,sel,testvars.siteuser,testvars.passw) website.submit_video(self,sel,vid_url) # Verify embed and player print "verifying embed" website.verify_submitted_video(self,sel,vid_url,embed_type="youtube") # Start sub widget print "starting sub widget" time.sleep(5) website.start_sub_widget(self,sel) # Transcribe print "transcribing video" widget.transcribe_video(self,sel,subtextfile) # Sync print "syncing video" widget.sync_video(self,sel,subtextfile) # Review print "review step - just submitting video" widget.submit_sub_edits(self,sel) #Website verify subs sel.select_frame("relative=top") sel.click(testvars.video_original) website.verify_subs(self,sel,subtextfile) sel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) #Edit subtitles sel.click(testvars.video_add_translation) widget.starter_dialog_edit_orig(self,sel) widget.goto_step(self,sel,"3") widget.edit_text(self,sel,subtextfile) widget.submit_sub_edits(self,sel) time.sleep(2) sel.select_frame("relative=top") # Click Original language then History tab sel.click(testvars.video_original) sel.wait_for_page_to_load(testvars.timeout) sel.click(testvars.history_tab) rev_num = website.get_current_rev(self,sel) website.verify_latest_history(self,sel,rev=str(rev_num),user="******",tm="0%",text="100%")
def start_sub_widget(self,sel,skip="True",edit_type='orig',sec_lang=None,login=False): """Start the Subtitle Widget using the Subtitle Me menu. This will handle the language choice for demo or submitted videos. skip is set to true by default and gets passed to widget.close_howto_video to prevent further how-to video displays. Choice for edit_type: orig, trans_orig, trans_other (requires sec_lang), forkit. Pre-condition: On a page where the widget is present. Video with or without subs. Post-condition: the widget is launched and you will be on step 1 or Edit step """ sel.window_maximize() mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(5) sel.click(testvars.WebsiteUI["SubtitleMe_menu"]) time.sleep(5) if sel.is_element_present(testvars.WidgetUI["Select_language"]) == False: if sel.is_element_present(testvars.WebsiteUI["AddSubtitles_menuitem"]): sel.click(testvars.WebsiteUI["AddSubtitles_menuitem"]) elif sel.is_element_present(testvars.WebsiteUI['NewTranslation_menuitem']): sel.click(testvars.WebsiteUI["AddSubtitles_menuitem"]) else: print "widget opened" widget.close_howto_video(self,sel) mslib.wait_for_element_present(self,sel,"css=.unisubs-help-heading") time.sleep(5) if sel.is_element_present(testvars.WidgetUI["Select_language"]): if edit_type == 'orig': widget.starter_dialog_edit_orig(self,sel) elif edit_type == 'trans_orig': widget.starter_dialog_translate_from_orig(self,sel) elif edit_type == 'trans_other': if sec_lang == None: self.fail("must provide from lang code in sec_lang") else: widget.starter_dialog_translate_from_not_orig(self,sel,from_lang=sec_lang) elif edit_type == 'forkit': widget.starter_dialog_fork(self,sel) else: print "not sure what I'm doing in started dialog" else: print "widget opened immediately" widget.close_howto_video(self,sel) mslib.wait_for_element_present(self,sel,"css=.unisubs-help-heading")
def make_new_subs(self,sel,subtextfile): print "make new subs" time.sleep(3) widget.starter_dialog_edit_orig(self,sel) # Transcribe widget.transcribe_video(self,sel,subtextfile) # Sync widget.sync_video(self,sel,subtextfile,2,3) #Login time.sleep(3) sel.click("css=div.unisubs-needLogin a") sel.click("css=.unisubs-log") widget.site_login_auth(self,sel) sel.select_window("null") # Review widget.submit_sub_edits(self,sel,offsite=True) mslib.wait_for_element_present(self,sel,testvars.offsite_goto_subs) sel.click(testvars.offsite_goto_site) sel.wait_for_page_to_load(testvars.timeout)