Example #1
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
    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)
Example #3
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
Example #4
0
    def test_that_user_can_select_version(self, mozwebqa, login, product):
        home_pg = MozTrapHomePage(mozwebqa)

        run = self.create_run(mozwebqa, product=product, activate=True)

        home_pg.go_to_home_page()
        home_pg.select_item(run['version']['product']['name'])

        Assert.false(home_pg.is_element_visible(*run['homepage_locator']))

        home_pg.select_item(run['version']['name'])

        Assert.true(home_pg.is_element_visible(*run['homepage_locator']))
    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
Example #6
0
    def test_that_user_can_login_and_logout(self, base_url, selenium, existing_user):
        from pages.login_page import MozTrapLoginPage
        login_pg = MozTrapLoginPage(base_url, selenium)
        home_pg = MozTrapHomePage(base_url, selenium)

        home_pg.get_relative_path('/')
        assert not home_pg.header.is_user_logged_in

        login_pg.go_to_login_page()
        login_pg.login(existing_user['email'], existing_user['password'])
        assert home_pg.header.is_user_logged_in
        assert existing_user['name'] == home_pg.header.username_text

        home_pg.header.click_logout()
        home_pg.get_relative_path('/')
        assert not home_pg.header.is_user_logged_in
Example #7
0
    def test_that_user_can_login_and_logout(self, mozwebqa, existing_user):
        from pages.login_page import MozTrapLoginPage
        login_pg = MozTrapLoginPage(mozwebqa)
        home_pg = MozTrapHomePage(mozwebqa)

        home_pg.get_relative_path('/')
        Assert.false(home_pg.header.is_user_logged_in)

        login_pg.go_to_login_page()
        login_pg.login(existing_user['email'], existing_user['password'])
        Assert.true(home_pg.header.is_user_logged_in)
        Assert.equal(home_pg.header.username_text, existing_user['name'])

        home_pg.header.click_logout()
        home_pg.get_relative_path('/')
        Assert.false(home_pg.header.is_user_logged_in)
Example #8
0
    def test_that_user_can_select_version(self, mozwebqa, login, product):
        home_pg = MozTrapHomePage(mozwebqa)

        run = self.create_run(mozwebqa, product=product, activate=True)

        home_pg.go_to_home_page()
        home_pg.select_item(run['version']['product']['name'])

        Assert.false(home_pg.is_element_visible(*run['homepage_locator']))

        home_pg.select_item(run['version']['name'])

        Assert.true(home_pg.is_element_visible(*run['homepage_locator']))
Example #9
0
    def test_that_user_can_select_version(self, base_url, selenium, login, product):
        home_pg = MozTrapHomePage(base_url, selenium)

        run = self.create_run(base_url, selenium, product=product, activate=True)

        home_pg.go_to_home_page()
        home_pg.select_item(run['version']['product']['name'])

        assert not home_pg.is_element_visible(*run['homepage_locator'])

        home_pg.select_item(run['version']['name'])

        assert home_pg.is_element_visible(*run['homepage_locator'])
Example #10
0
    def test_that_user_can_select_version(self, base_url, selenium, login,
                                          product):
        home_pg = MozTrapHomePage(base_url, selenium)

        run = self.create_run(base_url,
                              selenium,
                              product=product,
                              activate=True)

        home_pg.go_to_home_page()
        home_pg.select_item(run['version']['product']['name'])

        assert not home_pg.is_element_visible(*run['homepage_locator'])

        home_pg.select_item(run['version']['name'])

        assert home_pg.is_element_visible(*run['homepage_locator'])
Example #11
0
    def test_that_user_can_select_product(self, mozwebqa, login, product):
        home_pg = MozTrapHomePage(mozwebqa)

        home_pg.go_to_home_page()

        Assert.false(home_pg.is_product_version_visible(product))

        home_pg.select_item(product['name'])

        Assert.true(home_pg.is_product_version_visible(product))
Example #12
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
Example #13
0
    def test_that_user_can_select_product(self, base_url, selenium, login,
                                          product):
        home_pg = MozTrapHomePage(base_url, selenium)

        home_pg.go_to_home_page()

        assert not home_pg.is_product_version_visible(product)

        home_pg.select_item(product['name'])

        assert home_pg.is_product_version_visible(product)
Example #14
0
    def test_that_user_can_select_product(self, mozwebqa, login, product):
        home_pg = MozTrapHomePage(mozwebqa)

        home_pg.go_to_home_page()

        Assert.false(home_pg.is_product_version_visible(product))

        home_pg.select_item(product['name'])

        Assert.true(home_pg.is_product_version_visible(product))
Example #15
0
    def test_that_user_can_select_product(self, base_url, selenium, login, product):
        home_pg = MozTrapHomePage(base_url, selenium)

        home_pg.go_to_home_page()

        assert not home_pg.is_product_version_visible(product)

        home_pg.select_item(product['name'])

        assert home_pg.is_product_version_visible(product)
    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
