Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #35 from bebef1987/404

404 tests
  • Loading branch information...
commit 5d7a13972c2de5340ebc9a5c175bd3c74d940141 2 parents 067ef49 + dbba481
@retornam retornam authored
View
2  mozwebqa.cfg
@@ -1,4 +1,4 @@
[DEFAULT]
api = webdriver
-baseurl = https://www-dev.allizom.org/b/
+baseurl = https://www-dev.allizom.org/b
View
5 pages/desktop/base.py
@@ -2,12 +2,13 @@
# 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/.
+# file, You can obtain one at http://mozilla.org/MPL/2.0/
-from pages.page import Page
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
+from pages.page import Page
+
class Base(Page):
View
1  pages/desktop/contribute.py
@@ -6,7 +6,6 @@
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
-
from pages.desktop.base import Base
from pages.page import Page
View
44 pages/desktop/mission.py
@@ -0,0 +1,44 @@
+#!/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 pages.desktop.base import Base
+from selenium.webdriver.common.by import By
+
+
+class MissionPage(Base):
+
+ _mission_sidebar_link = (By.CSS_SELECTOR, '.sidebar > nav > ul > li:nth-of-type(1) > a')
+ _forums_sidebar_link = (By.CSS_SELECTOR, '.sidebar > nav > ul > li:nth-of-type(2) > a')
+ _governance_sidebar_link = (By.CSS_SELECTOR, '.sidebar > nav > ul > li:nth-of-type(3) > a')
+ _history_sidebar_link = (By.CSS_SELECTOR, '.sidebar > nav > ul > li:nth-of-type(4) > a')
+ _home_breadcrumb_link = (By.CSS_SELECTOR, '.breadcrumbs > a')
+ _mission_breadcrumb_link = (By.CSS_SELECTOR, '.breadcrumbs > span')
+ _video_section = (By.CSS_SELECTOR, '.mozilla-video-control-overlay')
+ _our_projects_learn_more_link = (By.CSS_SELECTOR, '.reference:nth-of-type(1) > .more')
+ _get_involved_learn_more_link = (By.CSS_SELECTOR, '.reference:nth-of-type(2) > .more')
+
+ def go_to_page(self):
+ self.open('/en-US/mission')
+
+ @property
+ def are_sidebar_links_visible(self):
+ self.is_element_visible(*self._mission_sidebar_link)
+ self.is_element_visible(*self._forums_sidebar_link)
+ self.is_element_visible(*self._governance_sidebar_link)
+ self.is_element_visible(*self._history_sidebar_link)
+ return True
+
+ @property
+ def are_breadcrumb_links_visible(self):
+ self.is_element_visible(*self._home_breadcrumb_link)
+ self.is_element_visible(*self._mission_breadcrumb_link)
+ return True
+
+ @property
+ def are_learn_more_links_visible(self):
+ self.is_element_visible(*self._our_projects_learn_more_link)
+ self.is_element_visible(*self._get_involved_learn_more_link)
+ return True
View
28 tests/test_404.py
@@ -0,0 +1,28 @@
+#!/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 unittestzero import Assert
+
+
+@pytest.mark.skip_selenium
+class TestStatus(object):
+
+ @pytest.mark.nondestructive
+ def test_status_code_returns_404(self, mozwebqa):
+ url=mozwebqa.base_url+'/abck'
+ response=requests.get(url)
+ Assert.equal(response.status_code, 404)
+
+ @pytest.mark.nondestructive
+ def test_xrobots_tag_is_present(self, mozwebqa):
+ '''Test for X-Robots-Tag header'''
+ url=mozwebqa.base_url
+ response=requests.get(url)
+ Assert.contains("x-robots-tag", response.headers.keys())
+ Assert.contains('noodp', response.headers.values())
View
3  tests/test_contribute.py
@@ -5,8 +5,9 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pytest
-from unittestzero import Assert
from pages.desktop.contribute import Contribute
+from unittestzero import Assert
+
class TestContribute:
View
2  tests/test_homepage.py
@@ -5,8 +5,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pytest
-from unittestzero import Assert
from pages.desktop.home import Home
+from unittestzero import Assert
class TestHomepage:
View
23 tests/test_mission.py
@@ -0,0 +1,23 @@
+from pages.desktop.mission import MissionPage
+from unittestzero import Assert
+
+
+class TestMissionPage:
+
+ def test_sidebar_links(self, mozwebqa):
+ missionPage = MissionPage(mozwebqa)
+ missionPage.go_to_page()
+ Assert.true(missionPage.are_sidebar_links_visible)
+ Assert.true(missionPage.are_breadcrumb_links_visible)
+ Assert.true(missionPage.are_learn_more_links_visible)
+
+ def test_header_section_present(self, mozwebqa):
+ missionPage = MissionPage(mozwebqa)
+ missionPage.go_to_page()
+ missionPage.toggle_tabzilla_dropdown()
+ Assert.true(missionPage.are_tabzilla_links_present)
+
+ def test_footer_section_present(self, mozwebqa):
+ missionPage = MissionPage(mozwebqa)
+ missionPage.go_to_page()
+ Assert.true(missionPage.are_footer_links_present)
View
3  tests/test_technology.py
@@ -2,10 +2,11 @@
# 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/.
+# file, You can obtain one at http://mozilla.org/MPL/2.0/
import pytest
from unittestzero import Assert
+
from pages.desktop.technology_page import TechnologyPage
Please sign in to comment.
Something went wrong with that request. Please try again.