def test_7(self): """http://litmus.pculture.org/show_test.cgi?id=7 add feed. 1. Open Ryan is Hungry 2. click one-click link 3. Verify feed added 4. Cleanup """ reg = mirolib.AppRegions() feed = "Ryan" try: url = "http://ryanishungry.com/subscribe/" switchApp(mirolib.open_ff()) if reg.t.exists("Firefox",45): click(reg.t.getLastMatch()) mirolib.shortcut("l") time.sleep(2) type(url + "\n") time.sleep(20) find(testvars.one_click_badge) click(testvars.one_click_badge) time.sleep(25) mirolib.close_ff() #Start Miro mirolib.close_one_click_confirm(self) mirolib.shortcut("r",shift=True) mirolib.click_podcast(self,reg,feed) finally: mirolib.delete_feed(self,reg,feed)
def _delete_feed_folder(self): folder_name = "My Folder" mirolib.shortcut("n",shift=True) if reg.m.exists("Folder",3): mirolib.log_result("98","test_92") time.sleep(2) type(folder_name+"\n") time.sleep(4) mirolib.delete_feed(self,reg,feed=folder_name) mirolib.log_result("92","delte feed folder")
def test_24(self): """http://litmus.pculture.org/show_test.cgi?id=24 edit remembered search. 1. Add 2-stupid-videos feed 2. Perform a search 3. Type in search box the delete key 4. Cleanup """ reg = mirolib.AppRegions() url = "http://pculture.org/feeds_test/2stupidvideos.xml" feed = "TwoStupid" term = "Face" title = "Flip" #1. add feed mirolib.add_feed(self,reg,url,feed) mirolib.set_podcast_autodownload(self,reg,setting="All") #2. search mirolib.tab_search(self,reg,term) self.assertTrue(reg.m.exists(title)) url2 = "http://pculture.org/feeds_test/list-of-guide-feeds.xml" feed2 = "Static" term2 = "FilmWeek" mirolib.add_feed(self,reg,url2,feed2) mirolib.tab_search(self,reg,"Brooklyn") mirolib.wait_for_item_in_tab(self,reg,"Videos",title) reg.m.click(title) type(Key.ENTER) time.sleep(2) type(" ") self.assertTrue(exists(Pattern("playback_controls.png"))) mirolib.shortcut("d") reg.s.click(feed2) self.assertTrue(reg.mtb.exists("BROOKLYN")) mirolib.tab_search(self,reg,term2) reg.mtb.click("button_save_as_podcast.png") mirolib.click_last_podcast(self,reg) mirolib.tab_search(self,reg,term2,confirm_present=True) mirolib.clear_search(reg) if reg.mtb.exists(term2.upper()): mirolib.log_result("324","test_24",status="fail") else: mirolib.log_result("324","test_24") #4. cleanup mirolib.delete_feed(self,reg,"stupid") mirolib.click_last_podcast(self,reg) mirolib.delete_current_selection(self,reg) mirolib.delete_feed(self,reg,"Static List")
def _delete_feed(self): feed_url = "stupidvideos.com/rss/rss.php?chart=new&format=yahoo" feed = "StupidVid" mirolib.shortcut("n") if reg.m.exists("URL",3): mirolib.log_result("97","test_92") time.sleep(2) type(feed_url+"\n") time.sleep(4) mirolib.delete_feed(self,reg,feed) mirolib.log_result("92","delte feed shortcut verified")
def _delete_playlist(self): mirolib.shortcut("p") if reg.m.exists("Enter a",3): mirolib.log_result("723","test_92") time.sleep(4) type("FaveList"+"\n") p = mirolib.get_playlists_region(reg) p.click("FaveList",2) time.sleep(2) mirolib.delete_current_selection(self,reg) time.sleep(2) self.assertFalse(p.exists("FaveList",3)) mirolib.log_result("92","delte playlist shortcut verified")
def test_75(self): """http://litmus.pculture.org/show_test.cgi?id=75 Absolute and relative links. 1. Feed 1 2. View videos 3 3. Click the links and verify they are opened 4. Cleanup """ try: reg = mirolib.AppRegions() #1. add feed url = "http://pculture.org/feeds_test/feed1.rss" feed = "Yah" term = "third test video" title = "Video 3" #1. add feed mirolib.add_feed(self,reg,url,feed) #2. search mirolib.tab_search(self,reg,term) #3. verify item metadata self.assertTrue(reg.m.exists(title)) #verify the links LINKS = {"absolute link": "google", "relative link": "appcast","another relative": "pculture" } for link, linkurl in LINKS.iteritems(): if reg.m.exists(link): click(reg.m.getLastMatch()) time.sleep(15) mirolib.shortcut("l") time.sleep(2) mirolib.shortcut("c") time.sleep(2) url = Env.getClipboard() print url mirolib.close_ff() baseurl = urlsplit(url).netloc if link == "relative link": if linkurl not in baseurl.split('.'): reg.s.find("Democracy") else: self.fail("wrong link url") else: url_parts = baseurl.split('.') self.failUnless(linkurl in url_parts) #cleanup finally: mirolib.close_ff() mirolib.delete_feed(self,reg,feed)
def _delete_playlist_folder(self): mirolib.shortcut("p",shift=True) time.sleep(4) if reg.m.exists("playlist folder",3): mirolib.log_result("724","test_92") type("SUPERPLAYS"+"\n") time.sleep(3) p = mirolib.get_playlists_region(reg) p.click("SUPERPLAYS") time.sleep(2) mirolib.delete_current_selection(self,reg) time.sleep(2) self.assertFalse(p.exists("SUPERPLAYS",3)) mirolib.log_result("92","delte playlist folder shortcut verified")
def skiptest_120(self): ## No feed counter, this test is no longer valid. """http://litmus.pculture.org/show_test.cgi?id=120 full feed counter. Litmus Test Title:: 120 full feed counter Description: Verify full feed counter accurately displays the number of items in a feed or folder. 1. Add 2 feeds and verify number of items 2. Put them in a folder 3. Update and verify counter 4. Cleanup """ setAutoWaitTimeout(testvars.timeout) #set the search regions reg = mirolib.AppRegions() FEEDS = {"my feed": "http://bluesock.org/~willg/cgi-bin/newitemsfeed.cgi", "recent posts": "http://blip.tv/rss?pagelen=1", } #1. Add the feeds and check num items for feed, url in FEEDS.iteritems(): mirolib.add_feed(self,reg,url,feed) #2. Select them and add to a folder try: reg.s.click("my feed") time.sleep(2) keyDown(Key.SHIFT) reg.s.click("recent posts") self.assertTrue(reg.m.exists("Delete")) self.assertTrue(reg.m.exists("New Folder")) except: self.verificationErrors.append("multi select failed") finally: keyUp(Key.SHIFT) #3. Delete then cancel. Verify still exists Static List reg.m.click("New Folder") time.sleep(2) type("Counter Test \n") mirolib.click_feed(self,reg,feed="Counter Test") mirolib.toggle_list(reg) mirolib.count_images(self,reg,img="Download",region="main",num_expected=6) self.assertTrue(tmpr.exists("15 Items")) mirolib.shortcut("r",shift=True) time.sleep(3) self.assertTrue(tmpr.exists("20 Items")) #4. Cleanup type(Key.DELETE) mirolib.remove_confirm(self,reg,action="remove")
def test_123(self): """http://litmus.pculture.org/show_test.cgi?id=123 add feed more than once. Litmus Test Title:: 123 - add a channel more than once Description: 1. Add a channel from the Miro Guide. 2. Copy the URL and use the Add Feed dialog to add it. 3. Verify feed not duplicated. 4. Cleanup """ #set the search regions reg = mirolib.AppRegions() feed = "EEVblog" feed2 = "TED" mirolib.click_sidebar_tab(self,reg,"Miro") gr = Region(reg.mtb) gr.setH(300) gr.click(Pattern("guide_search.png")) type(feed2 +"\n") time.sleep(5) reg.m.find(Pattern("add_feed.png")) click(reg.m.getLastMatch()) mirolib.click_sidebar_tab(self,reg,"Miro") gr.click(Pattern("guide_search.png")) type(feed + "\n") time.sleep(10) reg.m.find(Pattern("add_feed.png")) click(reg.m.getLastMatch()) time.sleep(20) mirolib.click_last_podcast(self,reg) time.sleep(5) #2. Copy the url and attempt to add it reg.t.click("Sidebar") tmpr = Region(reg.t.getLastMatch().below()) tmpr.setW(tmpr.getW()+200) tmpr.highlight(3) if tmpr.exists("Copy") or tmpr.exists("URL"): click(tmpr.getLastMatch()) time.sleep(2) mirolib.shortcut("n") time.sleep(2) type(Key.ENTER) #3. Verify feed not duplicated p = mirolib.get_podcasts_region(reg) time.sleep(2) mirolib.count_images(self,reg, img=feed,region="sidebar",num_expected=1) mirolib.delete_feed(self,reg,feed) mirolib.delete_feed(self,reg,feed2)
def test_138(self): #shortened as there no more feed counter and can't count too much stuff. """http://litmus.pculture.org/show_test.cgi?id=138 clear out old items. Litmus Test Title:: 138 Channels - clear out old items Description: 1. Add a feed that adds five new items each time it's updated. 2. Update the feed to add new items. 3. Modify old items settings to verify items cleared. 4. Cleanup """ setAutoWaitTimeout(testvars.timeout) #set the search regions reg = mirolib.AppRegions() url = "http://bluesock.org/~willg/cgi-bin/newitemsfeed.cgi" feed = "my feed" mirolib.add_feed(self,reg,url,feed) mirolib.get_podcasts_region(reg) mirolib.tab_search(self,reg,"my feed") mirolib.toggle_list(reg) mirolib.count_images(self,reg,img="my feed",region="list",num_expected=5) mirolib.click_podcast(self,reg,feed) mirolib.shortcut("r") time.sleep(10) mirolib.get_podcasts_region(reg) if mirolib.count_images(self,reg,img="my feed",region="list",num_expected=10) == 10: mirolib.log_result("99","test_92") #verifies update podcast shortcut mirolib.click_podcast(self,reg,feed) for x in range(0,3): mirolib.shortcut("r") time.sleep(3) mirolib.open_podcast_settings(self,reg) mirolib.change_podcast_settings(self,reg,option="Podcast Items",setting="Keep 0") time.sleep(2) mirolib.get_podcasts_region(reg) mirolib.count_images(self,reg,img="my feed",region="list",num_expected=5) #4. cleanup mirolib.delete_feed(self,reg,"my feed")
def test_160(self): """http://litmus.pculture.org/show_test.cgi?id=160. 1. File -> Open 2. Select video file on system 3. Verify playback starts and item added to Library 4. Cleanup - just remove from Library """ reg = mirolib.AppRegions() try: vid_path = os.path.join(mycwd,"TestData","monkey.flv") mirolib.shortcut('o') mirolib.type_a_path(self,vid_path) time.sleep(3) self.assertTrue(exists(Pattern("playback_controls.png"))) mirolib.shortcut("d") except FindFailed, debugging: self.verificationErrors.append(debugging)
def open_prefs(self,reg,lang='en',menu=None,option=None): """OS specific handling for Preferences menu, since it differs on osx and windows. """ if reg.s.exists("icon-search.png",3) or \ reg.s.exists("icon-video.png",3): click(reg.s.getLastMatch()) time.sleep(3) if lang == 'en': option = 'Preferences' sc = 'f' else: sc = menu[0].lower() #Open the Preferences Menu based on the os with keyboard navigation if config.get_os_name() == "osx": mirolib.shortcut(',') pr = Region(reg.m) else: myscreen = Screen() pr = Region(myscreen.getBounds()) type(sc,KEY_ALT) reg.t.click(option) time.sleep(2) return pr
reg.m.click(item_title) for x in vconvertList: mirolib.convert_file(self,reg,x) time.sleep(15) mirolib.click_sidebar_tab(self,reg,"Converting") mirolib.wait_conversions_complete(self,reg,item_title,str(x)) # 5. Verify playback mirolib.click_sidebar_tab(self,reg,"Videos") aplaybackList = ("Droid", "iPhone", "MP4", "Ogg Theora", "Playstation") for x in aplaybackList: mirolib.tab_search(self,reg,"Converted to "+str(x)) if reg.m.exists("item_play_unplayed.png"): doubleClick(reg.m.getLastMatch()) find(Pattern("playback_bar_video.png")) mirolib.shortcut("d") waitVanish(Pattern("playback_bar_video.png"),20) mirolib.log_result("102","test_620 stop video playback verified.") time.sleep(2) type(Key.DELETE) mirolib.remove_confirm(self,reg,"remove") time.sleep(3) else: self.fail("converted item not found") except FindFailed, debugging: self.verificationErrors.append(debugging) finally: while reg.m.exists("Converted to",3): click(reg.m.getLastMatch()) type(Key.DELETE) mirolib.remove_confirm(self,reg,"remove") # 6. Cleanup
def test_467(self): """http://litmus.pculture.org/show_test.cgi?id=467 change sys language. 1. Open Preferences 2. Change the system default language 3. Restart Miro 4. Verify changes and reset 5. Restart Miro """ reg = mirolib.AppRegions() #1. open preferences p = prefs.open_prefs(self,reg) #2. change language to croatian (hr) if p.exists("System default") or p.exists("English"): click(p.getLastMatch()) for x in range(0,3): if not exists("Croatian",3): type(Key.PAGE_DOWN) for x in range(0,6): if not exists("Croatian",3): type(Key.PAGE_UP) click("Croatian") time.sleep(2) type(Key.TAB) type(Key.TAB) type(Key.ENTER) #mirolib.shortcut("w") type(Key.ESC) #3. Restart Miro mirolib.quit_miro(self,reg) mirolib.restart_miro() #4. Verify Changes and reset prefs.open_prefs(self,reg,lang='hr',menu='Datoteka',option='Postavke') if p.exists("Croatian"): click(p.getLastMatch()) else: find("Jezik") click(getLastMatch().right(40)) type(Key.PAGE_UP) for x in range(0,3): if exists("English",3): break else: type(Key.PAGE_UP) click("English") time.sleep(2) type(Key.TAB) type(Key.TAB) type(Key.ENTER) type(Key.ESC) time.sleep(2) #5. Restart Miro if reg.s.exists("icon-search.png",3) or \ reg.s.exists("icon-video.png",3): click(reg.s.getLastMatch()) time.sleep(3) mirolib.shortcut('q') time.sleep(2) mirolib.restart_miro() self.assertTrue(exists("File"))