# -*- encoding=utf8 -*-
__author__ = "xiaohesheng"

"""
case_tag:spd3-web,10087
spd登录的ui自动化例子1
"""


from common.common_func import commonFuc
from airtest.core.api import *
from airtest_selenium.proxy import *
module = "demo-ui"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "spd3_login_url")
print(url)
chrome=WebChrome()
chrome=commonFuc().openBrowser(url, chrome)
chrome.maximize_window()
chrome.implicitly_wait(20)
username=commonFuc().get_business_data(module, "username")
password=commonFuc().get_business_data(module, "password")
login_button=commonFuc().get_business_data(module, "login_button")
print(username,password)
commonFuc().logIn(username,password,login_button,chrome)
name1=commonFuc().get_business_data(module,"name1")
print(name1)
result=commonFuc().check_login_result(name1,chrome)
print(result)
#断言实际结果中是否包含预期的文本
commonFuc().check_text_exist_result_text(name1,result)
chrome.airtest_touch(Template(r"tpl1691374901526.png", record_pos=(12.3, 2.8), resolution=(100, 100)))
commonFuc().quit_chrome(chrome)

