diff --git a/mozwebqa.cfg b/mozwebqa.cfg index dc03d9b2..ecf37445 100644 --- a/mozwebqa.cfg +++ b/mozwebqa.cfg @@ -1,4 +1,4 @@ [DEFAULT] api = webdriver -baseurl = https://www-dev.allizom.org/b/ +baseurl = https://www-dev.allizom.org/b diff --git a/pages/desktop/base.py b/pages/desktop/base.py index 9982ba2a..f2aa40b6 100644 --- a/pages/desktop/base.py +++ b/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): diff --git a/pages/desktop/contribute.py b/pages/desktop/contribute.py index a5331e0a..dcb41c25 100644 --- a/pages/desktop/contribute.py +++ b/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 diff --git a/pages/desktop/mission.py b/pages/desktop/mission.py new file mode 100644 index 00000000..27c3693f --- /dev/null +++ b/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 diff --git a/tests/test_404.py b/tests/test_404.py new file mode 100644 index 00000000..2182c205 --- /dev/null +++ b/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()) diff --git a/tests/test_contribute.py b/tests/test_contribute.py index 049da4d6..32be66ce 100644 --- a/tests/test_contribute.py +++ b/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: diff --git a/tests/test_homepage.py b/tests/test_homepage.py index d8e63994..958fabb9 100644 --- a/tests/test_homepage.py +++ b/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: diff --git a/tests/test_mission.py b/tests/test_mission.py new file mode 100644 index 00000000..905d5be1 --- /dev/null +++ b/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) diff --git a/tests/test_technology.py b/tests/test_technology.py index 2e7f6843..2f42e70c 100644 --- a/tests/test_technology.py +++ b/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