Permalink
Browse files

Merge pull request #96 from sashakruglov/moztrap_5936

Issue #87. Moztrap #5936
  • Loading branch information...
2 parents 4549f8b + 01169c3 commit 94aba9ddf812f2ffc07790ded469537bceef6f24 @bobsilverberg bobsilverberg committed Feb 5, 2013
View
@@ -73,6 +73,6 @@ def create_run(self, name='Test Run', product_version='Test Product Test Version
return run
@property
- def product_version(self):
- product_version_select = Select(self.selenium.find_element(*self._product_version_select_locator))
- return product_version_select.first_selected_option.text
+ def product_version_value(self):
+ product_version_select = self.find_element(*self._product_version_select_locator)
+ return product_version_select.find_element(By.CSS_SELECTOR, 'option:checked').text
@@ -41,3 +41,8 @@ def create_version(self, name='Test Version', product_name='Test Product'):
self.selenium.find_element(*self._submit_locator).click()
return version
+
+ @property
+ def product_name_value(self):
+ product_select = self.find_element(*self._product_select_locator)
+ return product_select.find_element(By.CSS_SELECTOR, 'option:checked').text
@@ -14,7 +14,7 @@ class MozTrapManageRunsPage(MozTrapBasePage):
_page_title = 'Manage-Runs'
- _create_run_locator = (By.CSS_SELECTOR, '#manageruns .create.single')
+ _create_run_button_locator = (By.CSS_SELECTOR, '#manageruns .create.single')
_delete_run_locator = (By.CSS_SELECTOR, '#manageruns .itemlist .listitem[data-title="%(run_name)s"] .action-delete')
_run_activate_locator = (By.CSS_SELECTOR, '#manageruns .itemlist .listitem[data-title="%(run_name)s"] .status-action.active')
_run_draft_locator = (By.CSS_SELECTOR, '#manageruns .itemlist .listitem[data-title="%(run_name)s"] .status-action.draft')
@@ -30,7 +30,7 @@ def go_to_manage_runs_page(self):
self.is_the_current_page
def click_create_run_button(self):
- self.selenium.find_element(*self._create_run_locator).click()
+ self.find_element(*self._create_run_button_locator).click()
from pages.create_run_page import MozTrapCreateRunPage
return MozTrapCreateRunPage(self.testsetup)
@@ -16,6 +16,7 @@ class MozTrapManageVersionsPage(MozTrapBasePage):
_version_manage_locator = (By.CSS_SELECTOR, '#manageproductversions .listitem .title[title="%(product_name)s %(version_name)s"]')
_version_homepage_locator = (By.CSS_SELECTOR, '.runsdrill .runsfinder .productversions .colcontent .title[title="%(version_name)s"][data-product="%(product_name)s"])')
+ _create_version_button_locator = (By.CSS_SELECTOR, '#manageproductversions .create.single')
_delete_version_locator = (By.CSS_SELECTOR, '#manageproductversions .listitem .action-delete[title="delete %(product_name)s %(version_name)s"]')
_clone_version_locator = (By.CSS_SELECTOR, '#manageproductversions .listitem .action-clone[title="clone %(product_name)s %(version_name)s"]')
@@ -27,6 +28,11 @@ def go_to_manage_versions_page(self):
self.get_relative_path('/manage/productversions/')
self.is_the_current_page
+ def click_create_version_button(self):
+ self.find_element(*self._create_version_button_locator).click()
+ from pages.create_version_page import MozTrapCreateVersionPage
+ return MozTrapCreateVersionPage(self.testsetup)
+
def delete_version(self, name='Test Version', product_name='Test Product'):
_delete_locator = (self._delete_version_locator[0], self._delete_version_locator[1] % {'product_name': product_name, 'version_name': name})
@@ -5,41 +5,75 @@
# 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,
+ u'filter is orange before it was pinned')
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,
+ u'pinned filter\'s color is not orange')
create_run_pg = manage_runs_pg.click_create_run_button()
Assert.equal(
- create_run_pg.product_version,
- product_version_name)
+ create_run_pg.product_version_value,
+ product_version_name,
+ u'default product version is incorrect')
+
+ @pytest.mark.moztrap(5936)
+ @pytest.mark.nondestructive
+ def test_that_pinning_filter_on_product_sets_defaults_in_new_product_version(self, mozwebqa_logged_in):
+ product = self.create_product(mozwebqa_logged_in)
+
+ from pages.manage_versions_page import MozTrapManageVersionsPage
+ manage_versions_pg = MozTrapManageVersionsPage(mozwebqa_logged_in)
+ manage_versions_pg.go_to_manage_versions_page()
+ filter_item = manage_versions_pg.filter_form.filter_by(lookup='product', value=product['name'])
+
+ #check that filter is not orange before it's pinned
+ Assert.not_equal(
+ filter_item.get_filter_color(),
+ PINNED_FILTER_COLOR,
+ u'filter is orange before it was pinned')
+
+ filter_item.pin_filter()
+
+ #check that filter is orange after it's been pinned
+ Assert.equal(
+ filter_item.get_filter_color(),
+ PINNED_FILTER_COLOR,
+ u'pinned filter\'s color is not orange')
+
+ create_version_pg = manage_versions_pg.click_create_version_button()
+
+ Assert.equal(
+ create_version_pg.product_name_value,
+ product['name'],
+ u'default product is incorrect')

0 comments on commit 94aba9d

Please sign in to comment.