Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #94 from sashakruglov/moztrap_5935

Issue #87. Test for MozTrap #5935
  • Loading branch information...
commit d91483b6ef1a3d565faca65b72e527d81528d45d 2 parents 1784bfb + 491a4a5
@m8ttyB m8ttyB authored
View
5 pages/create_run_page.py
@@ -71,3 +71,8 @@ def create_run(self, name='Test Run', product_version='Test Product Test Version
self.selenium.find_element(*self._submit_locator).click()
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
View
40 pages/manage_runs_page.py
@@ -5,6 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
+from selenium.webdriver.support.color import Color
from pages.base_page import MozTrapBasePage
@@ -13,19 +14,32 @@ class MozTrapManageRunsPage(MozTrapBasePage):
_page_title = 'Manage-Runs'
+ _create_run_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')
_run_status_locator = (By.CSS_SELECTOR, '#manageruns .itemlist .listitem[data-title="%(run_name)s"] .status-title')
_edit_run_locator = (By.CSS_SELECTOR, '#manageruns .itemlist .listitem[data-title="%(run_name)s"] .edit-link')
_filter_input_locator = (By.ID, 'text-filter')
- _filter_suggestion_locator = (By.CSS_SELECTOR, '#filter .textual .suggest .suggestion[data-type="name"][data-name="%(filter_name)s"]')
- _filter_locator = (By.CSS_SELECTOR, '#filterform .filter-group input[data-name="name"][value="%(filter_name)s"]:checked')
+ _filter_suggestion_by_name_locator = (By.CSS_SELECTOR,
+ '#filter .textual .suggest .suggestion[data-type="name"][data-name="%(filter_name)s"]')
+ _filter_suggestion_by_product_version_locator = (By.CSS_SELECTOR,
+ '#filter .textual .suggest .suggestion[data-type="productversion"][data-name="%(filter_name)s"]')
+ _filter_locator = (By.CSS_SELECTOR,
+ '#filterform .filter-group input[data-name="name"][value="%(filter_name)s"]:checked')
+ _pin_filter_button_locator = (By.CSS_SELECTOR,
+ '#filterform input[data-name="productversion"]:checked + .onoff .pinswitch')
+ _pinned_filter_locator = (By.CSS_SELECTOR, '#filterform .onoff.pinned')
def go_to_manage_runs_page(self):
self.selenium.get(self.base_url + '/manage/runs/')
self.is_the_current_page
+ def click_create_run_button(self):
+ self.selenium.find_element(*self._create_run_locator).click()
+ from pages.create_run_page import MozTrapCreateRunPage
+ return MozTrapCreateRunPage(self.testsetup)
+
def delete_run(self, name='Test Run'):
_delete_locator = (self._delete_run_locator[0], self._delete_run_locator[1] % {'run_name': name})
@@ -33,12 +47,23 @@ def delete_run(self, name='Test Run'):
self.wait_for_ajax()
def filter_runs_by_name(self, name):
- _filter_suggestion_locator = (self._filter_suggestion_locator[0], self._filter_suggestion_locator[1] % {'filter_name': name})
+ _filter_suggestion_locator = (
+ self._filter_suggestion_by_name_locator[0],
+ self._filter_suggestion_by_name_locator[1] % {'filter_name': name})
self.selenium.find_element(*self._filter_input_locator).send_keys(name)
self.selenium.find_element(*_filter_suggestion_locator).click()
self.wait_for_ajax()
+ def filter_runs_by_product_version(self, product_version):
+ _filter_suggestion_locator = (
+ self._filter_suggestion_by_product_version_locator[0],
+ self._filter_suggestion_by_product_version_locator[1] % {'filter_name': product_version})
+
+ self.selenium.find_element(*self._filter_input_locator).send_keys(product_version)
+ self.selenium.find_element(*_filter_suggestion_locator).click()
+ self.wait_for_ajax()
+
def remove_name_filter(self, name):
_filter_locator = (self._filter_locator[0], self._filter_locator[1] % {'filter_name': name.lower()})
@@ -69,3 +94,12 @@ def go_to_edit_run_page(self, name='Test Run'):
self.selenium.find_element(*_edit_run_locator).click()
from pages.edit_run_page import MozTrapEditRunPage
return MozTrapEditRunPage(self.testsetup)
+
+ def pin_product_version(self):
+ self.selenium.find_element(*self._pin_filter_button_locator).click()
+
+ @property
+ def pinned_filter_color(self, coding='hex'):
+ pinned_filter = self.selenium.find_element(*self._pinned_filter_locator)
+ color = pinned_filter.value_of_css_property('background-color')
+ return getattr(Color.from_string(color), coding)
View
36 tests/test_pinning_filters.py
@@ -0,0 +1,36 @@
+#!/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.base_test import BaseTest
+from pages.manage_runs_page import MozTrapManageRunsPage
+
+
+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):
+ product = self.create_product(mozwebqa_logged_in)
+ product_version = u'%s %s' % (product['name'], product['version']['name'])
+
+ manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in)
+ manage_runs_pg.go_to_manage_runs_page()
+ manage_runs_pg.filter_runs_by_product_version(product_version)
+ manage_runs_pg.pin_product_version()
+
+ Assert.equal(
+ manage_runs_pg.pinned_filter_color.upper(),
+ u'#DFB081')
+
+ create_run_pg = manage_runs_pg.click_create_run_button()
+
+ Assert.equal(
+ create_run_pg.product_version,
+ product_version)
Please sign in to comment.
Something went wrong with that request. Please try again.