diff --git a/base_test.py b/base_test.py index 9118b02..7ad9a15 100644 --- a/base_test.py +++ b/base_test.py @@ -161,17 +161,21 @@ class BaseTest(object): create_profile_pg.go_to_create_profile_page() create_profile_pg.delete_environment_category(category_name=profile['category']) - def create_and_run_test(self, mozwebqa): + def create_and_run_test(self, mozwebqa, profile=None): home_pg = MozTrapHomePage(mozwebqa) manage_suites_pg = MozTrapManageSuitesPage(mozwebqa) run_tests_pg = MozTrapRunTestsPage(mozwebqa) - product = self.create_product(mozwebqa, profile='Website Testing Environments') + if profile is None: + profile = self.create_profile(mozwebqa) + + product = self.create_product(mozwebqa, profile=profile['name']) suite = self.create_suite(mozwebqa, product=product) case = self.create_case(mozwebqa, product=product, version=product['version'], suite_name=suite['name']) + case['profile'] = profile 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=product['name'], version_name=product['version']['name'], run_name=run['name']) + home_pg.go_to_run_test(product_name=product['name'], version_name=product['version']['name'], run_name=run['name'], env_category=profile['category'], env_element=profile['element']) return case diff --git a/home_page.py b/home_page.py index 41ddfbb..e6923ba 100644 --- a/home_page.py +++ b/home_page.py @@ -12,7 +12,7 @@ class MozTrapHomePage(MozTrapBasePage): _page_title = 'MozTrap' _select_locator = u'css=.runsdrill .runsfinder .carousel .colcontent .title[title="%(item_name)s"]' - _browser_locator = 'css=#runtests-environment-form .browser-field select' + _env_select_locator = 'css=#runtests-environment-form .formfield[data-title="%(env_category)s"] select' _language_locator = 'css=#runtests-environment-form .language-field select' _os_locator = 'css=#runtests-environment-form .operating-system-field select' _submit_locator = 'css=#runtests-environment-form .form-actions button[type="submit"]' @@ -27,11 +27,11 @@ class MozTrapHomePage(MozTrapBasePage): self.click(_select_locator) self.wait_for_ajax() - def go_to_run_test(self, product_name, version_name, run_name, browser='Firefox', language='English', os='OS X'): + def go_to_run_test(self, product_name, version_name, run_name, env_category, env_element): + _env_select_locator = self._env_select_locator % {'env_category': env_category} + self.select_item(product_name) self.select_item(version_name) self.select_item(run_name) - self.select(self._browser_locator, browser) - self.select(self._language_locator, language) - self.select(self._os_locator, os) + self.select(_env_select_locator, env_element) self.click(self._submit_locator, wait_flag=True) diff --git a/test_run_tests_page.py b/test_run_tests_page.py index 0820733..0331d53 100644 --- a/test_run_tests_page.py +++ b/test_run_tests_page.py @@ -23,6 +23,7 @@ class TestRunTestsPage(BaseTest): Assert.true(run_tests_pg.is_test_passed(case_name=case['name'])) self.delete_product(mozwebqa_logged_in, product=case['product']) + self.delete_profile(mozwebqa_logged_in, profile=case['profile']) def test_that_user_can_fail_test(self, mozwebqa_logged_in): run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in) @@ -36,6 +37,7 @@ class TestRunTestsPage(BaseTest): Assert.true(run_tests_pg.is_test_failed(case_name=case['name'])) self.delete_product(mozwebqa_logged_in, product=case['product']) + self.delete_profile(mozwebqa_logged_in, profile=case['profile']) def test_that_user_can_mark_test_invalid(self, mozwebqa_logged_in): run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in) @@ -49,3 +51,4 @@ class TestRunTestsPage(BaseTest): Assert.true(run_tests_pg.is_test_invalid(case_name=case['name'])) self.delete_product(mozwebqa_logged_in, product=case['product']) + self.delete_profile(mozwebqa_logged_in, profile=case['profile'])