def test_article_history(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() user = self.accounts.getUserInfo(1) sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) sumo_func.open(sel, "/") self.functions.login(1, sel) sel.click("css=div#breadcrumbs a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.failUnless(sel.is_element_present("link=Installing Firefox"), "Installing Firefox link not present") sel.click("link=Installing Firefox") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.assertEqual("Installing Firefox", sel.get_title()) self.failUnless(sel.is_element_present("link=History"), "History link not present") sel.click("link=History") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.failUnless( sel.is_element_present("link=exact:History: Installing Firefox"), "History: Installing Firefox link not present") self.failUnless(sel.is_element_present("link=View page"), "View Page link not present") sel.click("link=View page") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.assertEqual("Installing Firefox", sel.get_title())
def test_loggedin_translate_existing_article(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() user = self.accounts.getUserInfo(0) sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) timestamp = sel.get_eval("new Date().getTime()") language = "hi-IN" self.functions.login(0, sel) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) sel.click("css=div#mostpopular-new > ul > li:nth-child(6) > a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.click("link=Translate this page") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) # Selecting a language from drop-down list #breaks in IE for all types of selectors #sel.select("lang", "index=0") sel.type("page", "article_" + timestamp) sel.click("css=input[value='Create translation']") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.type("editwiki", "article_" + timestamp) sel.type("comment", "article_" + timestamp) sel.click("save") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sumo_func.open(sel, "/en-US/kb/article_" + timestamp + "?bl=n") # Logging out sel.click("link=Log Out") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sumo_func.open(sel, "/en-US/kb/")
def test_verify_num_results_on_page(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) # Store some needed variables searchTerms = ["crashes", "firefox crashes"] for currentTerm in searchTerms: sumo_func.open(sel, "/search") # Click the search field and enter the search terms sel.type("q", currentTerm) sel.click("css=div#basic-search input[type='submit']") sel.wait_for_page_to_load( vars.ConnectionParameters.page_load_timeout) # Verify that there are 10 results on the page # After that, click the "Next" link, # until we're at the end of the search results: counter = 1 while sel.is_element_present("link=Next") and counter < 11: self.assertEqual("10", sel.get_xpath_count( "//div[@id='content-inner']/div[3]/div[@class='result']")) sel.click("link=Next") sel.wait_for_page_to_load( vars.ConnectionParameters.page_load_timeout) # Verify that we have a Next link on this page, otherwise, # we're at the end of the results and don't need to # count the results anymore! counter += 1
def test_contribute_redirect(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, "/contribute") actualUrl = urllib.unquote(sel.get_location()) self.failUnless("superheroes-wanted" in actualUrl, "Redirection failed")
def test_anon_submitting_a_new_question(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() timestamp = sel.get_eval("new Date().getTime()") sumo_func.open(sel, "/en-US/kb/Firefox+Support+Home+Page") sel.click("link=2) Get Personal Help") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.click("link=Ask a new question in the forum") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.click("css=ul.select-one > li > a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.click("css=ul.select-one > li > a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) question_to_ask = "automation test question %s" %(datetime.date.today()) sel.type("search", question_to_ask) sel.click("css=input[value='Ask this']") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.click("css=input[value *='None']") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.type("id_content", "This is a test. " + timestamp) sel.type("id_troubleshooting", "troubleshooting info") sel.click("css=input[value='Post Question']") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.type("id_email", "*****@*****.**") sel.click("css=input[value='Post Question']") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) time.sleep(3) self.failUnless(sel.is_text_present(question_to_ask), "Did not find posted Question %s \r\n" %(question_to_ask))
def test_kb_static(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) sumo_func.open(sel, "/en-US/kb/") self.assertEqual("Firefox Support Home Page", sel.get_title()) # Checks text above search box self.failUnless(sel.is_text_present("What do you need help with?"), "what need help not present") self.failUnless(sel.is_text_present("New to Firefox?"), "new to firefox not present") # Checks the "new to firefox?" text shows self.failUnless(sel.is_text_present("Popular Support Articles"), "pop support articles not present") self.failUnless(sel.is_element_present("button-seeall"), "see all articles link not present") self.failUnless(sel.is_text_present("Thunderbird Support"), "thunderbird support text not present") # Checks link to Thunderbird is shown ( footer ) self.failUnless(sel.is_element_present("link=Thunderbird"), "thunderbird link not present") self.failUnless(sel.is_element_present("link=More"), "more link not present") # Checks link to tiki-browse_freetags.php self.failUnless(sel.is_element_present("search-try"), "search box not present") # Checks search box area is present self.failUnless(sel.is_element_present("promotebox-title"), "promote widget not present") # This checks the promote widget is showing ( "new to firefox" ) self.failUnless(sel.is_element_present( "css=div#waysgethelp-list > ul > li"), "search ff ways to get help not present") self.assertEqual("4", sel.get_xpath_count( "//div[@id=\"promotebox-list\"]/ul/li/a")) # This checks there a 4 links under "New to Firefox?" self.failUnless(sel.is_element_present("wantgetinvolved-title"), "want to get involved widget not present") # This checks the "want to get involved" widget shows self.failUnless(sel.is_element_present("waysgethelp-title"), "ways to help widget missing") # Checks that the "ways to help" widget shows self.failUnless(sel.is_element_present( "link=2) Get Personal Help"), "get personal help link missing") self.failUnless(sel.is_element_present( "link=3) Other Firefox Support"), "other ff support link missing") # The above check links under "ways to get help" self.failUnless(sel.is_element_present( "link=Find out how to contribute"), "find out how to contribute link missing") # Checks the how to contribute link under "want to get involved?" self.failUnless(sel.is_element_present("link=log in"), "login link missing")
def setUp(self): self.selenium = selenium(vars.ConnectionParameters.server, vars.ConnectionParameters.port, vars.ConnectionParameters.browser, vars.ConnectionParameters.baseurl) self.selenium.start() self.selenium.set_timeout(vars.ConnectionParameters.page_load_timeout) self.accounts = sumo_test_data.SUMOtestData() self.functions = sumo_functions.SUMOfunctions()
def test_search_advanced_tags(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, "en-US/search?a=2") # clicks support form tab sel.click("css=div#search-tabs > ul > li:nth-child(2) > a") sel.type("support_q", "desktop") sel.click("css=form#support input[value='Search']") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.failUnless(sel.is_element_present("css=div.result"))
def test_kb_htc_check_images(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) sumo_func.open(sel, "/en-US/kb") sel.click("css=div#wantgetinvolved > a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.failUnless( sel.is_visible("css=div#top > div > a > span.img > img"))
def setUp(*args, **kwargs): setattr(test, 'browser', env) vars.ConnectionParameters.browser = test.browser #fn(*args, **kwargs) setattr(test, 'selenium', selenium(vars.ConnectionParameters.server,vars.ConnectionParameters.port,env,vars.ConnectionParameters.baseurl)) test.selenium.start() test.selenium.window_maximize() test.selenium.set_timeout(vars.ConnectionParameters.page_load_timeout) setattr(test, 'accounts', sumo_test_data.SUMOtestData()) setattr(test, 'functions', sumo_functions.SUMOfunctions())
def test_search_unknownchars(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() # We're checking to ensure that # "unknown" characters like # "�" don't appear sumo_func.open(sel, "/search?where=all&locale=ja&q=%E3%83%96%E3%83%83%E3%82%AF%E3%83%9E" + "%E3%83%BC%E3%82%AF%E3%81%AE%E6%95%B4%E7%90%86&sa") self.failUnless(sel.is_text_present(u"ブックマークの整理")) self.failIf(sel.is_text_present(u"�"))
def test_anon_csat_ntf_no(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() # This testcase verified that clicking "no" for both questions # in the CSAT poll works as expected sumo_func.open(sel, "/en-US/kb/Firefox+Support+Home+Page") sel.click("css=div#promotebox-list a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.click("css=input[value='No']") sel.click("css=div#pollarea2 div#polledit input:nth-child(2)") self.failIf(sel.is_visible("polls_optionId"), "Poll is still visible")
def test_nonnumeric_search_page_numbers(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) url = "/en-US/search?q=firefox+crashes&page=" pages = ["string", "2str", "$@&%*", "?2"] for page in pages: sumo_func.open(sel, url + page) self.failUnless(sel.is_element_present("css=div.result > a"), "No search results for non-numeric pages")
def test_forum_contribs_new_post(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() # Timestamp allows unique value each run Timestamp = sel.get_eval("new Date().getTime()") postTitle = "Litmus 7829 test" + Timestamp #postSumm = "Litmus Sel Test 9533" postMsg = "Litmus QA Testcase Test Msg" self.functions.login(0, sel) # we are using ssl url to preserver login info sumo_func.open( sel, vars.ConnectionParameters.baseurl_ssl + "/en-US/forums/contributors") #self.assertEqual("Contributors | Forums | Firefox Support", #sel.get_title()) sumo_func.open(sel, sel.get_location() + "/new") sel.type("css=form.new-thread input#id_title", postTitle) sel.type("css=form.new-thread textarea#id_content", postMsg) sel.click("css=input[value='Post']") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) time.sleep(5) self.failUnless(sel.is_text_present(postMsg)) # Verify post title sumo_func.open( sel, vars.ConnectionParameters.baseurl_ssl + "/en-US/forums/contributors") self.failUnless(sel.is_text_present(postTitle)) ''' # Verify this post is not present in other forums sumo_func.open(sel, vars.ConnectionParameters.baseurl_ssl+"/en-US/forums/knowledge-base-articles") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) # Verify post not present in this forum self.failIf(sel.is_text_present(postTitle)) sel.click("css=ol.breadcrumbs > li:nth-child(2) > a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) # Click link toOff Topic Forum sel.click("link=Off Topic") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) # Verify post not present in this forum self.failIf(sel.is_text_present(postTitle)) sel.click("css=ol.breadcrumbs > li:nth-child(2) > a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.click("link=Contributors") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) # verify post is present in this forum self.failUnless(sel.is_text_present(postTitle)) ''' # Logout self.functions.logout(sel)
def test_article_rename_cancel(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) self.functions.login(0, sel) sumo_func.open(sel, "/en-US/kb/Creating+articles") self.failUnless(sel.is_text_present("Quick edit an article"), "Quick Edit an article text not present") sel.type("page", "My First Testing Article") self.failUnless(sel.is_element_present("quickedit"), "quickedit element not present") sel.click("quickedit") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.type( "editwiki", "{SHOWFOR(spans=on)/}\n\nDescribe what the \ article is about here. Include links to pages that users\nmight \ have mistaken this article for.\n\nDescribe the cause of the \ problem. Summarize the fix in one sentence.\n\n{maketoc}\n\n\n!\ Section one title\nText here.\n# Step 1\n# Step 2\n# Step 3\n# \ Step 4\n\n!Section two\nText here.\n\nI must make sure that \ MYSECRETWORD is included in this article.") sel.type("comment", "I have made new article for testing") self.assertEqual("My First Testing Article", sel.get_title()) self.failUnless( sel.is_text_present("exact:Edit: My First Testing Article"), "edit title not present") self.failUnless(sel.is_element_present("save"), "save element not present") sel.click("save") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.assertEqual("My First Testing Article", sel.get_title()) self.failUnless(sel.is_text_present("My First Testing Article"), "title not present") self.failUnless( sel.is_text_present( "I must make sure that MYSECRETWORD is included in this article." ), "Content not present") self.failUnless(sel.is_element_present("link=rename"), "rename link not present") sel.click("link=rename") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.failUnless( sel.is_element_present("link=My First Testing Article"), "Article link not present") self.failUnless(sel.is_element_present("rename"), "rename not present") sel.click("link=My First Testing Article") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.assertEqual("My First Testing Article", sel.get_title()) self.failUnless( sel.is_text_present( "I must make sure that MYSECRETWORD is included in this article." ), "Content text not present")
def test_hp_see_all_pop_support_articles(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) sumo_func.open(sel, "/en-US/kb/") URL_name = sel.get_location() sel.click("button-seeall") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) url = URL_name + "Article+list" self.failUnless(url in sel.get_location(), "%s not in %s" % (url, sel.get_location))
def test_advanced_search_checked_kb_and_forum(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) # This script checks that the KB tickbox is checked # and that the default forum to search is "Firefox" sumo_func.open(sel, "/search?a=2") self.failUnless(sel.is_checked("id_category_0"), "Default search forum is not set to Firefox") search_word = "Firefox crashes" sel.type("kb_q", search_word) #submit search #sel.click("css=form.kb > div.submit-search > input") sel.click("css=input[value='Search']") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) not_found = True counter = 1 while (not_found and counter < 5): if (not (sel.is_text_present(search_word))): sel.refresh() sel.wait_for_page_to_load( vars.ConnectionParameters.page_load_timeout) time.sleep(1) counter = counter + 1 else: not_found = False self.failUnless( sel.is_element_present("css=div.search-results > div.result > a"), "Search result at %s on page %s not found" % ("css=div.search-results > div.result > a", sel.get_location())) sumo_func.open(sel, "/search?a=2") #switch tabs sel.click("css=div#search-tabs > ul > li:nth-child(2) > a") search_word = "Firefox crashes" sel.type("support_q", search_word) #submit search sel.click("css=div.submit-search > input") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) not_found = True counter = 1 while (not_found and counter < 5): if (not (sel.is_text_present(search_word))): sel.refresh() sel.wait_for_page_to_load( vars.ConnectionParameters.page_load_timeout) time.sleep(1) counter = counter + 1 else: not_found = False self.failUnless( sel.is_element_present("css=div.search-results > div.result > a"))
def test_anon_csat_popular_article_no(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) # This testcase verified that clicking "no" for both # questions in the CSAT poll works as expected sumo_func.open(sel, "/en-US/kb/Firefox+Support+Home+Page") sel.click("css=div#mostpopular-new a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.click("css=input.feedback-submit[value='No']") sel.click("css=div#pollarea2 div#polledit input:nth-child(2)") self.failIf(sel.is_visible("polls_optionId"), "Poll still visible")
def test_kb_delete_as_admin(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() user = self.accounts.getUserInfo(1) sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) sumo_func.open(sel, "/en-US/kb/Firefox+Support+Home+Page") self.functions.login(1, sel) sel.click("link=Create an article") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) sel.type("page", "deletiontesting") sel.click("quickedit") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) # types "deletiontesting" into the body # of the article sel.type("editwiki", "deletiontesting") # types a comment for the article sel.type("comment", "testing article with quotes. \"Quotes.\"") # adds some tags sel.type("tagBox", "article, deletion, quotes") # submits the article sel.click("save") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) # verifies all the stuff we've entered self.failUnless( "This is a new staging page that has not been approved" in sel.get_text("css=div#col1 > div > div > div:nth-child(3)")) self.failUnless(sel.is_text_present("deletiontesting"), "content text not present") self.failUnless(sel.is_text_present("article"), "tags not working") self.failUnless(sel.is_text_present("quotes"), "tags not working") # remove the article sel.click("link=remove") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.failUnless( sel.is_element_present("link=return to wikipage deletiontesting"), "wikipage return link not present") sel.click("remove") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.failUnless(sel.is_text_present("Need Help with Firefox?"), "remove redirect failed") # we're still logged in, right? self.failUnless(sel.is_element_present("link=log out"), "no longer logged in") # log out self.functions.logout(sel) #selenium RC does not like 404 responses conn = urllib.urlopen(vars.ConnectionParameters.authurlssl + "/en-US/kb/deletiontesting") status = conn.getcode() self.failUnless(status == 404)
def test_no_query_adv_forum_search(self): sel = self.selenium user = sumo_test_data.SUMOtestData().getUserInfo(0) sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, "en-US/search?a=2") # clicks support form tab sel.click("css=div#search-tabs > ul > li:nth-child(2) > a") sel.type("id_asked_by", user['username']) sel.click("css=form#support input[value='Search']") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.failUnless( "refine" in sel.get_attribute( "css=div#basic-search > form > input:nth-child(13)@class"), "refine class not found")
def test_atom_feeds(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, "/en-US/forums") sel.click("css=div.name > a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) forumlink = sel.get_location() + "/feed" sel.click("css=div#content-inner div.title a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) threadlink = sel.get_location() + "/feed" # selenium will give an XHR error with response_code = 404 # if page not found, causing failure of test self.failUnless(sumo_func.getResponse(threadlink) == 200) self.failUnless(sumo_func.getResponse(forumlink) == 200)
def test_ask_a_question(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() # Description: This checks that the correct elements and # links are shown on the "Ask A Question" page sumo_func.open(sel, "/en-US/kb/ask") #self.failUnless(sel.is_element_present("css=div#breadcrumbs a"), #"Firefox breadcrumb not present") self.failUnless(sel.is_text_present("Where to ask your question"), "Where to ask your question not present") self.failUnless("Ask a question" in sel.get_title()) self.failUnless(sel.is_text_present("Ask a question"), "Ask a question not present") self.failUnless(sel.is_element_present("css=div[id='firefox-help']"), "Search box header not present") self.failUnless(sel.is_element_present("q"), "Search box not present") self.failUnless(sel.is_element_present("link=Thunderbird Support"), "Thunderbird support link not present") self.failUnless(sel.is_element_present("link=*forum*"), "Forum link not present") self.failUnless(sel.is_element_present("link=Other Firefox support"), "Other FF Support link not present") self.failUnless(sel.is_text_present("Firefox support forum"), "FF Support forum link not present") self.failUnless( sel.is_element_present("link=Ask a new question in the forum"), "New Question link not present") self.failUnless(sel.is_text_present("Firefox support live chat"), "Live chat title not present") self.failUnless( sel.is_element_present("link=Take me to the live chat"), "Live chat link not present") self.failUnless(sel.is_text_present("Other places to ask for help"), "Other help not present") self.failUnless(sel.is_element_present("link=Firefox Help Home"), "Sidebar Firefox Support link not present") self.failUnless(sel.is_element_present("link=Discussion"), "KB DIscussion link not present") #self.failUnless(sel.is_element_present("link=Support Forum"), #"Support Forum link not present") self.failUnless(sel.is_element_present("link=Ask a Question"), "Ask a question link not present") #self.failUnless(sel.is_element_present("link=How to Contribute"), #"How to contribute link not present") self.failUnless( sel.is_element_present("link=Sign In") or sel.is_element_present("link=Log Out"))
def test_logout(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() user = self.accounts.getUserInfo(2) sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) sumo_func.open(sel, "/en-US/kb/") self.functions.login(2, sel) self.assertEqual("Contributor Home Page", sel.get_title()) self.failUnless(sel.is_text_present("Contributor Home Page"), "Contributor title not present") self.failUnless(sel.is_text_present("Log Out"), "Logout link missing") sel.click("link=Log Out") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.assertEqual("Firefox Support Home Page", sel.get_title()) self.failUnless(sel.is_text_present("log in"), "login link missing")
def test_webtrends_search_tracking(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, "/en-US/search?q=deleting+bookmarks") source = sel.get_html_source() if 'WT.oss' in source and 'WT.oss_r' in source: name = sel.get_attribute("css=head > meta[name='WT.oss']@content") count = sel.get_attribute( "css=head > meta[name='WT.oss_r']@content") name2 = sel.get_text( "css=div#content-inner > div:nth-child(2) > strong:nth-child(2)" ) count2 = sel.get_text( "css=div#content-inner > div:nth-child(2) > strong") self.failUnless(name == name2, "WT.oss is problematic") self.failUnless(count == count2, "WT.oss_r is problematic")
def test_anon_csat_popular_article_yes_new(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) # Testcase verifies answering "yes" for the CSAT questions # for KB articles under "Most popular" section. poll_option = 1 while poll_option < 6: sumo_func.open(sel, "/en-US/kb/Firefox+Support+Home+Page") sel.click("css=div#promotebox-list a") sel.wait_for_page_to_load( vars.ConnectionParameters.page_load_timeout) sel.click("css=div#pollarea input") sel.click("css=div#polledit input[value=%s]" % str(poll_option)) sel.click("polls_submit") sel.click("css=div#pollarea2 input") self.failIf(sel.is_visible("polls_optionId"), "Poll still visible") poll_option = poll_option + 1
def test_old_search_page_redirects(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) #check redirect from old tiki search sumo_func.open( sel, "/tiki-newsearch.php?where=all&locale=en-US&q=shockwave&sa=Search") self.failUnless("/search?" in sel.get_location(), "%s incorrect redirection" % sel.get_location()) self.failUnless("q=shockwave" in sel.get_location(), "%s incorrect redirection" % sel.get_location()) #check redirect from old php search sumo_func.open(sel, "/search.php?q=shockwave&locale=en-US&where=all") self.failUnless("/search?" in sel.get_location(), "%s incorrect redirection" % sel.get_location()) self.failUnless("q=shockwave" in sel.get_location(), "%s incorrect redirection" % sel.get_location())
def test_forum_goto_post_after_reply(self): '''Checks if forum redirects to post after replying''' sel = self.selenium sumo_page_obj = sumo_page.SumoPage(sel) self.sumo_fncs = sumo_functions.SUMOfunctions() userAdm = 1 thread_num = str(random.randint(100, 10000)) self.sumo_fncs.login(userAdm, sel) # using SSL url to preserve login info sumo_page_obj.open(vars.ConnectionParameters.baseurl_ssl + "/en-US/forums") sumo_page_obj.click("css=div.name a", True, vars.ConnectionParameters.page_load_timeout) sumo_page_obj.click("new-thread", True, vars.ConnectionParameters.page_load_timeout) thread_name = 'test_thread_%s' % thread_num sel.type("id_title", thread_name) thread_text = 'some text' sel.type("id_content", thread_text) sumo_page_obj.click("css=input[value='Post']", True, vars.ConnectionParameters.page_load_timeout) self.failUnless(sel.is_text_present(thread_name), "Thread name not present") self.failUnless(sel.is_text_present(thread_text), "Thread text not present") thread_loc = str(sel.get_location()) thread_loc_arr = thread_loc.split('/') url1 = thread_loc_arr[len(thread_loc_arr) - 2] url2 = thread_loc_arr[len(thread_loc_arr) - 1] thread_loc = '/en-US/forums/%s/%s' % (url1, url2) num_of_posts = 5 start_time = time.time() for counter in range(1, (num_of_posts + 1)): thread_reply = 'some reply %s' % str(int(thread_num) + counter) sel.type("id_content", thread_reply) sumo_page_obj.click("css=input[value='Reply']", True, vars.ConnectionParameters.page_load_timeout) self.failUnless(sel.is_text_present(thread_reply), "Thread reply not present") location = sel.get_location() self.failUnless("#post-" in location, "Not redirecting to post (not in url)")
def test_login2x(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) sumo_func.open(sel, "/en-US/kb/") self.functions.login(0, sel) self.assertEqual("Contributor Home Page", sel.get_title()) self.failUnless(sel.is_text_present("Contributor Home Page"), "contributor title missing") # Now bring up the already logged in screen sumo_func.open(sel, "/tiki-login_scr.php") # Verify the already logged in text self.failUnless(sel.is_element_present("css=div#mod-login_box > div"), "login box missing") self.failUnless(sel.is_text_present("Logged in as:"), "not logged in") # Click the log out in msg prompt sel.click("link=Log out") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) self.assertEqual("Firefox Support Home Page", sel.get_title())
def test_anon_csat_popular_article_yes(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() sumo_func.open(sel, vars.ConnectionParameters.authurl) sumo_func.open(sel, vars.ConnectionParameters.authurlssl) polloption = "2" sumo_func.open(sel, "/en-US/kb/") sel.click("css=div#mostpopular-new a") sel.wait_for_page_to_load(vars.ConnectionParameters.page_load_timeout) poll_option = 1 # sel.while("${poll_option}<6") while poll_option < 6: sumo_func.open(sel, "/en-US/kb/Firefox+Support+Home+Page") sel.click("css=div#promotebox-list a") sel.wait_for_page_to_load( vars.ConnectionParameters.page_load_timeout) sel.click("css=div#pollarea input") sel.click("css=div#polledit input[value=%s]" % str(poll_option)) sel.click("polls_submit") sel.click("css=div#pollarea2 input") self.failIf(sel.is_visible("polls_optionId"), "Poll still visible") poll_option = poll_option + 1
def test_locale_redirect(self): sel = self.selenium sumo_func = sumo_functions.SUMOfunctions() locales = ["sq", "ar", "as", "ast", "eu", "bn-BD", "bn-IN", "bs", "pt-BR", "bg", "ca", "hr", "da", "eo", "et", "fi", "fr", "fy-NL", "fur", "gl", "el", "gu-IN", "he", "hi-IN", "hu", "is", "ilo", "id", "ga-IE", "kn", "kk", "rw", "lt", "mk", "ms", "mr", "mn", "no", "oc", "pa-IN", "pl", "pt-PT", "ro", "rm", "gd", "sr-CYRL", "zh-CN", "si", "sk", "sv-SE", "ta-LK", "te", "th", "zh-TW", "vi"] for locale in locales: #print locale if "-" in locale: #check existing locales don't redirect sumo_func.open(sel, "/" + locale) self.failUnless("/" + locale in sel.get_location(), "%s not in %s" % (locale, sel.get_location())) else: #check redirect for existing xy when xy-ZW does not exist sumo_func.open(sel, "/" + locale + "-AA") self.failUnless("/" + locale + "/" in sel.get_location(), "%s not in %s" % (locale, sel.get_location()))