Beispiel #1
0
    def test_not_exist_login(self, config, setup, teardown):
        user = GkrUserSteps(config)
        main_page = MainPage(config)

        user.login(rand_str(10), rand_str(10))
        user.waits_for_element_displayed(main_page.login_form.ERROR)
        user.should_see_element_with_text(main_page.login_form.ERROR,
                                          ErrorMessages.LOGIN_FAILED.text)
Beispiel #2
0
    def test_not_exist_recovery_email(self, config):
        user = GkrUserSteps(config)
        main_page = MainPage(config)

        user.logout()
        user.clicks(main_page.top_menu.LOGIN_LINK)
        user.clicks(main_page.login_form.RECOVERY)
        user.enters_text(main_page.recovery.EMAIL,
                         rand_str(10) + '@' + rand_str(10) + '.' + rand_str(3))
        user.clicks(main_page.recovery.SUBMIT)
        user.should_see_element_with_text(
            main_page.recovery.ERROR,
            ErrorMessages.PASSWORD_RECOVERY_FAILED.text)
Beispiel #3
0
    def test_customer_edit(self, config, setup, teardown):
        email = rand_str(10) + '@' + rand_str(10) + '.ru'
        user.login(ADMIN.login, ADMIN.password)
        user.waits_for_ajax()
        db_customer = db_user.query_first(
            Customers, Customers.name == customer.customers_data.name)
        user.opens(Urls.ADMIN_CUSTOMER_EDIT.url % db_customer.id)
        user.enters_text(customer_edit_page.EMAIL, email)
        user.clicks(customer_edit_page.SUBMIT)

        user.waits_for_ajax()
        user.should_not_see_text(ErrorMessages.ADMIN_CUSTOMER_SAVE.text)
        user.opens(Urls.ADMIN_CUSTOMER_EDIT.url % db_customer.id)
        user.should_see_field_value(customer_edit_page.EMAIL, email)
Beispiel #4
0
    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)
Beispiel #5
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
Beispiel #6
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)
Beispiel #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)