Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Merge pull request #251 from retornam/updateproducts
Browse files Browse the repository at this point in the history
Updating locators for new products page
  • Loading branch information
jgmize committed Nov 21, 2013
2 parents 892e0ed + 256f006 commit c64e9a2
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 113 deletions.
126 changes: 64 additions & 62 deletions pages/desktop/products.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,116 +16,118 @@ def go_to_page(self):
product_nav_links_list = [
{
'locator': (By.CSS_SELECTOR, '#products-nav li:nth-child(1) a'),
'url_suffix': '/products/#products',
'url_suffix': '/products/#firefox',
}, {
'locator': (By.CSS_SELECTOR, '#products-nav li:nth-child(2) a'),
'url_suffix': '/products/#innovations',
'url_suffix': '/products/#mozilla',
}, {
'locator': (By.CSS_SELECTOR, '#products-nav li:nth-child(3) a'),
'url_suffix': '/products/#tools',
}, {
'locator': (By.CSS_SELECTOR, '#products-nav li:nth-child(4) a'),
'url_suffix': '/products/#platforms',
'url_suffix': '/products/#developers',
}
]

images_list = [
{
'locator': (By.CSS_SELECTOR, '#products li:nth-child(1) a img'),
'locator': (By.CSS_SELECTOR, '#firefox li:nth-child(1) a img'),
'img_name_suffix': 'badge-firefox.jpg?2013-06',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(2) a img'),
'locator': (By.CSS_SELECTOR, '#firefox li:nth-child(2) a img'),
'img_name_suffix': 'badge-android.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#firefox li:nth-child(3) a img'),
'img_name_suffix': 'badge-firefoxos.jpg?2013-06',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(3) a img'),
'locator': (By.CSS_SELECTOR, '#firefox li:nth-child(4) a img'),
'img_name_suffix': 'badge-marketplace.jpg?2013-06',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(4) a img'),
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(1) a img'),
'img_name_suffix': 'badge-persona.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(5) a img'),
'img_name_suffix': 'badge-thunderbird.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(6) a img'),
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(2) a img'),
'img_name_suffix': 'badge-webmaker.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#innovations li:nth-child(1) a img'),
'img_name_suffix': 'badge-webfwd.jpg',
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(3) a img'),
'img_name_suffix': 'badge-openbadges.png',
}, {
'locator': (By.CSS_SELECTOR, '#innovations li:nth-child(2) a img'),
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(4) a img'),
'img_name_suffix': 'badge-labs.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#tools li:nth-child(1) a img'),
'img_name_suffix': 'badge-tools.jpg',
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(5) a img'),
'img_name_suffix': 'badge-webfwd.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(6) a img'),
'img_name_suffix': 'badge-thunderbird.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#tools li:nth-child(2) a img'),
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(1) a img'),
'img_name_suffix': 'badge-bugzilla.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#tools li:nth-child(3) a img'),
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(2) a img'),
'img_name_suffix': 'badge-firebug.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#platforms li:nth-child(1) a img'),
'img_name_suffix': 'badge-gecko.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#platforms li:nth-child(2) a img'),
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(3) a img'),
'img_name_suffix': 'badge-xulrunner.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#platforms li:nth-child(3) img'),
'img_name_suffix': 'badge-reserved.jpg',
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(4) img'),
'img_name_suffix': 'badge-gecko.jpg',
}, {
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(5) img'),
'img_name_suffix': 'badge-api.jpg',
}
]

