Fixed test_that_user_can_pass_test
This commit is contained in:
Родитель
80b0075f14
Коммит
9293539a59
27
base_test.py
27
base_test.py
|
@ -23,11 +23,11 @@ class BaseTest(object):
|
|||
Base class for all Tests
|
||||
'''
|
||||
|
||||
def create_product(self, mozwebqa):
|
||||
def create_product(self, mozwebqa, profile=None):
|
||||
create_product_pg = CaseConductorCreateProductPage(mozwebqa)
|
||||
|
||||
create_product_pg.go_to_create_product_page()
|
||||
product = create_product_pg.create_product()
|
||||
product = create_product_pg.create_product(profile=profile)
|
||||
|
||||
return product
|
||||
|
||||
|
@ -64,14 +64,16 @@ class BaseTest(object):
|
|||
if delete_product:
|
||||
self.delete_product(mozwebqa, product=version['product'])
|
||||
|
||||
def create_run(self, mozwebqa, activate=False, version=None, suite_name_list=None):
|
||||
def create_run(self, mozwebqa, activate=False, product=None, version=None, suite_name_list=None):
|
||||
create_run_pg = CaseConductorCreateRunPage(mozwebqa)
|
||||
|
||||
if version is None:
|
||||
version = self.create_version(mozwebqa)
|
||||
version = self.create_version(mozwebqa, product=product)
|
||||
if product is None:
|
||||
product = version['product']
|
||||
|
||||
create_run_pg.go_to_create_run_page()
|
||||
product_version = u'%(product_name)s %(version_name)s' % {'product_name': version['product']['name'], 'version_name': version['name']}
|
||||
product_version = u'%(product_name)s %(version_name)s' % {'product_name': product['name'], 'version_name': version['name']}
|
||||
run = create_run_pg.create_run(product_version=product_version, suite_list=suite_name_list)
|
||||
run['version'] = version
|
||||
|
||||
|
@ -144,17 +146,12 @@ class BaseTest(object):
|
|||
manage_suites_pg = CaseConductorManageSuitesPage(mozwebqa)
|
||||
run_tests_pg = CaseConductorRunTestsPage(mozwebqa)
|
||||
|
||||
suite = self.create_suite(mozwebqa)
|
||||
case = self.create_case(mozwebqa, activate=True, product=suite['product'], suite_name=suite['name'])
|
||||
|
||||
manage_suites_pg.go_to_manage_suites_page()
|
||||
manage_suites_pg.filter_suites_by_name(name=suite['name'])
|
||||
manage_suites_pg.activate_suite(name=suite['name'])
|
||||
|
||||
cycle = self.create_cycle(mozwebqa, activate=True, product=suite['product'])
|
||||
run = self.create_run(mozwebqa, activate=True, cycle=cycle, suite_name=suite['name'])
|
||||
product = self.create_product(mozwebqa, profile='Website Testing Environments')
|
||||
suite = self.create_suite(mozwebqa, product=product)
|
||||
case = self.create_case(mozwebqa, product=product, version=product['version'], suite_name=suite['name'])
|
||||
run = self.create_run(mozwebqa, activate=True, product=product, version=product['version'], suite_name_list=[suite['name']])
|
||||
|
||||
home_pg.go_to_homepage_page()
|
||||
home_pg.go_to_run_test(product_name=run['cycle']['product']['name'], cycle_name=run['cycle']['name'], run_name=run['name'])
|
||||
home_pg.go_to_run_test(product_name=product['name'], version_name=product['version']['name'], run_name=run['name'])
|
||||
|
||||
return case
|
||||
|
|
|
@ -10,17 +10,18 @@ from base_page import CaseConductorBasePage
|
|||
class CaseConductorRunTestsPage(CaseConductorBasePage):
|
||||
|
||||
_page_title = 'Mozilla Case Conductor'
|
||||
_test_action_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../div[@class="status"]/button[@class="%(action)s"]'
|
||||
_test_is_passed_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../div[@class="status"]/span[@class="passed"]'
|
||||
_test_is_failed_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../div[@class="status"]/span[@class="failed"]'
|
||||
_test_is_invalid_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../div[@class="status"]/span[@class="invalidated"]'
|
||||
_test_summary_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../..'
|
||||
_step_fail_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../../..//ol[@class="steps"]/li[%(step_number)s]/div[contains(@class,"stepfail")]/p[@class="summary"]'
|
||||
_step_fail_result_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../../..//ol[@class="steps"]/li[%(step_number)s]/div[contains(@class,"stepfail")]//li[@class="fail-desc"]/textarea[@name="actualResult"]'
|
||||
_step_fail_submit_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../../..//ol[@class="steps"]/li[%(step_number)s]/div[contains(@class,"stepfail")]//div[@class="form-actions"]/button[@class="fail"]'
|
||||
_test_invalid_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../../..//form[contains(@class,"testinvalid")]/h4[@class="summary"]'
|
||||
_test_invalid_desc_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../../..//form[contains(@class,"testinvalid")]//textarea[@name="comment"]'
|
||||
_test_invalid_submit_locator = u'xpath=//section[@id="run"]//article[contains(@class,"item")]//h3[@title="%(case_name)s"]/../../..//form[contains(@class,"testinvalid")]//div[@class="form-actions"]/button[@class="invalid"]'
|
||||
|
||||
_test_action_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itemhead .results .result-action.%(action)s'
|
||||
_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.invalid[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-summary .stepfail-content .fail-field .fail-input'
|
||||
_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-summary .stepfail-content .form-actions .fail'
|
||||
_test_invalid_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itemhead .testinvalid .invalid-summary'
|
||||
_test_invalid_desc_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itemhead .testinvalid .invalid-form .invalid-input'
|
||||
_test_invalid_submit_locator = u'css=#runtests .itemlist .listitem[data-title="%(case_name)s"] .itemhead .testinvalid .invalid-form .form-actions .invalid'
|
||||
|
||||
def start_test(self, case_name):
|
||||
_start_test_locator = self._test_action_locator % {'case_name': case_name, 'action': 'start'}
|
||||
|
@ -39,7 +40,7 @@ class CaseConductorRunTestsPage(CaseConductorBasePage):
|
|||
_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_result = u'Test Case step %(step_number)s failed' % {'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)
|
||||
|
@ -52,7 +53,7 @@ class CaseConductorRunTestsPage(CaseConductorBasePage):
|
|||
_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_desc = 'Test Case is invalid'
|
||||
_test_invalid_desc = u'%(case_name)s is invalid' % {'case_name': case_name}
|
||||
|
||||
self.click(_test_summary_locator)
|
||||
self.click(_test_invalid_locator)
|
||||
|
|
|
@ -23,7 +23,7 @@ class TestRunTestsPage(BaseTest):
|
|||
|
||||
Assert.true(run_tests_pg.is_test_passed(case_name=case['name']))
|
||||
|
||||
# TODO: cleanup when platform allows for deleting activated items
|
||||
self.delete_product(mozwebqa_logged_in, product=case['product'])
|
||||
|
||||
def test_that_user_can_fail_test(self, mozwebqa_logged_in):
|
||||
run_tests_pg = CaseConductorRunTestsPage(mozwebqa_logged_in)
|
||||
|
|
Загрузка…
Ссылка в новой задаче