Skip to content
Browse files

Merge pull request #76 from AlinT/addon_count_fail

Fix failing test due to increase number of addons
  • Loading branch information...
2 parents 1b528bc + 87786e7 commit b6392ba0d2d4c431b38c461eab807f41119e688e zacc committed Oct 19, 2012
Showing with 27 additions and 6 deletions.
  1. +19 −0 pages/dashboard_page.py
  2. +8 −6 tests/test_addon_count.py
View
19 pages/dashboard_page.py
@@ -19,6 +19,8 @@ class DashboardPage(FlightDeckBasePage):
_private_libraries_link = (By.LINK_TEXT, "Private Libraries")
_addons_public_counter = (By.ID, "public_addons_no")
_logged_in_username_locator = (By.CSS_SELECTOR, "li.name")
+ _next_locator = (By.CSS_SELECTOR, '.UI_Pagin_Action.next > a')
+ _previous_locator = (By.CSS_SELECTOR, '.UI_Pagin_Action.prev > a')
def addon(self, lookup):
return self.Addon(self.testsetup, lookup)
@@ -34,9 +36,26 @@ def logged_in_username(self):
def addons_count_label(self):
return self.selenium.find_element(*self._addons_public_counter).text
+ @property
def addons_element_count(self):
return len(self.selenium.find_elements(*self.Addon._base_locator))
+ def click_next(self):
+ self.selenium.find_element(*self._next_locator).click()
+ return DashboardPage(self.testsetup)
+
+ def click_previous(self):
+ self.selenium.find_element(*self._previous_locator).click()
+ return DashboardPage(self.testsetup)
+
+ @property
+ def is_next_button_enabled(self):
+ return self.is_element_visible(*self._next_locator)
+
+ @property
+ def is_previous_button_enabled(self):
+ return self.is_element_visible(*self._previous_locator)
+
def click_public_addons_link(self):
self.selenium.find_element(*self._public_addons_link).click()
View
14 tests/test_addon_count.py
@@ -3,9 +3,10 @@
# 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.home_page import HomePage
-from unittestzero import Assert
import pytest
+from unittestzero import Assert
+
+from pages.home_page import HomePage
class TestAddonCount:
@@ -23,11 +24,12 @@ def test_addon_count(self, mozwebqa):
dashboard_obj.click_public_addons_link()
- #Get the total count of the number of add-ons that are displayed on the dashboard.
- addon_count = dashboard_obj.addons_element_count()
-
#Get the number of addons that are displayed on the left hand side of the page.(Something like your add-ons(20))
counter = dashboard_obj.addons_count_label
+ addon_count = dashboard_obj.addons_element_count
+ while dashboard_obj.is_next_button_enabled:
+ addon_count = addon_count + dashboard_obj.addons_element_count
+ dashboard_obj = dashboard_obj.click_next()
#Assert that the total addons on the page matches the counter on the left hand side.
- Assert.equal(str(addon_count), str(counter))
+ Assert.equal(counter, str(addon_count))

0 comments on commit b6392ba

Please sign in to comment.
Something went wrong with that request. Please try again.