products_links_list = [
firefox_links_list = [
{
'locator': (By.CSS_SELECTOR, '#products li:nth-child(1) a'),
'url_suffix': '/firefox/',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(2) a'),
'url_suffix': '/firefox/os/',
'locator': (By.CSS_SELECTOR, '#firefox li:nth-child(1) a'),
'url_suffix': '/firefox/features/',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(3) a'),
'url_suffix': '/apps/',
'locator': (By.CSS_SELECTOR, '#firefox li:nth-child(2) a'),
'url_suffix': '/firefox/mobile/features/',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(4) a'),
'url_suffix': '/persona/',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(5) a'),
'url_suffix': '/thunderbird/',
'locator': (By.CSS_SELECTOR, '#firefox li:nth-child(3) a'),
'url_suffix': '/firefox/os/',
}, {
'locator': (By.CSS_SELECTOR, '#products li:nth-child(6) a'),
'url_suffix': 'webmaker.org/',
'locator': (By.CSS_SELECTOR, '#firefox li:nth-child(4) a'),
'url_suffix': 'marketplace.firefox.com/',
}
]

innovations_links_list = [
mozilla_links_list = [
{
'locator': (By.CSS_SELECTOR, '#innovations li:nth-child(1) a'),
'url_suffix': 'webfwd.org/',
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(1) a'),
'url_suffix': '/persona/',
}, {
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(2) a'),
'url_suffix': 'webmaker.org/',
}, {
'locator': (By.CSS_SELECTOR, '#innovations li:nth-child(2) a'),
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(3) a'),
'url_suffix': 'openbadges.org/',
}, {
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(4) a'),
'url_suffix': 'mozillalabs.com/',
}
]

tools_links_list = [
{
'locator': (By.CSS_SELECTOR, '#tools li:nth-child(1) a'),
'url_suffix': '/Tools/',
}, {
'locator': (By.CSS_SELECTOR, '#tools li:nth-child(2) a'),
'url_suffix': 'www.bugzilla.org/',
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(5) a'),
'url_suffix': 'webfwd.org/',
}, {
'locator': (By.CSS_SELECTOR, '#tools li:nth-child(3) a'),
'url_suffix': 'getfirebug.com/',
'locator': (By.CSS_SELECTOR, '#mozilla li:nth-child(6) a'),
'url_suffix': '/thunderbird/',
}
]

platforms_links_list = [
developers_links_list = [
{
'locator': (By.CSS_SELECTOR, '#platforms li:nth-child(1) a'),
'url_suffix': '/Gecko',
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(1) a'),
'url_suffix': 'bugzilla.org/',
}, {
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(2) a'),
'url_suffix': 'getfirebug.com/',
}, {
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(3) a'),
'url_suffix': 'developer.mozilla.org/XULRunner',
}, {
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(4) a'),
'url_suffix': 'developer.mozilla.org/Gecko',
}, {
'locator': (By.CSS_SELECTOR, '#platforms li:nth-child(2) a'),
'url_suffix': '/XULRunner',
'locator': (By.CSS_SELECTOR, '#developers li:nth-child(5) a'),
'url_suffix': '/Apps/Reference',
}
]
69 changes: 18 additions & 51 deletions tests/test_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,131 +95,98 @@ def test_image_srcs_are_correct(self, mozwebqa):
Assert.equal(0, len(bad_images), '%s bad images found: ' % len(bad_images) + ', '.join(bad_images))

@pytest.mark.nondestructive
def test_products_links_are_visible(self, mozwebqa):
def test_firefox_links_are_visible(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_links = []
for link in products_page.products_links_list:
for link in products_page.firefox_links_list:
if not products_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_products_link_destinations_are_correct(self, mozwebqa):
def test_firefox_link_destinations_are_correct(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_links = []
for link in products_page.products_links_list:
for link in products_page.firefox_links_list:
url = products_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_products_link_urls_are_valid(self, mozwebqa):
def test_firefox_link_urls_are_valid(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_urls = []
for link in products_page.products_links_list:
for link in products_page.firefox_links_list:
url = products_page.link_destination(link.get('locator'))
response_code = products_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_innovations_links_are_visible(self, mozwebqa):
def test_mozilla_links_are_visible(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_links = []
for link in products_page.innovations_links_list:
for link in products_page.mozilla_links_list:
if not products_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_innovations_link_destinations_are_correct(self, mozwebqa):
def test_mozilla_link_destinations_are_correct(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_links = []
for link in products_page.innovations_links_list:
for link in products_page.mozilla_links_list:
url = products_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_innovations_link_urls_are_valid(self, mozwebqa):
def test_mozilla_link_urls_are_valid(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_urls = []
for link in products_page.innovations_links_list:
for link in products_page.mozilla_links_list:
url = products_page.link_destination(link.get('locator'))
response_code = products_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):
def test_developers_links_are_visible(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_links = []
for link in products_page.tools_links_list:
for link in products_page.developers_links_list:
if not products_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):
def test_developers_link_destinations_are_correct(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_links = []
for link in products_page.tools_links_list:
for link in products_page.developers_links_list:
url = products_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):
def test_developers_link_urls_are_valid(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_urls = []
for link in products_page.tools_links_list:
url = products_page.link_destination(link.get('locator'))
response_code = products_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_platforms_links_are_visible(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_links = []
for link in products_page.platforms_links_list:
if not products_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_platforms_link_destinations_are_correct(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_links = []
for link in products_page.platforms_links_list:
url = products_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_platforms_link_urls_are_valid(self, mozwebqa):
products_page = ProductsPage(mozwebqa)
products_page.go_to_page()
bad_urls = []
for link in products_page.platforms_links_list:
for link in products_page.developers_links_list:
url = products_page.link_destination(link.get('locator'))
response_code = products_page.get_response_code(url)
if response_code != requests.codes.ok:
Expand Down

0 comments on commit c64e9a2

Please sign in to comment.