def setup_method(self): super().setup_method() project_overview_url = self.data.server_name + self.p.project_overview_url + self.project_id suite_overview_url = self.data.server_name + self.p.suites.view_url + self.suite_id case = decode_data(str(self.t.cases[0])) case2 = decode_data(str(self.t.cases[1])) first_section = self.p.sections.first_section second_section = self.p.sections.second_section message = self.t.messages.msg_success_added_test_case self.section.open_page(project_overview_url) self.section.open_test_cases() self.section.add_first_section(first_section) self.section.press_add_section_button() self.section.add_subsequent_section(second_section) self.tests.press_add_test_case_button() self.tests.insert_test_data_to_testcase_text(case) self.tests.confirm_test_case() self.tests.verify_test_case(case, message) self.section.open_page(suite_overview_url) self.tests.press_add_test_case_button() self.tests.insert_test_data_to_testcase_text(case2) self.tests.confirm_test_case() self.tests.verify_test_case(case2, message) self.section.open_page(suite_overview_url) self.cases = [case, case2]
def prepare_for_testing(cls): add_project_url = (cls.data.server_name + cls.p.add_project_url) cls.login.simple_login(cls.data.login.username, cls.data.login.password) cls.project.open_page(add_project_url) cls.project_id = cls.project.add_single_repo_project( cls.p.project_info.project_name) case1 = decode_data(str(cls.t.cases[0])) case2 = decode_data(str(cls.t.cases[1])) case3 = decode_data(str(cls.t.cases[2])) cls.tests.open_page(cls.data.server_name + cls.r.overview_url + cls.project_id) cls.tests.add_tests(case1, case2, case3) cls.cases = [case1, case2, case3] full_name = cls.r.add.user_full_name email_address = cls.r.add.user_email_address password = cls.r.add.user_password user = User(full_name, email_address, password) cls.users.open_page(cls.data.server_name + cls.u.overview_url) cls.users.add_user(user) add_milestone_url = cls.data.server_name + cls.m.add_milestone_url.format( cls.project_id) milestone_message = cls.m.messages.msg_success_added_milestone milestone = cls.m.milestones[0] cls.miles.open_page(add_milestone_url) cls.miles.add_milestone(milestone.name, milestone.description) cls.miles.confirm_milestone(milestone_message)
def test_run_report_without_permission_to_create(self): user = decode_data(str(self.users.regular_user)) user_overview_url = self.data.server_name + self.users.overview_url self.users_roles.open_page(user_overview_url) self.users_roles.add_user(user) role = decode_data(str(self.users.roles.no_permissions)) self.users_roles.open_page(self.data.server_name + self.users.add_role_url) self.users_roles.add_role(role) self.users_roles.open_page(self.users_overview_url) self.users_roles.select_user(self.users.regular_user.full_name) self.users_roles.open_access_tab() self.users_roles.change_role_for_user(role.name) self.reports_page.open_page(self.data.server_name + self.reports.reports.property_distribution.format(self.project_id)) self.reports_page.check_schedule_on_demand_via_api() self.reports_page.click_add_report() reports = self.client.get_reports(self.project_id) report_id = reports[0]['id'] self.client.client.username = user.email_address self.client.client.password = user.password self.reports_page.expect_to_raise_exception( self.client.run_report, [report_id], 403, self.reports.errors.insufficient_permissions )
def prepare_for_testing(cls): add_project_url = (cls.data.server_name + cls.p.add_project_url) cls.plans.open_page(cls.data.server_name) cls.login.simple_login(cls.data.login.username, cls.data.login.password) cls.project.open_page(add_project_url) cls.project_id = cls.project.add_single_repo_project( cls.p.project_info.project_name) case1 = decode_data(str(cls.t.cases[0])) case2 = decode_data(str(cls.t.cases[1])) case3 = decode_data(str(cls.t.cases[2])) cls.plans.open_page(cls.data.server_name + cls.r.overview_url + cls.project_id) cls.tests.add_tests(case1, case2, case3) cls.cases = [case1, case2, case3] full_name = cls.plan_data.add.user_full_name email_address = cls.plan_data.add.user_email_address password = cls.plan_data.add.user_password user = User(full_name, email_address, password) cls.users.open_page(cls.data.server_name + cls.u.overview_url) cls.users.add_user(user)
def test_check_tester_with_modify_permission_can_modify_another_user_test_result( self): new_result = decode_data(str(self.runs.test_results.add[1])) edit_result = decode_data(str(self.runs.test_results.edit[1])) edit_result.id = self.tests.add_result(new_result) self.login_as_tester_with_modify_permissions() self.run.open_page(self.test_url) self.tests.edit_test_result(edit_result) self.tests.validate_test_result(edit_result)
def test_check_tester_can_modify_own_test_result(self): new_result = decode_data(str(self.runs.test_results.add[0])) edit_result = decode_data(str(self.runs.test_results.edit[1])) edit_result.id = self.tests.add_result(new_result) self.run.open_page(self.test_url) self.tests.edit_test_result(edit_result) # Added sleep as sometimes in this case driver are erroring on getting access to element after reload time.sleep(3) self.tests.validate_test_result(edit_result)
def test_check_admin_cant_modify_test_results_by_default(self): new_result = decode_data(str(self.runs.test_results.add[0])) edit_result = decode_data(str(self.runs.test_results.edit[0])) try: edit_result.id = self.tests.add_result(new_result) self.prepare_data.login_as_admin() self.run.open_page(self.test_url) self.tests.verify_edit_result_visibility(change_id=edit_result.id, visibility=False) finally: self.prepare_data.login_as_tester()
def test_c228_change_and_check_case_properties(self): original = decode_data(str(self.t.cases[0])) edited = decode_data(str(self.t.cases[1])) message = self.t.messages.msg_success_edited_test_case self.tests.press_add_test_case_button() self.tests.insert_test_data_to_testcase_text(original) self.tests.confirm_test_case() self.tests.edit_test_case(edited) self.tests.confirm_test_case() self.tests.verify_test_case(edited, message)
def test_contact_admin_forget_admin(self): user = decode_data(str(self.users.add_admin_user[0])) user = decode_data(str(self.users.add_admin_user[0])) self.users_roles.open_page(self.data.server_name + self.users.add_user_url) self.users_roles.add_name_and_email(user.full_name, user.email_address) self.users_roles.insert_manual_password(user.password) self.users_roles.add_user_as_admin() user.id = self.users_roles.retrieve_id_from_link(user.full_name) # Test Contact Admin Forget admin self.login.open_page(self.data.server_name + self.users.edit_user_details_url + user.id) self.users_roles.validate_admin_forget_user()
def test_check_tester_can_modify_all_test_result_within_editing_period( self): first_result = decode_data(str(self.runs.test_results.add[0])) second_result = decode_data(str(self.runs.test_results.add[1])) first_result.id = self.tests.add_result(first_result) second_result.id = self.tests.add_result(second_result) self.prepare_data.login_as_tester() self.run.open_page(self.test_url) self.tests.verify_edit_result_visibility(change_id=first_result.id, visibility=True) self.tests.verify_edit_result_visibility(change_id=second_result.id, visibility=True)
def test_add_subsequent_test_to_section_inline(self): cases = [] cases.append(decode_data(str(self.t.cases[1]))) cases.append(decode_data(str(self.t.cases[2]))) cases.append(decode_data(str(self.t.cases[3]))) section, id = self.section.get_section(self.p.sections.section_name) self.tests.press_add_test_inline(str(id)) for case in cases: self.tests.add_test_case_inline(str(id), case.title) self.tests.confirm_adding_testcase_inline(section) case.id = self.tests.validate_test_case_inline( self.p.sections.section_name, case)
def test_edit_user(self): user = decode_data(str(self.users.edit)) user_to_edit = decode_data(str(self.users.add[2])) self.users_roles.open_page(self.users_overview_url) self.users_roles.select_user(user_to_edit.full_name) self.users_roles.edit_user(user) self.users_roles.click_add() user.id = self.users_roles.retrieve_id_from_link(user.full_name) self.users_roles.validate_success_message(self.users.messages.msg_success_updated_user) self.users_roles.validate_user_data(user) self.login.click_logout() self.login.simple_login(user.email_address, user.password)
def test_add_youtrack_integration_success(self): yt = decode_data(str(self.youtrack.youtrack)) yt.user_variable_username = decode_data( str(self.youtrack.youtrack.user_variable_username)) yt.user_variable_password = decode_data( str(self.youtrack.youtrack.user_variable_password)) message = self.youtrack.messages.success_updated_integration_settings self.integration.open_page(self.data.server_name + self.youtrack.integration_url) self.integration.add_defects_data(yt) self.integration.add_user_variable(yt.user_variable_username) self.integration.add_user_variable(yt.user_variable_password) self.integration.save_settings() self.integration.check_success_message(message)
def test_hidden_fields_for_sso_only_users(self): self.site_settings.switch_on_sso() self.site_settings.configure_sso( idp_sso_url=self.valid_settings.idp_sso_url, idp_issuer_url=self.valid_settings.idp_issuer_url, certificate=self.valid_settings.idp_certificate, fallback='false', create_account='true') self.site_settings.click_save_settings() user_to_test = decode_data(str(self.user.add[3])) self.users.open_page(self.user_overview_url) if self.users.check_user_exists(user_to_test): self.users.forget_user(user_to_test.full_name) self.login.click_logout() self.login.click_sso_button() self.login.sso_sign_in(username=user_to_test.email_address, password=user_to_test.password) self.login.check_if_dashboard_is_displayed() try: self.login.open_page(self.data.server_name + self.data.my_settings_url) self.users.check_sso_checkbox_not_shown() self.users.check_email_field_disabled() self.users.check_password_field_not_displayed() self.login.click_logout() self.login.logout_IDP(self.data.idp_url) finally: self.clean_up_user(user_to_test.full_name)
def test_bulk_save_changes(self): user_to_check = decode_data(str(self.users.add[0])) try: self.users_roles.open_page(self.users_overview_url) self.users_roles.select_users([user_to_check.full_name]) self.users_roles.click_bulk_update_selected() self.users_roles.add_bulk_update_changes(email_notification=self.users.bulk_edit.email_notification, locale=self.users.bulk_edit.locale, time_zone=self.users.bulk_edit.time_zone, language=self.users.bulk_edit.language, sso=self.users.bulk_edit.sso, role=self.users.bulk_edit.role, is_administrator=self.users.bulk_edit.is_administrator, active=self.users.bulk_edit.active) self.users_roles.bulk_save_changes() self.users_roles.check_confirmation_page_displayed() self.users_roles.click_save_changes() self.users_roles.open_page(self.users_overview_url) self.users_roles.apply_filter('all') self.users_roles.select_user(user_to_check.full_name) self.users_roles.check_user_updated(email_notification=self.users.bulk_edit.email_notification, locale=self.users.bulk_edit.locale, time_zone=self.users.bulk_edit.time_zone, language=self.users.bulk_edit.language, sso=self.users.bulk_edit.sso, role=self.users.bulk_edit.role, is_administrator=self.users.bulk_edit.is_administrator, active=self.users.bulk_edit.active) finally: self.users_roles.open_page(self.users_overview_url) self.users_roles.apply_filter('active')
def test_update_plan_without_permissions(self): user = decode_data(str(self.users.regular_user)) user_overview_url = self.data.server_name + self.users.overview_url self.users_roles_page.open_page(user_overview_url) self.users_roles_page.add_user(user) role = decode_data(str(self.users.roles.no_permissions)) self.users_roles_page.open_page(self.data.server_name + self.users.add_role_url) self.users_roles_page.add_role(role) self.users_roles_page.open_page(user_overview_url) self.users_roles_page.select_user(self.users.regular_user.full_name) self.users_roles_page.open_access_tab() self.users_roles_page.change_role_for_user(role.name) original_username = self.client.client.username original_password = self.client.client.password self.client.client.username = user.email_address self.client.client.password = user.password try: plan_entry = PlanEntry( suite_id=self.suite.id, include_all=True, case_ids=[self.case.id], config_ids=[self.config_ids[0], self.config_ids[1]], runs=[{ "config_ids": [self.config_ids[0]], "include_all": True }, { "config_ids": [self.config_ids[1]], "include_all": True }], name="Windows", ) resp = self.client.add_plan_entry(self.plan.id, plan_entry, check_errors=False) self.attachments_page.assert_response_error( resp, self.attachments.errors.insufficient_permissions_msg) finally: self.client.client.username = original_username self.client.client.password = original_password
def test_check_tester_can_modify_own_test_result_status(self): new_result = decode_data(str(self.runs.test_results.add[0])) edit_result = TestResult(status=self.runs.test_results.edit[0].status) edit_result.id = self.tests.add_result(new_result) self.run.open_page(self.test_url) self.tests.edit_test_result(edit_result) self.tests.validate_test_result(edit_result)
def add_lead_user(self): user = decode_data(str(self.users.lead_user)) self.users_roles.open_page(self.users_overview_url) self.users_roles.add_user(user) self.users_roles.select_user(self.users.lead_user.full_name) self.users_roles.open_access_tab() self.users_roles.change_role_for_user("Lead")
def test_add_role_no_permissions(self): role = decode_data(str(self.users.roles.no_permissions)) message = self.users.roles.messages.msg_success_role_added self.users_roles.open_page(self.data.server_name + self.users.add_role_url) self.users_roles.add_role(role) self.users_roles.verify_role(role, message) self.users_roles.delete_role(role.name)
def test_check_tests_can_modify_own_test_result_assigned_to(self): new_result = decode_data(str(self.runs.test_results.add[0])) edit_result = TestResult( assigned_to=self.runs.test_results.edit[0].assigned_to) edit_result.id = self.tests.add_result(new_result) self.run.open_page(self.test_url) self.tests.edit_test_result(edit_result) self.tests.validate_test_result(edit_result)
def test_c219_add_case_with_attachment(self): test_case = decode_data(str(self.t.cases[0])) attachment_path = os.path.abspath('../data/text_file.txt') self.tests.press_add_test_case_button() self.tests.insert_test_data_to_testcase_text(test_case) self.tests.add_attachment(attachment_path) self.tests.confirm_test_case() self.tests.verify_text_attachment(attachment_path)
def add_role_with_modify_test_results_permission(self): role = decode_data(str(self.users.roles.tester_role)) role.permissions = (RolePermissions.RESULTS_ADD | RolePermissions.RESULTS_MODIFY).value self.users_roles.open_page(self.data.server_name + self.users.add_role_url) self.users_roles.add_role(role) self.users_roles.check_success_message_displayed()
def test_user_with_modify_permission_can_push_defect_to_existing_test_result( self): new_result = decode_data(str(self.runs.test_results.add[1])) new_result.id = self.tests.add_result(new_result) self.login_as_tester_with_modify_permissions() self.run.open_page(self.test_url) self.tests.open_test_result(change_id=new_result.id) self.tests.click_push_defect_and_verify_dialog()
def add_tester_user_with_modify_test_results_permission(self): user = decode_data(str(self.users.tester_user)) self.add_role_with_modify_test_results_permission() self.users_roles.open_page(self.users_overview_url) self.users_roles.add_user(user) self.users_roles.select_user(self.users.tester_user.full_name) self.users_roles.open_access_tab() self.users_roles.change_role_for_user("Advanced Tester")
def test_c233_delete_last_case_in_section(self): case1 = decode_data(str(self.t.cases[1])) case2 = decode_data(str(self.t.cases[2])) case3 = decode_data(str(self.t.cases[3])) message = self.t.messages.msg_success_added_test_case del_message = self.t.messages.msg_success_deleted_test_case self.section.add_section(self.p.sections.section_name) self.section.press_add_section_button() section, id = self.section.get_section(self.p.sections.section_name) self.tests.press_add_test_inline(str(id)) for case in case1, case2, case3: self.tests.add_test_case_inline(str(id), case.title) self.tests.confirm_adding_testcase_inline(section) self.tests.delete_test_case(case1.title, del_message) self.tests.delete_test_case(case2.title, del_message) self.tests.delete_test_case(case3.title, del_message)
def test_check_tester_with_modify_permission_can_modify_another_user_test_result_assignee_set_others( self): new_result = decode_data(str(self.runs.test_results.add[1])) edit_result = TestResult(assigned_to=self.users.lead_user.full_name) edit_result.id = self.tests.add_result(new_result) self.login_as_tester_with_modify_permissions() self.run.open_page(self.test_url) self.tests.edit_test_result(edit_result) self.tests.validate_test_result(edit_result)
def test_add_role_new_role(self): # Note that not all possible values are valid. You can't # have permission to delete an entity but not have permission # to add/edit that entity. role = decode_data(str(self.users.roles.new_role)) message = self.users.roles.messages.msg_success_role_added self.users_roles.open_page(self.data.server_name + self.users.add_role_url) self.users_roles.add_role(role) self.users_roles.verify_role(role, message)
def test_delete_role(self): role = decode_data(str(self.users.roles.new_role)) new_permissions = (RolePermissions.RUNS_ADD | RolePermissions.CASES_ADD | RolePermissions.SUITES_ADD).value role.permissions = new_permissions message = self.users.roles.messages.msg_success_role_deleted self.users_roles.open_page(self.users_overview_url) self.users_roles.open_roles_tab() self.users_roles.delete_role(role.name) self.users_roles.validate_success_message(message)
def test_add_user_with_email_invitation(self): user = decode_data(str(self.users.add[2])) self.users_roles.open_page(self.data.server_name + self.users.add_user_url) self.users_roles.add_name_and_email(user.full_name, user.email_address) self.users_roles.select_email_invite() self.users_roles.click_add() user.id = self.users_roles.retrieve_id_from_link(user.full_name) self.users_roles.validate_success_message(self.users.messages.msg_success_added_user_invitation) self.users_roles.validate_user_data(user)
def test_add_user_with_custom_password(self): user = decode_data(str(self.users.add[1])) self.users_roles.open_page(self.data.server_name + self.users.add_user_url) self.users_roles.add_name_and_email(user.full_name, user.email_address) self.users_roles.insert_manual_password(user.password) self.users_roles.click_add() user.id = self.users_roles.retrieve_id_from_link(user.full_name) self.users_roles.validate_success_message(self.users.messages.msg_success_added_user_manual_psw) self.users_roles.validate_user_data(user)