Permalink
Browse files

TestRunTestsPage

  • Loading branch information...
Bebe
Bebe committed Jul 10, 2012
1 parent b2d2601 commit fa230da2e8a929d7435efbe9c33168c930b74c6c
Showing with 45 additions and 38 deletions.
  1. +1 −1 pages/create_run_page.py
  2. +4 −2 pages/home_page.py
  3. +40 −35 pages/run_tests_page.py
View
@@ -54,7 +54,7 @@ def create_run(self, name='Test Run', product_version='Test Product Test Version
if suite_list:
for suite in suite_list:
- suite_input_element = self.selenium.find_element(By.XPATH, "//article[@data-title='%s'/input" % suite)
+ suite_input_element = self.selenium.find_element(By.XPATH, "//article[@data-title='%s']/input" % suite)
suite_input_element.click()
self.selenium.find_element(*self._include_selected_suites_locator).click()
self.selenium.find_element(*self._submit_locator).click()
View
@@ -37,5 +37,7 @@ def go_to_run_test(self, product_name, version_name, run_name, env_category, env
self.select_item(product_name)
self.select_item(version_name)
self.select_item(run_name)
- self.select(_env_select_locator, env_element)
- self.selenium.find_element(self._submit_locator).click()
+
+ env_select = Select(self.selenium.find_element(*_env_select_locator))
+ env_select.select_by_visible_text(env_element)
+ self.selenium.find_element(*self._submit_locator).click()
View
@@ -4,68 +4,73 @@
# 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 selenium.webdriver.common.by import By
+
from pages.base_page import MozTrapBasePage
class MozTrapRunTestsPage(MozTrapBasePage):
_page_title = 'MozTrap'
- _test_pass_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .action-pass'
- _test_is_passed_locator = u'css=#runtests .itemlist .listitem.passed[data-title="%(case_name)s"]'
- _test_is_failed_locator = u'css=#runtests .itemlist .listitem.failed[data-title="%(case_name)s"]'
- _test_is_invalid_locator = u'css=#runtests .itemlist .listitem.invalidated[data-title="%(case_name)s"]'
- _test_summary_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .item-summary'
- _step_fail_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .steps .stepitem[data-step-number="%(step_number)s"] .stepfail .stepfail-summary'
- _step_fail_result_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .steps .stepitem[data-step-number="%(step_number)s"] .stepfail .stepfail-content .fail-field textarea[name="comment"]'
- _step_fail_submit_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .steps .stepitem[data-step-number="%(step_number)s"] .stepfail .stepfail-content .form-actions .fail'
- _test_invalid_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .testinvalid .invalid-summary'
- _test_invalid_desc_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .testinvalid .invalid-form .invalid-input'
- _test_invalid_submit_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .testinvalid .invalid-form .form-actions .invalid'
+ _test_pass_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .action-pass')
+ _test_is_passed_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem.passed[data-title="%(case_name)s"]')
+ _test_is_failed_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem.failed[data-title="%(case_name)s"]')
+ _test_is_invalid_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem.invalidated[data-title="%(case_name)s"]')
+ _test_summary_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .item-summary')
+ _step_fail_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .steps .stepitem[data-step-number="%(step_number)s"] .stepfail .stepfail-summary')
+ _step_fail_result_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .steps .stepitem[data-step-number="%(step_number)s"] .stepfail .stepfail-content .fail-field textarea[name="comment"]')
+ _step_fail_submit_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .steps .stepitem[data-step-number="%(step_number)s"] .stepfail .stepfail-content .form-actions .fail')
+ _test_invalid_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .testinvalid .invalid-summary')
+ _test_invalid_desc_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .testinvalid .invalid-form .invalid-input')
+ _test_invalid_submit_locator = (By.CSS_SELECTOR, '#runtests .itemlist .listitem[data-title="%(case_name)s"] .itembody .testinvalid .invalid-form .form-actions .invalid')
+
+ def open_test_summary(self, case_name):
+ _open_test = (self._test_summary_locator[0], self._test_summary_locator[1] % {'case_name': case_name})
+ self.selenium.find_element(*_open_test).click()
def pass_test(self, case_name):
- _pass_test_locator = self._test_pass_locator % {'case_name': case_name}
+ _pass_test_locator = (self._test_pass_locator[0], self._test_pass_locator[1] % {'case_name': case_name})
- self.click(_pass_test_locator)
+ self.open_test_summary(case_name)
+ self.selenium.find_element(*_pass_test_locator).click()
self.wait_for_ajax()
def fail_test(self, case_name, step_number=1):
- _test_summary_locator = self._test_summary_locator % {'case_name': case_name}
- _step_fail_locator = self._step_fail_locator % {'case_name': case_name, 'step_number': step_number}
- _step_fail_result_locator = self._step_fail_result_locator % {'case_name': case_name, 'step_number': step_number}
- _step_fail_submit_locator = self._step_fail_submit_locator % {'case_name': case_name, 'step_number': step_number}
+ _step_fail_locator = (self._step_fail_locator[0], self._step_fail_locator[1] % {'case_name': case_name, 'step_number': step_number})
+ _step_fail_result_locator = (self._step_fail_result_locator[0], self._step_fail_result_locator[1] % {'case_name': case_name, 'step_number': step_number})
+ _step_fail_submit_locator = (self._step_fail_submit_locator[0], self._step_fail_submit_locator[1] % {'case_name': case_name, 'step_number': step_number})
_step_fail_result = u'%(case_name)s step %(step_number)s failed' % {'step_number': step_number, 'case_name': case_name}
- self.click(_test_summary_locator)
- self.click(_step_fail_locator)
- self.type(_step_fail_result_locator, _step_fail_result)
- self.click(_step_fail_submit_locator)
+ self.open_test_summary(case_name)
+ self.selenium.find_element(*_step_fail_locator).click()
+ self.type_in_element(_step_fail_result_locator, _step_fail_result)
+ self.selenium.find_element(*_step_fail_submit_locator).click()
self.wait_for_ajax()
def mark_test_invalid(self, case_name):
- _test_summary_locator = self._test_summary_locator % {'case_name': case_name}
- _test_invalid_locator = self._test_invalid_locator % {'case_name': case_name}
- _test_invalid_desc_locator = self._test_invalid_desc_locator % {'case_name': case_name}
- _test_invalid_submit_locator = self._test_invalid_submit_locator % {'case_name': case_name}
+ _test_invalid_locator = (self._test_invalid_locator[0], self._test_invalid_locator[1] % {'case_name': case_name})
+ _test_invalid_desc_locator = (self._test_invalid_desc_locator[0], self._test_invalid_desc_locator[1] % {'case_name': case_name})
+ _test_invalid_submit_locator = (self._test_invalid_submit_locator[0], self._test_invalid_submit_locator[1] % {'case_name': case_name})
_test_invalid_desc = u'%(case_name)s is invalid' % {'case_name': case_name}
- self.click(_test_summary_locator)
- self.click(_test_invalid_locator)
- self.type(_test_invalid_desc_locator, _test_invalid_desc)
- self.click(_test_invalid_submit_locator)
+ self.open_test_summary(case_name)
+ self.selenium.find_element(*_test_invalid_locator).click()
+ self.type_in_element(_test_invalid_desc_locator, _test_invalid_desc)
+ self.selenium.find_element(*_test_invalid_submit_locator).click()
self.wait_for_ajax()
def is_test_passed(self, case_name):
- _test_is_passed_locator = self._test_is_passed_locator % {'case_name': case_name}
+ _test_is_passed_locator = (self._test_is_passed_locator[0], self._test_is_passed_locator[1] % {'case_name': case_name})
- return self.is_element_present(_test_is_passed_locator)
+ return self.is_element_present(*_test_is_passed_locator)
def is_test_failed(self, case_name):
- _test_is_failed_locator = self._test_is_failed_locator % {'case_name': case_name}
+ _test_is_failed_locator = (self._test_is_failed_locator[0], self._test_is_failed_locator[1] % {'case_name': case_name})
- return self.is_element_present(_test_is_failed_locator)
+ return self.is_element_present(*_test_is_failed_locator)
def is_test_invalid(self, case_name):
- _test_is_invalid_locator = self._test_is_invalid_locator % {'case_name': case_name}
+ _test_is_invalid_locator = (self._test_is_invalid_locator[0], self._test_is_invalid_locator[1] % {'case_name': case_name})
- return self.is_element_present(_test_is_invalid_locator)
+ return self.is_element_present(*_test_is_invalid_locator)

0 comments on commit fa230da

Please sign in to comment.