def get_vimeo_video_url(self): if "firefox" not in selvars.set_browser(): vimeoURL = "http://vimeo.com/25378567" else: self.selenium = (selenium( selvars.set_localhost(), selvars.set_port(), selvars.set_browser("vimeo", " get video url"), "http://vimeo.com/")) self.selenium.start() vsel = self.selenium try: vsel.set_timeout(testvars.MSTestVariables["TimeOut"]) vsel.open("groups/all/sort:recent") vsel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) vsel.click("css=.detail_format a.thumbnail") mslib.wait_for_element_present( self, vsel, "css=div.tabmain a:contains('Videos')") vsel.click("css=div.tabmain a:contains('Videos')") mslib.wait_for_element_present(self, vsel, "css=div#vimeo_dropdown_2") vsel.click_at("css=div#vimeo_dropdown_2", "") vsel.click_at("css=li#detail", "") mslib.wait_for_element_present(self, vsel, "css=.thumbnail_box a.thumbnail") vsel.click("css=.thumbnail_box a.thumbnail") mslib.wait_for_element_present(self, vsel, "css=input#clip_id") urlid = vsel.get_value("css=input#clip_id") vimeoURL = "http://vimeo.com/" + urlid print vimeoURL finally: vsel.stop() return vimeoURL
def get_youtube_video_url(self,vid_format="embed"): if "firefox" not in selvars.set_browser(): youtubeURL = "http://www.youtube.com/watch?v=lVJVRywgmYM" else: cat_num = random.randint(1,26) self.selenium = (selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser("youtube"," get video url"), "http://youtube.com/")) self.selenium.start() vsel= self.selenium vsel.set_timeout(testvars.timeout) try: if vid_format == "webm": vsel.open("results?uploaded=w&search_query=crazy&search_duration=short&webm=1&search_type=videos&uni=3&search_sort=video_date_uploaded") else: vsel.open("videos?s=mr&c="+str(cat_num)) vsel.wait_for_page_to_load(testvars.timeout) for x in range(0,5): time.sleep(2) # if vsel.is_element_present("css=div.video-title"): break if vsel.is_element_present("css=div.browse-item-content"): break cat_num = random.randint(1,26) vsel.open("videos?s=mr&c="+str(cat_num)) vsel.wait_for_page_to_load(testvars.timeout) if x == 4: self.fail("can't get youtube video url") # vsel.click("css=div.video-title a") vsel.click("css=div.browse-item-content h3 a") vsel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) youtubeURL = vsel.get_eval("window.location") print youtubeURL finally: vsel.stop() return youtubeURL
def get_vimeo_video_url(self): if "firefox" not in selvars.set_browser(): vimeoURL = "http://vimeo.com/25378567" else: self.selenium = (selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser("vimeo"," get video url"), "http://vimeo.com/")) self.selenium.start() vsel= self.selenium try: vsel.set_timeout(testvars.MSTestVariables["TimeOut"]) vsel.open("groups/all/sort:recent") vsel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) vsel.click("css=.detail_format a.thumbnail") mslib.wait_for_element_present(self,vsel,"css=div.tabmain a:contains('Videos')") vsel.click("css=div.tabmain a:contains('Videos')") mslib.wait_for_element_present(self,vsel,"css=div#vimeo_dropdown_2") vsel.click_at("css=div#vimeo_dropdown_2", "") vsel.click_at("css=li#detail", "") mslib.wait_for_element_present(self,vsel,"css=.thumbnail_box a.thumbnail") vsel.click("css=.thumbnail_box a.thumbnail") mslib.wait_for_element_present(self, vsel,"css=input#clip_id") urlid = vsel.get_value("css=input#clip_id") vimeoURL = "http://vimeo.com/"+urlid print vimeoURL finally: vsel.stop() return vimeoURL
def create_team(self, sel, team, team_logo): sel.type_keys("id_name", team + " ") sel.type("id_description", "Team " + team + " - for test purposes only.") sel.type("id_logo", team_logo) if "iexplore" in selvars.set_browser(): vid_url = "http://blip.tv/file/1077145/" else: vid_url = "http://blip.tv/file/get/Miropcf-Miro20Introduction771.ogv" sel.type("id_video_url", vid_url) sel.click("css=.green_button.big:contains('Create Team')") sel.wait_for_page_to_load(testvars.timeout) # Verify team creation parameters if team == "": self.assertTrue( sel.is_element_present( "css=ul.errorlist li:contains('This field is required')")) else: self.assertEqual(str(team), str(sel.get_value("id_name"))) self.assertEqual("Team " + str(team) + " - for test purposes only.", str(sel.get_value("id_description"))) self.failUnless( sel.is_element_present( "css=.avatar-container img[src*='png_100x100']")) self.failUnless( sel.is_element_present( "css=p:contains('Current video') > a:contains('blip')"))
def setUp(self): """ Sets up run envirnment for selenium server """ self.verificationErrors = [] self.selenium = selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(),self.shortDescription()), selvars.set_site()) self.selenium.start() self.session = self.selenium.sessionId
def setUp(self): """ Sets up run envirnment for selenium server """ self.verificationErrors = [] self.selenium = (selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(),self.shortDescription()), "http://pculture.org/")) self.selenium.start() self.session = self.selenium.sessionId
def setUp(self): """ Sets up run envirnment for selenium server """ self.verificationErrors = [] self.selenium = (selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(),self.shortDescription()), "http://universalsubtitles.mirocommunity.org/")) self.selenium.start() self.session = self.selenium.sessionId self.selenium.set_timeout(testvars.timeout)
def setUp(self): """ Sets up run envirnment for selenium server """ self.verificationErrors = [] self.selenium = (selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(),self.shortDescription()), "http://subtesting.com/")) self.selenium.start() self.session = self.selenium.sessionId self.selenium.set_timeout(testvars.timeout)
def setUp(self): """ Sets up run envirnment for selenium server """ self.verificationErrors = [] self.selenium = (selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(),self.shortDescription()), selvars.set_site())) self.selenium.start() self.session = self.selenium.sessionId self.selenium.set_timeout(testvars.timeout)
def setUp(self): """ Sets up run envirnment for selenium server """ self.verificationErrors = [] self.selenium = selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(),self.shortDescription()), selvars.set_site() ) self.selenium.start() self.session = self.selenium.sessionId if selvars.set_sauce() == True: print "sauce job result: http://saucelabs.com/jobs/"+str(self.session)
def get_youtube_video_url(self, vid_format="embed"): if "firefox" not in selvars.set_browser(): youtubeURL = "http://www.youtube.com/watch?v=lVJVRywgmYM" else: cat_num = random.randint(1, 26) self.selenium = (selenium( selvars.set_localhost(), selvars.set_port(), selvars.set_browser("youtube", " get video url"), "http://youtube.com/")) self.selenium.start() vsel = self.selenium vsel.set_timeout(testvars.timeout) try: if vid_format == "webm": vsel.open( "results?uploaded=w&search_query=crazy&search_duration=short&webm=1&search_type=videos&uni=3&search_sort=video_date_uploaded" ) else: vsel.open("videos?s=mr&c=" + str(cat_num)) vsel.wait_for_page_to_load(testvars.timeout) for x in range(0, 5): time.sleep(2) # if vsel.is_element_present("css=div.video-title"): break if vsel.is_element_present("css=div.browse-item-content"): break cat_num = random.randint(1, 26) vsel.open("videos?s=mr&c=" + str(cat_num)) vsel.wait_for_page_to_load(testvars.timeout) if x == 4: self.fail("can't get youtube video url") # vsel.click("css=div.video-title a") vsel.click("css=div.browse-item-content h3 a") vsel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) youtubeURL = vsel.get_eval("window.location") print youtubeURL finally: vsel.stop() return youtubeURL
def get_dailymotion_video_url(self): if "firefox" not in selvars.set_browser(): dailymotionURL = "http://www.dailymotion.com/video/xjhmjf_souviens-toi-tafit-mag-seance-studio-d-enregistrement-ade-mougins_music" else: self.selenium = (selenium(selvars.set_localhost(), selvars.set_port(), selvars.set_browser("dailymotion"," get video url"), "http://dailymotion.com/")) self.selenium.start() vsel= self.selenium try: vsel.set_timeout(testvars.MSTestVariables["TimeOut"]) # open most recent cc licensed videos vsel.open("/en/creative/1") vsel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) vsel.click("css=h3 a.dmco_simplelink") vsel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) dailymotionURL = vsel.get_eval("window.location") print dailymotionURL finally: vsel.stop() return dailymotionURL
def setUp(self): """ Sets up run envirnment for selenium server """ self.verificationErrors = [] print "starting testcase " + self.id() + ": " + self.shortDescription() self.selenium = (selenium( selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(), self.shortDescription()), selvars.set_site())) self.selenium.start() self.session = self.selenium.sessionId
def setUp(self): self.verificationErrors = [] testid = self.id() self.selenium = selenium( selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(), self.shortDescription()), selvars.set_site()) self.selenium.start() self.session = self.selenium.sessionId if selvars.set_sauce() == True: print "sauce job result: http://saucelabs.com/jobs/" + str( self.session)
def get_dailymotion_video_url(self): if "firefox" not in selvars.set_browser(): dailymotionURL = "http://www.dailymotion.com/video/xjhmjf_souviens-toi-tafit-mag-seance-studio-d-enregistrement-ade-mougins_music" else: self.selenium = (selenium( selvars.set_localhost(), selvars.set_port(), selvars.set_browser("dailymotion", " get video url"), "http://dailymotion.com/")) self.selenium.start() vsel = self.selenium try: vsel.set_timeout(testvars.MSTestVariables["TimeOut"]) # open most recent cc licensed videos vsel.open("/en/creative/1") vsel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) vsel.click("css=h3 a.dmco_simplelink") vsel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"]) dailymotionURL = vsel.get_eval("window.location") print dailymotionURL finally: vsel.stop() return dailymotionURL
def setUp(self): """ Sets up run envirnment for selenium server """ self.verificationErrors = [] self.selenium = selenium( selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(), self.shortDescription()), "http://universalsubtitles.mirocommunity.org/", ) self.selenium.start() self.session = self.selenium.sessionId self.selenium.set_timeout(testvars.timeout)
def setUp(self): """ Sets up run envirnment for selenium server """ self.verificationErrors = [] print "starting testcase " + self.id() + ": " + self.shortDescription() self.selenium = (selenium( selvars.set_localhost(), selvars.set_port(), selvars.set_browser(self.id(), self.shortDescription()), selvars.set_site())) self.selenium.start() self.session = self.selenium.sessionId if selvars.set_sauce() == True: print "sauce job result: http://saucelabs.com/jobs/" + str( self.session)
def create_team(self,sel,team,team_logo): sel.type_keys("id_name", team+" ") sel.type("id_description", "Team "+team+ " - for test purposes only.") sel.type("id_logo", team_logo) if "iexplore" in selvars.set_browser(): vid_url = "http://blip.tv/file/1077145/" else: vid_url = "http://blip.tv/file/get/Miropcf-Miro20Introduction771.ogv" sel.type("id_video_url", vid_url ) sel.click("css=.green_button.big:contains('Create Team')") sel.wait_for_page_to_load(testvars.timeout) # Verify team creation parameters if team == "": self.assertTrue(sel.is_element_present("css=ul.errorlist li:contains('This field is required')")) else: self.assertEqual(str(team), str(sel.get_value("id_name"))) self.assertEqual("Team "+str(team)+" - for test purposes only.", str(sel.get_value("id_description"))) self.failUnless(sel.is_element_present("css=.avatar-container img[src*='png_100x100']")) self.failUnless(sel.is_element_present("css=p:contains('Current video') > a:contains('blip')"))
def test_470(self): """Widget Step 1, advanced (recommended) mode setting. http://litmus.pculture.org/show_test.cgi?id=470 """ print "starting testcase 470" 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) #Type sub-text in the video, then wait stay on Step-1 screen mslib.wait_for_element_present(self, sel, testvars.WidgetUI["Play_pause"]) mode_label = sel.get_text( "css=.unisubs-speedmode option:contains('Recommended')") sel.select("//select", "label=" + mode_label) mslib.wait_for_video_to_buffer(self, sel) sel.click(testvars.WidgetUI["Play_pause"]) # keep typing while in playback mode until button changes to play button (indicating paused) sel.click("//div/input") for x in range(0, 4): while sel.is_element_present( testvars.WidgetUI["Video_pause_button"]): time.sleep(.2) sel.type_keys("//div/input", "Hi ") # stop typing and wait for playback to resume (pause button present) stop_time = sel.get_text(testvars.WidgetUI['Video_elapsed_time']) sel.type_keys("//div/input", "I'm Asa Dotzler") if "firefox" in selvars.set_browser(): sel.key_press("css=.trans", "13") else: sel.focus("css=input[class*=trans]") sel.key_press_native('10') mslib.wait_for_element_present( self, sel, testvars.WidgetUI["Video_pause_button"]) time.sleep(.5) resume_time = sel.get_text(testvars.WidgetUI['Video_elapsed_time']) self.failUnless(int(stop_time) > int(resume_time))
def set_test_browser(): """Returns the browser name for the litmus platform field" """ if selvars.set_sauce() == True: b = json.loads(selvars.set_browser()) if b["browser"] == "firefox": return "Firefox" elif b["browser"] == "chrome": return "Firefox" elif b["browser"] == "safariproxy": return "Safari" elif b["browser"] == "opera": return "Opera" elif b["browser"] == "iexplore": return "IE 8" elif b["browser"] == "iexploreproxy": return "IE 8" elif b["browser"] == "googlechrome": return "Google Chrome" else: print "no idea what the browser is: "+ b["browser"] if selvars.set_browser() == "*firefox": return "Firefox" elif selvars.set_browser() == "*chrome": return "Firefox" elif selvars.set_browser() == "*safari": return "Safari" elif selvars.set_browser() == "*opera": return "Opera" elif selvars.set_browser() == "*iexplore": return "IE 8" elif selvars.set_browser() == "*iexploreproxy": return "IE 8" elif selvars.set_browser() == "*googlechrome": return "Google Chrome" else: print "no idea what the browser is"