Ejemplo n.º 1
0
    def create_resume(self, data=None) -> None:
        if data is None:
            data = self.data
        create_resume_page = CreateResumePage(self.test.driver)
        create_resume_page.open()
        self.form = create_resume_page.create_form

        create_resume_form = self.fill_resume(data)
        create_resume_form.submit_resume()
        create_resume_form.wait_for_resume_page()
Ejemplo n.º 2
0
    def create_resume_with_experience(self, data=None):
        if data is None:
            data = self.data
        create_resume_page = CreateResumePage(self.test.driver)
        create_resume_page.open()
        self.form = create_resume_page.create_form

        create_resume_form = self.fill_resume(data)
        create_resume_form.open_popup_add_experience()
        self.create_experience(data)
        create_resume_form.submit_resume()
        create_resume_form.wait_for_resume_page()
Ejemplo n.º 3
0
class CreateResume(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)
        setup_auth(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.scenario = ResumeScenario(self, self.create_resume_form)
        self.create_resume_page.open()

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

    def test_create_resume(self):
        self.scenario.create_resume(self.data)
        place = self.resume.get_place()
        description = self.resume.get_description()
        skills = self.resume.get_skills()

        self.assertEqual(self.data['place'], place)
        self.assertEqual(self.data['description'], description)
        self.assertEqual(self.data['skills'], skills)

    def test_enter_equal_salary(self):
        self.scenario.fill_resume(self.data)
        salary = 5
        self.create_resume_form.set_salary_min(salary)
        self.create_resume_form.set_salary_max(salary)
        self.create_resume_form.submit_resume()
        self.resume.wait_for_resume_page()

        page_salary = self.resume.get_salary()
        self.assertEqual(salary, int(page_salary[0]))
        self.assertEqual(salary, int(page_salary[1]))
Ejemplo n.º 4
0
class CreateResumeWrong(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)
        setup_auth(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.scenario = ResumeScenario(self, self.create_resume_form)
        self.create_resume_page.open()

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

    def test_create_empty_resume(self):
        self.create_resume_form.submit_resume()
        self.assertTrue(self.create_resume_form.is_title_error())
        self.assertTrue(self.create_resume_form.is_description_error())
        self.assertTrue(self.create_resume_form.is_place_error())
        self.assertTrue(self.create_resume_form.is_skills_error())

    def test_enter_salary_in_letters(self):
        self.create_resume_form.set_salary_min("letters")
        self.create_resume_form.submit_resume()
        self.assertTrue(
            self.create_resume_form.is_salary_error('Некорректное число'))

    def test_enter_negative_salary(self):
        self.create_resume_form.set_salary_min(-123)
        self.create_resume_form.submit_resume()
        self.assertTrue(
            self.create_resume_form.is_salary_error(
                'Поле не может принимать отрицательное значение.'))

    def test_enter_salary_in_symbol(self):
        self.create_resume_form.set_salary_min('(!"№;%:?*()')
        self.create_resume_form.submit_resume()
        self.assertTrue(
            self.create_resume_form.is_salary_error('Некорректное число'))

    def test_enter_salary_min_greater_max(self):
        self.create_resume_form.set_salary_min(12)
        self.create_resume_form.set_salary_max(3)
        self.create_resume_form.submit_resume()
        self.assertTrue(
            self.create_resume_form.is_salary_error(
                'Минимальная зарплата не может быть больше максимальной'))

    def test_enter_salary_is_zero(self):
        self.scenario.fill_resume(self.data)
        self.create_resume_form.set_salary_min(0)
        self.create_resume_form.set_salary_max(1)
        self.create_resume_form.submit_resume()

        self.assertTrue(
            self.create_resume_form.is_salary_error(
                'Поле не может принимать отрицательное значение.'))

    def test_create_resume_with_empty_contect_data(self):
        self.scenario.fill_resume(self.data)
        self.create_resume_form.clear_contact_data()
        self.create_resume_form.submit_resume()
        self.assertTrue(self.create_resume_form.is_surname_error())
        self.assertTrue(self.create_resume_form.is_name_error())
        self.assertTrue(self.create_resume_form.is_email_error())

    def test_enter_very_big_salary(self):
        # Ошибка при вводе зарплаты >999999999
        self.scenario.fill_resume(self.data)
        self.create_resume_form.set_salary_min(1)
        self.create_resume_form.set_salary_max(9999999999999)
        self.create_resume_form.submit_resume()
        self.assertTrue(self.create_resume_form.is_common_error())

    def test_load_image_error(self):
        self.scenario.fill_resume(self.data)
        self.create_resume_form.load_image()
        self.create_resume_form.submit_resume()
        self.assertTrue(
            self.create_resume_form.is_common_error(
                'Превышен максимальный размер изображения. Максимальный размер: 2 mB.'
            ))
Ejemplo n.º 5
0
class CreateExperience(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',
    }

    def setUp(self) -> None:
        default_setup(self)
        setup_auth(self)

        self.create_resume_page = CreateResumePage(self.driver)
        self.create_resume_form = self.create_resume_page.create_form
        self.create_experience_form = self.create_resume_page.create_experience_form

        self.resume_page = ResumePage(self.driver)
        self.resume = self.resume_page.form

        self.scenario = ResumeScenario(self, self.create_resume_form)
        self.create_resume_page.open()
        self.scenario.fill_resume(self.data)
        self.create_resume_form.open_popup_add_experience()

    def test_create_empty_experience(self):
        self.create_experience_form.submit_exp()
        self.assertTrue(
            self.create_experience_form.is_date_error('Укажите дату'))
        self.assertTrue(self.create_experience_form.is_position_error())
        self.assertTrue(self.create_experience_form.is_name_job_error())

    def test_enter_date_start_greater_end(self):
        self.create_experience_form.set_position(self.data['position'])
        self.create_experience_form.set_name_job(self.data['name_job'])
        self.create_experience_form.set_date_start('2010-01-01')
        self.create_experience_form.set_date_end('2000-01-01')
        self.create_experience_form.submit_exp()
        self.assertTrue(
            self.create_experience_form.is_date_error('Некорректная дата.'))

    def test_close_popup(self):
        self.create_experience_form.close_popup()
        self.assertFalse(self.create_experience_form.form_is_open())

    def test_create_experience(self):
        self.scenario.create_experience(self.data)
        page_date = self.create_resume_form.get_job_date()
        for i in range(len(page_date)):
            page_date[i] = page_date[i].replace('\n', '')
        self.assertEqual(page_date[0], self.data['start_date'])
        self.assertEqual(page_date[1], self.data['end_date'])
        self.assertEqual(self.create_resume_form.get_job_name(),
                         self.data['name_job'])
        self.assertEqual(self.create_resume_form.get_job_position(),
                         self.data['position'])

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