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

Commit

Permalink
Merge pull request #28 from rbillings/tagsearch
Browse files Browse the repository at this point in the history
Added test for searching on a QMO post tag
  • Loading branch information
stephendonner committed Oct 30, 2012
2 parents b50d601 + 7d7b9d9 commit b441c52
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pages/base.py
Expand Up @@ -11,7 +11,7 @@


class BasePage(Page): class BasePage(Page):


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


@property @property
def is_logged_in(self): def is_logged_in(self):
Expand Down
9 changes: 9 additions & 0 deletions pages/community.py
Expand Up @@ -4,13 +4,22 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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 selenium.webdriver.common.by import By

from base import BasePage from base import BasePage




class CommunityPage(BasePage): class CommunityPage(BasePage):


_page_title = u'Community | QMO \u2013 quality.mozilla.org' _page_title = u'Community | QMO \u2013 quality.mozilla.org'
_tag_locator = (By.CSS_SELECTOR, '#tag_cloud-3 a')


def go_to_community_page(self): def go_to_community_page(self):
self.selenium.get(self.testsetup.base_url + '/community') self.selenium.get(self.testsetup.base_url + '/community')
self.is_the_current_page self.is_the_current_page

@property
def click_first_tag_link(self):
self.selenium.find_element(*self._tag_locator).click()
from pages.tag_results import TagResultsPage
return TagResultsPage(self.testsetup)
16 changes: 16 additions & 0 deletions pages/tag_results.py
@@ -0,0 +1,16 @@
#!/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 selenium.webdriver.common.by import By

from base import BasePage


class TagResultsPage(BasePage):

@property
def results(self):
return self.selenium.find_elements(By.CSS_SELECTOR, "#content-main > article")
24 changes: 24 additions & 0 deletions tests/test_tag_search.py
@@ -0,0 +1,24 @@
#!/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
from unittestzero import Assert

from pages.community import CommunityPage
from pages.tag_results import TagResultsPage


class TestTagSearchPage:

@pytest.mark.nondestructive
def test_search_tag(self, mozwebqa):
community_page = CommunityPage(mozwebqa)
community_page.go_to_community_page()

tag_results_page = community_page.click_first_tag_link

Assert.contains('Posts and pages tagged', tag_results_page.page_title)
Assert.greater(len(tag_results_page.results), 0)

0 comments on commit b441c52

Please sign in to comment.