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

Docspagefix #15

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion page.py
Expand Up @@ -27,4 +27,4 @@ def is_element_visible(self, locator):
try:
return self.selenium.find_element(*locator).is_displayed()
except:
return False
return False
15 changes: 11 additions & 4 deletions pages/base.py
@@ -1,4 +1,5 @@
#!/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/.
Expand All @@ -11,16 +12,22 @@
class BasePage(Page):

_page_title_locator = (By.CSS_SELECTOR, "h1.page-title")

@property
def is_logged_in(self):
return self.login_region.is_logout_visible

@property
def login_region(self):
from regions.login import LoginRegion
return LoginRegion(self.testsetup)

@property
def is_logged_in(self):
return self.login_region.is_logout_visible

@property
def page_title(self):
return self.selenium.find_element(*self._page_title_locator).text

@property
def header_region(self):
from regions.header import HeaderRegion
return HeaderRegion(self.testsetup)

17 changes: 17 additions & 0 deletions pages/docs.py
@@ -0,0 +1,17 @@
#!/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 base import BasePage


class DocsPage(BasePage):

_page_title = u"Docs | QMO \u2013 quality.mozilla.org"

def go_to_docs_page(self):
self.selenium.get(self.testsetup.base_url + "/docs")
self.is_the_current_page

20 changes: 20 additions & 0 deletions pages/regions/header.py
@@ -0,0 +1,20 @@
#!/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 page import Page

from selenium.webdriver.common.by import By


class HeaderRegion(Page):

_docs_link_locator = (By.CSS_SELECTOR, '#nav-main li:nth-child(7) a')

def click_docs_link(self):
self.selenium.find_element(*self._docs_link_locator).click()
from pages.docs import DocsPage
return DocsPage(self.testsetup)

19 changes: 19 additions & 0 deletions tests/test_docs.py
@@ -0,0 +1,19 @@
#!/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 unittestzero import Assert

from pages.home import HomePage


class TestDocsPage:

def test_docs_title(self,mozwebqa):
home_page = HomePage(mozwebqa)
home_page.go_to_home_page()
docs_page = home_page.header_region.click_docs_link()
Assert.true(docs_page.is_the_current_page)