def before_all(context): context.browser = Browser() context.home_page = HomePage() context.search_results_page = SearchResultsPage() context.croatian_page = CroatianPage() context.log_in = LogIn() context.profile_page = ProfilePage()
def __init__(self, driver): super().__init__(driver) self.page = ProfilePage(driver) self.__fields = [ self.page.right_column.SKILLS, self.page.right_column.INTERESTS, self.page.right_column.EDUCATION, self.page.right_column.JOB, self.page.right_column.AIMS ]
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()
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 test_customer_self_registration(self, config, teardown): global self_reg_mobile customer = random_user(UserRoles.CUSTOMER) user = GkrUserSteps(config) db_user = GkrDbSteps(config) reg_page = RegistrationPage(config) profile_page = ProfilePage(config) main_page = MainPage(config) dialogs = Dialogs(config) self_reg_mobile = customer.customers_data.mobile_phone user.logout() user.clicks(main_page.top_menu.REG_LINK) user.fill_registration_form(customer) user.submit_regform() user.should_see_dialog_text(dialogs.REG_SUCCESS_DIALOG, Messages.REGISTRATION_SUCCESSFUL) t_customer = db_user.query_first(TCustomers, TCustomers.mobile_phone == self_reg_mobile) user.opens(Urls.REGISTRATION.url + '/customer/?code=' + str(t_customer.code) + '&id=' + str(t_customer.id)) customer.password = db_user.query_first(AclUsers, AclUsers.name == customer.customers_data.mobile_phone).pwd user.should_see_dialog_text(dialogs.EMAIL_SUCCESS_DIALOG, Messages.EMAIL_CONFIRMED) user.close(dialogs.EMAIL_SUCCESS_DIALOG) user.login(customer.customers_data.mobile_phone, customer.password) user.should_see_element(profile_page) # проверка доступности полей disabled = 'disabled' user.should_see_attribute_value(reg_page.NAME, disabled, True) user.should_see_attribute_value(reg_page.SURNAME, disabled, True) user.should_see_attribute_value(reg_page.PATRONYMIC, disabled, True) user.should_see_element_enabled(reg_page.BIRTHDAY) user.should_see_attribute_value(reg_page.EMAIL, disabled, True) user.should_see_attribute_value(reg_page.MOBILE, disabled, True) user.should_see_attribute_value(reg_page.HOME_PHONE, disabled, True) user.should_see_attribute_value(reg_page.PASSPORT_SERIAL, disabled, True) user.should_see_attribute_value(reg_page.PASSPORT_NUMBER, disabled, True) user.should_see_attribute_value(reg_page.ISSUE_DATE, disabled, True) user.should_see_attribute_value(reg_page.ISSUE, disabled, True) user.should_see_element_enabled(profile_page.PASSWORD) user.should_see_element_enabled(profile_page.PASSWORD_CONFIRM) # проверка значений app_format = '%d.%m.%Y' user.should_see_element(profile_page) user.should_see_field_value(reg_page.NAME, customer.customers_data.name) user.should_see_field_value(reg_page.SURNAME, customer.customers_data.surname) user.should_see_field_value(reg_page.PATRONYMIC, customer.customers_data.patronymic) user.should_see_field_value(reg_page.BIRTHDAY, customer.customers_data.birthday.strftime(app_format)) user.should_see_field_value(reg_page.EMAIL, customer.customers_data.email) user.should_see_field_value(reg_page.MOBILE, customer.customers_data.mobile_phone) user.should_see_field_value(reg_page.HOME_PHONE, '') user.should_see_field_value(reg_page.PASSPORT_SERIAL, customer.customers_data.serial) user.should_see_field_value(reg_page.PASSPORT_NUMBER, customer.customers_data.no) user.should_see_field_value(reg_page.ISSUE, customer.customers_data.issue) user.should_see_field_value(reg_page.ISSUE_DATE, customer.customers_data.when_at.strftime(app_format))
def if_subscribe_course_present_in_profile(self): """Method for checking presents follow course in profile page""" self.profile_page = ProfilePage(self.driver) self.profile_page.go_to() self.profile_page.click_on_following_courses() try: self.find_element_by_xpath(cpl.TEST_COURSE) except NoSuchElementException: return False return True
def test_redirect_on_click_chat_user(self): self.chat_steps.open_chat() expected_name = self.chat_steps.get_chat_user_name(position=0) self.chat_steps.open_chat_user(position=0) sender_profile = ProfilePage(self.driver) actual_name = sender_profile.left_column.get_profile_name_text() self.assertEqual( expected_name, actual_name, f'Sender name {actual_name} doesn\'t match {expected_name}')
def test_login_correct_credentials(self, driver): data = dp.test_data_provider("login", "login_correct_credentials") page = HomePage(driver) assert_true(page.is_page_loaded) actions.click(page.sign_in_button) page = AuthPage(driver) assert_true(page.is_page_loaded) page.login(data) page = ProfilePage(driver) assert_true(page.is_page_loaded)
def test_password_change_incorrect(self, config, password, password_confirm, message): user = GkrUserSteps(config) profile_page = ProfilePage(config) customer = CUSTOMER user.login(customer.customers_data.mobile_phone, customer.password) user.waits_for_element_displayed(profile_page) user.enters_text(profile_page.PASSWORD, password) user.enters_text(profile_page.PASSWORD_CONFIRM, password_confirm) user.clicks(profile_page.SUBMIT) user.waits_for_element_displayed(profile_page.ERROR_MESSAGE) user.should_see_element_with_text(profile_page.ERROR_MESSAGE, message)
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.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 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 test_login5(self): login_page = LoginPage(driver=self.driver) login_page.set_login("dmytro.a.frolov") login_page.set_password("Froyman98_!") login_page.click_login_button() main_page = MainPage(self.driver) main_page.click_skip_button() main_page.click_top_menu(Header.MY_PROFILE) profile_page = ProfilePage(driver=self.driver) profile_page.click_on_team_profile() team_page = TeamPage(driver=self.driver) for people in team_page.get_people(): print(people.name + " " + people.phone + " " + people.position + " " + people.email)
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 test_valid_acc_creation(self, driver): data = provider.test_data_provider("register", "valid_acc_creation") homepage = HomePage(driver) authpage = AuthPage(driver) createaccpage = CreateAccPage(driver) profilepage = ProfilePage(driver) assert_true(homepage.is_page_loaded) homepage.sign_in_button.click() assert_true(authpage.is_page_loaded) authpage.register(data) assert_true(createaccpage.is_page_loaded) createaccpage.fill_up_form(data) assert_true(profilepage.is_page_loaded()) time.sleep(3)
def test_birthday_change_successfully(self, config): user = GkrUserSteps(config) profile_page = ProfilePage(config) reg_page = RegistrationPage(config) customer = CUSTOMER user.login(customer.customers_data.mobile_phone, customer.password) user.waits_for_element_displayed(profile_page) birthday = (datetime.now() - timedelta(weeks=500)).strftime('%d.%m.%Y') user.enters_text(reg_page.BIRTHDAY, birthday) user.clicks(profile_page.SUBMIT) user.waits_for_element_displayed(profile_page.SUCCESS_MESSAGE) user.should_see_element_with_text( profile_page.SUCCESS_MESSAGE, ConfirmationMessages.PROFILE_CHANGED.text) user.opens(Urls.PROFILE) user.should_see_field_value(reg_page.BIRTHDAY, birthday)
def test_legal_timeslot(self, config): user = GkrUserSteps(config) db_user = GkrDbSteps(config) queue_page = QueuePage(config) profile_page = ProfilePage(config) ticket_data_dialog = TicketDataDialog(config) for i in legal_timeslot_data: legal = random_user(UserRoles.CUSTOMER, is_legal=True) db_user.create_user(legal) day = (datetime.now() + timedelta(days=random.randrange(0, 2))).strftime('%Y-%m-%d') service = i[0] stat_value = i[1] locality = 'с. Виноградное' street = 'ул. Горная' user.login(legal.customers_data.mobile_phone, legal.password) user.waits_for_element_displayed(profile_page) user.selects_from_main_menu(MainMenu.QUEUE) user.waits_for_element_displayed(queue_page) user.chooses_from_select(queue_page.CITY, Departments.FEO_DEP.short_name) user.chooses_from_select(queue_page.SERVICE, service) user.chooses_from_select(queue_page.OBJECT_TYPE, '1') user.enters_suggest(queue_page.LOCALITY, locality) user.enters_suggest(queue_page.STREET, street) user.enters_text(queue_page.HOUSE, 2) user.set_calendar_date(queue_page.CALENDAR, day) user.set_calendar_time(queue_page.CALENDAR, None) user.enters_text(queue_page.CAPTCHA, '11111') user.clicks(queue_page.SUBMIT) user.waits_for_element_displayed(ticket_data_dialog) user.login(legal.customers_data.mobile_phone, legal.password) user.waits_for_element_displayed(profile_page) user.selects_from_main_menu(MainMenu.QUEUE) user.chooses_from_select(queue_page.CITY, Departments.FEO_DEP.short_name) user.chooses_from_select(queue_page.SERVICE, service) user.waits_for_ajax() user.should_see_element_with_text(queue_page.STAT_INDICATOR, stat_value) db_user.delete_user_by_mobile(legal.customers_data.mobile_phone)
def register_user(self): # self.click(self._close_privacy_policy_bar_button) self.clear_field_and_send_keys(self._name_value, self._name_field) self.clear_field_and_send_keys(self._surname_value, self._surname_field) self.clear_field_and_send_keys(self._company_name_value, self._company_name_field) self.clear_field_and_send_keys(self._NIP_value, self._NIP_field) self.clear_field_and_send_keys(self._phone_value, self._phone_field) self.clear_field_and_send_keys(self._email_value, self._email_field) self.clear_field_and_send_keys(self._password_value, self._password1_field) self.clear_field_and_send_keys(self._password_value, self._password2_field) self.get_driver().execute_script("arguments[0].click();", self.find_element(self._accept1_checkbox)) # self.click(self._accept1_checkbox) self.get_driver().execute_script("arguments[0].click();", self.find_element(self._accept2_checkbox)) # self.click(self._accept2_checkbox) self.get_driver().execute_script("arguments[0].click();", self.find_element(self._accept3_checkbox)) # self.click(self._accept3_checkbox) self.get_driver().execute_script("arguments[0].click();", self.find_element(self._register_account_submit_button)) # self.click(self._register_account_submit_button) return ProfilePage(self.get_driver())
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 __init__(self, driver): self.base = Page(driver) self.onboarding_page = OnboardingPage(driver) self.popular_page = PopularPage(driver) self.category_page = CategoryPage(driver) self.search_page = SearchPage(driver) self.ticket_page = TicketPage(driver) self.profile_page = ProfilePage(driver) self.footer = Footer(driver) self.popular_detail_page = PopularDetailPage(driver) self.profile_support_page = ProfileSupportPage(driver) self.order_place_page = OrderPlacePage(driver) self.order_category_page = OrderCategoryPage(driver) self.order_products_page = OrderProductsPage(driver) self.order_page = OrderPage(driver) self.errors_pages = ErrorsPages(driver)
def test_password_recovery(self, config, teardown): user = GkrUserSteps(config) db_user = GkrDbSteps(config) login_page = LoginForm(config) main_page = MainPage(config) profile_page = ProfilePage(config) dialogs = Dialogs(config) db_user.create_user(customer) user.logout() user.clicks(main_page.top_menu.LOGIN_LINK) user.clicks(main_page.login_form.RECOVERY) user.enters_text(main_page.recovery.EMAIL, customer.customers_data.email) user.clicks(main_page.recovery.SUBMIT) user.waits_for_element_disappeared(main_page.recovery.WAIT, config.page_load_timeout) user.should_see_element_with_text( main_page.recovery.SUCCESS_TEXT, ConfirmationMessages.PASSWORD_RECOVERY_SUCCESS) created_c = db_user.query_first( Customers, Customers.mobile_phone == customer.customers_data.mobile_phone) user.opens('/forgot/success/?code=' + created_c.code + '&id=' + str(created_c.id)) user.should_see_element_matched_to( dialogs.RESET_PASSWORD_SUCCESS_DIALOG, contains_string( ConfirmationMessages.PASSWORD_RECOVERY_CONFIRMED.text)) new_password = db_user.query_first( AclUsers, AclUsers.name == customer.customers_data.mobile_phone) user.login(customer.customers_data.mobile_phone, customer.password) user.should_see_element_with_text(login_page.ERROR, ErrorMessages.LOGIN_FAILED) user.login(customer.customers_data.mobile_phone, new_password.pwd) user.should_see_element(profile_page)
def test_password_change_successfully(self, config, teardown): user = GkrUserSteps(config) db_user = GkrDbSteps(config) profile_page = ProfilePage(config) customer = random_user(UserRoles.CUSTOMER) db_user.create_user(customer) global mobile mobile = customer.customers_data.mobile_phone password = '******' user.login(customer.customers_data.mobile_phone, customer.password) user.waits_for_element_displayed(profile_page) user.enters_text(profile_page.PASSWORD, password) user.enters_text(profile_page.PASSWORD_CONFIRM, password) user.clicks(profile_page.SUBMIT) user.waits_for_element_displayed(profile_page.SUCCESS_MESSAGE) user.should_see_element_with_text(profile_page.SUCCESS_MESSAGE, ConfirmationMessages.PROFILE_CHANGED) user.login(customer.customers_data.mobile_phone, password) user.should_see_element(profile_page)
def setUp(self) -> None: default_setup(self) self.profile_page = ProfilePage(self.driver) self.resume_page = ResumePage(self.driver)
def test_legal_self_registration(self, config, teardown): global legal_mobile legal = LEGAL_REG user = GkrUserSteps(config) db_user = GkrDbSteps(config) reg_page = RegistrationPage(config) dialogs = Dialogs(config) profile_page = ProfilePage(config) legal_mobile = legal.customers_data.mobile_phone user.opens(Urls.REGISTRATION) user.should_see_element(reg_page) user.clicks(reg_page.LEGAL_TYPE) user.waits_for_element_displayed(reg_page.LEGAL_HEADER) user.fill_legal_registration_form(legal) user.clicks(reg_page.CHECKBOX) user.waits_for_element_enabled(reg_page.SUBMIT) user.clicks(reg_page.SUBMIT) user.waits_for_element_displayed(dialogs.REG_SUCCESS_DIALOG) user.should_see_dialog_text(dialogs.REG_SUCCESS_DIALOG, Messages.REGISTRATION_SUCCESSFUL.text) user.close(dialogs.REG_SUCCESS_DIALOG) t_customer = db_user.query_first( TCustomers, TCustomers.mobile_phone == legal.customers_data.mobile_phone) user.opens(Urls.REGISTRATION.url + '/customer/?code=' + str(t_customer.code) + '&id=' + str(t_customer.id)) legal.password = db_user.query_first( AclUsers, AclUsers.name == legal.customers_data.mobile_phone).pwd user.should_see_element(dialogs.EMAIL_SUCCESS_DIALOG) user.should_see_dialog_text(dialogs.EMAIL_SUCCESS_DIALOG, Messages.EMAIL_CONFIRMED.text) user.close(dialogs.EMAIL_SUCCESS_DIALOG) user.login(legal.customers_data.mobile_phone, legal.password) # проверка доступности полей disabled = 'disabled' user.should_see_attribute_value(profile_page.SURNAME, disabled, True) user.should_see_attribute_value(profile_page.NAME, disabled, True) user.should_see_attribute_value(profile_page.PATRONYMIC, disabled, True) user.should_see_attribute_value(profile_page.EMAIL, disabled, True) user.should_see_attribute_value(profile_page.MOBILE, disabled, True) user.should_see_attribute_value(profile_page.INN, disabled, True) user.should_see_element_enabled(profile_page.PASSWORD) user.should_see_element_enabled(profile_page.PASSWORD_CONFIRM) # проверка значений user.should_see_field_value(profile_page.INN, legal.customers_data.inn) user.should_see_field_value(profile_page.SURNAME, legal.customers_data.surname) user.should_see_field_value(profile_page.NAME, legal.customers_data.name) user.should_see_field_value(profile_page.PATRONYMIC, legal.customers_data.patronymic) user.should_see_field_value(profile_page.EMAIL, legal.customers_data.email) user.should_see_field_value(profile_page.MOBILE, legal.customers_data.mobile_phone)
def sign_in(self, login: str, password: str) -> ProfilePage: form: AuthForm = self.form form.login = login form.password = password form.submit() return ProfilePage(self.driver)
def delete_employer(self): profile_page = ProfilePage(self.test.driver) profile_page.open() profile_page.delete_account()
def delete_applicant(self): profile_page = ProfilePage(self.test.driver) profile_page.open() profile_page.delete_account()
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_customer_queue_successful(self, config, teardown): customer = random_user(UserRoles.CUSTOMER) user = GkrUserSteps(config) db_user = GkrDbSteps(config) profile_page = ProfilePage(config) queue_page = QueuePage(config) ticket_data_dialog = TicketDataDialog(config) db_user.create_user(customer) global queue_mobile queue_mobile = customer.customers_data.mobile_phone day = (datetime.now() + timedelta(days=1)).strftime('%Y-%m-%d') print_day = (datetime.now() + timedelta(days=1)).strftime('%d.%m.%Y') locality = 'с. Александровка' street = 'ул. Виноградная' house = rand_num(2) + '/1a' flat = rand_num(2) + 'б' user.login(customer.customers_data.mobile_phone, customer.password) user.should_see_element(profile_page) user.selects_from_main_menu(MainMenu.QUEUE) user.waits_for_element_displayed(queue_page) user.chooses_from_select(queue_page.SERVICE, Services.SINGLE_WINDOW.name) user.chooses_from_select(queue_page.OBJECT_TYPE, ObjectTypes.DOMOVLADENIE.name) user.chooses_from_select(queue_page.CITY, Departments.BEL_DEP.short_name) user.enters_suggest(queue_page.LOCALITY, locality) user.enters_suggest(queue_page.STREET, street) user.enters_text(queue_page.HOUSE, house) user.enters_text(queue_page.FLAT, flat) user.enters_text(queue_page.CAPTCHA, '11111') user.clicks(queue_page.SUBMIT) user.waits_for_element_displayed(queue_page.CALENDAR) user.set_calendar_date(queue_page.CALENDAR, day) user.set_calendar_time(queue_page.CALENDAR, None) time = queue_page.CALENDAR.time_list[0].text user.clicks(queue_page.SUBMIT) user.waits_for_element_displayed(ticket_data_dialog) ticket_id = ticket_data_dialog.TICKET_NUMBER.element.text user.should_see_element_with_text(ticket_data_dialog.TICKET_TIME, (print_day + ' ' + time)) user.should_see_element_with_text(ticket_data_dialog.TICKET_SERVICE, Services.SINGLE_WINDOW.name) user.should_see_element_with_text(ticket_data_dialog.TICKET_DEP, Departments.BEL_DEP.name) user.should_see_element_with_text( ticket_data_dialog.TICKET_CUSTOMER, customer.customers_data.surname + " " + customer.customers_data.name + " " + customer.customers_data.patronymic) user.should_see_element_with_text( ticket_data_dialog.TICKET_ADDRESS, Departments.BEL_DEP.short_name + " " + locality + " " + street + " д. " + house + " кв. " + flat) db_user.should_see_service_group_id(ticket_id, UserTypes.CUSTOMER.id) user.close(ticket_data_dialog) user.selects_from_main_menu(MainMenu.QUEUE) user.waits_for_element_displayed(queue_page) user.clicks(queue_page.SUBMIT) user.waits_for_element_displayed = user.waits_for_element_displayed( queue_page.ERROR_TEXT) user.should_see_text_in_list( queue_page.ERROR_TEXT, ErrorMessages.CUSTOMER_REGISTRATION_LIMIT.text % (customer.customers_data.serial, customer.customers_data.no, ticket_id)) user.opens(Urls.PROFILE) history_item = profile_page.TICKETS_HISTORY.get_history_by_id( ticket_id) user.should_see_history_services(history_item, ticket_id, Services.SINGLE_WINDOW.name, print_day + ' ' + time)