def test_load_baseurl_and_assert_header(self, mozwebqa):
     '''
     Demo Test - Verify Header is correct on Amo Page
     '''
     home_page = MySiteHomePage(mozwebqa)
     home_page.go_to_home_page()
     Assert.equal(home_page.header_text, 'We are')
 def test_load_baseurl_and_assert_header(self, mozwebqa):
     '''
     Demo Test - Verify Header is correct on Amo Page
     '''
     home_page = MySiteHomePage(mozwebqa)
     home_page.go_to_home_page()
     Assert.equal(home_page.header_text, 'We are')
 def test_response_404(self, mozwebqa):
     main_page = MySiteHomePage(mozwebqa)
     garbage_path = ['/76976cd1a3cbadaf77533a', '/garbage123213', '/blablabla']
     for path in garbage_path:
         url = main_page.base_url + path
         response = main_page.get_response_code(url)
         Assert.equal(response, 'The request returned an HTTP 404 response.', 'in url: %s' % url)
 def test_load_baseurl_and_assert_header(self, mozwebqa):
     """
     Demo Test - Verify Header is correct on Amo Page
     """
     home_page = MySiteHomePage(mozwebqa)
     home_page.go_to_home_page()
     Assert.equal(home_page.header_text, "mozilla")
 def test_response_200(self, mozwebqa):
     main_page = MySiteHomePage(mozwebqa)
     for url in main_page.get_all_links():
         if '#' in url:
             continue
         response = main_page.get_response_code(url)
         Assert.equal(response, 'The request returned an HTTP 200 response.', 'in url: %s' % url)
 def test_load_baseurl_nondestructive(self, mozwebqa):
     '''
     This test is nondestructive - it does not write
     to the database or leave a mark on the website
     '''
     home_page = MySiteHomePage(mozwebqa)
     home_page.go_to_home_page()
     Assert.true(home_page.is_the_current_page)
 def test_load_baseurl_xfail(self, mozwebqa):
     '''
     This test will fail but we have marked it with XFail
     The test result will be XFail
     '''
     home_page = MySiteHomePage(mozwebqa)
     home_page.go_to_home_page()
     Assert.equal(home_page.header_text, 'BlaBla')
 def test_response_200(self, mozwebqa):
     main_page = MySiteHomePage(mozwebqa)
     for url in main_page.get_all_links():
         # Ignoring js links
         if '#' or 'javascript' in url:
             continue
         response = main_page.get_response_code(url)
         Assert.equal(response, 'The request returned an HTTP 200 response.', 'in url: %s' % url)
 def test_load_baseurl_xfail(self, mozwebqa):
     '''
     This test will fail but we have marked it with XFail
     The test result will be XFail
     '''
     home_page = MySiteHomePage(mozwebqa)
     home_page.go_to_home_page()
     Assert.equal(home_page.header_text, 'BlaBla')
 def test_load_baseurl_nondestructive(self, mozwebqa):
     """
     This test is nondestructive - it does not write
     to the database or leave a mark on the website
     """
     home_page = MySiteHomePage(mozwebqa)
     home_page.go_to_home_page()
     Assert.true(home_page.is_the_current_page)
 def test_request_ends_with_slash(self, mozwebqa):
     # BaseUrl Should be added without language in path for proper tests of locale (e.g. http://mozilla.org/firefox)
     lang = 'en-US'
     main_page = MySiteHomePage(mozwebqa, False)
     url_path = urlparse(main_page.base_url)
     response_path = main_page.get_response_path(main_page.base_url, lang)
     url_path_re = urlparse(response_path)
     if (url_path.path == '' and url_path_re.path == '/'):
         Assert.true(response_path.endswith('/'))
     else:
         Assert.contains("/%s/" % lang, response_path)
 def test_locale(self, mozwebqa):
     main_page = MySiteHomePage(mozwebqa)
     if main_page.is_change_locale_visible:
         for i in range(main_page.locales_count):
             main_page.locales[i].select()
             selected = main_page.locales[i].value
             regex = re.search('((.*-)(.*))', selected)
             try:
                 selected = regex.group(2) + regex.group(3).upper()
             except:
                 print ""
             Assert.contains(selected, main_page.get_url_current_page())
     else:
         print "There is no language selector on the page"
 def test_favicon_exist(self, mozwebqa):
     main_page = MySiteHomePage(mozwebqa)
     link = main_page.get_favicon_link(main_page.base_url)
     if link:
         match = re.search('favicon.(ico|png|gif)', link)
         if match:
             Assert.contains('favicon', link)
         response = main_page.get_response_code(link)
     elif link == None:
         u = urlparse(main_page.base_url)
         link = "%s://%s/favicon.ico" % (u.scheme, u.netloc)
         response = main_page.get_response_code(link)
     else:
         link = '%sfavicon.ico' % main_page.base_url
         response = main_page.get_response_code(link)
     Assert.equal(response, 'The request returned an HTTP 200 response.', 'in url: %s' % link)
 def test_robot_txt_present_on_site(self, mozwebqa):
     main_page = MySiteHomePage(mozwebqa)
     result = main_page.is_robot_txt_present(main_page.base_url)
     Assert.equal(result, "A robots.txt file is present on the server")
 def test_validate_feeds(self, mozwebqa):
     main_page = MySiteHomePage(mozwebqa)
     #feed_link = main_page.get_feed_link
     feed_link = 'http://blog.mozilla.com/feed/'
     validate_result = main_page.validate_feed(feed_link)
     Assert.not_none(validate_result)
 def test_validate_links(self, mozwebqa):
     main_page = MySiteHomePage(mozwebqa)
     main_page.validate_link(main_page.base_url)