Skip to content
Browse files

Issue #87. Moztrap 5932

  • Loading branch information...
1 parent b010f06 commit c19005aaed7667c78c139dad2e558f7a29faa5c0 @sashakruglov committed Jan 31, 2013
Showing with 87 additions and 7 deletions.
  1. +15 −0 pages/create_bulk_cases_page.py
  2. +15 −0 pages/create_case_page.py
  3. +12 −0 pages/manage_cases_page.py
  4. +2 −0 pages/page.py
  5. +43 −7 tests/test_pinning_filters.py
View
15 pages/create_bulk_cases_page.py
@@ -66,3 +66,18 @@ def create_bulk_cases(
self.selenium.find_element(*self._submit_locator).click()
return cases
+
+ @property
+ def product_value(self):
+ product_select = self.find_element(*self._product_select_locator)
+ return Select(product_select).first_selected_option.text
+
+ @property
+ def product_version_value(self):
+ version_select = self.find_element(*self._version_select_locator)
+ return Select(version_select).first_selected_option.text
+
+ @property
+ def suite_value(self):
+ suite_select = self.find_element(*self._suite_select_locator)
+ return Select(suite_select).first_selected_option.text
View
15 pages/create_case_page.py
@@ -61,3 +61,18 @@ def create_case(self, name='Test Case', product='Test Product', version='Test Ve
self.selenium.find_element(*self._submit_locator).click()
return case
+
+ @property
+ def product_value(self):
+ product_select = self.find_element(*self._product_select_locator)
+ return Select(product_select).first_selected_option.text
+
+ @property
+ def product_version_value(self):
+ version_select = self.find_element(*self._version_select_locator)
+ return Select(version_select).first_selected_option.text
+
+ @property
+ def suite_value(self):
+ suite_select = self.find_element(*self._suite_select_locator)
+ return Select(suite_select).first_selected_option.text
View
12 pages/manage_cases_page.py
@@ -16,6 +16,8 @@ class MozTrapManageCasesPage(MozTrapBasePage):
_delete_case_locator = (By.CSS_SELECTOR, '#managecases .itemlist .listitem[data-title="%(case_name)s"] .action-delete')
_case_status_locator = (By.CSS_SELECTOR, '#managecases .itemlist .listitem[data-title="%(case_name)s"] .status-action')
+ _create_case_button_locator = (By.CSS_SELECTOR, '#managecases .create.single')
+ _create_bulk_cases_button_locator = (By.CSS_SELECTOR, '#managecases .create.bulk')
@property
def filter_form(self):
@@ -25,6 +27,16 @@ def go_to_manage_cases_page(self):
self.selenium.get(self.base_url + '/manage/cases/')
self.is_the_current_page
+ def click_create_case_button(self):
+ self.find_element(*self._create_case_button_locator).click()
+ from pages.create_case_page import MozTrapCreateCasePage
+ return MozTrapCreateCasePage(self.testsetup)
+
+ def click_create_bulk_cases_button(self):
+ self.find_element(*self._create_bulk_cases_button_locator).click()
+ from pages.create_bulk_cases_page import MozTrapCreateBulkCasesPage
+ return MozTrapCreateBulkCasesPage(self.testsetup)
+
def delete_case(self, name='Test Case'):
_delete_locator = (self._delete_case_locator[0], self._delete_case_locator[1] % {'case_name': name})
View
2 pages/page.py
@@ -104,6 +104,8 @@ def find_element(self, *locator):
def find_elements(self, *locator):
return self._selenium_root.find_elements(*locator)
+ def go_back(self):
+ self.selenium.back()
class PageRegion(Page):
View
50 tests/test_pinning_filters.py
@@ -5,41 +5,77 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pytest
-
from unittestzero import Assert
from pages.base_test import BaseTest
-from pages.manage_runs_page import MozTrapManageRunsPage
+
+
+PINNED_FILTER_COLOR = u'#DFB081'
class TestPinningFilters(BaseTest):
@pytest.mark.moztrap(5935)
@pytest.mark.nondestructive
def test_that_pinning_filter_on_product_version_set_defaults_in_new_run(self, mozwebqa_logged_in):
- pinned_filter_color = u'#DFB081'
product = self.create_product(mozwebqa_logged_in)
product_version_name = u'%s %s' % (product['name'], product['version']['name'])
+ from pages.manage_runs_page import MozTrapManageRunsPage
manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in)
manage_runs_pg.go_to_manage_runs_page()
- filter_item = manage_runs_pg.filter_form.filter_by(
- lookup='productversion', value=product_version_name)
+ filter_item = manage_runs_pg.filter_form.filter_by(lookup='productversion', value=product_version_name)
#check that filter is not orange before it's pinned
Assert.not_equal(
filter_item.get_filter_color(),
- pinned_filter_color)
+ PINNED_FILTER_COLOR)
filter_item.pin_filter()
#check that filter is orange after it's been pinned
Assert.equal(
filter_item.get_filter_color(),
- pinned_filter_color)
+ PINNED_FILTER_COLOR)
create_run_pg = manage_runs_pg.click_create_run_button()
Assert.equal(
create_run_pg.product_version,
product_version_name)
+
+ @pytest.mark.moztrap(5932)
+ @pytest.mark.nondestructive
+ def test_that_pinning_filters_on_product_and_version_and_suite_set_defaults_in_new_case(self, mozwebqa_logged_in):
+ product = self.create_product(mozwebqa_logged_in)
+ version = product['version']
+ product_version_name = u'%s %s' % (product['name'], version['name'])
+ suite = self.create_suite(mozwebqa_logged_in, product=product)
+
+ from pages.manage_cases_page import MozTrapManageCasesPage
+ manage_cases_pg = MozTrapManageCasesPage(mozwebqa_logged_in)
+ manage_cases_pg.go_to_manage_cases_page()
+
+ filters = []
+ filters.append(manage_cases_pg.filter_form.filter_by(lookup='product', value=product['name']))
+ filters.append(manage_cases_pg.filter_form.filter_by(lookup='productversion', value=product_version_name))
+ filters.append(manage_cases_pg.filter_form.filter_by(lookup='suite', value=suite['name']))
+
+ for item in filters:
+ item.pin_filter()
+ Assert.equal(item.get_filter_color(), PINNED_FILTER_COLOR)
+
+ #go to create case page
+ create_case_pg = manage_cases_pg.click_create_case_button()
+ Assert.equal(create_case_pg.product_value, product['name'])
+ Assert.equal(create_case_pg.product_version_value, version['name'])
+ Assert.equal(create_case_pg.suite_value, suite['name'])
+
+ #go back and check that filters are present and still pinned
+ create_case_pg.go_back()
+
+ #go to create bulk cases page
+ create_bulk_cases_pg = manage_cases_pg.click_create_bulk_cases_button()
+ Assert.equal(create_bulk_cases_pg.product_value, product['name'])
+ Assert.equal(create_bulk_cases_pg.product_version_value, version['name'])
+ Assert.equal(create_bulk_cases_pg.suite_value, suite['name'])

0 comments on commit c19005a

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