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