Permalink
Browse files

Merge pull request #28 from rbillings/tagsearch

Added test for searching on a QMO post tag
  • Loading branch information...
2 parents b50d601 + 7d7b9d9 commit b441c529345cc2c46bd4bd77ac456d8149c39a7f @stephendonner stephendonner committed Oct 30, 2012
Showing with 50 additions and 1 deletion.
  1. +1 −1 pages/base.py
  2. +9 −0 pages/community.py
  3. +16 −0 pages/tag_results.py
  4. +24 −0 tests/test_tag_search.py
View
@@ -11,7 +11,7 @@
class BasePage(Page):
- _page_title_locator = (By.CSS_SELECTOR, "h1.page-title")
+ _page_title_locator = (By.CSS_SELECTOR, "h1.section-title")
@property
def is_logged_in(self):
View
@@ -4,13 +4,22 @@
# 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 CommunityPage(BasePage):
_page_title = u'Community | QMO \u2013 quality.mozilla.org'
+ _tag_locator = (By.CSS_SELECTOR, '#tag_cloud-3 a')
def go_to_community_page(self):
self.selenium.get(self.testsetup.base_url + '/community')
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)
View
@@ -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")
View
@@ -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.