Exemple #1
0
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()
Exemple #2
0
class Navbar(unittest.TestCase):
    def setUp(self) -> None:
        default_setup(self)

        self.main_page = MainPage(self.driver)
        self.auth_page = AuthPage(self.driver)
        self.profile_page = ProfilePage(self.driver)

    def tearDown(self):
        self.driver.quit()

    def test_logout_link(self):
        setup_auth(self)
        self.main_page.click_logout()
        self.assertTrue(self.auth_page.is_open())

    def test_profile_link(self):
        setup_auth(self)
        self.main_page.click_profile_page()
        self.assertTrue(self.profile_page.is_open())

    def test_notification_link(self):
        setup_auth(self)
        self.main_page.click_notif_popup()
        notif = self.main_page.notification
        self.assertTrue(notif.is_open())

    def test_chats_link(self):
        setup_auth(self)
        self.main_page.click_chats_page()
        chat_page = ChatPage(self.driver)
        self.assertTrue(chat_page.is_open())

    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())

    def test_resume_link(self):
        self.main_page.open()
        self.main_page.click_res_list()
        res_list = ResumesPage(self.driver)
        self.assertTrue(res_list.is_open())

    def test_company_link(self):
        self.main_page.open()
        self.main_page.click_comp_list()
        comp_list = CompaniesPage(self.driver)
        self.assertTrue(comp_list.is_open())

    def test_mainpage_link(self):
        self.auth_page.open()
        self.main_page.click_mainpage()
        self.assertTrue(self.main_page.is_open())

    def test_registration_link(self):
        self.main_page.open()
        self.main_page.click_registration_page()
        reg_page = RegistrationPage(self.driver)
        self.assertTrue(reg_page.is_open())

    def test_auth_link(self):
        self.main_page.open()
        self.main_page.click_auth_page()
        self.assertTrue(self.auth_page.is_open())

    def test_create_vacancy(self):
        auth_as_employer_has_comp(self)
        self.main_page.click_create_vacancy()
        create_vac = CreateVacancyPage(self.driver)
        self.assertTrue(create_vac.is_open())

    def test_create_company(self):
        auth_as_employer_no_comp(self)
        self.main_page.click_create_company()
        create_comp = CreateCompanyPage(self.driver)
        self.assertTrue(create_comp.is_open())

    def test_create_resume(self):
        auth_as_applicant(self)
        self.main_page.click_create_resume()
        create_res = CreateResumePage(self.driver)
        self.assertTrue(create_res.is_open())