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

Added test for Media page #16

Closed
wants to merge 1 commit 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion page.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 Down Expand Up @@ -27,4 +28,4 @@ def is_element_visible(self, locator):
try:
return self.selenium.find_element(*locator).is_displayed()
except:
return False
return False
5 changes: 3 additions & 2 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 @@ -10,7 +11,7 @@
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
Expand All @@ -27,4 +28,4 @@ def page_title(self):
@property
def header_region(self):
from regions.header import HeaderRegion
return HeaderRegion(self.testsetup)
return HeaderRegion(self.testsetup)
9 changes: 5 additions & 4 deletions pages/docs.py
@@ -1,18 +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 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

@property
def is_page_title_correct(self):
return self.selenium.get_title() == self._page_title
return self.selenium.get_title() == self._page_title
20 changes: 20 additions & 0 deletions pages/media.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 base import BasePage


class MediaPage(BasePage):

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

def go_to_media_page(self):
self.selenium.get(self.testsetup.base_url + "/media")
self.is_the_current_page

@property
def is_page_title_correct(self):
return self.selenium.get_title() == self._page_title
16 changes: 12 additions & 4 deletions pages/regions/header.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 @@ -7,11 +8,18 @@

from selenium.webdriver.common.by import By


class HeaderRegion(Page):

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


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

def click_media_link(self):
self.selenium.find_element(*self._media_link_locator).click()
from pages.media import MediaPage
return MediaPage(self.testsetup)

def click_docs_link(self):
self.selenium.find_element(*self._docs_link_locator).click()
from pages.docs import DocsPage
return DocsPage(self.testsetup)
return DocsPage(self.testsetup)
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -3,6 +3,6 @@ UnittestZero
execnet==1.0.9
py==1.4.7
pytest==2.2.3
pytest-mozwebqa==0.8
pytest-mozwebqa==0.10
pytest-xdist==1.8
selenium
5 changes: 5 additions & 0 deletions tests/build/pip-delete-this-directory.txt
@@ -0,0 +1,5 @@
This file is placed here by pip to indicate the source was put
here by pip.

Once this package is successfully installed this source code will be
deleted (unless you remove this file).