def delete_resume(self): profile_page = ProfilePage(self.test.driver) edit_resume_page = EditResumePage(self.test.driver) edit_resume_form = edit_resume_page.edit_form profile_page.open() profile_page.click_my_first_resume_edit() edit_resume_form.delete_resume()
class Favorite(unittest.TestCase): data = { 'title': 'My Title', 'description': 'My cool resume', 'place': 'I very good', 'skills': 'My great skills', } def setUp(self) -> None: default_setup(self) scen = RegistrationEmployerScenario(self) scen.registration_employer(True) self.resume_page = ResumePage(self.driver) self.resume = self.resume_page.form self.resume_list = ResumesPage(self.driver) self.resume_list_form = self.resume_list.list self.profile_page = ProfilePage(self.driver) self.profile_form = self.profile_page.profile_form self.resume_list.open() self.resume_list_form.go_first_resume_page() def tearDown(self): self.profile_page.delete_account() self.driver.quit() def test_add_to_favorite(self): self.assertEqual(self.resume.get_text_favorite_btn(), 'Добавить в избранное') self.resume.add_to_favorite() self.resume.wait_to_add_favorite() self.assertEqual(self.resume.get_text_favorite_btn(), 'Убрать из избранного') self.profile_page.open() def test_check_added_favorite_in_profile(self): self.assertEqual(self.resume.get_text_favorite_btn(), 'Добавить в избранное') self.resume.add_to_favorite() self.resume.wait_to_add_favorite() self.profile_page.open() page_data = self.profile_page.get_my_favorite() self.assertDictEqual(page_data, { 'title': self.data['title'], 'description': self.data['description'], }) self.profile_page.click_my_profile_info()
class Response(unittest.TestCase): data = { 'title': 'My Title', 'description': 'My cool resume', 'place': 'I very good', 'skills': 'My great skills', } def setUp(self) -> None: default_setup(self) auth_as_employer_has_comp(self) self.vacancy = VacancyScenario(test=self) self.vacancy.create_vacancy() self.uri_to_delete = self.vacancy.get_vacancy_uri self.resume_page = ResumePage(self.driver) self.resume = self.resume_page.form self.resume_list = ResumesPage(self.driver) self.resume_list_form = self.resume_list.list self.profile_page = ProfilePage(self.driver) self.profile_form = self.profile_page.profile_form self.resume_list.open() self.resume_list_form.go_first_resume_page() def tearDown(self): self.vacancy.delete_vacancy(self.uri_to_delete) self.driver.quit() def test_create_response(self): self.resume.response() self.assertEqual(self.resume.get_response_done(), 'Ваш отклик успешно отправлен!') def test_check_created_response_in_profile(self): data = self.resume.response() parsed = data.split('\n') title = parsed[0] self.profile_page.open() self.profile_page.click_link_to_myResponses() self.assertTrue(self.profile_page.find_vacancy_in_responses(title))
def delete_employer(self): profile_page = ProfilePage(self.test.driver) profile_page.open() profile_page.delete_account()
class CheckRegistration(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.incorrect_name = 'name123' self.incorrect_surname = 'surname123' self.incorrect_email = 'margot.ru' self.correct_name = 'margotName' self.correct_surname = 'margotSurname' self.correct_email = '*****@*****.**' self.correct_password = self.PASSWORD_APPL self.auth_page = AuthPage(self.driver) self.reg_page = RegistrationPage(self.driver) self.profile_page = ProfilePage(self.driver) self.main_page = MainPage(self.driver) def tearDown(self): self.driver.quit() def test_checkout_to_auth(self): self.reg_page.open() self.reg_page.go_to_auth() self.auth_page.check_open_page() def test_correct_registration_applicant_and_delete(self): data = registration_applicant(self) self.main_page.click_profile_page() self.profile_page.is_open() self.assertTrue(self.profile_page.check_profile_data(data)) self.profile_page.delete_account() def test_correct_reg_empl_and_del(self): scen = RegistrationEmployerScenario(self) data = scen.registration_employer(True) self.main_page.click_profile_page() self.profile_page.is_open() self.assertTrue(self.profile_page.check_profile_data(data)) self.profile_page.delete_account() def test_correct_reg_empl_with_company_and_del(self): scen = RegistrationEmployerScenario(self) data = scen.registration_employer(True) self.main_page.click_profile_page() self.profile_page.is_open() self.assertTrue(self.profile_page.check_profile_data(data)) self.profile_page.delete_account() def test_empty_form_apl(self): empty_form = { 'NAME': '', 'SURNAME': '', 'EMAIL': '', 'PASSWORD': '', 'CONFIRM_PASSWORD': '' } self.reg_page.open() self.reg_page.set_data(empty_form) self.assertTrue(self.reg_page.errors_empty_data()) def test_empty_form_empl(self): empty_form = { 'NAME': '', 'SURNAME': '', 'EMAIL': '', 'PASSWORD': '', 'CONFIRM_PASSWORD': '' } self.reg_page.open() self.reg_page.click_checkout_btn() self.reg_page.set_data(empty_form) self.assertTrue(self.reg_page.errors_empty_data()) def test_incorrect_name_appl(self): incorrect_name_data = { 'NAME': self.incorrect_name, 'SURNAME': self.correct_surname, 'EMAIL': self.correct_email, 'PASSWORD': self.correct_password, 'CONFIRM_PASSWORD': self.correct_password } self.reg_page.open() self.reg_page.set_data(incorrect_name_data) self.assertTrue( self.reg_page.top_error( 'Неправильные значения полей: имя должно содержать только буквы' )) def test_incorrect_name_empl(self): incorrect_name_data = { 'NAME': self.incorrect_name, 'SURNAME': self.correct_surname, 'EMAIL': self.correct_email, 'PASSWORD': self.correct_password, 'CONFIRM_PASSWORD': self.correct_password } self.reg_page.open() self.reg_page.click_checkout_btn() self.reg_page.select_company() self.reg_page.set_data(incorrect_name_data) self.assertTrue( self.reg_page.top_error( 'Неправильные значения полей: имя должно содержать только буквы' )) def test_incorrect_surname_appl(self): incorrect_surname_data = { 'NAME': self.correct_name, 'SURNAME': self.incorrect_surname, 'EMAIL': self.correct_email, 'PASSWORD': self.correct_password, 'CONFIRM_PASSWORD': self.correct_password } self.reg_page.open() self.reg_page.set_data(incorrect_surname_data) self.assertTrue( self.reg_page.top_error( 'Неправильные значения полей: фамилия должна содержать только буквы' )) def test_incorrect_surname_empl(self): incorrect_surname_data = { 'NAME': self.correct_name, 'SURNAME': self.incorrect_surname, 'EMAIL': self.correct_email, 'PASSWORD': self.correct_password, 'CONFIRM_PASSWORD': self.correct_password } self.reg_page.open() self.reg_page.click_checkout_btn() self.reg_page.click_to_checkbox() self.reg_page.set_data(incorrect_surname_data) self.assertTrue( self.reg_page.top_error( 'Неправильные значения полей: фамилия должна содержать только буквы' )) def test_incorrect_email_appl(self): incorrect_email_data = { 'NAME': self.correct_name, 'SURNAME': self.correct_surname, 'EMAIL': self.incorrect_email, 'PASSWORD': self.correct_password, 'CONFIRM_PASSWORD': self.correct_password } self.reg_page.open() self.reg_page.set_data(incorrect_email_data) self.assertTrue(self.reg_page.error_email()) def test_not_equal_passwords(self): different_password_data = { 'NAME': self.correct_name, 'SURNAME': self.correct_surname, 'EMAIL': self.correct_email, 'PASSWORD': self.correct_password, 'CONFIRM_PASSWORD': '******' } self.reg_page.open() self.reg_page.set_data(different_password_data) self.assertTrue(self.reg_page.errors_in_passwords()) def test_existing_account(self): data = registration_applicant(self) self.main_page.click_logout() self.reg_page.open() self.reg_page.set_data(data) self.assertTrue( self.reg_page.top_error('Пользователь уже существует.')) setup_auth(self, data) self.profile_page.open() self.profile_page.delete_account()
class EditResume(unittest.TestCase): data = { 'title': 'My Title', 'description': 'My cool resume', 'place': 'I very good', 'skills': 'My great skills', 'position': 'Developer', 'name_job': 'Mail.ru Group', 'start_date': '2010-01-02', 'end_date': '2020-01-02', } other_data = { 'title': 'other My Title', 'description': 'other My cool resume', 'place': 'other I very good', 'skills': 'other My great skills', } def setUp(self) -> None: default_setup(self) self.create_resume_page = CreateResumePage(self.driver) self.create_resume_form = self.create_resume_page.create_form self.resume_page = ResumePage(self.driver) self.resume = self.resume_page.form self.edit_resume_page = EditResumePage(self.driver) self.edit_resume_form = self.edit_resume_page.edit_form self.profile_page = ProfilePage(self.driver) self.scenario = ResumeScenario(self, self.create_resume_form) setup_auth(self) self.scenario.create_resume_with_experience(self.data) self.profile_page.open() self.profile_page.click_my_first_resume_edit() self.assertTrue(self.edit_resume_page.is_open()) def test_save_without_changes(self): self.edit_resume_form.submit_resume() self.resume.wait_for_resume_page() self.assertTrue(self.resume_page.is_open()) self.assertEqual(self.data['place'], self.resume.get_place()) self.assertEqual(self.data['description'], self.resume.get_description()) self.assertEqual(self.data['skills'], self.resume.get_skills()) def test_save_with_changes(self): self.edit_resume_form.clear_inputs() self.scenario.fill_resume(self.other_data) self.edit_resume_form.submit_resume() self.resume.wait_for_resume_page() self.assertTrue(self.resume_page.is_open()) self.assertEqual(self.other_data['place'], self.resume.get_place()) self.assertEqual(self.other_data['description'], self.resume.get_description()) self.assertEqual(self.other_data['skills'], self.resume.get_skills()) def test_add_experience(self): self.edit_resume_form.open_popup_add_experience() self.scenario.create_experience(self.data) self.edit_resume_form.submit_resume() self.edit_resume_form.wait_for_resume_page() position = self.resume.get_position() name_job = self.resume.get_name_job() self.assertEqual(self.data['position'], position[1].text) self.assertEqual(self.data['name_job'], name_job[1].text) def test_delete_experience(self): self.edit_resume_form.delete_experience() self.assertFalse(self.edit_resume_form.check_experience_exist()) def tearDown(self): self.scenario.delete_resume() self.driver.quit()
class CheckSettingsChange(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.profile_page = ProfilePage(self.driver) self.main_page = MainPage(self.driver) self.main_page.open() def test_open_settings(self): self.main_page.open_auth_popup() self.main_page.auth(self.EMAIL, self.PASSWORD) is_auth = self.main_page.check_auth() self.assertTrue(is_auth) self.profile_page.open() self.profile_page.click_settings_form_button() is_settings_open = self.profile_page.check_settings_form_open() self.assertTrue(is_settings_open) def test_change_login(self): self.test_open_settings() self.profile_page.change_login(self.EMAIL + "123") is_error = self.profile_page.check_login_changed(self.EMAIL + "123") self.assertTrue(is_error) def test_change_email(self): self.test_open_settings() self.profile_page.change_email(self.EMAIL, self.EMAIL + "abc") is_error = self.profile_page.check_email_changed(self.EMAIL + "abc") self.profile_page.change_email(self.EMAIL + "abc", self.EMAIL) self.assertTrue(is_error) def test_change_email_exist(self): self.test_open_settings() self.profile_page.change_email(self.EMAIL, "*****@*****.**") is_error = self.profile_page.check_error_with_text( "Данный Email адрес уже существует") self.assertTrue(is_error) def test_change_email_wrong_format(self): self.test_open_settings() self.profile_page.change_email(self.EMAIL, "[email protected]@mail.ru") is_error = self.profile_page.check_error_with_text( "Неправильный формат E-mail") self.assertTrue(is_error) def test_click_safety_button(self): self.test_open_settings() self.profile_page.click_safety_button() is_clicked = self.profile_page.check_safety_button_clicked() self.assertTrue(is_clicked) def test_change_password(self): self.test_click_safety_button() self.profile_page.change_password(self.PASSWORD, self.PASSWORD + "s") self.profile_page.click_info_button() self.profile_page.click_safety_button() self.profile_page.submit_form() is_error = self.profile_page.check_error_with_text("Неверный пароль") self.assertTrue(is_error) self.profile_page.open() self.profile_page.click_settings_form_button() is_settings_open = self.profile_page.check_settings_form_open() self.assertTrue(is_settings_open) self.profile_page.click_safety_button() self.profile_page.check_safety_button_clicked() self.profile_page.change_password(self.PASSWORD + "s", self.PASSWORD) def test_password_short_error(self): self.test_click_safety_button() self.profile_page.change_new_password("123") self.profile_page.submit_form() is_error = self.profile_page.check_error_with_text( "Пароль должен содержать не менее 6 символов") self.assertTrue(is_error) def test_upload_avatar(self): self.main_page.open_auth_popup() self.main_page.auth(self.EMAIL, self.PASSWORD) self.main_page.check_auth() self.profile_page.open() result = self.profile_page.check_changing_avatar() self.assertTrue(result) def test_passwords_different(self): self.test_click_safety_button() self.profile_page.change_new_password("12334467456") self.profile_page.change_again_password("122343434") self.profile_page.submit_form() is_error = self.profile_page.check_error_with_text( "Пароли не совпадают") self.assertTrue(is_error) def test_settings_close(self): self.test_open_settings() self.profile_page.click_close_button() is_closed = self.profile_page.check_close_clicked() self.assertTrue(is_closed) def test_subscription(self): self.main_page.open_auth_popup() self.main_page.auth(self.EMAIL, self.PASSWORD) is_auth = self.main_page.check_auth() self.assertTrue(is_auth) self.profile_page.open() self.profile_page.click_subscription_button() is_closed = self.profile_page.check_umoney_redirected() self.assertTrue(is_closed) def tearDown(self): self.driver.quit()
def delete_applicant(self): profile_page = ProfilePage(self.test.driver) profile_page.open() profile_page.delete_account()
class Vacancy(unittest.TestCase): def setUp(self) -> None: default_setup(self) auth_as_employer_has_comp(self) self.profile_page = ProfilePage(self.driver) self.vac_page = CreateVacancyPage(self.driver) self.vac_list = VacanciesPage(self.driver) self.vac_form = self.vac_page.form self.vac_page.open() def tearDown(self): self.driver.quit() def test_create_empty_vacancy(self): self.vac_form.submit() self.assertTrue(self.vac_form.is_title_error) self.assertTrue(self.vac_form.is_description_error) self.assertTrue(self.vac_form.is_skills_error) self.assertTrue(self.vac_form.is_requirements_error) self.assertTrue(self.vac_form.is_phone_error) self.assertTrue(self.vac_form.is_place_error) def test_create_vacancy_with_russian_letters_in_salary(self): self.vac_form.set_salary_min('a') self.vac_form.set_salary_max('b') self.vac_form.submit() self.assertTrue( self.vac_form.is_salary_error( 'Некорректное число и Некорректное число')) def test_create_vacancy_with_negative_salary(self): self.vac_form.set_salary_min('-1') self.vac_form.set_salary_max('-2') self.vac_form.submit() self.assertTrue( self.vac_form.is_salary_error( 'Поле не может принимать отрицательное значение. ' + 'и Поле не может принимать отрицательное значение.')) def test_create_vacancy_with_invalid_chars_in_salary(self): self.vac_form.set_salary_min('!"№;%:?*()&^@\'\"`№$-+=~#') self.vac_form.submit() self.assertTrue(self.vac_form.is_salary_error('Некорректное число')) def test_create_vacancy_with_min_greater_max_in_salary(self): self.vac_form.set_salary_min('2') self.vac_form.set_salary_max('1') self.vac_form.submit() self.assertTrue( self.vac_form.is_salary_error( 'Минимальная зарплата не может быть' + ' больше максимальной')) def test_create_vacancy_with_min_equal_max_in_salary(self): self.vac_form.set_salary_min('1') self.vac_form.set_salary_max('1') self.vac_form.submit() self.assertTrue(self.vac_form.is_salary_error('')) def test_create_vacancy_with_zero_in_salary(self): self.vac_form.set_salary_min('0') self.vac_form.set_salary_max('0') self.vac_form.submit() self.assertTrue(self.vac_form.is_salary_error('')) def test_create_vacancy_without_contacts(self): vacancy = VacancyScenario(form=self.vac_form) vacancy.fill_vacancy() self.vac_form.set_email('') self.vac_form.submit() self.assertTrue(self.vac_form.is_email_error) def test_delete_vacancy_success(self): vacancy = VacancyScenario(test=self) vacancy.create_vacancy() existed_title = self.vac_form.get_title vacancy.delete_vacancy() self.profile_page.open() self.profile_page.profile_form.click_to_my_cards() self.assertFalse(self.vac_form.check_vacancy_exist(existed_title)) def test_create_vacancy_success(self): vacancy = VacancyScenario(test=self) vacancy.create_vacancy() existed_title = self.vac_form.get_title vacancy.delete_vacancy() self.assertTrue(vacancy.vacancy_uniq_title, existed_title) def test_create_vacancy_with_unlimited_salary(self): nmb = str(2 << 64) vacancy = VacancyScenario(form=self.vac_form) vacancy.fill_vacancy() self.vac_form.set_salary_min(nmb) self.vac_form.set_salary_max(nmb) self.vac_form.submit() self.assertTrue( self.vac_form.is_server_error('Обязательные поля не заполнены.')) def test_update_vacancy_success(self): vacancy = VacancyScenario(test=self, form=self.vac_form) vacancy.create_vacancy() vacancy.open_update_page() self.vac_form.set_salary_min('1') self.vac_form.set_salary_max('10') self.vac_form.submit() vacancy.delete_vacancy() def test_view_vacancy_in_list(self): vacancy = VacancyScenario(test=self) vacancy.create_vacancy() existed_title = self.vac_form.get_title uri_to_delete = vacancy.get_vacancy_uri self.vac_list.open() vacancy_titles = self.vac_form.get_vacancies_in_list_titles() vacancy.delete_vacancy(uri_to_delete) self.assertTrue(existed_title in vacancy_titles) def test_redirect_vacancy_from_list(self): vacancy = VacancyScenario(test=self) vacancy.create_vacancy() existed_title_on_create = self.vac_form.get_title uri_to_delete = vacancy.get_vacancy_uri self.vac_list.open() self.vac_form.open_by_title(existed_title_on_create) title_clicked = self.vac_form.get_title vacancy.delete_vacancy(uri_to_delete) self.assertTrue(title_clicked == existed_title_on_create)
class CheckProfile(unittest.TestCase): driver: Remote def setUp(self) -> None: default_setup(self) self.profile_page = ProfilePage(self.driver) self.resume_page = ResumePage(self.driver) def tearDown(self): self.driver.quit() def test_link_to_my_resume(self): auth_as_applicant(self) self.profile_page.open() self.assertTrue(self.profile_page.click_link_to_my_cards()) def test_link_to_my_responses(self): auth_as_applicant(self) self.profile_page.open() self.assertTrue(self.profile_page.click_link_to_myResponses()) def test_link_to_my_fav_as_empl(self): auth_as_employer_has_comp(self) self.profile_page.open() self.assertTrue(self.profile_page.click_to_link_myFavorite()) def test_open_vac(self): auth_as_employer_has_comp(self) self.profile_page.open() self.assertTrue(self.profile_page.click_link_to_my_cards()) self.profile_page.view_card() # TODO проверить открытие вакансии def test_edit_vac(self): auth_as_employer_has_comp(self) self.profile_page.open() self.assertTrue(self.profile_page.click_link_to_my_cards()) self.profile_page.edit_card() # TODO проверить открытие вакансии на редактирование def test_check_open_vacancy_response(self): auth_as_applicant(self) self.profile_page.open() self.assertTrue(self.profile_page.click_link_to_myResponses()) self.profile_page.open_vacancy_responses() def test_check_open_company_response(self): auth_as_applicant(self) self.profile_page.open() self.assertTrue(self.profile_page.click_link_to_myResponses()) self.profile_page.open_company_responses() def test_upload_big_avatar(self): auth_as_applicant(self) self.profile_page.open() self.profile_page.upload_avatar("/test_data/big_img.png") self.assertTrue( self.profile_page.check_error( 'Превышен максимальный размер изображения. Максимальный размер: 2 mB.' )) def test_upload_avatar(self): auth_as_applicant(self) self.profile_page.open() self.profile_page.upload_avatar("/test_data/robot.png") self.assertFalse( self.profile_page.check_error( 'Размеры изображения превышают допутимую высоту 2500px и ширину 2500px.' )) def test_check_open_resume_response(self): auth_as_applicant(self) self.profile_page.open() self.assertTrue(self.profile_page.click_link_to_myResponses()) self.profile_page.open_resume_responses() self.assertTrue(self.resume_page.is_open()) def test_edit_name(self): check_value = 'margotmargot' auth_as_applicant(self) self.profile_page.open() self.profile_page.edit(check_value, 1) self.driver.refresh() self.assertTrue(self.profile_page.get_text(check_value, 0)) self.profile_page.edit('margot', 1) def test_edit_email(self): check_value = '*****@*****.**' auth_as_employer_has_comp(self) self.profile_page.open() self.profile_page.edit(check_value, 3) self.assertTrue(self.profile_page.get_text(check_value, 2)) self.driver.refresh() self.profile_page.edit('*****@*****.**', 3) def test_edit_phone(self): check_value = '12345678910' auth_as_applicant(self) self.profile_page.open() self.profile_page.edit(check_value, 4) self.driver.refresh() self.assertTrue(self.profile_page.get_text(check_value, 3)) def test_incorrect_name(self): check_data = auth_as_applicant(self) self.profile_page.open() self.profile_page.edit('margot1', 1) self.assertTrue( self.profile_page.check_error( 'Неправильные значения полей: имя должно содержать только буквы' )) self.driver.refresh() self.assertTrue(self.profile_page.get_text(check_data['NAME'], 0)) def test_incorrect_surname(self): check_data = auth_as_applicant(self) self.profile_page.open() self.profile_page.edit('margot1', 2) self.assertTrue( self.profile_page.check_error( 'Неправильные значения полей: фамилия должна содержать только буквы' )) self.driver.refresh() self.assertTrue(self.profile_page.get_text(check_data['SURNAME'], 1)) def test_incorrect_email(self): check_data = auth_as_applicant(self) self.profile_page.open() self.profile_page.edit('margot1', 3) self.assertTrue( self.profile_page.check_span_error( 'Email должен содержать "@" и латинские буквы, цифры, символы.' )) self.driver.refresh() self.assertTrue(self.profile_page.get_text(check_data['EMAIL'], 2)) def test_incorrect_phone(self): check_data = auth_as_applicant(self) self.profile_page.open() self.profile_page.edit('margot1', 4) self.assertTrue( self.profile_page.check_span_error('Неверный номер телефона.'))