Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'mozilla/webdriver' into run_tests

  • Loading branch information...
commit b2d2601976998e268b562a11ac57362699d92710 2 parents 43e6361 + 444db25
Bebe authored
View
2  pages/manage_runs_page.py
@@ -27,7 +27,7 @@ def go_to_manage_runs_page(self):
def delete_run(self, name='Test Run'):
_delete_locator = (self._delete_run_locator[0], self._delete_run_locator[1] % {'run_name': name})
- self.selenium.find_element(*self._delete_locator).click()
+ self.selenium.find_element(*_delete_locator).click()
self.wait_for_ajax()
def filter_runs_by_name(self, name):
View
48 pages/manage_versions_page.py
@@ -5,57 +5,57 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from pages.base_page import MozTrapBasePage
-
+from selenium.webdriver.common.by import By
+from selenium.webdriver.support.wait import WebDriverWait
class MozTrapManageVersionsPage(MozTrapBasePage):
_page_title = 'MozTrap'
- _version_manage_locator = u'css=#manageproductversions .listitem .title[title="%(product_name)s %(version_name)s"]'
- _version_homepage_locator = u'css=.runsdrill .runsfinder .productversions .colcontent .title[title="%(version_name)s"][data-product="%(product_name)s"])'
- _delete_version_locator = u'css=#manageproductversions .listitem .action-delete[title="delete %(product_name)s %(version_name)s"]'
- _clone_version_locator = u'css=#manageproductversions .listitem .action-clone[title="clone %(product_name)s %(version_name)s"]'
- _filter_input_locator = 'id=text-filter'
- _filter_suggestion_locator = u'css=#filter .textual .suggest .suggestion[data-type="version"][data-name="%(filter_name)s"]'
- _filter_locator = u'css=#filterform .filter-group input[data-name="version"][value="%(filter_name)s"]:checked'
+ _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"])')
+ _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"]')
+ _filter_input_locator = (By.ID, 'text-filter')
+ _filter_suggestion_locator = (By.CSS_SELECTOR, '#filter .textual .suggest .suggestion[data-type="version"][data-name="%(filter_name)s"]')
+ _filter_locator = (By.CSS_SELECTOR, '#filterform .filter-group input[data-name="version"][value="%(filter_name)s"]:checked')
def go_to_manage_versions_page(self):
self.get_relative_path('/manage/productversions/')
self.is_the_current_page
def delete_version(self, name='Test Version', product_name='Test Product'):
- _delete_locator = self._delete_version_locator % {'product_name': product_name, 'version_name': name}
+ _delete_locator = (self._delete_version_locator[0], self._delete_version_locator[1] % {'product_name': product_name, 'version_name': name})
- self.click(_delete_locator)
+ self.selenium.find_element(*_delete_locator).click()
self.wait_for_ajax()
def filter_versions_by_name(self, name):
- _filter_locator = self._filter_locator % {'filter_name': name.lower()}
- _filter_suggestion_locator = self._filter_suggestion_locator % {'filter_name': name}
-
- self.type(self._filter_input_locator, name)
- self.selenium.type_keys(self._filter_input_locator, name)
- self.wait_for_element_present(_filter_suggestion_locator)
- self.click(_filter_suggestion_locator)
- self.wait_for_element_present(_filter_locator)
+ _filter_locator = (self._filter_locator[0], self._filter_locator[1] % {'filter_name': name.lower()})
+ _filter_suggestion_locator = (self._filter_suggestion_locator[0], self._filter_suggestion_locator[1] % {'filter_name': name})
+
+ self.selenium.find_element(*self._filter_input_locator).send_keys(name)
+ WebDriverWait(self.selenium, self.timeout).until(lambda s: self.is_element_present(*_filter_suggestion_locator))
+ self.selenium.find_element(*_filter_suggestion_locator).click()
+ WebDriverWait(self.selenium, self.timeout).until(lambda s: self.is_element_present(*_filter_locator))
self.wait_for_ajax()
def remove_name_filter(self, name):
- _filter_locator = self._filter_locator % {'filter_name': name.lower()}
+ _filter_locator = (self._filter_locator[0], self._filter_locator[1] % {'filter_name': name.lower()})
- self.click(_filter_locator)
+ self.selenium.find_element(*_filter_locator).click()
self.wait_for_ajax()
def clone_version(self, name='Test Version', product_name='Test Product'):
- _clone_version_locator = self._clone_version_locator % {'product_name': product_name, 'version_name': name}
+ _clone_version_locator = (self._clone_version_locator[0], self._clone_version_locator[1] % {'product_name': product_name, 'version_name': name})
cloned_version = {}
- self.click(_clone_version_locator)
+ self.selenium.find_element(*_clone_version_locator).click()
self.wait_for_ajax()
cloned_version['product_name'] = product_name
cloned_version['name'] = name + '.next'
- cloned_version['manage_locator'] = self._version_manage_locator % {'product_name': cloned_version['product_name'], 'version_name': cloned_version['name']}
- cloned_version['homepage_locator'] = self._version_homepage_locator % {'product_name': cloned_version['product_name'], 'version_name': cloned_version['name']}
+ cloned_version['manage_locator'] = (self._version_manage_locator[0], self._version_manage_locator[1] % {'product_name': cloned_version['product_name'], 'version_name': cloned_version['name']})
+ cloned_version['homepage_locator'] = (self._version_homepage_locator[0], self._version_homepage_locator[1] % {'product_name': cloned_version['product_name'], 'version_name': cloned_version['name']})
return cloned_version
View
4 tests/test_manage_runs_page.py
@@ -18,10 +18,10 @@ def test_that_user_can_create_and_delete_run(self, mozwebqa_logged_in):
manage_runs_pg.filter_runs_by_name(name=run['name'])
- Assert.true(manage_runs_pg.is_element_present(run['manage_locator']))
+ Assert.true(manage_runs_pg.is_element_present(*run['manage_locator']))
manage_runs_pg.delete_run(name=run['name'])
- Assert.false(manage_runs_pg.is_element_present(run['manage_locator']))
+ Assert.false(manage_runs_pg.is_element_present(*run['manage_locator']))
self.delete_version(mozwebqa_logged_in, version=run['version'], delete_product=True)
Please sign in to comment.
Something went wrong with that request. Please try again.