Коммит
259cfbf318
|
@ -14,88 +14,47 @@ class MozTrapRunTestsPage(MozTrapBasePage):
|
|||
|
||||
_page_title = 'Run Tests'
|
||||
|
||||
_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')
|
||||
|
||||
_test_item_locator = (By.CSS_SELECTOR, '.listitem')
|
||||
|
||||
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[0], self._test_pass_locator[1] % {'case_name': case_name})
|
||||
|
||||
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):
|
||||
_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.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_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.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[0], self._test_is_passed_locator[1] % {'case_name': case_name})
|
||||
|
||||
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[0], self._test_is_failed_locator[1] % {'case_name': case_name})
|
||||
|
||||
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[0], self._test_is_invalid_locator[1] % {'case_name': case_name})
|
||||
|
||||
return self.is_element_present(*_test_is_invalid_locator)
|
||||
_test_item_locator = (By.CSS_SELECTOR, '#runtests .listitem')
|
||||
|
||||
@property
|
||||
def test_items(self):
|
||||
return [self.TestItem(self.testsetup, web_el) for web_el
|
||||
def test_results(self):
|
||||
return [TestResult(self.testsetup, web_el) for web_el
|
||||
in self.selenium.find_elements(*self._test_item_locator)]
|
||||
|
||||
class TestItem(PageRegion):
|
||||
def get_test_result(self, case_name):
|
||||
for result in self.test_results:
|
||||
if result.case_name.lower() == case_name.lower():
|
||||
return result
|
||||
raise Exception('Test case "%s" is not found in the results' % case_name)
|
||||
|
||||
|
||||
class TestResult(PageRegion):
|
||||
|
||||
_case_result_locator = (By.CSS_SELECTOR, '.result')
|
||||
_case_name_locator = (By.CSS_SELECTOR, '.title')
|
||||
_suite_name_locator = (By.CSS_SELECTOR, 'a[data-type="suite"]')
|
||||
_suite_name_locator = (By.CSS_SELECTOR, '.filter-link.suite')
|
||||
_case_position_number_locator = (By.CSS_SELECTOR, '.order')
|
||||
|
||||
@property
|
||||
def result(self):
|
||||
return self.find_element(*self._case_result_locator).text
|
||||
_result_passed_locator = (By.CSS_SELECTOR, '.result.passed')
|
||||
_result_failed_locator = (By.CSS_SELECTOR, '.result.failed')
|
||||
_result_invalid_locator = (By.CSS_SELECTOR, '.result.invalidated')
|
||||
_result_blocked_locator = (By.CSS_SELECTOR, '.result.blocked')
|
||||
|
||||
_open_test_summary_locator = (By.CSS_SELECTOR, '.item-summary')
|
||||
_pass_test_button_locator = (By.CSS_SELECTOR, '.action-pass')
|
||||
_fail_test_button_locator = (By.CSS_SELECTOR, '.stepfail-summary')
|
||||
_invalidate_test_button_locator = (By.CSS_SELECTOR, '.invalid-summary')
|
||||
_block_test_button_locator = (By.CSS_SELECTOR, '.block-summary')
|
||||
|
||||
_failed_step_comment_locator = (By.CSS_SELECTOR, '.fail-field textarea[name="comment"]')
|
||||
_failed_step_submit_locator = (By.CSS_SELECTOR, '.fail')
|
||||
_invalid_test_comment_locator = (By.CSS_SELECTOR, '.invalid-input')
|
||||
_invalid_test_submit_locator = (By.CSS_SELECTOR, '.invalid')
|
||||
_blocked_test_comment_locator = (By.CSS_SELECTOR, '.block-input')
|
||||
_blocked_test_submit_locator = (By.CSS_SELECTOR, '.block')
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
def case_name(self):
|
||||
return self.find_element(*self._case_name_locator).text
|
||||
|
||||
@property
|
||||
|
@ -105,3 +64,51 @@ class MozTrapRunTestsPage(MozTrapBasePage):
|
|||
@property
|
||||
def position_number(self):
|
||||
return self.find_element(*self._case_position_number_locator).text
|
||||
|
||||
@property
|
||||
def is_test_passed(self):
|
||||
return self.is_element_present(*self._result_passed_locator)
|
||||
|
||||
@property
|
||||
def is_test_failed(self):
|
||||
return self.is_element_present(*self._result_failed_locator)
|
||||
|
||||
@property
|
||||
def is_test_invalid(self):
|
||||
return self.is_element_present(*self._result_invalid_locator)
|
||||
|
||||
@property
|
||||
def is_blocked(self):
|
||||
return self.is_element_present(*self._result_blocked_locator)
|
||||
|
||||
def open_test_summary(self):
|
||||
self.find_element(*self._open_test_summary_locator).click()
|
||||
|
||||
def pass_test(self):
|
||||
self.open_test_summary()
|
||||
self.find_element(*self._pass_test_button_locator).click()
|
||||
self.wait_for_ajax()
|
||||
|
||||
def fail_test(self):
|
||||
self.open_test_summary()
|
||||
self.find_element(*self._fail_test_button_locator).click()
|
||||
self.type_in_element(self._failed_step_comment_locator,
|
||||
u'Test case "%s" failed' % self.case_name)
|
||||
self.find_element(*self._failed_step_submit_locator).click()
|
||||
self.wait_for_ajax()
|
||||
|
||||
def invalidate_test(self):
|
||||
self.open_test_summary()
|
||||
self.selenium.find_element(*self._invalidate_test_button_locator).click()
|
||||
self.type_in_element(self._invalid_test_comment_locator,
|
||||
u'Test case "%s" is invalid' % self.case_name)
|
||||
self.selenium.find_element(*self._invalid_test_submit_locator).click()
|
||||
self.wait_for_ajax()
|
||||
|
||||
def mark_blocked(self):
|
||||
self.open_test_summary()
|
||||
self.selenium.find_element(*self._block_test_button_locator).click()
|
||||
self.type_in_element(self._blocked_test_comment_locator,
|
||||
u'Test case "%s" is blocked' % self.case_name)
|
||||
self.selenium.find_element(*self._blocked_test_submit_locator).click()
|
||||
self.wait_for_ajax()
|
||||
|
|
|
@ -26,3 +26,40 @@ class TestManageRunsPage(BaseTest):
|
|||
manage_runs_pg.delete_run(name=run['name'])
|
||||
|
||||
Assert.false(manage_runs_pg.is_element_present(*run['manage_locator']))
|
||||
|
||||
@pytest.mark.moztrap(3302)
|
||||
def test_for_edit_active_run_that_includes_suites_to_be_sure_they_are_listed(self, mozwebqa_logged_in, product):
|
||||
#create version
|
||||
version = product['version']
|
||||
#create two test suites
|
||||
suite_a = self.create_suite(mozwebqa_logged_in, product=product, use_API=True, name='suite A')
|
||||
suite_b = self.create_suite(mozwebqa_logged_in, product=product, use_API=True, name='suite B')
|
||||
#create test run
|
||||
suite_order = [suite_b['name'], suite_a['name']]
|
||||
test_run = self.create_run(
|
||||
mozwebqa_logged_in, product=product,
|
||||
version=version, suite_name_list=suite_order)
|
||||
|
||||
manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in)
|
||||
manage_runs_pg.go_to_manage_runs_page()
|
||||
manage_runs_pg.filter_form.filter_by(lookup='name', value=test_run['name'])
|
||||
manage_runs_pg.activate_run(name=test_run['name'])
|
||||
edit_run_pg = manage_runs_pg.go_to_edit_run_page(test_run['name'])
|
||||
|
||||
#assert that multiselect widget is not present thus suites list is readonly
|
||||
Assert.false(
|
||||
edit_run_pg.is_multiselect_widget_present,
|
||||
u'multiselect widget should not be present')
|
||||
#assert that order of suites is correct
|
||||
Assert.equal(
|
||||
suite_order, edit_run_pg.readonly_included_suites,
|
||||
u'suites are listed in wrong order')
|
||||
|
||||
edit_run_pg.save_run()
|
||||
test_run = manage_runs_pg.test_runs[0]
|
||||
test_run.show_details()
|
||||
|
||||
#assert that order of suites is still correct
|
||||
Assert.equal(
|
||||
suite_order, test_run.included_suites,
|
||||
u'suites are listed in wrong order')
|
||||
|
|
|
@ -17,39 +17,42 @@ class TestRunTestsPage(BaseTest):
|
|||
|
||||
@pytest.mark.moztrap([205, 208])
|
||||
def test_that_user_can_pass_test(self, mozwebqa_logged_in, product, element):
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
|
||||
|
||||
case = self.create_and_run_test(mozwebqa_logged_in, product, element)[0]
|
||||
|
||||
Assert.false(run_tests_pg.is_test_passed(case_name=case['name']))
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.false(result.is_test_passed)
|
||||
|
||||
run_tests_pg.pass_test(case_name=case['name'])
|
||||
result.pass_test()
|
||||
|
||||
Assert.true(run_tests_pg.is_test_passed(case_name=case['name']))
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.true(result.is_test_passed)
|
||||
|
||||
@pytest.mark.moztrap(206)
|
||||
def test_that_user_can_fail_test(self, mozwebqa_logged_in, product, element):
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
|
||||
|
||||
case = self.create_and_run_test(mozwebqa_logged_in, product, element)[0]
|
||||
|
||||
Assert.false(run_tests_pg.is_test_failed(case_name=case['name']))
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.false(result.is_test_failed)
|
||||
|
||||
run_tests_pg.fail_test(case_name=case['name'])
|
||||
result.fail_test()
|
||||
|
||||
Assert.true(run_tests_pg.is_test_failed(case_name=case['name']))
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.true(result.is_test_failed)
|
||||
|
||||
@pytest.mark.moztrap(207)
|
||||
def test_that_user_can_mark_test_invalid(self, mozwebqa_logged_in, product, element):
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
|
||||
|
||||
case = self.create_and_run_test(mozwebqa_logged_in, product, element)[0]
|
||||
|
||||
Assert.false(run_tests_pg.is_test_invalid(case_name=case['name']))
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.false(result.is_test_invalid)
|
||||
|
||||
run_tests_pg.mark_test_invalid(case_name=case['name'])
|
||||
result.invalidate_test()
|
||||
|
||||
Assert.true(run_tests_pg.is_test_invalid(case_name=case['name']))
|
||||
result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.true(result.is_test_invalid)
|
||||
|
||||
@pytest.mark.moztrap(2744)
|
||||
def test_that_test_run_saves_right_order_of_test_cases(self, mozwebqa_logged_in, product, element):
|
||||
|
@ -78,7 +81,7 @@ class TestRunTestsPage(BaseTest):
|
|||
env_category_name=element['category']['name'], env_element_name=element['name'])
|
||||
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
|
||||
actual_order = [(item.name, item.suite_name) for item in run_tests_pg.test_items]
|
||||
actual_order = [(item.case_name, item.suite_name) for item in run_tests_pg.test_results]
|
||||
|
||||
expected_order = [(case['name'], suite) for case in suite_a_cases for suite in (suite_a['name'],)] + \
|
||||
[(case['name'], suite) for case in suite_b_cases for suite in (suite_b['name'],)]
|
||||
|
@ -101,46 +104,21 @@ class TestRunTestsPage(BaseTest):
|
|||
product_name=product['name'], version_name=version['name'], run_name=first_run['name'],
|
||||
env_category_name=element['category']['name'], env_element_name=element['name'])
|
||||
#check actual order of items on run tests page
|
||||
actual_order = [(item.name, item.suite_name) for item in run_tests_pg.test_items]
|
||||
actual_order = [(item.case_name, item.suite_name) for item in run_tests_pg.test_results]
|
||||
|
||||
expected_order = [(case['name'], suite) for case in suite_b_cases for suite in (suite_b['name'],)] + \
|
||||
[(case['name'], suite) for case in suite_a_cases for suite in (suite_a['name'],)]
|
||||
#assert that right order saved
|
||||
Assert.equal(actual_order, expected_order)
|
||||
|
||||
@pytest.mark.moztrap(3302)
|
||||
def test_for_edit_active_run_that_includes_suites_to_be_sure_they_are_listed(self, mozwebqa_logged_in, product):
|
||||
#create version
|
||||
version = product['version']
|
||||
#create two test suites
|
||||
suite_a = self.create_suite(mozwebqa_logged_in, product=product, use_API=True, name='suite A')
|
||||
suite_b = self.create_suite(mozwebqa_logged_in, product=product, use_API=True, name='suite B')
|
||||
#create test run
|
||||
suite_order = [suite_b['name'], suite_a['name']]
|
||||
test_run = self.create_run(
|
||||
mozwebqa_logged_in, product=product,
|
||||
version=version, suite_name_list=suite_order)
|
||||
def test_that_user_can_mark_test_as_blocked(self, mozwebqa_logged_in, product, element):
|
||||
case = self.create_and_run_test(mozwebqa_logged_in, product, element)[0]
|
||||
|
||||
manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in)
|
||||
manage_runs_pg.go_to_manage_runs_page()
|
||||
manage_runs_pg.filter_form.filter_by(lookup='name', value=test_run['name'])
|
||||
manage_runs_pg.activate_run(name=test_run['name'])
|
||||
edit_run_pg = manage_runs_pg.go_to_edit_run_page(test_run['name'])
|
||||
run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
|
||||
test_result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.false(test_result.is_blocked)
|
||||
|
||||
#assert that multiselect widget is not present thus suites list is readonly
|
||||
Assert.false(
|
||||
edit_run_pg.is_multiselect_widget_present,
|
||||
u'multiselect widget should not be present')
|
||||
#assert that order of suites is correct
|
||||
Assert.equal(
|
||||
suite_order, edit_run_pg.readonly_included_suites,
|
||||
u'suites are listed in wrong order')
|
||||
test_result.mark_blocked()
|
||||
|
||||
edit_run_pg.save_run()
|
||||
test_run = manage_runs_pg.test_runs[0]
|
||||
test_run.show_details()
|
||||
|
||||
#assert that order of suites is still correct
|
||||
Assert.equal(
|
||||
suite_order, test_run.included_suites,
|
||||
u'suites are listed in wrong order')
|
||||
test_result = run_tests_pg.get_test_result(case['name'])
|
||||
Assert.true(test_result.is_blocked)
|
||||
|
|
Загрузка…
Ссылка в новой задаче