def test_tiki_search_result(self, testsetup): support_home_page_obj = support_home_page.SupportHomePage(testsetup) search_page_obj = search_page.SearchPage(testsetup) search_term = 'firefox crashes' support_home_page_obj.go_to_support_home_page() support_home_page_obj.do_search_on_main_search_box( search_term, search_page_obj) not_found = True counter = 0 while (not_found and counter < 3): if not (search_page_obj.is_element_present( search_page_obj.second_page_link)): search_page_obj.refresh() counter += 1 else: not_found = False assert search_page_obj.is_element_present((search_page_obj.second_page_link)),\ "Page-2 link not found" assert search_page_obj.is_element_present((search_page_obj.next_page_link)),\ "Next Page link not found" assert search_term == search_page_obj.get_search_box_value(),\ "search term: %s not found on search box" % search_term assert search_page_obj.is_element_present(search_page_obj.result_div),\ "Results not present" assert search_page_obj.is_element_present(search_page_obj.support_question_link),\ "link=supportquestion not found on search results page" assert search_page_obj.is_element_present(search_page_obj.kb_link),\ "Firefox Help Home link not found on search results page" assert search_page_obj.is_element_present(search_page_obj.question_link),\ "Ask a Question link not found on search results page"
def test_anon_pagination_numeric_links(self, testsetup): support_hp_obj = support_home_page.SupportHomePage(testsetup) search_page_obj = search_page.SearchPage(testsetup) # Description: # This testcase checks the following about pagination links # a) the current page is not a link # b) All the other page links are active next = "Next" # Do a search for which hits are expected... search_word = "bookmarks" support_hp_obj.do_search_on_main_search_box(search_word, search_page_obj) not_found = True counter = 1 while (not_found and counter < 5): if (not (testsetup.selenium.is_text_present(search_word))): testsetup.selenium.refresh() testsetup.selenium.wait_for_page_to_load(testsetup.timeout) time.sleep(2) counter = counter + 1 else: not_found = False pageCounter = 1 # store the last link url = "/search?q=%s" % (search_word) search_page_obj.open(url) if (testsetup.selenium.is_element_present( "css=ol.pagination > li:nth-child(7)")): lastLink = int( testsetup.selenium.get_text( "css=ol.pagination > li:nth-child(7)")) else: return # Iterate over every page of hits... while (testsetup.selenium.is_element_present( search_page_obj.next_page_link) and int(pageCounter) + 1 <= int(lastLink) - 3): # Verify that all page numbers previous to current page ARE active linkNumber = 1 while int(linkNumber) < int(pageCounter): if int(linkNumber) < int(pageCounter) - 3: linkNumber = linkNumber + 1 continue assert(\ testsetup.selenium.is_element_present("link=" + str(linkNumber)),\ "Previous page %s is not a link" % str(linkNumber)) linkNumber = linkNumber + 1 # Verify that all page numbers following current page ARE active linkNumber = int(pageCounter) + 1 while int(linkNumber) <= int(pageCounter) + 3: assert(\ testsetup.selenium.is_element_present("link=" + str(linkNumber)),\ "Following page %s is not a link" % str(linkNumber)) linkNumber = linkNumber + 1 pageCounter = int(pageCounter) + 1 search_page_obj.click(search_page_obj.next_page_link, True, testsetup.timeout)
def test_search_advanced_links(self, testsetup): search_page_obj = search_page.SearchPage(testsetup) refine_search_page_obj = refine_search_page.RefineSearchPage(testsetup) support_home_page_obj = support_home_page.SupportHomePage(testsetup) support_home_page_obj.go_to_support_home_page() support_home_page_obj.do_search_on_main_search_box("dfg", search_page_obj) search_page_obj.click_refine_search_link(refine_search_page_obj) assert "a=2" in refine_search_page_obj.get_url_current_page(),\ "%s not in URL: %s" % ("a=2", refine_search_page_obj.get_url_current_page)
def test_search_advanced_links(self): sel = self.selenium search_page_obj = search_page.SearchPage(sel) refine_search_page_obj = refine_search_page.RefineSearchPage(sel) support_home_page_obj = support_home_page.SupportHomePage(sel) support_home_page_obj.go_to_support_home_page() support_home_page_obj.do_search_on_main_search_box( "dfg", search_page_obj) search_page_obj.click_refine_search_link(refine_search_page_obj) self.failUnless("a=2" in refine_search_page_obj.get_url_current_page(), "%s not in URL: %s" % ("a=2", sel.get_location()))
def test_search_on_home_page(self, testsetup): support_home_page_obj = support_home_page.SupportHomePage(testsetup) search_page_obj = search_page.SearchPage(testsetup) search_term = 'iphone' support_home_page_obj.go_to_support_home_page() support_home_page_obj.do_search_on_main_search_box( search_term, search_page_obj) url = search_page_obj.get_url_current_page() assert search_term in url,\ "Search term %s does not exist in the url %s" % (search_term, url)
def test_search_on_home_page(self): sel = self.selenium support_home_page_obj = support_home_page.SupportHomePage(sel) search_page_obj = search_page.SearchPage(sel) search_term = 'iphone' support_home_page_obj.go_to_support_home_page() support_home_page_obj.do_search_on_main_search_box( search_term, search_page_obj) url = search_page_obj.get_url_current_page() self.failUnless( search_term in url, "Search term %s does not exist in the url %s" % (search_term, url))
def test_login(self): """tests login & logout """ sel = self.selenium login_page_obj = login_page.LoginPage(sel) support_page_obj = support_home_page.SupportHomePage(sel) user_info = sumo_test_data.SUMOtestData().getUserInfo(0) uname = user_info['username'] pwd = user_info['password'] ''' Login ''' login_page_obj.log_in(uname, pwd) login_page_obj.go_to_login_page() ''' Logout ''' login_page_obj.log_out() support_page_obj.is_the_current_page
def test_tiki_search_result(self): sel = self.selenium support_home_page_obj = support_home_page.SupportHomePage(sel) search_page_obj = search_page.SearchPage(sel) search_term = 'firefox crashes' support_home_page_obj.go_to_support_home_page() support_home_page_obj.do_search_on_main_search_box( search_term, search_page_obj) not_found = True counter = 0 while (not_found and counter < 3): if (not (search_page_obj.is_element_present( search_page_obj.second_page_link))): sel.refresh() sel.wait_for_page_to_load( vars.ConnectionParameters.page_load_timeout) counter = counter + 1 else: not_found = False self.failUnless( search_page_obj.is_element_present( (search_page_obj.second_page_link))) self.failUnless( search_page_obj.is_element_present( (search_page_obj.next_page_link))) self.assertEqual(search_term, search_page_obj.get_search_box_value()) self.failUnless( search_page_obj.is_element_present(search_page_obj.result_div), "Result not present") self.failUnless( search_page_obj.is_element_present( search_page_obj.support_question_link)) self.failUnless( search_page_obj.is_element_present(search_page_obj.kb_link)) self.failUnless( search_page_obj.is_element_present(search_page_obj.question_link))