def delete_suite(self, mozwebqa, suite): manage_suites_pg = MozTrapManageSuitesPage(mozwebqa) manage_suites_pg.go_to_manage_suites_page() manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) manage_suites_pg.delete_suite(name=suite['name'])
def test_editing_of_existing_suite_that_has_no_included_cases( self, mozwebqa_logged_in, product): #create suite and cases suite = self.create_suite(mozwebqa_logged_in, product, use_API=True) cases = self.create_bulk_cases(mozwebqa_logged_in, product, use_API=True, cases_amount=3) # simulate random order of cases case_list = [cases[i]['name'] for i in (2, 0, 1)] manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in) manage_suites_pg.go_to_manage_suites_page() manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name']) # product field should not be read-only. Assert.false(edit_suite_pg.is_product_field_readonly, u'product version field should be editable') edit_suite_pg.include_cases_to_suite(case_list) manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name']) Assert.true(edit_suite_pg.is_product_field_readonly, u'product version field should be read-only') Assert.equal([item.name for item in edit_suite_pg.included_cases], case_list, u'items are listed in wrong order')
def delete_suite(self, base_url, selenium, suite): manage_suites_pg = MozTrapManageSuitesPage(base_url, selenium) manage_suites_pg.go_to_manage_suites_page() manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) manage_suites_pg.delete_suite(name=suite['name'])
def test_editing_of_existing_suite_that_has_no_included_cases( self, api, base_url, selenium, login, product): # create suite and cases suite = self.create_suite(base_url, selenium, product, api=api) cases = self.create_bulk_cases(base_url, selenium, product, api=api, cases_amount=3) # simulate random order of cases case_list = [cases[i]['name'] for i in (2, 0, 1)] manage_suites_pg = MozTrapManageSuitesPage(base_url, selenium) manage_suites_pg.go_to_manage_suites_page() manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name']) # product field should not be read-only. assert not edit_suite_pg.is_product_field_readonly edit_suite_pg.include_cases_to_suite(case_list) edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name']) assert edit_suite_pg.is_product_field_readonly assert case_list == [ item.name for item in edit_suite_pg.included_cases ]
def delete_suite(self, mozwebqa, suite, delete_product=False): manage_suites_pg = MozTrapManageSuitesPage(mozwebqa) manage_suites_pg.go_to_manage_suites_page() manage_suites_pg.filter_suites_by_name(name=suite['name']) manage_suites_pg.delete_suite(name=suite['name']) if delete_product: self.delete_product(mozwebqa, product=suite['product'])
def test_that_user_can_create_suite_and_add_some_cases_to_it( self, api, mozwebqa, login, product): manage_suites_pg = MozTrapManageSuitesPage(mozwebqa) cases = [ self.create_case(mozwebqa=mozwebqa, product=product, api=api) for i in range(3) ] suite = self.create_suite(mozwebqa=mozwebqa, product=product, api=api, case_list=[case for case in cases])
def test_that_user_can_create_suite_and_add_some_cases_to_it( self, mozwebqa_logged_in, product): manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in) cases = [ self.create_case(mozwebqa=mozwebqa_logged_in, product=product, use_API=True) for i in range(3) ] suite = self.create_suite(mozwebqa=mozwebqa_logged_in, product=product, use_API=True, case_list=[case for case in cases])
def test_that_user_can_create_and_delete_suite(self, mozwebqa_logged_in, product): manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in) suite = self.create_suite(mozwebqa_logged_in, product, use_API=False) manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) Assert.true(manage_suites_pg.is_element_present(*suite['locator'])) manage_suites_pg.delete_suite(name=suite['name']) Assert.false(manage_suites_pg.is_element_present(*suite['locator']))
def test_that_user_can_create_and_delete_suite(self, base_url, selenium, login, product): manage_suites_pg = MozTrapManageSuitesPage(base_url, selenium) suite = self.create_suite(base_url, selenium, product) manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) assert manage_suites_pg.is_element_present(*suite['locator']) manage_suites_pg.delete_suite(name=suite['name']) assert not manage_suites_pg.is_element_present(*suite['locator'])
def test_that_user_can_create_and_delete_suite(self, mozwebqa_logged_in): manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in) suite = self.create_suite(mozwebqa_logged_in) manage_suites_pg.filter_suites_by_name(name=suite['name']) Assert.true(manage_suites_pg.is_element_present(*suite['locator'])) manage_suites_pg.delete_suite(name=suite['name']) Assert.false(manage_suites_pg.is_element_present(*suite['locator'])) self.delete_product(mozwebqa_logged_in, product=suite['product'])
def test_that_user_can_create_suite_and_add_some_cases_to_it(self, mozwebqa_logged_in): manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in) product = self.create_product(mozwebqa_logged_in) cases = [self.create_case(mozwebqa=mozwebqa_logged_in, product=product) for i in range(3)] suite = self.create_suite(mozwebqa=mozwebqa_logged_in, product=product, case_name_list=[case['name'] for case in cases]) manage_suites_pg.filter_suites_by_name(name=suite['name']) Assert.true(manage_suites_pg.is_element_present(*suite['locator'])) manage_test_cases_pg = manage_suites_pg.view_cases(name=suite['name']) for case in cases: Assert.true(manage_test_cases_pg.is_element_present(*case['locator']))
def test_that_pinning_filters_on_product_sets_defaults_in_new_suite( self, base_url, selenium, login, product): manage_suites_pg = MozTrapManageSuitesPage(base_url, selenium) manage_suites_pg.go_to_manage_suites_page() filter_item = manage_suites_pg.filter_form.filter_by( lookup='product', value=product['name']) # check that filter is not orange before it's pinned self.check_pinned_filter(filter_item, is_pinned=False) filter_item.pin_filter() # check that filter is orange after it's been pinned self.check_pinned_filter(filter_item, is_pinned=True) create_suite_pg = manage_suites_pg.click_create_suite_button() assert product['name'] == create_suite_pg.product_name_value
def test_that_pinning_filters_on_product_sets_defaults_in_new_suite( self, mozwebqa, login, product): manage_suites_pg = MozTrapManageSuitesPage(mozwebqa) manage_suites_pg.go_to_manage_suites_page() filter_item = manage_suites_pg.filter_form.filter_by( lookup='product', value=product['name']) # check that filter is not orange before it's pinned self.check_pinned_filter(filter_item, is_pinned=False) filter_item.pin_filter() # check that filter is orange after it's been pinned self.check_pinned_filter(filter_item, is_pinned=True) create_suite_pg = manage_suites_pg.click_create_suite_button() Assert.equal(create_suite_pg.product_name_value, product['name'], u'default product is incorrect')
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
# create suite and cases (both included and not included into suite) included_cases = self.create_bulk_cases(mozwebqa, product, api=api, cases_amount=2) not_included_cases = self.create_bulk_cases(mozwebqa, product, api=api, cases_amount=3) suite = self.create_suite(mozwebqa, product, api=api, case_list=[case for case in included_cases]) # filter by suite name and go to edit suite page manage_suites_pg = MozTrapManageSuitesPage(mozwebqa) manage_suites_pg.go_to_manage_suites_page() manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name']) Assert.true(edit_suite_pg.is_product_field_readonly, u'product version field should be read only') # check list of available cases actual_available_cases = [ item.name for item in edit_suite_pg.available_cases ] expected_available_cases = [ item['name'] for item in not_included_cases ]
def test_that_pinning_name_field_filter_only_works_for_current_page( self, mozwebqa_logged_in, product): good_case_name = u'mozilla' good_suite_name = u'MozTrap' self.create_bulk_cases(mozwebqa_logged_in, product, use_API=True, name=good_case_name, cases_amount=3) self.create_bulk_cases(mozwebqa_logged_in, product, use_API=True, name=u'ALLIZOM', cases_amount=2) self.create_suite(mozwebqa_logged_in, product, use_API=True, name=good_suite_name) self.create_suite(mozwebqa_logged_in, product, use_API=True, name=u'PartZom') manage_cases_pg = MozTrapManageCasesPage(mozwebqa_logged_in) manage_cases_pg.go_to_manage_cases_page() #filter cases by name and assert that only cases with mozilla in their name are found cases_filter = manage_cases_pg.filter_form.filter_by( lookup='name', value=good_case_name) Assert.equal(cases_filter.content_text, good_case_name) self.check_pinned_filter(cases_filter, is_pinned=False) for case in manage_cases_pg.test_cases: Assert.contains(good_case_name, case.name.lower()) #pin filter and assert that it turns orange cases_filter.pin_filter() self.check_pinned_filter(cases_filter, is_pinned=True) manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in) manage_suites_pg.go_to_manage_suites_page() #check that there is no filters applied Assert.equal(manage_suites_pg.filter_form.filter_items, []) #filter suites by name and assert that only suites with moztrap in their name are found suites_filter = manage_suites_pg.filter_form.filter_by( lookup='name', value=good_suite_name) Assert.equal(suites_filter.content_text, good_suite_name.lower()) self.check_pinned_filter(suites_filter, is_pinned=False) for suite in manage_suites_pg.test_suites: Assert.contains(good_suite_name, suite.name) #pin filter and assert that it turns orange suites_filter.pin_filter() self.check_pinned_filter(suites_filter, is_pinned=True) #and check everything again on manage cases page manage_cases_pg.go_to_manage_cases_page() applied_filter = manage_cases_pg.filter_form.filter_items Assert.equal(len(applied_filter), 1) Assert.equal(applied_filter[0].content_text, good_case_name) for case in manage_cases_pg.test_cases: Assert.contains(good_case_name, case.name.lower()) #and check everything one more time on manage suites page manage_suites_pg.go_to_manage_suites_page() applied_filter = manage_suites_pg.filter_form.filter_items Assert.equal(len(applied_filter), 1) Assert.equal(applied_filter[0].content_text, good_suite_name.lower()) for suite in manage_suites_pg.test_suites: Assert.contains(good_suite_name, suite.name) #and go to manage runs page and see no filters there manage_runs_pg = MozTrapManageRunsPage(mozwebqa_logged_in) manage_runs_pg.go_to_manage_runs_page() #check that there is no filters applied Assert.equal(manage_runs_pg.filter_form.filter_items, [])
product, api=api, cases_amount=2) not_included_cases = self.create_bulk_cases(base_url, selenium, product, api=api, cases_amount=3) suite = self.create_suite(base_url, selenium, product, api=api, case_list=[case for case in included_cases]) # filter by suite name and go to edit suite page manage_suites_pg = MozTrapManageSuitesPage(base_url, selenium) manage_suites_pg.go_to_manage_suites_page() manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name']) assert edit_suite_pg.is_product_field_readonly # check list of available cases actual_available_cases = [ item.name for item in edit_suite_pg.available_cases ] expected_available_cases = [ item['name'] for item in not_included_cases ] assert expected_available_cases == actual_available_cases
def test_that_pinning_filter_persists_for_session(self, api, mozwebqa, existing_user, login, product, element): # create suite, cases and test run product_version_name = u'%s %s' % (product['name'], product['version']['name']) case, suite, run = self.create_and_run_test(api, mozwebqa, product, element) # go to manage cases page manage_cases_pg = MozTrapManageCasesPage(mozwebqa) manage_cases_pg.go_to_manage_cases_page() # filter on product filter_item = manage_cases_pg.filter_form.filter_by( lookup='product', value=product['name']) self.check_pinned_filter(filter_item, is_pinned=False) # see only cases for specified product displayed_cases = manage_cases_pg.test_cases Assert.equal(len(displayed_cases), 1, 'there should be only one case displayed') Assert.equal(case.name.lower(), displayed_cases[0].name.lower(), 'displayed case name differs from expected value') # pin product filter filter_item.pin_filter() self.check_pinned_filter(filter_item, is_pinned=True) # go to manage suites page manage_suites_pg = MozTrapManageSuitesPage(mozwebqa) manage_suites_pg.go_to_manage_suites_page() # see only suites for specified product displayed_suites = manage_suites_pg.test_suites Assert.equal(len(displayed_suites), 1, 'there should be only one suite displayed') Assert.equal(suite.name.lower(), displayed_suites[0].name.lower(), 'displayed suite name differs from expected value') # go to results page view_results_pg = MozTrapViewRunResultsPage(mozwebqa) view_results_pg.go_to_view_run_results_page() # see only results for specified product # because we are going to check the same thing several times # let's define a function and call it each time we need this check def check_test_run_results(results): Assert.equal(len(results), 1, 'there should be only one test run result') Assert.equal(run['name'].lower(), results[0].name.lower(), 'displayed run name differs from expected value') Assert.equal( product_version_name, results[0].product_version, 'displayed test run productversion differs from expected value' ) check_test_run_results(view_results_pg.test_run_results) # refresh page and see that filter persists view_results_pg.refresh() check_test_run_results(view_results_pg.test_run_results) # log out and back in and see that filter persists view_results_pg.header.click_logout() view_results_pg.header.login(existing_user['email'], existing_user['password']) check_test_run_results(view_results_pg.test_run_results) # check that filter is still pinned filters = view_results_pg.filter_form.filter_items Assert.equal(len(filters), 1) self.check_pinned_filter(filters[0], is_pinned=True)
# create suite and cases (both included and not included into suite) included_cases = self.create_bulk_cases(mozwebqa_logged_in, product, use_API=True, cases_amount=2) not_included_cases = self.create_bulk_cases(mozwebqa_logged_in, product, use_API=True, cases_amount=3) suite = self.create_suite(mozwebqa_logged_in, product, use_API=True, case_list=[case for case in included_cases]) # filter by suite name and go to edit suite page manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in) manage_suites_pg.go_to_manage_suites_page() manage_suites_pg.filter_form.filter_by(lookup='name', value=suite['name']) edit_suite_pg = manage_suites_pg.edit_suite(name=suite['name']) Assert.true(edit_suite_pg.is_product_field_readonly, u'product version field should be read only') # check list of available cases actual_available_cases = [ item.name for item in edit_suite_pg.available_cases ] expected_available_cases = [ item['name'] for item in not_included_cases ]
def test_that_pinning_filter_persists_for_session(self, api, base_url, selenium, existing_user, login, product, element): # create suite, cases and test run product_version_name = u'%s %s' % (product['name'], product['version']['name']) case, suite, run = self.create_and_run_test(api, base_url, selenium, product, element) # go to manage cases page manage_cases_pg = MozTrapManageCasesPage(base_url, selenium) manage_cases_pg.go_to_manage_cases_page() # filter on product filter_item = manage_cases_pg.filter_form.filter_by( lookup='product', value=product['name']) self.check_pinned_filter(filter_item, is_pinned=False) # see only cases for specified product displayed_cases = manage_cases_pg.test_cases assert 1 == len(displayed_cases) assert case.name.lower() == displayed_cases[0].name.lower() # pin product filter filter_item.pin_filter() self.check_pinned_filter(filter_item, is_pinned=True) # go to manage suites page manage_suites_pg = MozTrapManageSuitesPage(base_url, selenium) manage_suites_pg.go_to_manage_suites_page() # see only suites for specified product displayed_suites = manage_suites_pg.test_suites assert 1 == len(displayed_suites) assert suite.name.lower() == displayed_suites[0].name.lower() # go to results page view_results_pg = MozTrapViewRunResultsPage(base_url, selenium) view_results_pg.go_to_view_run_results_page() # see only results for specified product # because we are going to check the same thing several times # let's define a function and call it each time we need this check def check_test_run_results(results): assert 1 == len(results) assert run['name'].lower() == results[0].name.lower() assert product_version_name == results[0].product_version check_test_run_results(view_results_pg.test_run_results) # refresh page and see that filter persists view_results_pg.refresh() check_test_run_results(view_results_pg.test_run_results) # log out and back in and see that filter persists view_results_pg.header.click_logout() view_results_pg.header.login(existing_user['email'], existing_user['password']) check_test_run_results(view_results_pg.test_run_results) # check that filter is still pinned filters = view_results_pg.filter_form.filter_items assert 1 == len(filters) self.check_pinned_filter(filters[0], is_pinned=True)
def test_that_pinning_name_field_filter_only_works_for_current_page( self, api, base_url, selenium, login, product): good_case_name = u'mozilla' good_suite_name = u'MozTrap' self.create_bulk_cases(base_url, selenium, product, api=api, name=good_case_name, cases_amount=3) self.create_bulk_cases(base_url, selenium, product, api=api, name=u'ALLIZOM', cases_amount=2) self.create_suite(base_url, selenium, product, api=api, name=good_suite_name) self.create_suite(base_url, selenium, product, api=api, name=u'PartZom') manage_cases_pg = MozTrapManageCasesPage(base_url, selenium) manage_cases_pg.go_to_manage_cases_page() # filter cases by name and assert that only cases with mozilla in their name are found cases_filter = manage_cases_pg.filter_form.filter_by( lookup='name', value=good_case_name) assert good_case_name == cases_filter.content_text self.check_pinned_filter(cases_filter, is_pinned=False) for case in manage_cases_pg.test_cases: assert good_case_name in case.name.lower() # pin filter and assert that it turns orange cases_filter.pin_filter() self.check_pinned_filter(cases_filter, is_pinned=True) manage_suites_pg = MozTrapManageSuitesPage(base_url, selenium) manage_suites_pg.go_to_manage_suites_page() # check that there is no filters applied assert [] == manage_suites_pg.filter_form.filter_items # filter suites by name and assert that only suites with moztrap in their name are found suites_filter = manage_suites_pg.filter_form.filter_by( lookup='name', value=good_suite_name) assert good_suite_name.lower() == suites_filter.content_text self.check_pinned_filter(suites_filter, is_pinned=False) for suite in manage_suites_pg.test_suites: assert good_suite_name in suite.name # pin filter and assert that it turns orange suites_filter.pin_filter() self.check_pinned_filter(suites_filter, is_pinned=True) # and check everything again on manage cases page manage_cases_pg.go_to_manage_cases_page() applied_filter = manage_cases_pg.filter_form.filter_items assert 1 == len(applied_filter) assert good_case_name == applied_filter[0].content_text for case in manage_cases_pg.test_cases: assert good_case_name in case.name.lower() # and check everything one more time on manage suites page manage_suites_pg.go_to_manage_suites_page() applied_filter = manage_suites_pg.filter_form.filter_items assert 1 == len(applied_filter) assert good_suite_name.lower() == applied_filter[0].content_text for suite in manage_suites_pg.test_suites: assert good_suite_name in suite.name # and go to manage runs page and see no filters there manage_runs_pg = MozTrapManageRunsPage(base_url, selenium) manage_runs_pg.go_to_manage_runs_page() # check that there is no filters applied assert [] == manage_runs_pg.filter_form.filter_items