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_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 test_494(self): """Revisions - translation - invalid comparison selection http://litmus.pculture.org/show_test.cgi?id=494 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"], "OctopusGarden.txt") website.SiteLogIn(self, sel, testvars.siteuser, testvars.passw) #get a video and open page test_video_url = website.get_video_with_translations(self, sel) print test_video_url sel.open(test_video_url) language = website.get_translated_lang(self, sel) website.click_lang_tab(self, sel, language) ## if not enough revisions for comparison, edit the sub text. rev_num = website.get_current_rev(self, sel) print rev_num while rev_num < 2: print "only 2 or less revs - editing text first" #edit text sel.click(testvars.video_edit_subtitles) mslib.wait_for_element_present(self, sel, "css=div.unisubs-help-heading") if sel.is_element_present( "css=h2:contains('Editing Translation')"): widget.edit_translation(self, sel, subtextfile) else: widget.goto_step(self, sel, step="3") widget.edit_text(self, sel, subtextfile) widget.submit_sub_edits(self, sel) rev_num = website.get_current_rev(self, sel) sel.click(testvars.history_tab) row_num = 1 website.check_the_box(self, sel, row_num) #uncheck the box to start while sel.is_element_present( "//div[@id='revisions-tab']/table/tbody/tr[" + str(row_num) + "]"): website.check_the_box(self, sel, row_num) sel.click(testvars.video_compare_revisions) self.assertEqual("Select two revisions to compare, please", sel.get_alert()) website.check_the_box(self, sel, row_num) #uncheck the box row_num += 1 if row_num == 3: break
def test_492(self): """Revisions - compare translation revisions. http://litmus.pculture.org/show_test.cgi?id=492 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) website.SiteLogIn(self, sel, testvars.siteuser, testvars.passw) #get a video and open page test_video_url = website.get_video_with_translations(self, sel) print test_video_url sel.open(test_video_url) language = website.get_translated_lang(self, sel) website.click_lang_tab(self, sel, language) website.store_subs(self, sel) rev_num = website.get_current_rev(self, sel) subtextfile = "subs.txt" #If there is only 1 revision - edit the subs to make a new revision if int(rev_num) < 1: print "only 1 rev - editing text first" sel.click(testvars.video_edit_subtitles) widget.goto_step(self, sel, step="3") widget.edit_text(self, sel, subtextfile) widget.submit_sub_edits(self, sel) website.click_lang_tab(self, sel, language) sel.select_frame("relative=top") sel.click(testvars.history_tab) mslib.wait_for_element_present(self, sel, testvars.video_compare_revisions) #get the checkbox value for comparing row_num = 2 website.check_the_box(self, sel, row_num) #check the box sel.click(testvars.video_compare_revisions) website.verify_compare_revisions(self, sel, str(int(rev_num) - 1), str(rev_num)) if sel.get_value("//div[@id='revisions-tab']/table/tbody/tr[" + str(row_num) + "]/td[1]/input") == "on": website.check_the_box(self, sel, row_num) #uncheck the box #If there are more than 2 revision, test another compare if int(rev_num) > 2: row_num = 3 old_rev = int(rev_num) - 2 website.check_the_box(self, sel, row_num) sel.click(testvars.video_compare_revisions) website.verify_compare_revisions(self, sel, old_rev, str(rev_num))
def test_494(self): """Revisions - translation - invalid comparison selection http://litmus.pculture.org/show_test.cgi?id=494 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"],"OctopusGarden.txt") website.SiteLogIn(self,sel,testvars.siteuser, testvars.passw) #get a video and open page test_video_url = website.get_video_with_translations(self,sel) print test_video_url sel.open(test_video_url) language = website.get_translated_lang(self,sel) website.click_lang_tab(self,sel,language) ## if not enough revisions for comparison, edit the sub text. rev_num = website.get_current_rev(self,sel) print rev_num while rev_num < 2: print "only 2 or less revs - editing text first" #edit text sel.click(testvars.video_edit_subtitles) mslib.wait_for_element_present(self,sel,"css=div.unisubs-help-heading") if sel.is_element_present("css=h2:contains('Editing Translation')"): widget.edit_translation(self,sel,subtextfile) else: widget.goto_step(self,sel,step="3") widget.edit_text(self,sel,subtextfile) widget.submit_sub_edits(self,sel) rev_num = website.get_current_rev(self,sel) sel.click(testvars.history_tab) row_num = 1 website.check_the_box(self,sel,row_num) #uncheck the box to start while sel.is_element_present("//div[@id='revisions-tab']/table/tbody/tr["+str(row_num)+"]"): website.check_the_box(self,sel,row_num) sel.click(testvars.video_compare_revisions) self.assertEqual("Select two revisions to compare, please", sel.get_alert()) website.check_the_box(self,sel,row_num) #uncheck the box row_num += 1 if row_num == 3: break
def test_492(self): """Revisions - compare translation revisions. http://litmus.pculture.org/show_test.cgi?id=492 """ sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) website.SiteLogIn(self,sel,testvars.siteuser, testvars.passw) #get a video and open page test_video_url = website.get_video_with_translations(self,sel) print test_video_url sel.open(test_video_url) language = website.get_translated_lang(self,sel) website.click_lang_tab(self,sel,language) website.store_subs(self,sel) rev_num = website.get_current_rev(self,sel) subtextfile = "subs.txt" #If there is only 1 revision - edit the subs to make a new revision if int(rev_num) < 1: print "only 1 rev - editing text first" sel.click(testvars.video_edit_subtitles) widget.goto_step(self,sel,step="3") widget.edit_text(self,sel,subtextfile) widget.submit_sub_edits(self,sel) website.click_lang_tab(self,sel,language) sel.select_frame("relative=top") sel.click(testvars.history_tab) mslib.wait_for_element_present(self,sel,testvars.video_compare_revisions) #get the checkbox value for comparing row_num = 2 website.check_the_box(self,sel,row_num) #check the box sel.click(testvars.video_compare_revisions) website.verify_compare_revisions(self,sel,str(int(rev_num) - 1),str(rev_num)) if sel.get_value("//div[@id='revisions-tab']/table/tbody/tr["+str(row_num)+"]/td[1]/input") == "on": website.check_the_box(self,sel,row_num) #uncheck the box #If there are more than 2 revision, test another compare if int(rev_num) > 2: row_num = 3 old_rev = int(rev_num)-2 website.check_the_box(self,sel,row_num) sel.click(testvars.video_compare_revisions) website.verify_compare_revisions(self,sel,old_rev,str(rev_num))
def edit_subs(self,sel,orig_rev,subtextfile): widget.goto_step(self,sel,"2") time.sleep(3) widget.edit_text(self,sel,subtextfile) widget.site_login_from_widget_link(self,sel) widget.submit_sub_edits(self,sel,offsite=True) mslib.wait_for_element_present(self,sel,testvars.offsite_goto_subs) sel.click(testvars.offsite_goto_subs) ### sel.wait_for_page_to_load(testvars.timeout) vid_title = sel.get_text(testvars.vid_title) print " * verify edits" mslib.wait_for_element_present(self,sel,testvars.video_video_info) history_text = sel.get_text("css=tr td:nth-child(1)") print history_text sel.click(testvars.video_original) mslib.wait_for_element_present(self,sel,testvars.history_tab) sel.click(testvars.history_tab) mslib.wait_for_element_present(self,sel,testvars.video_compare_revisions)
def edit_subs(self, sel, orig_rev, subtextfile): widget.goto_step(self, sel, "2") time.sleep(3) widget.edit_text(self, sel, subtextfile) widget.site_login_from_widget_link(self, sel) widget.submit_sub_edits(self, sel, offsite=True) mslib.wait_for_element_present(self, sel, testvars.offsite_goto_subs) sel.click(testvars.offsite_goto_subs) ### sel.wait_for_page_to_load(testvars.timeout) vid_title = sel.get_text(testvars.vid_title) print " * verify edits" mslib.wait_for_element_present(self, sel, testvars.video_video_info) history_text = sel.get_text("css=tr td:nth-child(1)") print history_text sel.click(testvars.video_original) mslib.wait_for_element_present(self, sel, testvars.history_tab) sel.click(testvars.history_tab) mslib.wait_for_element_present(self, sel, testvars.video_compare_revisions)
def test_415(self): """Widget Step 3, edit subtitle text. Tests smalls, caps, spaces, and non-ascii chars http://litmus.pculture.org/show_test.cgi?id=415 """ print "starting testcase 415" sel = self.selenium sel.set_timeout(testvars.MSTestVariables["TimeOut"]) subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"], "switch-to-firefox.txt") # be sure logged out website.SiteLogout(self, sel) website.start_demo(self, sel) website.start_sub_widget(self, sel, login=False) widget.transcribe_video(self, sel, subtextfile) widget.sync_video(self, sel, subtextfile) #edit subtitles print "editing subtitles" widget.edit_text(self, sel, subtextfile) # make it french print "french" widget.edit_text(self, sel, subtextfile, new_text=testvars.eels_fr) #make it japanese print "japanese" widget.edit_text(self, sel, subtextfile, new_text=testvars.eels_jp)
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%")