def create_and_run_test(self, api, base_url, selenium, product, element):
        home_pg = MozTrapHomePage(base_url, selenium)

        self.connect_product_to_element(base_url, selenium, product, element)
        case = self.create_case(base_url, selenium, product, api=api)
        suite = self.create_suite(base_url,
                                  selenium,
                                  product=product,
                                  api=api,
                                  case_list=[case])
        run = self.create_run(base_url,
                              selenium,
                              activate=True,
                              product=product,
                              version=product['version'],
                              suite_name_list=[suite['name']])

        home_pg.go_to_home_page()
        home_pg.go_to_run_test(product_name=product['name'],
                               version_name=product['version']['name'],
                               run_name=run['name'],
                               env_category_name=element['category']['name'],
                               env_element_name=element['name'])

        return case, suite, run
    def test_that_test_run_saves_right_order_of_test_cases(self, mozwebqa_logged_in):
        #get profile, product and version
        profile = self.create_profile(mozwebqa_logged_in)
        product = self.create_product(mozwebqa_logged_in, profile['name'])
        version = product['version']
        #create several test case via bulk create
        cases = self.create_bulk_cases(mozwebqa_logged_in, cases_amount=5, product=product, name='is')
        #create first test suite
        suite_a_cases = (cases[3]['name'], cases[1]['name'])
        suite_a = self.create_suite(
            mozwebqa_logged_in, product=product, name='suite A', case_name_list=suite_a_cases)
        #create second test suite
        suite_b_cases = (cases[2]['name'], cases[0]['name'], cases[4]['name'])
        suite_b = self.create_suite(
            mozwebqa_logged_in, product=product, name='suite B', case_name_list=suite_b_cases)
        #create first test run (suite a, suite b)
        first_suite_order = (suite_a['name'], suite_b['name'])
        first_run = self.create_run(
            mozwebqa_logged_in, activate=True, product=product,
            version=version, suite_name_list=first_suite_order)
        #execute first test run
        home_page = MozTrapHomePage(mozwebqa_logged_in)
        home_page.go_to_home_page()
        home_page.go_to_run_test(
            product_name=product['name'], version_name=version['name'], run_name=first_run['name'],
            env_category=profile['category'], env_element=profile['element'])

        run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
        actual_order = [(item.name, item.suite_name) for item in run_tests_pg.test_items]

        expected_order = [(case, suite) for case in suite_a_cases for suite in (suite_a['name'],)] + \
                         [(case, suite) for case in suite_b_cases for suite in (suite_b['name'],)]
        #assert that right order saved
        Assert.equal(actual_order, expected_order)
        #edit run to reorder suites
        manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in)
        manage_runs_pg.go_to_manage_runs_page()
        #push run into draft mode
        manage_runs_pg.filter_form.filter_by(lookup='name', value=first_run['name'])
        manage_runs_pg.make_run_draft(first_run['name'])
        #go to edit run page and reorder suites by name (suite b, suite a)
        edit_run_pg = manage_runs_pg.go_to_edit_run_page(first_run['name'])
        second_run = edit_run_pg.edit_run(first_run, reorder_suites=True)
        #make run active again
        manage_runs_pg.filter_form.filter_by(lookup='name', value=first_run['name'])
        manage_runs_pg.activate_run(first_run['name'])
        #execute run again
        home_page.go_to_home_page()
        home_page.go_to_run_test(
            product_name=product['name'], version_name=version['name'], run_name=first_run['name'],
            env_category=profile['category'], env_element=profile['element'])
        #check actual order of items on run tests page
        actual_order = [(item.name, item.suite_name) for item in run_tests_pg.test_items]

        expected_order = [(case, suite) for case in suite_b_cases for suite in (suite_b['name'],)] + \
                         [(case, suite) for case in suite_a_cases for suite in (suite_a['name'],)]
        #assert that right order saved
        Assert.equal(actual_order, expected_order)
    def test_that_test_run_saves_right_order_of_test_cases(self, api, mozwebqa, login, product, element):
        self.connect_product_to_element(mozwebqa, product, element)
        version = product['version']
        # create several test case via bulk create
        cases = self.create_bulk_cases(mozwebqa, product, api=api, cases_amount=5)
        # create first test suite
        suite_a_cases = (cases[3], cases[1])
        suite_a = self.create_suite(
            mozwebqa, product=product, api=api, name='suite A', case_list=suite_a_cases)
        # create second test suite
        suite_b_cases = (cases[2], cases[0], cases[4])
        suite_b = self.create_suite(
            mozwebqa, product=product, api=api, name='suite B', case_list=suite_b_cases)
        # create first test run (suite a, suite b)
        first_suite_order = (suite_a['name'], suite_b['name'])
        first_run = self.create_run(
            mozwebqa, product=product, activate=True,
            version=version, suite_name_list=first_suite_order)
        # execute first test run
        home_page = MozTrapHomePage(mozwebqa)
        home_page.go_to_home_page()
        home_page.go_to_run_test(
            product_name=product['name'], version_name=version['name'], run_name=first_run['name'],
            env_category_name=element['category']['name'], env_element_name=element['name'])

        run_tests_pg = MozTrapRunTestsPage(mozwebqa)
        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'],)]
        # assert that right order saved
        assert expected_order == actual_order
        # edit run to reorder suites
        manage_runs_pg = MozTrapManageRunsPage(mozwebqa)
        manage_runs_pg.go_to_manage_runs_page()
        # push run into draft mode
        manage_runs_pg.filter_form.filter_by(lookup='name', value=first_run['name'])
        manage_runs_pg.make_run_draft(first_run['name'])
        # go to edit run page and reorder suites by name (suite b, suite a)
        edit_run_pg = manage_runs_pg.go_to_edit_run_page(first_run['name'])
        edit_run_pg.edit_run(first_run, reorder_suites=True)
        # make run active again
        manage_runs_pg.activate_run(first_run['name'])
        # execute run again
        home_page.go_to_home_page()
        home_page.go_to_run_test(
            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.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 expected_order == actual_order
Пример #4
0
    def create_and_run_test(self, mozwebqa, product, element):
        home_pg = MozTrapHomePage(mozwebqa)

        self.connect_product_to_element(mozwebqa, product, element)
        case = self.create_case(mozwebqa, product, use_API=True)
        suite = self.create_suite(mozwebqa, product=product, use_API=True, case_list=[case])
        run = self.create_run(mozwebqa, activate=True, product=product, version=product['version'], suite_name_list=[suite['name']])

        home_pg.go_to_home_page()
        home_pg.go_to_run_test(product_name=product['name'], version_name=product['version']['name'], run_name=run['name'], env_category_name=element['category']['name'], env_element_name=element['name'])

        return case
Пример #5
0
    def create_and_run_test(self, api, base_url, selenium, product, element):
        home_pg = MozTrapHomePage(base_url, selenium)

        self.connect_product_to_element(base_url, selenium, product, element)
        case = self.create_case(base_url, selenium, product, api=api)
        suite = self.create_suite(base_url, selenium, product=product, api=api, case_list=[case])
        run = self.create_run(base_url, selenium, activate=True, product=product, version=product['version'], suite_name_list=[suite['name']])

        home_pg.go_to_home_page()
        home_pg.go_to_run_test(product_name=product['name'], version_name=product['version']['name'], run_name=run['name'], env_category_name=element['category']['name'], env_element_name=element['name'])

        return case, suite, run
Пример #6
0
    def create_and_run_test(self, mozwebqa, profile=None):
        home_pg = MozTrapHomePage(mozwebqa)
        manage_suites_pg = MozTrapManageSuitesPage(mozwebqa)
        run_tests_pg = MozTrapRunTestsPage(mozwebqa)

        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_home_page()
        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
Пример #7
0
    def create_and_run_test(self, mozwebqa, profile=None):
        home_pg = MozTrapHomePage(mozwebqa)
        manage_suites_pg = MozTrapManageSuitesPage(mozwebqa)
        run_tests_pg = MozTrapRunTestsPage(mozwebqa)

        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'], env_category=profile['category'], env_element=profile['element'])

        return case
Пример #8
0
    def create_and_run_test(self, mozwebqa, product, element):
        home_pg = MozTrapHomePage(mozwebqa)

        self.connect_product_to_element(mozwebqa, product, element)
        case = self.create_case(mozwebqa, product, use_API=True)
        suite = self.create_suite(mozwebqa,
                                  product=product,
                                  use_API=True,
                                  case_list=[case])
        run = self.create_run(mozwebqa,
                              activate=True,
                              product=product,
                              version=product['version'],
                              suite_name_list=[suite['name']])

        home_pg.go_to_home_page()
        home_pg.go_to_run_test(product_name=product['name'],
                               version_name=product['version']['name'],
                               run_name=run['name'],
                               env_category_name=element['category']['name'],
                               env_element_name=element['name'])

        return case, suite, run
Пример #9
0
    def test_that_test_run_saves_right_order_of_test_cases(
            self, mozwebqa_logged_in, product, element):
        self.connect_product_to_element(mozwebqa_logged_in, product, element)
        version = product['version']
        # create several test case via bulk create
        cases = self.create_bulk_cases(mozwebqa_logged_in,
                                       product,
                                       use_API=True,
                                       cases_amount=5)
        # create first test suite
        suite_a_cases = (cases[3], cases[1])
        suite_a = self.create_suite(mozwebqa_logged_in,
                                    product=product,
                                    use_API=True,
                                    name='suite A',
                                    case_list=suite_a_cases)
        # create second test suite
        suite_b_cases = (cases[2], cases[0], cases[4])
        suite_b = self.create_suite(mozwebqa_logged_in,
                                    product=product,
                                    use_API=True,
                                    name='suite B',
                                    case_list=suite_b_cases)
        # create first test run (suite a, suite b)
        first_suite_order = (suite_a['name'], suite_b['name'])
        first_run = self.create_run(mozwebqa_logged_in,
                                    product=product,
                                    activate=True,
                                    version=version,
                                    suite_name_list=first_suite_order)
        # execute first test run
        home_page = MozTrapHomePage(mozwebqa_logged_in)
        home_page.go_to_home_page()
        home_page.go_to_run_test(product_name=product['name'],
                                 version_name=version['name'],
                                 run_name=first_run['name'],
                                 env_category_name=element['category']['name'],
                                 env_element_name=element['name'])

        run_tests_pg = MozTrapRunTestsPage(mozwebqa_logged_in)
        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'],)]
        # assert that right order saved
        Assert.equal(actual_order, expected_order)
        # edit run to reorder suites
        manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in)
        manage_runs_pg.go_to_manage_runs_page()
        # push run into draft mode
        manage_runs_pg.filter_form.filter_by(lookup='name',
                                             value=first_run['name'])
        manage_runs_pg.make_run_draft(first_run['name'])
        # go to edit run page and reorder suites by name (suite b, suite a)
        edit_run_pg = manage_runs_pg.go_to_edit_run_page(first_run['name'])
        edit_run_pg.edit_run(first_run, reorder_suites=True)
        # make run active again
        manage_runs_pg.activate_run(first_run['name'])
        # execute run again
        home_page.go_to_home_page()
        home_page.go_to_run_test(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.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)