Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Contribute_page coverage #164

Merged
merged 1 commit into from

3 participants

@AndreiH
Collaborator

Added some coverage for contribute page, for issue #106

@bobsilverberg

LGTM and passes on all 3 environments. :)

@stephendonner

Let's rock.

@stephendonner stephendonner merged commit 14dd4aa into mozilla:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 25, 2013
  1. Contribute_page coverage

    Andrei Hutusoru authored
This page is out of date. Refresh to see the latest.
Showing with 161 additions and 0 deletions.
  1. +95 −0 pages/desktop/contribute.py
  2. +66 −0 tests/test_contribute.py
View
95 pages/desktop/contribute.py
@@ -12,6 +12,101 @@
class Contribute(Base):
+ details_links = [
+ {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(1) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'https://support.mozilla.org/kb/superheroes-wanted',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(1) >.content > p > a:nth-of-type(2)'),
+ 'url_suffix': 'http://support.mozillamessaging.com/kb/superheroes-wanted',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(2) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'http://quality.mozilla.org/teams/desktop-firefox/',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(2) >.content > p > a:nth-of-type(2)'),
+ 'url_suffix': 'http://quality.mozilla.org/teams/web-qa/',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(2) >.content > p > a:nth-of-type(3)'),
+ 'url_suffix': 'http://quality.mozilla.org/',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(3) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'https://developer.mozilla.org/en/Introduction',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(3) >.content > p > a:nth-of-type(2)'),
+ 'url_suffix': 'http://www.whatcanidoformozilla.org/',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(4) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'https://affiliates.mozilla.org/',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(4) >.content > p > a:nth-of-type(2)'),
+ 'url_suffix': 'https://wiki.mozilla.org/MarketingGuide',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(5) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'https://wiki.mozilla.org/L10n',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(5) >.content > p > a:nth-of-type(2)'),
+ 'url_suffix': 'https://wiki.mozilla.org/L10n:Web_parts',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(6) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'https://wiki.mozilla.org/Webdev/GetInvolved',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(6) >.content > p > a:nth-of-type(2)'),
+ 'url_suffix': 'https://wiki.mozilla.org/Gaia/Hacking',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(7) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'https://addons.mozilla.org/developers/docs/getting-started',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(7) >.content > p > a:nth-of-type(2)'),
+ 'url_suffix': 'https://wiki.mozilla.org/AMO:Editors/Applying',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(8) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'https://blog.mozilla.org/creative/',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(9) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'https://developer.mozilla.org/docs/Project:How_to_Help',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(10) >.content > p > a:nth-of-type(1)'),
+ 'url_suffix': 'https://webmaker.org/',
+ }, {
+ 'locator': (By.CSS_SELECTOR, 'li:nth-of-type(10) >.content > p > a:nth-of-type(2)'),
+ 'url_suffix': 'https://webmaker.org/events/',
+ }
+ ]
+
+ images_list = [
+ {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(1) > img'),
+ 'img_name_suffix': 'sumo.png',
+ }, {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(2) > img'),
+ 'img_name_suffix': 'qmo.png',
+ }, {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(3) > img'),
+ 'img_name_suffix': 'dinohead.png',
+ }, {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(4) > img'),
+ 'img_name_suffix': 'firefox.png',
+ }, {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(5) > img'),
+ 'img_name_suffix': 'localization.png',
+ }, {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(6) > img'),
+ 'img_name_suffix': 'web.png',
+ }, {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(7) > img'),
+ 'img_name_suffix': 'addons.png',
+ }, {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(8) > img'),
+ 'img_name_suffix': 'creativecollective.png',
+ }, {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(9) > img'),
+ 'img_name_suffix': 'mdn.png',
+ }, {
+ 'locator': (By.CSS_SELECTOR, '.contribute-options > li:nth-child(10) > img'),
+ 'img_name_suffix': 'webmaker.png',
+ }
+ ]
+
def go_to_page(self):
self.open('/contribute/')
View
66 tests/test_contribute.py
@@ -13,6 +13,72 @@
class TestContribute:
@pytest.mark.nondestructive
+ def test_images_are_visible(self, mozwebqa):
+ contribute_page = Contribute(mozwebqa)
+ contribute_page.go_to_page()
+ bad_images = []
+ for image in contribute_page.images_list:
+ if not contribute_page.is_element_visible(*image.get('locator')):
+ bad_images.append('The image at %s is not visible' % image.get('locator')[1:])
+ Assert.equal(0, len(bad_images), '%s bad images found: ' % len(bad_images) + ', '.join(bad_images))
+
+ @pytest.mark.nondestructive
+ def test_image_srcs_are_correct(self, mozwebqa):
+ contribute_page = Contribute(mozwebqa)
+ contribute_page.go_to_page()
+ bad_images = []
+ for image in contribute_page.images_list:
+ src = contribute_page.image_source(image.get('locator'))
+ if not src.endswith(image.get('img_name_suffix')):
+ bad_images.append('%s does not end with %s' % (src, image.get('img_name_suffix')))
+ Assert.equal(0, len(bad_images), '%s bad images found: ' % len(bad_images) + ', '.join(bad_images))
+
+ @pytest.mark.nondestructive
+ def test_images_srcs_are_valid(self, mozwebqa):
+ contribute_page = Contribute(mozwebqa)
+ contribute_page.go_to_page()
+ bad_urls = []
+ for image in contribute_page.images_list:
+ url = contribute_page.image_source(image.get('locator'))
+ response_code = contribute_page.get_response_code(url)
+ if response_code != requests.codes.ok:
+ bad_urls.append('%s is not a valid url - status code: %s.' % (url, response_code))
+ Assert.equal(0, len(bad_urls), '%s bad urls found: ' % len(bad_urls) + ', '.join(bad_urls))
+
+ @pytest.mark.nondestructive
+ def test_tools_links_are_visible(self, mozwebqa):
+ contribute_page = Contribute(mozwebqa)
+ contribute_page.go_to_page()
+ bad_links = []
+ for link in contribute_page.details_links:
+ if not contribute_page.is_element_visible(*link.get('locator')):
+ bad_links.append('The link at %s is not visible' % link.get('locator')[1:])
+ Assert.equal(0, len(bad_links), '%s bad links found: ' % len(bad_links) + ', '.join(bad_links))
+
+ @pytest.mark.nondestructive
+ def test_tools_link_destinations_are_correct(self, mozwebqa):
+ contribute_page = Contribute(mozwebqa)
+ contribute_page.go_to_page()
+ bad_links = []
+ for link in contribute_page.details_links:
+ url = contribute_page.link_destination(link.get('locator'))
+ if not url.endswith(link.get('url_suffix')):
+ bad_links.append('%s does not end with %s' % (url, link.get('url_suffix')))
+ Assert.equal(0, len(bad_links), '%s bad links found: ' % len(bad_links) + ', '.join(bad_links))
+
+ @pytest.mark.nondestructive
+ def test_tools_link_urls_are_valid(self, mozwebqa):
+ contribute_page = Contribute(mozwebqa)
+ contribute_page.go_to_page()
+ bad_urls = []
+ for link in contribute_page.details_links:
+ url = contribute_page.link_destination(link.get('locator'))
+ response_code = contribute_page.get_response_code(url)
+ if response_code != requests.codes.ok:
+ bad_urls.append('%s is not a valid url - status code: %s.' % (url, response_code))
+ Assert.equal(0, len(bad_urls), '%s bad urls found: ' % len(bad_urls) + ', '.join(bad_urls))
+
+ @pytest.mark.nondestructive
def test_footer_section(self, mozwebqa):
contribute_page = Contribute(mozwebqa)
contribute_page.go_to_page()
Something went wrong with that request. Please try again.