Browse files

Bug 945474 removing Apps page from mozilla.org

  • Loading branch information...
1 parent 32627ca commit fa4b343dd30d53beaec33d3e578d27d745285f73 @retornam retornam committed Dec 3, 2013
Showing with 0 additions and 161 deletions.
  1. +0 −67 pages/desktop/apps.py
  2. +0 −94 tests/test_apps.py
View
67 pages/desktop/apps.py
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from selenium.webdriver.common.by import By
-from selenium.webdriver.support.ui import WebDriverWait
-from pages.desktop.base import Base
-
-
-class Apps(Base):
-
- def go_to_page(self):
- self.open('/apps/')
-
- page_links_list = [
- {
- 'locator': (By.ID, 'marketplace-button'),
- 'url_suffix': 'marketplace.firefox.com/',
- }, {
- 'locator': (By.CSS_SELECTOR, '#showcased-nonfx a'),
- 'url_suffix': '/mobile/aurora/',
- }, {
- 'locator': (By.CSS_SELECTOR, '#apps-preview ul li:nth-of-type(1) > a'),
- 'url_suffix': '#games',
- }, {
- 'locator': (By.CSS_SELECTOR, '#apps-preview ul li:nth-of-type(2) > a'),
- 'url_suffix': '#news',
- }, {
- 'locator': (By.CSS_SELECTOR, '#apps-preview ul li:nth-of-type(3) > a'),
- 'url_suffix': '#productivity',
- }, {
- 'locator': (By.CSS_SELECTOR, '#build ul li:nth-of-type(1) > a'),
- 'url_suffix': 'marketplace.firefox.com/developers/',
- }, {
- 'locator': (By.CSS_SELECTOR, '#build ul li:nth-of-type(2) > a'),
- 'url_suffix': 'marketplace.firefox.com/developers/partners',
- }
- ]
-
- _showcased_apps_links_locator = (By.CSS_SELECTOR, 'div.billboard a')
- _sign_up_form_locator = (By.ID, 'footer-email-form')
- _sign_up_form_email_input_locator = (By.ID, 'id_email')
- _sign_up_form_html_radio_locator = (By.CSS_SELECTOR, '.field-format > label:nth-of-type(1)')
- _sign_up_form_text_radio_locator = (By.CSS_SELECTOR, '.field-format > label:nth-of-type(2)')
- _sign_up_form_privacy_checkbox_locator = (By.CSS_SELECTOR, '.privacy-check-label')
- _sign_up_form_submit_button_locator = (By.ID, 'footer_email_submit')
-
- @property
- def showcased_apps_links(self):
- return self.selenium.find_elements(*self._showcased_apps_links_locator)
-
- @property
- def is_sign_up_form_present(self):
- return self.is_element_present(*self._sign_up_form_locator)
-
- @property
- def are_sign_up_form_fields_visible(self):
- return self.is_element_visible(*self._sign_up_form_email_input_locator) \
- and self.is_element_visible(*self._sign_up_form_html_radio_locator) \
- and self.is_element_visible(*self._sign_up_form_text_radio_locator) \
- and self.is_element_visible(*self._sign_up_form_privacy_checkbox_locator) \
- and self.is_element_visible(*self._sign_up_form_submit_button_locator)
-
- def expand_sign_up_form(self):
- self.selenium.find_element(*self._sign_up_form_email_input_locator).click()
- WebDriverWait(self.selenium, self.timeout).until(lambda s: s.find_element(*self._sign_up_form_text_radio_locator))
View
94 tests/test_apps.py
@@ -1,94 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import pytest
-import requests
-from pages.desktop.apps import Apps
-from unittestzero import Assert
-
-
-class TestApps:
-
- @pytest.mark.nondestructive
- def test_footer_link_destinations_are_correct(self, mozwebqa):
- apps_page = Apps(mozwebqa)
- apps_page.go_to_page()
- Assert.contains(apps_page.footer.expected_footer_logo_destination,
- apps_page.footer.footer_logo_destination)
- Assert.contains(apps_page.footer.expected_footer_logo_img,
- apps_page.footer.footer_logo_img)
- bad_links = []
- for link in Apps.Footer.footer_links_list:
- url = apps_page.link_destination(link.get('locator'))
- if url.find(link.get('url_suffix')) < 1:
- 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_tabzilla_links_are_correct(self, mozwebqa):
- apps_page = Apps(mozwebqa)
- apps_page.go_to_page()
- Assert.true(apps_page.header.is_tabzilla_panel_visible)
- apps_page.header.toggle_tabzilla_dropdown()
- bad_links = []
- for link in Apps.Header.tabzilla_links_list:
- url = apps_page.link_destination(link.get('locator'))
- if url.find(link.get('url_suffix')) < 1:
- 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_page_links_are_visible(self, mozwebqa):
- apps_page = Apps(mozwebqa)
- apps_page.go_to_page()
- bad_links = []
- for link in apps_page.page_links_list:
- if not apps_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_page_link_destinations_are_correct(self, mozwebqa):
- apps_page = Apps(mozwebqa)
- apps_page.go_to_page()
- bad_links = []
- for link in apps_page.page_links_list:
- url = apps_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_page_link_urls_are_valid(self, mozwebqa):
- apps_page = Apps(mozwebqa)
- apps_page.go_to_page()
- bad_urls = []
- for link in apps_page.page_links_list:
- url = apps_page.link_destination(link.get('locator'))
- response_code = apps_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_showcased_apps_link_urls_are_valid(self, mozwebqa):
- apps_page = Apps(mozwebqa)
- apps_page.go_to_page()
- bad_urls = []
- for link in apps_page.showcased_apps_links:
- url = link.get_attribute('href')
- response_code = apps_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_sign_up_form_is_visible(self, mozwebqa):
- apps_page = Apps(mozwebqa)
- apps_page.go_to_page()
- Assert.true(apps_page.is_sign_up_form_present, 'The sign up form is not present on the page.')
- apps_page.expand_sign_up_form()
- Assert.true(apps_page.are_sign_up_form_fields_visible, 'The fields on the sign up form are not all visible.')

0 comments on commit fa4b343

Please sign in to comment.