def fin(): config = getattr(request, '_funcargs')['config'] db_steps = GkrDbSteps(config) db_steps.delete_user_by_mobile( history_operator.customers_data.mobile_phone) if advance_one is not None: db_steps.delete_advance_by_id(advance_one.id, advance_two.id)
def test_tcustomer_confirmation(self, config, teardown): global tcustomer tcustomer = random_tcustomer() db_user = GkrDbSteps(config) user = GkrUserSteps(config) tcustomer_page = CustomerEditPage(config) db_user.creates_tcustomer(tcustomer) user.login(ADMIN.login, ADMIN.password) user.waits_for_ajax() customer = db_user.query_first( TCustomers, TCustomers.name == tcustomer.customers_data.name) user.opens(Urls.ADMIN_TCUSTOMER_EDIT.url % customer.id) user.clicks(tcustomer_page.SUBMIT) user.waits_for_element_displayed( tcustomer_page.dialogs.EMAIL_SUCCESS_DIALOG) user.should_see_dialog_text( tcustomer_page.dialogs.EMAIL_SUCCESS_DIALOG, RegistrationMessages.EMAIL_CONFIRMED.text) db_user.should_not_see_db_entry( TCustomers, TCustomers.id == tcustomer.customers_data.id) db_user.should_see_db_entry( Customers, Customers.name == tcustomer.customers_data.name)
def test_ticket_update_request_by_authorized_users(self, config, login, password): db_user = GkrDbSteps(config) session = HttpSteps.HttpSession() login_url = config.base_url + Urls.LOGIN.url + '/ajax' ticket_edit_url = config.base_url + Urls.ADMIN_TICKED_EDIT.url advance_updated = db_user.fill_advance_queue(Departments.SIMF_DEP, Services.SINGLE_WINDOW, datetime.now(), ObjectTypes.STROI_OBJECT, OPERATOR) params = { 'id': advance_updated.id, 'serviceid': advance_updated.service_id, 'inputData': rand_str(10), 'objectsCount': 2 } session.with_method('post').with_params({ 'username': login, 'password': password }).with_url(login_url).submit() session.with_method('post').with_url( ticket_edit_url % advance_updated.id).with_params(params).submit() sleep(2) advance_changed = db_user.query_first( Advance, advance_updated.id == advance_updated.id) db_user.delete_advance_by_id(advance_updated.id) assert_that( advance_changed.objects_count, equal_to(1), 'Запрос изменения тикета ' + ticket_edit_url % advance_updated.id + ' открыт для авторизованного пользователя ' + login)
def setup(request): global customer config = getattr(request, '_funcargs')['config'] customer = random_user(UserRoles.CUSTOMER) db_user = GkrDbSteps(config) db_user.create_user(customer) db_user.blocks_user(customer.customers_data.mobile_phone, is_blocked=1)
def test_operator_queue_successful(self, config, teardown): operator = random_user(UserRoles.OPERATOR) user = GkrUserSteps(config) db_user = GkrDbSteps(config) queue_page = QueuePage(config) ticket_data_dialog = TicketDataDialog(config) db_user.create_user(operator) global queue_operator_mobile queue_operator_mobile = operator.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) flat = rand_num(2) user.login(operator.customers_data.mobile_phone, operator.password) user.should_see_element(queue_page) customer = user.fill_random_operator_queue() global queue_customer_by_operator_mobile queue_customer_by_operator_mobile = customer.mobile_phone user.chooses_from_select(queue_page.SERVICE, Services.DEAL_REGISTER.name) user.chooses_from_select(queue_page.OBJECT_TYPE, ObjectTypes.STROI_OBJECT.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.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) 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.DEAL_REGISTER.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.surname + " " + customer.name + " " + customer.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_data_dialog.TICKET_NUMBER.element.text, UserTypes.CUSTOMER.id)
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 setup(request): config = getattr(request, '_funcargs')['config'] global customer, db_user, user, customer_edit_page customer = random_user(UserRoles.CUSTOMER) db_user = GkrDbSteps(config) user = GkrUserSteps(config) customer_edit_page = CustomerEditPage(config) db_user.create_user(customer)
def setup(request): global operator, customer, db_user config = getattr(request, '_funcargs')['config'] db_user = GkrDbSteps(config) user = GkrUserSteps(config) user.login(ADMIN.login, ADMIN.password) user.waits_for_ajax() user.opens(Urls.ADMIN_STATISTIC.url) operator = random_user(UserRoles.OPERATOR) customer = random_user(UserRoles.CUSTOMER, is_legal=True) db_user.create_user(operator) db_user.create_user(customer)
def test_service_deletion(self, config, setup): global service user = GkrUserSteps(config) db_user = GkrDbSteps(config) services_page = ServicesAdminPage(config) service = db_user.creates_service(admins_data.random_service()) user.opens(Urls.ADMIN_SERVICES) user.clicks(services_page.SERVICES_LIST.get_row_by_title(service.name).delete) user.waits_for_alert() user.waits_for(2) user.accepts_alert() user.waits_for_ajax() user.waits_for(2) user.should_not_matches_to_list_item(services_page.SERVICES_LIST, contains_string(str(service.id)))
def setup(request): global fields_operator config = getattr(request, '_funcargs')['config'] db_user = GkrDbSteps(config) queue_page = QueuePage(config) fields_operator = random_user(UserRoles.OPERATOR) db_user.create_user(fields_operator) user = GkrUserSteps(config) user.login(fields_operator.customers_data.mobile_phone, fields_operator.password) user.waits_for_element_displayed(queue_page)
def config(request): c.config(request) for k, v in request.config.option.__dict__.items(): setattr(tc, k, v) db_user = GkrDbSteps(tc) db_user.create_user(CUSTOMER) db_user.create_user(OPERATOR) db_user.create_user(LEGAL) db_user.create_user(ADMIN) tc.driver.set_window_size(1280, 900) yield tc tc.driver.quit()
def test_blocking_password_recovery(self, config, setup, teardown): user = GkrUserSteps(config) db_user = GkrDbSteps(config) main_page = MainPage(config) dialogs = Dialogs(config) user.logout() user.clicks(main_page.top_menu.LOGIN_LINK) user.clicks(main_page.login_form.PASSWORD_RECOVERY) user.enters_text(main_page.recovery.EMAIL, customer.customers_data.email) user.clicks(main_page.login_form.SUBMIT) 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_dialog_text(dialogs.RESET_PASSWORD_SUCCESS_DIALOG, ErrorMessages.PASSWORD_RECOVERY_BLOCKED.text)
def setup(request): global db_user, session, login_url, logout_url, blocking_url, ticket_edit_url, customer config = getattr(request, '_funcargs')['config'] db_user = GkrDbSteps(config) session = HttpSteps.HttpSession() logout_url = config.base_url + Urls.LOGOUT.url blocking_url = config.base_url + Urls.ADMIN_BLOCKING.url login_url = config.base_url + Urls.LOGIN.url + '/ajax' ticket_edit_url = config.base_url + Urls.ADMIN_TICKED_EDIT.url r_user = random_user(UserRoles.CUSTOMER) db_user.create_user(r_user) sleep(1) customer = db_user.query_first( Customers, Customers.mobile_phone == r_user.customers_data.mobile_phone)
def test_service_creation(self, config, setup, teardown): global service user = GkrUserSteps(config) db_user = GkrDbSteps(config) services_page = ServicesAdminPage(config) name = randrus_str(10) prefix = randrus_str(2) group = UserTypes.LEGAL duration = 10 additional_duration = 5 percent_records = 30 percent_records_advance = 60 button_text = "<html><b><p align=center><span style='font-size:40.0pt;color:white'>%s</span></b>" % name user.opens(Urls.ADMIN_SERVICES) user.enters_text(services_page.NAME, name) user.enters_text(services_page.PREFIX, prefix) user.chooses_from_select(services_page.GROUP, group.name) user.enters_text(services_page.DURATION, duration) user.enters_text(services_page.ADDITIONAL_DURATION, additional_duration) user.enters_text(services_page.PERCENT_RECORDS, percent_records) user.enters_text(services_page.PERCENT_RECORDS_ADVANCE, percent_records_advance) user.waits_for_element_enabled(services_page.SUBMIT) user.clicks(services_page.SUBMIT) user.waits_for_ajax() user.reloads_page() service = db_user.query_first(Services, Services.name == name) # проверяет данные в таблице row = services_page.SERVICES_LIST.get_row_by_title(name) user.should_see_element_with_text(row.id, service.id) user.should_see_element_with_text(row.title, name) user.should_see_element_with_text(row.group, group.name) # проверяет данные в базе db_user.should_see_db_entry_value(service, 'name', name) db_user.should_see_db_entry_value(service, 'service_prefix', prefix) db_user.should_see_db_entry_value(service, 'group_id', group.id) db_user.should_see_db_entry_value(service, 'duration', duration) db_user.should_see_db_entry_value(service, 'aditional_duration', additional_duration) db_user.should_see_db_entry_value(service, 'precent_records', percent_records/100) db_user.should_see_db_entry_value(service, 'precent_records_advance', percent_records_advance/100) db_user.should_see_db_entry_value(service, 'button_text', button_text)
def test_concurrent_registration(self, config): user = GkrUserSteps(config) db_user = GkrDbSteps(config) reg_page = RegistrationPage(config) dialogs = Dialogs(config) i = 0 report = '' while i < int(config.attempts): mobile = '9777' + rand_num(7) user.opens(Urls.REGISTRATION) user.should_see_element(reg_page) user.enters_text(reg_page.SURNAME, randrus_str(15)) user.enters_text(reg_page.NAME, randrus_str(15)) user.enters_text(reg_page.PATRONYMIC, randrus_str(15)) user.enters_text(reg_page.BIRTHDAY, '12.06.1984') user.enters_text(reg_page.PASSPORT_SERIAL, rand_num(4)) user.enters_text(reg_page.PASSPORT_NUMBER, rand_num(6)) user.enters_text(reg_page.ISSUE, randrus_str(15)) user.enters_text(reg_page.ISSUE_DATE, '09.01.2015') user.enters_text(reg_page.MOBILE, mobile) user.enters_text(reg_page.EMAIL, rand_str() + '@' + rand_str() + '.com') user.waits_for_element_enabled(reg_page.SUBMIT) user.submit_regform() user.waits_for_element_displayed(dialogs.REG_SUCCESS_DIALOG) tc = db_user.query_first(TCustomers, TCustomers.mobile_phone == mobile) user.opens(Urls.LOGOUT) user.opens('/registration/customer/?code=' + str(tc.code) + '&id=' + str(tc.id)) user.waits_for_element_displayed(dialogs.EMAIL_SUCCESS_DIALOG) c = db_user.query_first(Customers, Customers.mobile_phone == mobile) report = report + '\nНовый пользователь id=' + str( c.id) + ', phone=' + c.mobile_phone user.logout() i += 1 allure.attach('response.log', str(report), type=AttachmentType.TEXT)
def fin(): config = getattr(request, '_funcargs')['config'] db_steps = GkrDbSteps(config) http_steps = GkrHttpSteps(config) params = {'wait_max_advance': wait_max_advance_old} db_steps.update(Standards, Standards.id == 1, params) days_params = { 'finish_advance_date': (datetime.now() + timedelta(days=2)).strftime('%Y-%m-%d') } db_steps.update(Department, Department is not None, days_params) simf_params = { 'finish_advance_date': (datetime.now() - timedelta(days=1)).strftime('%Y-%m-%d') } db_steps.update(Department, Department.id == 75, simf_params) http_steps.renew_queue()
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 test_department_edition(self, config, setup, teardown): global department_name append_text = randrus_str(5) disabled = "disabled" user = GkrUserSteps(config) db_user = GkrDbSteps(config) http_user = GkrHttpSteps(config) department_admin_page = DepartmentsAdminPage(config) department = db_user.creates_department(rand_department(), DepartRegion.ARMYANSK, DepartRegion.BELOGORSKI, phys_percent=0.1, legal_percent=0.2) department_name = department.name + append_text http_user.renew_queue() user.opens(Urls.ADMIN_DEPS) user.chooses_from_select(department_admin_page.DEPARTMENTS_LIST, department.description) user.waits_for_ajax() user.appends_text(department_admin_page.NAME, append_text) user.appends_text(department_admin_page.DESC, append_text) user.chooses_from_select(department_admin_page.SCHEDULE, Calendars.BEL_CALENDAR.name) user.chooses_from_select(department_admin_page.CALENDAR, Calendars.BEL_CALENDAR.name) user.unselects_checkbox(department_admin_page.PHYS_CHECKBOX) user.unselects_checkbox(department_admin_page.LEGAL_CHECKBOX) user.clicks(department_admin_page.REGIONS_LIST.get_row_by_name(DepartRegion.ARMYANSK.location).delete) user.chooses_from_select(department_admin_page.REGIONS_SELECT, DepartRegion.ALUSHTA.location) user.clicks(department_admin_page.SAVE) user.waits_for_element_displayed(department_admin_page.SAVED) user.reloads_page() user.chooses_from_select(department_admin_page.DEPARTMENTS_LIST, department.description + append_text) user.should_see_field_value(department_admin_page.NAME, department.name + append_text) user.should_see_field_value(department_admin_page.DESC, department.description + append_text) user.should_see_attribute_value(department_admin_page.PHYS_INPUT, disabled, True) user.should_see_attribute_value(department_admin_page.LEGAL_INPUT, disabled, True) user.should_see_list_size(department_admin_page.REGIONS_LIST, 2) user.should_not_matches_to_list_item(department_admin_page.REGIONS_LIST, contains_string(DepartRegion.ARMYANSK.location)) user.should_matches_to_list_item(department_admin_page.REGIONS_LIST, contains_string(DepartRegion.ALUSHTA.location))
def test_customers_search(self, config, attribute, setup, teardown): user = GkrUserSteps(config) db_user = GkrDbSteps(config) customers_admin_page = CustomersAdminPage(config) db_user.create_user(customer) user.opens(Urls.ADMIN_CUSTOMERS.url) user.should_see_element(customers_admin_page) user.enters_text(customers_admin_page.TERM_FIELD, "") user.clicks(customers_admin_page.SEARCH_SUBMIT) user.waits_for_ajax() term = getattr(getattr(customer, 'customers_data'), attribute) user.enters_text(customers_admin_page.TERM_FIELD, term) user.clicks(customers_admin_page.SEARCH_SUBMIT) user.waits_for_ajax() user.should_see_list_size(customers_admin_page.TABLE, self.expected_rows) user.should_see_element_contains_text( customers_admin_page.TABLE.elements[self.expected_rows - 1], term)
def test_schedule_edition(self, config, setup, teardown): global schedule_name user = GkrUserSteps(config) db_user = GkrDbSteps(config) schedule_page = SchedulePage(config) schedule = random_schedule() schedule_name = schedule.name db_user.creates_schedule(schedule) user.opens(Urls.ADMIN_SCHEDULE.url) user.chooses_from_select(schedule_page.SCHEDULE_LIST, schedule.name) tue = schedule_page.SETTINGS_TABLE.get_row_by_name('Вторник') time_from = '08:00' time_to = '18:00' break_from = '13:00' break_to = '14:00' duration = '45' value = 'value' user.enters_text(tue.time_from, time_from) user.enters_text(tue.time_to, time_to) user.enters_text(tue.break_from, break_from) user.enters_text(tue.break_to, break_to) user.enters_text(tue.duration, duration) user.clicks(schedule_page.SAVE) user.waits_for_ajax() user.should_see_element_with_text(schedule_page.SUCCESS_MESSAGE, ConfirmationMessages.SCHEDULE_SAVED) user.reloads_page() user.chooses_from_select(schedule_page.SCHEDULE_LIST, schedule.name) user.waits_for_ajax() tue = schedule_page.SETTINGS_TABLE.get_row_by_name('Вторник') user.should_see_attribute_value(tue.time_from, value, time_from) user.should_see_attribute_value(tue.time_to, value, time_to) user.should_see_attribute_value(tue.break_from, value, break_from) user.should_see_attribute_value(tue.break_to, value, break_to) user.should_see_attribute_value(tue.duration, value, duration)
def test_history_search_empty(self, config, teardown): global advance_one, advance_two, history_operator advance_one = None advance_two = None user = GkrUserSteps(config) db_user = GkrDbSteps(config) main_page = MainPage(config) history_operator = random_user(UserRoles.OPERATOR) db_user.create_user(history_operator) user.login(history_operator.customers_data.mobile_phone, history_operator.password) user.waits_for_element_displayed(main_page.top_menu.LOGOUT) user.selects_from_main_menu(MainMenu.HISTORY) user.should_see_text(ConfirmationMessages.HISTORY_EMPTY) user.reloads_page() user.search_history(randrus_str(7)) user.should_see_text(ConfirmationMessages.HISTORY_EMPTY)
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_history_search_by_fio(self, config, teardown): global advance_one, advance_two, history_operator user = GkrUserSteps(config) db_user = GkrDbSteps(config) history_page = HistoryPage(config) history_operator = random_user(UserRoles.OPERATOR) db_user.create_user(history_operator) advance_one = db_user.fill_advance_queue( Departments.BEL_DEP, Services.SINGLE_WINDOW, datetime.now() - timedelta(days=1), ObjectTypes.STROI_OBJECT, history_operator) advance_two = db_user.fill_advance_queue( Departments.BEL_DEP, Services.GKN, datetime.now() - timedelta(days=2), ObjectTypes.DOMOVLADENIE, history_operator) user.login(history_operator.customers_data.mobile_phone, history_operator.password) user.waits_for_element_displayed(history_page.top_menu.LOGOUT) user.selects_from_main_menu(MainMenu.HISTORY) # поиск по имени user.search_history(advance_two.input_data.split()[2]) user.should_see_list_size(history_page.SEARCH_ROWS, 1) user.should_matches_to_list_item(history_page.SEARCH_ROWS, contains_string(str(advance_two.id))) # поиск по фамилии user.search_history(advance_one.input_data.split()[1]) user.should_see_list_size(history_page.SEARCH_ROWS, 1) user.should_matches_to_list_item(history_page.SEARCH_ROWS, contains_string(str(advance_one.id))) # поиск по отчеству user.search_history(advance_two.input_data.split()[3]) user.should_see_list_size(history_page.SEARCH_ROWS, 1) user.should_matches_to_list_item(history_page.SEARCH_ROWS, contains_string(str(advance_two.id)))
def test_operator_timeslot(self, config): user = GkrUserSteps(config) db_user = GkrDbSteps(config) queue_page = QueuePage(config) ticket_data_dialog = TicketDataDialog(config) day = (datetime.now() + timedelta(days=random.randrange(0, 2))).strftime('%Y-%m-%d') locality = 'с. Виноградное' street = 'ул. Горная' house = 1 for i in operator_timeslot_data: operator = random_user(UserRoles.OPERATOR) db_user.create_user(operator) object_type = i[0] stat_value = i[1] user.login(operator.customers_data.mobile_phone, operator.password) user.should_see_element(queue_page) user.fill_random_operator_queue() user.chooses_from_select(queue_page.SERVICE, Services.DEAL_REGISTER.name) user.chooses_from_select(queue_page.OBJECT_TYPE, object_type) user.chooses_from_select(queue_page.CITY, Departments.FEO_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.set_calendar_date(queue_page.CALENDAR, day) user.set_calendar_time(queue_page.CALENDAR, None) user.clicks(queue_page.SUBMIT) user.waits_for_element_displayed(ticket_data_dialog) user.opens(Urls.REGISTRATOR) user.chooses_from_select(queue_page.CITY, Departments.FEO_DEP.short_name) user.waits_for_ajax() user.should_see_element_with_text(queue_page.STAT_INDICATOR, stat_value) db_user.delete_user_by_mobile(operator.customers_data.mobile_phone)
def test_schedule_deletion(self, config, setup): user = GkrUserSteps(config) db_user = GkrDbSteps(config) schedule_page = SchedulePage(config) schedule = random_schedule() db_user.creates_schedule(schedule) user.opens(Urls.ADMIN_SCHEDULE.url) user.chooses_from_select(schedule_page.SCHEDULE_LIST, schedule.name) user.clicks(schedule_page.DELETE) user.waits_for_alert() user.accepts_alert() user.should_see_element_with_text( schedule_page.SUCCESS_MESSAGE, ConfirmationMessages.SCHEDULE_REMOVED) user.waits_for_ajax() user.reloads_page() user.should_not_see_text_in_select(schedule_page.SCHEDULE_LIST, schedule.name)
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(request): config = getattr(request, '_funcargs')['config'] db_steps = GkrDbSteps(config) params = {'next_opening_date': next_opening_date.strftime('%Y-%m-%d')} db_steps.update(Standards, Standards.id == 1, params)
def fin(): config = getattr(request, '_funcargs')['config'] db_steps = GkrDbSteps(config) db_steps.delete_user_by_mobile(mobile) db_steps.delete_user_by_mobile('*****@*****.**')
def fin(): config = getattr(request, '_funcargs')['config'] db_steps = GkrDbSteps(config) db_steps.delete_user_by_mobile(customer.customers_data.mobile_phone)
def fin(): config = getattr(request, '_funcargs')['config'] db_steps = GkrDbSteps(config) db_steps.delete_user_by_mobile(self_reg_mobile)