Files
smart-management-auto-test/zhyy/test_case/TestCase/UI自动化/parent/vispark/login.py

70 lines
3.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
# __author__ = 'xinjiu.qiao'
import allure
from airtest.core.api import *
from ui_auto_lego.common import handle_driver
from ui_auto_lego.common.handle_action import HandleAction
from ui_library.page.parent.vispark import advance_program, home, login
from ui_library.common.read_config import readconfig
from ui_auto_lego.common.launch import InitMobilStartApp
from ui_library.operation.parent.vispark.handle_swipe import hd_swipe
handle_driver_obj = handle_driver.HandleDriver()
login_page = login.prLogin()
obj_handle_action = HandleAction()
home_page = home.prHome()
us_ap = advance_program.adprogram()
rf_config = readconfig()
user_info = eval(rf_config.parent_user)
h_swipe = hd_swipe()
@allure.feature('ViSpark 登录前及登录测试')
class TestLogin(object):
init_mobile_start_app = InitMobilStartApp()
poco_driver = init_mobile_start_app.poco_driver
def setup(self):
# 启动被测试应用
# self.init_mobile_start_app.launch_app()
pass
def teardown(self):
# 退出被测试应用并清理数据
self.init_mobile_start_app.quit()
sleep(5)
self.init_mobile_start_app.clear_app()
@allure.story("[login登录--001]")
@allure.title("[login家长端首页进入登录验证--001]")
def test_login_check(self):
# nickname = user_info.get("nickname")
# 步骤1(建议一个页面用一个步骤)
with allure.step("同意用户协议"):
obj_handle_action.click_by_poco(self.poco_driver, login_page.user_terms_agree_by_poco())
with allure.step("是否进行升级,选择否"):
obj_handle_action.click_by_poco(self.poco_driver, login_page.get_no_upgrade_by_poco())
# 步骤2(建议一个页面用一个步骤)
with allure.step("切换为密码登录,输入用户名和密码,勾选协议,并登录"):
# 切换到登录页面点击me
obj_handle_action.click_by_poco(self.poco_driver, login_page.get_me_button_by_poco())
# 切换为密码登录
obj_handle_action.click_by_poco(self.poco_driver, login_page.login_via_password_by_poco())
# 输入用户名
allure.attach(user_info.get("username"), '用户名:')
handle_driver_obj.text_by_touch_pos([login_page.login_username_by_air()], self.poco_driver, user_info.get("username"))
# 输入密码
allure.attach(user_info.get("password"), '密码:')
obj_handle_action.set_text_by_poco(self.poco_driver, login_page.login_password_by_poco(), user_info.get("password"))
# 勾选用户协议
obj_handle_action.click_by_poco(self.poco_driver, login_page.get_agreement_by_poco())
# 点击登录
obj_handle_action.click_by_poco(self.poco_driver, login_page.get_login_button_by_poco())
#首页进入登录时,判断登录后是否存在首页的元素信息
assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver, ssion="VISPARK Courses") == True
# assert_equal("New Users","2","登录功能正确")
if __name__ == '__main__':
TestLogin().test_login_check()