Permalink
Browse files

Merge pull request #55 from retornam/bedrock

Adding tests for about page:
  • Loading branch information...
2 parents 02aeaec + 99631a1 commit f7420a82b9bfdac55b522c2483d954969d34eba5 @stephendonner stephendonner committed Jun 9, 2012
Showing with 92 additions and 0 deletions.
  1. +54 −0 pages/desktop/about.py
  2. +38 −0 tests/test_about.py
@@ -0,0 +1,54 @@
+#!/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 pages.desktop.base import Base
+
+
+class AboutPage(Base):
+
+ def go_to_page(self):
+ self.open('/about/')
+
+ _mission_header_link = (By.CSS_SELECTOR, '#nav-main > ul > li:nth-child(1) > a')
+ _about_header_link = (By.CSS_SELECTOR, '#nav-main > ul > li:nth-child(2) > a')
+ _projects_header_link = (By.CSS_SELECTOR, '#nav-main > ul > li:nth-child(3) > a')
+ _get_involved_header_link = (By.CSS_SELECTOR, '#nav-main > ul > li:nth-child(4) > a')
+ _get_to_know_mozilla_header = (By.CSS_SELECTOR, '.large.center')
+ _career_center_link = (By.CSS_SELECTOR, '.links:nth-of-type(1) > li:nth-of-type(1) > h4 > a')
+ _press_center_link = (By.CSS_SELECTOR, '.links:nth-of-type(1) > li:nth-of-type(2) > h4 > a')
+ _mozilla_blog_link = (By.CSS_SELECTOR, '.links:nth-of-type(1) > li:nth-of-type(3) > h4 > a')
+ _privacy_center_link = (By.CSS_SELECTOR, '.links:nth-of-type(1) > li:nth-of-type(4) > h4 > a')
+ _forums_link = (By.CSS_SELECTOR, '.links:nth-of-type(1) > li:nth-of-type(5) > h4 > a')
+ _governance_link = (By.CSS_SELECTOR, '.links:nth-of-type(2) > li:nth-of-type(5) > h4 > a')
+ _get_involved_link = (By.CSS_SELECTOR, '.links:nth-of-type(2) > li:nth-of-type(4) > h4 > a')
+ _locations_link = (By.CSS_SELECTOR, '.links:nth-of-type(2) > li:nth-of-type(3) > h4 > a')
+ _partnerships_link = (By.CSS_SELECTOR, '.links:nth-of-type(2) > li:nth-of-type(2) > h4 > a')
+ _brand_toolkit_link = (By.CSS_SELECTOR, '.links:nth-of-type(2) > li:nth-of-type(1) > h4 > a')
+
+ @property
+ def are_major_links_present(self):
+ return self.is_element_present(*self._career_center_link) and \
+ self.is_element_present(*self._press_center_link) and \
+ self.is_element_present(*self._mozilla_blog_link) and \
+ self.is_element_present(*self._privacy_center_link) and \
+ self.is_element_present(*self._forums_link) and \
+ self.is_element_present(*self._governance_link) and \
+ self.is_element_present(*self._get_involved_header_link) and \
+ self.is_element_present(*self._locations_link) and \
+ self.is_element_present(*self._partnerships_link) and \
+ self.is_element_present(*self._brand_toolkit_link)
+
+ @property
+ def are_nav_links_present(self):
+ return self.is_element_present(*self._mission_header_link) and \
+ self.is_element_present(*self._about_header_link) and \
+ self.is_element_present(*self._projects_header_link) and \
+ self.is_element_present(*self._get_involved_link)
+
+ @property
+ def is_know_mozilla_header_present(self):
+ return self.is_element_present(*self._get_to_know_mozilla_header)
View
@@ -0,0 +1,38 @@
+#!/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
+from unittestzero import Assert
+from pages.desktop.about import AboutPage
+
+
+class TestAboutPage:
+
+ @pytest.mark.nondestructive
+ def test_footer_section(self, mozwebqa):
+ about_page = AboutPage(mozwebqa)
+ about_page.go_to_page()
+ Assert.true(about_page.footer.are_footer_links_visible)
+
+ @pytest.mark.nondestructive
+ def test_header_section(self, mozwebqa):
+ about_page = AboutPage(mozwebqa)
+ about_page.go_to_page()
+ Assert.true(about_page.header.is_tabzilla_panel_visible)
+ about_page.header.toggle_tabzilla_dropdown()
+ Assert.true(about_page.header.are_tabzilla_links_visible)
+
+ @pytest.mark.nondestructive
+ def test_navbars_and_headings(self, mozwebqa):
+ about_page = AboutPage(mozwebqa)
+ about_page.go_to_page()
+ Assert.true(about_page.are_nav_links_present)
+
+ @pytest.mark.nondestructive
+ def test_major_links(self, mozwebqa):
+ about_page = AboutPage(mozwebqa)
+ about_page.go_to_page()
+ Assert.true(about_page.are_major_links_present)

0 comments on commit f7420a8

Please sign in to comment.