Example #17
0
    def test_that_user_can_login_and_logout(self, mozwebqa):
        from pages.login_page import MozTrapLoginPage
        login_pg = MozTrapLoginPage(mozwebqa)
        home_pg = MozTrapHomePage(mozwebqa)

        home_pg.get_relative_path('/')

        Assert.false(home_pg.header.is_user_logged_in)

        login_pg.go_to_login_page()
        login_pg.login()

        user = home_pg.testsetup.credentials['default']
        users_name = user['name']

        Assert.true(home_pg.header.is_user_logged_in)
        Assert.equal(home_pg.header.username_text, users_name)

        home_pg.header.click_logout()
        home_pg.get_relative_path('/')

        Assert.false(home_pg.header.is_user_logged_in)
Example #18
0
    def test_that_user_can_select_product(self, mozwebqa_logged_in):
        home_pg = MozTrapHomePage(mozwebqa_logged_in)

        product = self.create_product(mozwebqa_logged_in)

        home_pg.go_to_homepage_page()

        Assert.false(home_pg.is_element_visible(*product['version']['homepage_locator']))

        home_pg.select_item(product['name'])

        Assert.true(home_pg.is_element_visible(*product['version']['homepage_locator']))

        self.delete_product(mozwebqa_logged_in, product=product)
Example #19
0
    def test_that_user_can_select_product(self, mozwebqa_logged_in):
        home_pg = MozTrapHomePage(mozwebqa_logged_in)

        product = self.create_product(mozwebqa_logged_in)

        home_pg.go_to_homepage_page()

        Assert.false(
            home_pg.is_element_visible(
                *product['version']['homepage_locator']))

        home_pg.select_item(product['name'])

        Assert.true(
            home_pg.is_element_visible(
                *product['version']['homepage_locator']))

        self.delete_product(mozwebqa_logged_in, product=product)
Example #20
0
    def test_that_user_can_login_and_logout(self, mozwebqa, existing_user):
        from pages.login_page import MozTrapLoginPage
        login_pg = MozTrapLoginPage(mozwebqa)
        home_pg = MozTrapHomePage(mozwebqa)

        home_pg.get_relative_path('/')
        Assert.false(home_pg.header.is_user_logged_in)

        login_pg.go_to_login_page()
        login_pg.login(existing_user['email'], existing_user['password'])
        Assert.true(home_pg.header.is_user_logged_in)
        Assert.equal(home_pg.header.username_text, existing_user['name'])

        home_pg.header.click_logout()
        home_pg.get_relative_path('/')
        Assert.false(home_pg.header.is_user_logged_in)
Example #21
0
    def test_that_user_can_login_and_logout(self, base_url, selenium,
                                            existing_user):
        from pages.login_page import MozTrapLoginPage
        login_pg = MozTrapLoginPage(base_url, selenium)
        home_pg = MozTrapHomePage(base_url, selenium)

        home_pg.get_relative_path('/')
        assert not home_pg.header.is_user_logged_in

        login_pg.go_to_login_page()
        login_pg.login(existing_user['email'], existing_user['password'])
        assert home_pg.header.is_user_logged_in
        assert existing_user['name'] == home_pg.header.username_text

        home_pg.header.click_logout()
        home_pg.get_relative_path('/')
        assert not home_pg.header.is_user_logged_in
Example #22
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
Example #23
0
    def test_that_user_can_login_and_logout(self, mozwebqa):
        from pages.login_page import MozTrapLoginPage
        login_pg = MozTrapLoginPage(mozwebqa)
        home_pg = MozTrapHomePage(mozwebqa)

        home_pg.get_relative_path('/')

        Assert.false(home_pg.header.is_user_logged_in)

        login_pg.go_to_login_page()
        login_pg.login()

        user = home_pg.testsetup.credentials['default']
        users_name = user['name']

        Assert.true(home_pg.header.is_user_logged_in)
        Assert.equal(home_pg.header.username_text, users_name)

        home_pg.header.click_logout()
        home_pg.get_relative_path('/')

        Assert.false(home_pg.header.is_user_logged_in)
Example #24
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
Example #25
0
    def test_that_user_can_select_run(self, mozwebqa_logged_in):
        home_pg = MozTrapHomePage(mozwebqa_logged_in)

        run = self.create_run(mozwebqa_logged_in, activate=True)

        home_pg.go_to_homepage_page()
        home_pg.select_item(run['version']['product']['name'])
        home_pg.select_item(run['version']['name'])

        Assert.false(home_pg.is_element_visible(*run['run_tests_locator']))

        home_pg.select_item(run['name'])

        Assert.true(home_pg.is_element_visible(*run['run_tests_locator']))

        self.delete_product(mozwebqa_logged_in, product=run['version']['product'])
Example #26
0
    def test_that_user_can_select_run(self, mozwebqa_logged_in):
        home_pg = MozTrapHomePage(mozwebqa_logged_in)

        run = self.create_run(mozwebqa_logged_in, activate=True)

        home_pg.go_to_homepage_page()
        home_pg.select_item(run['version']['product']['name'])
        home_pg.select_item(run['version']['name'])

        Assert.false(home_pg.is_element_visible(*run['run_tests_locator']))

        home_pg.select_item(run['name'])

        Assert.true(home_pg.is_element_visible(*run['run_tests_locator']))

        self.delete_product(mozwebqa_logged_in,
                            product=run['version']['product'])
    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)