Commit a44d8ee4 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

新增采购单管理脚本

No related merge requests found
Showing with 87 additions and 3 deletions
+87 -3
# -*- encoding=utf8 -*-
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,a_e2_采购单管理_列表查询_模糊查询_根据采购单号,id2297,id2297-42,sit,on
内网:a_e2_采购单管理_列表查询_模糊查询_根据采购单号
"""
from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
def test1():
module = "b3_herp3_purchase"
"""
场景:a_e2_采购单管理_列表查询_模糊查询_根据采购单号
用例名称:a_e2_采购单管理_列表查询_模糊查询_根据采购单号
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "herpService_purchase_listVoPage_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
print('headers', headers)
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
# 从文件提取采购单号
info = FileUtils().r_info8(module, "采购单信息", 'message2')
print('info', info)
list_a = info['list_a']
print('list_a', list_a)
orderNo = "orderNo"
for i in list_a:
orderNo = i['orderNo']
break
# 获取采购订单号的前,中,后三部分字符串用于模糊查询
list1 = commonFuc().get_str(orderNo)
print(list1)
# a_e1_采购单管理_列表查询_精确查询_根据制单时间
for i in list1:
# # 请求体
request_body = commonFuc().get_business_data(module, "payload19_9", i)
print('request_body', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 断言i
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
total = commonFuc().analysis_json('total', data)
if code == 0 and total >= 1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
test1()
......@@ -562,3 +562,10 @@ class commonFuc(object):
image_path = pro_path + "//log//" + imgName
chrome.get_screenshot_as_file(image_path)
return imgName, image_path
#获取字符串的前,中,后字符
def get_str(self,str):
str_length=len(str)
before=str[0:int(str_length/3)]
middle=str[int(str_length/3):int(str_length/2)]
after=str[int(str_length/5):int(str_length-1)]
return before,middle,after
\ No newline at end of file
......@@ -80,5 +80,6 @@ json_headers2: {
"payload19_6": {"pageNum":1,"pageSize":50,"queryObject":{"billMode":"%s","orderNo":"%s","status":"%s","planOrderNo":"%s","provName":"%s","exeProvName":"%s","hosId":"h0347","createTimeStart":"","createTimeEnd":""}}
"payload19_7": {"pageNum":1,"pageSize":50,"queryObject":{"billMode":"%s","orderNo":"%s","status":"%s","planOrderNo":"%s","provName":"%s","exeProvName":"%s","hosId":"h0347","upStatus":"%s","createTimeStart":"","createTimeEnd":""}}
"payload19_8": {"pageNum":1,"pageSize":50,"queryObject":{"billMode":"%s","orderNo":"%s","status":"%s","planOrderNo":"%s","provName":"%s","exeProvName":"%s","hosId":"h0347","upStatus":"%s","createTimeStart":"%s","createTimeEnd":"%s"}}
"payload19_9": {"pageNum":1,"pageSize":50,"queryObject":{"orderNo":"%s","planOrderNo":"","provName":"","exeProvName":"","hosId":"h0347","createTimeStart":"","createTimeEnd":""}}
checkDict2: {"code": 0,'msg': None,'data':1}
......@@ -56,7 +56,7 @@
<tr width="600">
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分0</td>
<td class='details-col-elapsed'>0分1</td>
<td class="details-col-elapsed">100.0%</td>
</tr>
</table>
......@@ -72,9 +72,9 @@
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/a_e1_采购单管理_列表查询_精确查询_根据制单时间/log.html' target='_blank'>a_e1_采购单管理_列表查询_精确查询_根据制单时间</a></td>
<td class="details-col-elapsed"><a href='../log/a_e2_采购单管理_列表查询_模糊查询_根据采购单号/log.html' target='_blank'>a_e2_采购单管理_列表查询_模糊查询_根据采购单号</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">0.866</td>
<td class="details-col-elapsed">1.358</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