コード例 #1
0
    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)
コード例 #2
0
def random_schedule():
    return Schedule(
        name=randrus_str(10),
        time_begin_1=str(randrange(8, 12, 1)) + ':00:00',
        time_end_1=str(randrange(17, 19, 1)) + ':00:00',
        breaks_id1=rand_num()
    )
コード例 #3
0
def random_break(id_=rand_num()):
    return Break(
        id=id_,
        from_time=str(randrange(13, 14, 1)) + ':00:00',
        to_time=str(randrange(15, 16, 1)) + ':00:00',
        duration=str(randrange(30, 60, 10))
    )
コード例 #4
0
def random_service():
    return Services(
        id=rand_num(10),
        name=randrus_str(10),
        group_id=UserTypes.LEGAL.id,
        calendar_id=1
    )
コード例 #5
0
    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)
コード例 #6
0
def random_user(role, is_legal=False):
    c = Customers(name=randrus_str(15),
                  surname=randrus_str(15),
                  patronymic=randrus_str(15),
                  email=rand_str() + '@' + rand_str() + '.com',
                  birthday=datetime.now() - timedelta(weeks=int(rand_num(4))),
                  mobile_phone='9777' + rand_num(7),
                  home_phone='',
                  code=uuid.uuid4().hex,
                  no=rand_num(6),
                  serial=rand_num(4),
                  issue=randrus_str(15),
                  when_at=datetime.now() - timedelta(weeks=int(rand_num(3))),
                  created=datetime.now().strftime('%Y-%m-%d 00:00:00'),
                  validated=datetime.now().strftime('%Y-%m-%d 00:00:00'))
    if is_legal:
        c.inn = '1' + rand_num(10)
    user = User(c, '12345678', role)
    return user
コード例 #7
0
        validated=datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
    ), '12345678', UserRoles.CUSTOMER)

ADMIN = User(
    Customers(
        name=u'ИмяАдмин',
        surname='ФамилияАдмин',
        patronymic='ОтчествоАдмин',
        birthday=datetime.now() - timedelta(weeks=2000),
        email='*****@*****.**',
        mobile_phone='79908888888',
        home_phone='',
        code=uuid.uuid4().hex,
        no=888888,
        serial=8888,
        issue=randrus_str(15),
        when_at=datetime.now() - timedelta(weeks=1500),
        created=datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
        validated=datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
    ), '12345678', UserRoles.ADMIN)

LEGAL_REG = User(
    Customers(
        name=randrus_str(15),
        surname=randrus_str(15),
        patronymic=randrus_str(15),
        email=rand_str() + '@' + rand_str() + '.com',
        mobile_phone='9777' + rand_num(7),
        inn=rand_num(10),
    ), '12345678', UserRoles.CUSTOMER)
コード例 #8
0
    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)