Esempio n. 1
0
def setup_user_reset_password(sb):
    request = {'name': generate_uuid()}
    MenuBar.click_menu_item_by_text(sb, '配置', '用户管理')
    default_password = UserPage.reset_user_password(sb, request['name'])
    yield str(default_password).strip()
    sb.save_teardown_screenshot()
    UserPage.delete_user_by_name(sb, request['name'])
def test_login_with_reset_locked_account(sb, login, setup_user):
    #5次登录错误,账户被锁定
    MenuBar.click_personal_info_menu_item(sb, '退出系统')
    for i in range(5):
        LoginPage.login(sb, setup_user['name'], '123456')
        sb.sleep(1)
    #管理员登录,重置密码
    LoginPage.login(sb, sb_config.username, sb_config.password)
    sb.sleep(2)
    MenuBar.click_menu_item_by_text(sb, '配置', '用户管理')
    default_password = UserPage.reset_user_password(sb, setup_user['name'])
    MenuBar.click_personal_info_menu_item(sb, '退出系统')
    sb.sleep(2)
    # 重新登录,并修改密码
    LoginPage.login(sb, setup_user['name'], str(default_password).strip())
    PersonInfoPage.reset_password(sb,
                                  str(default_password).strip(), 'Guard123',
                                  'Guard123')
    sb.sleep(5)
    # 重新登陆系统,验证密码修改成功
    LoginPage.login(sb, setup_user['name'], 'Guard123')
    sb.assert_element_visible('.avatar-name')