class ChatLeftSide(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.VACANCY_NAME = "Программист JAVA" self.TEST_MSG = "привет" self.STATUS_TEST = "Новый статус заявки" self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.chatPage = ChatPage(self.driver) self.main_page = MainPage(self.driver) self.resume_page = ResumePage(self.driver) self.resume = self.resume_page.form self.scenario = ResumeScenario(self, self.resume) def tearDown(self): self.driver.quit() def test_chat_exist_after_response(self): auth_as_applicant(self) self.scenario.create_resume() self.vacanciesPage.open() self.vacanciesPage.click_on_first_vacancy() self.vacancyPage.click_on_response() self.vacancyPage.click_on_first_resume() self.chatPage.open() self.assertTrue(self.chatPage.is_open()) self.scenario.delete_resume()
class PopularCategory(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.sphere = 'Государственные организации' self.main_page = MainPage(self.driver) self.vacancies_page = VacanciesPage(self.driver) self.reg_page = RegistrationPage(self.driver) self.create_resume_page = CreateResumePage(self.driver) self.main_page.open() def tearDown(self): self.driver.quit() def test_check_vacancy_by_sphere(self): self.main_page.click_on_sphere(self.sphere) self.assertTrue(self.vacancies_page.is_open()) self.vacancies_page.click_on_first_vacancy() self.assertEqual(self.vacancies_page.get_sphere(), self.sphere) def test_check_footer_btn_not_auth(self): text = self.main_page.click_footer_btn() self.assertEqual(text, 'Создать аккаунт') self.reg_page.wait_for_page_open() self.assertTrue(self.reg_page.is_open()) def test_check_footer_btn_auth(self): setup_auth(self) text = self.main_page.click_footer_btn() self.assertEqual(text, 'Создать резюме') self.create_resume_page.wait_for_page_open() self.assertTrue(self.create_resume_page.is_open())
def setUp(self) -> None: default_setup(self) self.PROFESSION = "Воспитатель" self.mainPage = MainPage(self.driver) self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.mainPage.open()
def setUp(self) -> None: default_setup(self) self.sphere = 'Государственные организации' self.main_page = MainPage(self.driver) self.vacancies_page = VacanciesPage(self.driver) self.reg_page = RegistrationPage(self.driver) self.create_resume_page = CreateResumePage(self.driver) self.main_page.open()
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 setUp(self) -> None: default_setup(self) self.KEYWORD = "Воспитатель" self.COLUMN = "Образование" self.mainPage = MainPage(self.driver) self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.mainPage.open()
def setUp(self) -> None: default_setup(self) self.PROFESSION = "Воспитатель" self.mainPage = MainPage(self.driver) self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.mainPage.open() self.Applicant = RegistrationApplicantScenario(self) self.data = self.Applicant.registration_applicant()
def setUp(self) -> None: default_setup(self) self.PROFESSION = "Воспитатель" self.PLACE = "Москва" self.KEYWORD = "Воспитатель" self.COLUMN = "Направление" self.mainPage = MainPage(self.driver) self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.mainPage.open()
def setUp(self) -> None: default_setup(self) self.main_page = MainPage(self.driver) self.vacancies = VacanciesPage(self.driver) self.rec_page = RecommendationPage(self.driver) self.profile = ProfilePage(self.driver) 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.scenario = ResumeScenario(self, self.resume) self.Applicant = RegistrationApplicantScenario(self) self.reg_data = self.Applicant.registration_applicant()
def setUp(self) -> None: default_setup(self) self.VACANCY_NAME = "Программист JAVA" self.TEST_MSG = "привет" self.STATUS_TEST = "Новый статус заявки" self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.chatPage = ChatPage(self.driver) self.main_page = MainPage(self.driver) self.resume_page = ResumePage(self.driver) self.resume = self.resume_page.form self.scenario = ResumeScenario(self, self.resume)
def test_search(self, driver): # constants word = 'Центральный' vacancies_main_page = VacanciesPage(driver) vacancies_main_page.go_to_vacancies() vacancies_main_page.enter_word_in_company_names_input(word) vacancies_main_page.click_on_search_button() result = vacancies_main_page.find_all_company_names() for i in result: assert i.find(word) or i == word
def setUp(self) -> None: default_setup(self) self.TEST_MSG = "привет2" self.TEST_MSG2 = "привет" self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.chatPage = ChatPage(self.driver)
class CheckRecommendations(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.PROFESSION = "Воспитатель" self.mainPage = MainPage(self.driver) self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.mainPage.open() def test_vacancy_open_on_click(self): auth_as_applicant(self) self.mainPage.click_recommendations() self.assertTrue(self.vacanciesPage.is_open()) self.vacanciesPage.click_on_first_vacancy() self.assertTrue(self.vacancyPage.is_open()) def tearDown(self): self.driver.quit()
class CheckRecommendationsCreate(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.PROFESSION = "Воспитатель" self.mainPage = MainPage(self.driver) self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.mainPage.open() self.Applicant = RegistrationApplicantScenario(self) self.data = self.Applicant.registration_applicant() def test_vacancy_equiv_on_click(self): self.mainPage.search_by_profession(self.PROFESSION) self.vacanciesPage.click_on_first_vacancy() name = self.vacancyPage.get_vacancy_name() self.mainPage.open() self.mainPage.click_recommendations() self.assertTrue( self.vacanciesPage.check_vacancies_exists_by_name(name)) def tearDown(self): self.Applicant.delete_applicant() self.driver.quit()
class CheckSearch(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.PROFESSION = "Воспитатель" self.PLACE = "Москва" self.KEYWORD = "Воспитатель" self.COLUMN = "Направление" self.mainPage = MainPage(self.driver) self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.mainPage.open() def test_search_by_profession(self): self.mainPage.search_by_profession(self.PROFESSION) self.assertTrue( self.vacanciesPage.check_vacancy_exist_by_profession( self.PROFESSION)) def test_search_by_place(self): self.mainPage.search_by_place(self.PLACE) self.assertTrue( self.vacanciesPage.check_vacancy_exist_by_place(self.PLACE)) def test_search_by_place_and_profession(self): self.mainPage.search_by_place_and_profession(self.PLACE, self.PROFESSION) self.assertTrue( self.vacanciesPage.check_vacancy_by_place_and_profession( self.PLACE, self.PROFESSION)) def test_search_by_category(self): name = self.mainPage.click_on_category() self.vacanciesPage.click_on_first_vacancy() self.assertTrue(self.vacancyPage.check_info_exist(name, self.COLUMN)) def tearDown(self): self.driver.quit()
def __init__(self, browser_init): self.browser_init = browser_init self.header = Header(self.browser_init) self.sign_in_page = SignInPage(self.browser_init) self.forgot_password_page = ForgotPasswordPage(self.browser_init) self.confirmation_password_page = ConfirmPassword(self.browser_init) self.vacancies_page = VacanciesPage(self.browser_init) self.view_vacancy_page = ViewVacancyPage(self.browser_init) self.preview_resume_page = PreviewResumePage(self.browser_init) self.edit_resume_page = EditResumePage(self.browser_init) self.view_company_page = ViewCompanyPage(self.browser_init) self.companies_page = CompaniesPage(self.browser_init) self.my_companies_page = MyCompaniesPage(self.browser_init) self.update_company_page = UpdateCompanyPage(self.browser_init) self.create_vacancy_page = CreateVacancyPage(self.browser_init) self.create_company_page = CreateCompanyPage(self.browser_init) self.company_details_page = CompanyDetailsPage(self.browser_init) self.hot_vacancies_page = HotVacanciesPage(self.browser_init) self.search_page = SearchPage(self.browser_init) self.user_profile_page = UserPage(self.browser_init)
class Notification(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.main_page = MainPage(self.driver) self.vacancies = VacanciesPage(self.driver) self.rec_page = RecommendationPage(self.driver) self.profile = ProfilePage(self.driver) 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.scenario = ResumeScenario(self, self.resume) self.Applicant = RegistrationApplicantScenario(self) self.reg_data = self.Applicant.registration_applicant() def tearDown(self): self.main_page.open() self.main_page.click_logout() logData = { 'EMAIL': self.reg_data["EMAIL"], 'PASSWORD': self.reg_data["PASSWORD"] } setup_auth(self, logData) self.Applicant.delete_applicant() self.driver.quit() def test_empty_notification(self): self.main_page.click_notif_popup() self.main_page.wait_notif_open() self.assertEqual(self.main_page.get_text_empty_notif(), 'У вас нет новых уведомлений') def test_recommended_vacancies(self): self.vacancies.open() self.vacancies.click_on_first_vacancy() self.main_page.click_notif_popup() self.main_page.wait_notif_open() self.assertTrue(self.main_page.check_notif_recommendations()) def test_recommended_vacancies_page(self): self.vacancies.open() self.vacancies.click_on_first_vacancy() self.main_page.click_notif_popup() self.main_page.wait_notif_open() self.main_page.notification.click_notif_recommendation() self.assertTrue(self.rec_page.is_open()) self.main_page.click_notif_popup() self.main_page.wait_notif_open() self.assertEqual(self.main_page.get_text_recommendation(), '') def test_response(self): self.scenario.create_resume() self.main_page.click_logout() auth_as_employer_has_comp(self) vacancy = VacancyScenario(test=self) vacancy.create_vacancy() self.resume_list.open() self.resume_list_form.go_first_resume_page() self.resume.response() self.resume.get_response_done() self.vacancies.open() self.vacancies.click_on_first_vacancy() vacancy.delete_vacancy() self.main_page.click_logout() setup_auth(self, self.reg_data) self.main_page.click_notif_popup() self.main_page.wait_notif_open() self.assertTrue(self.main_page.check_response()) self.main_page.delete_response() self.scenario.delete_resume()
class ChatLeftSideWithCreate(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.VACANCY_NAME = "Программист JAVA" self.TEST_MSG = "привет" self.STATUS_TEST = "Новый статус заявки" self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.chatPage = ChatPage(self.driver) self.main_page = MainPage(self.driver) self.Applicant = RegistrationApplicantScenario(self) self.data = self.Applicant.registration_applicant() self.resume_page = ResumePage(self.driver) self.resume = self.resume_page.form self.scenario = ResumeScenario(self, self.resume) def test_check_new_chat_after_request(self): self.scenario.create_resume() self.vacanciesPage.open() self.vacanciesPage.search_vacancy_by_keyword(self.VACANCY_NAME) self.vacanciesPage.click_on_first_vacancy() self.vacancyPage.click_on_response() self.vacancyPage.click_on_first_resume() self.chatPage.open() self.main_page.open() self.main_page.click_logout() auth_as_employer_has_comp(self) self.chatPage.open() name = self.chatPage.get_first_chat_name() firstAndLastName = name.split(" ") self.assertEqual(firstAndLastName[0], self.data["NAME"]) self.assertEqual(firstAndLastName[1], self.data["SURNAME"]) def test_check_new_message_after_request(self): self.scenario.create_resume() self.vacanciesPage.open() self.vacanciesPage.search_vacancy_by_keyword(self.VACANCY_NAME) self.vacanciesPage.click_on_first_vacancy() self.vacancyPage.click_on_response() self.vacancyPage.click_on_first_resume() self.main_page.open() self.main_page.click_logout() auth_as_employer_has_comp(self) self.chatPage.open() self.chatPage.click_on_another_chat(0) self.chatPage.click_on_send_msg(self.TEST_MSG) self.main_page.open() self.main_page.click_logout() logData = {'EMAIL': self.data["EMAIL"], 'PASSWORD': self.data["PASSWORD"]} setup_auth(self, logData) self.chatPage.open() self.chatPage.click_on_another_chat(0) text = self.chatPage.get_last_msg() self.assertEqual(text, self.TEST_MSG) def tearDown(self): self.main_page.open() self.main_page.click_logout() logData = {'EMAIL': self.data["EMAIL"], 'PASSWORD': self.data["PASSWORD"]} setup_auth(self, logData) self.scenario.delete_resume() self.Applicant.delete_applicant() self.driver.quit()
def test_choose_region(self, driver): needed_region = 'Кубинка' vacancies_main_page = VacanciesPage(driver) vacancies_main_page.go_to_vacancies() vacancies_main_page.enter_region_for_keys(needed_region) vacancies_main_page.click_on_needed_region(needed_region) vacancies_main_page.click_on_search_button() result = vacancies_main_page.find_all_regions() for i in result: print("нашла") assert i.find(needed_region) or i == needed_region vacancies_main_page.click_on_show_contacts() assert vacancies_main_page.find_phone()
def test_vacancy_link(self): self.main_page.open() self.main_page.click_vac_list() vac_list = VacanciesPage(self.driver) self.assertTrue(vac_list.is_open())
class CheckSearchVacancyPage(unittest.TestCase): def setUp(self) -> None: default_setup(self) self.KEYWORD = "Воспитатель" self.COLUMN = "Образование" self.mainPage = MainPage(self.driver) self.vacanciesPage = VacanciesPage(self.driver) self.vacancyPage = VacancyPage(self.driver) self.mainPage.open() def test_search_by_keyword(self): self.vacanciesPage.open() self.vacanciesPage.search_vacancy_by_keyword(self.KEYWORD) self.assertTrue(self.vacanciesPage.check_vacancy_exist_by_profession(self.KEYWORD)) def test_search_by_checkbox(self): self.vacanciesPage.open() name = self.vacanciesPage.search_vacancy_by_checkbox() self.vacanciesPage.click_on_first_vacancy() self.assertTrue(self.vacancyPage.check_info_exist(name, self.COLUMN)) def test_search_by_checkbox_and_keyword(self): self.vacanciesPage.open() name = self.vacanciesPage.search_vacancy_by_keyword_and_checkbox(self.KEYWORD) self.assertTrue(self.vacanciesPage.check_vacancy_exist_by_profession(self.KEYWORD)) self.vacanciesPage.click_on_first_vacancy() self.assertTrue(self.vacancyPage.check_info_exist(name, self.COLUMN)) def test_scroll_up_after_search(self): self.vacanciesPage.open() self.vacanciesPage.search_vacancy_by_keyword(self.KEYWORD) self.vacanciesPage.check_vacancy_exist_by_profession(self.KEYWORD) height = self.driver.execute_script("return window.pageYOffset") self.assertEqual(height, 0) def tearDown(self): self.driver.quit()
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)