Commit 10605afa authored by xiao-hesheng's avatar xiao-hesheng
Browse files

修改ui自动化demo

添加airtest下的ui自动化demo
parent 5765f29d
......@@ -8,11 +8,14 @@ spd登录的ui自动化例子1
from common.common_func import commonFuc
from airtest.core.api import *
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from airtest_selenium.proxy import *
module = "demo-ui"
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "spd3_login_url")
print(url)
chrome=webdriver.Chrome()
chrome=WebChrome()
chrome=commonFuc().openBrowser(url,chrome)
chrome.maximize_window()
chrome.implicitly_wait(20)
......@@ -27,4 +30,7 @@ result=commonFuc().check_login_result(name1,chrome)
print(result)
#断言实际结果中是否包含预期的文本
commonFuc().check_text_exist_result_text(name1,result)
commonFuc().quit_chrome(chrome)
\ No newline at end of file
chrome.airtest_touch(Template(r"tpl1691374901526.png", record_pos=(12.3, 2.8), resolution=(100, 100)))
commonFuc().quit_chrome(chrome)
# -*- encoding=utf8 -*-
__author__ = "Administrator"
"""
case_tag:api,baidu,sit,on
"""
from airtest.core.api import *
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from airtest_selenium.proxy import *
driver = WebChrome()
driver.implicitly_wait(20)
driver.get("https://www.baidu.com")
sleep(4)
driver.find_element_by_id("kw").send_keys("airtest")
sleep(4)
driver.airtest_touch(Template(r"tpl1691374901526.png", record_pos=(12.3, 2.8), resolution=(100, 100)))
# -*- encoding=utf8 -*-
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web境内,用例集id2226,sit,on
主数据平台:注册企业接口
"""
from common.common_func import commonFuc
import time
module = "mdm3-es"
#企业注册接口
import os
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "CompanyRegist_url")
print(url)
# #获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers", commonFuc().get_business_data(module,"json_contentType"))
print(headers)
name=commonFuc().get_business_data(module,"name1")#获取前缀name
cname=name+commonFuc().randomString(5)#随机数生成拼接企业名称
request_body = commonFuc().get_business_data(module, "payload3",cname,cname,cname,cname,cname,cname)
print(request_body)
"""
场景:外网主数据平台企业注册-器械注册人注册接口-境内企业
用例名称:企业注册接口-器械注册人-正常注册-境内企业
输入:cname
输出:"rtn_msg": "返回注册企业信息"
"""
#发送请求
result = commonFuc().http_post(url, request_body, headers)
print(result)
#获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict")
print(check_dict)
#断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
#断言实际结果中是否包含预期的文本
commonFuc().check_text_exist(name,result)
......@@ -247,4 +247,35 @@ checkDict: {"code": 0,'msg': None}
"certListCode": []
}
]
}
#器械注册人_企业注册提交_正常注册(境内)
"payload3": {
"compFunction": "2",
"compFunctionArr": [
"2"
],
"cname": "%s",
"shortName": "",
"isAbroad": "0",
"addrCodeList": [
"11"
],
"area": "",
"userName": "%s",
"address": "",
"userLoginCode": "%s",
"userLoginPsw": "a123456!",
"confimPassword": "a123456!",
"registContactUser": "",
"registContactWay": "",
"email": "%s@sina.com",
"registSourceProject": "%s",
"legal": "",
"erpCode": "%s",
"dataEntrance": "注册",
"compKind": "0",
"upCompanyId": "",
"companyRegistBizscopeVos": [],
"certVOList": []
}
\ No newline at end of file
......@@ -55,9 +55,9 @@
<tr width="600">
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0</td>
<td class='details-col-elapsed'>0分2秒</td>
<td class="details-col-elapsed">0.0%</td>
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分27</td>
<td class="details-col-elapsed">100.0%</td>
</tr>
</table>
......@@ -73,8 +73,8 @@
<tr width="600">
<td class="details-col-elapsed"><a href='../log/demo-spd3-login/log.html' target='_blank'>demo-spd3-login</a></td>
<td class="fail">失败</td>
<td class="details-col-elapsed">2.185</td>
<td class="success">成功</td>
<td class="details-col-elapsed">27.622</td>
<td class="details-col-elapsed">xiaohesheng</td>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment