This repository has been archived by the owner on Aug 20, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from bebef1987/404
404 tests
- Loading branch information
Showing
9 changed files
with
104 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,4 +1,4 @@ | |||
[DEFAULT] | [DEFAULT] | ||
api = webdriver | api = webdriver | ||
baseurl = https://www-dev.allizom.org/b/ | baseurl = https://www-dev.allizom.org/b | ||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters