Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-airtest-web-sc
Commits
2bc3a596
Commit
2bc3a596
authored
Nov 02, 2023
by
章 登恒
Browse files
commit
parent
5153ed85
Changes
1
Hide whitespace changes
Inline
Side-by-side
testcase/test_scene6/scene6_mainflow.py
View file @
2bc3a596
...
...
@@ -7,9 +7,10 @@ usr2,pwd2 = 'bj_02','Gyxc1234'
usr3
,
pwd3
=
'bj_03'
,
'Gyxc1234'
usr4
,
pwd4
=
'bj_04'
,
'Gyxc1234'
usr5
,
pwd5
=
'bj_05'
,
'Gyxc1234'
outwarehouse
=
'103356'
#调拨出库仓
inwarehouse
=
'103396'
#
调拨入库仓
lendin
=
'103503'
#借入仓库名称
lendout
=
'103396'
#
借出仓库名称
salesman
=
'杨春刚'
#业务员名称
custname
=
'北京大学第三医院'
#客户名称
productcode
=
10005528
#商品编码
STASHIP_TEMP
=
24
#启运温度
...
...
@@ -21,7 +22,169 @@ TRANS_MACHINE = '冷冻车'#运输工具
errmsg6
=
'流程六:手术跟台及消耗结算流程异常,请检查!'
#流程异常提示信息
class
SurgicalOrder
():
def
data_add_surgical
(
self
):
###打开手术请领单###
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//span[text()="手术请领单"]'
)))
sleep
(
0.5
)
order_link
=
chrome
.
find_element_by_xpath
(
'//span[text()="手术请领单"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
order_link
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'(//iframe[@class="metro-main-frame"])[2]'
))
sleep
(
0.5
)
# 点击新建按钮
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="新建"]'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//span[text()="新建"]'
).
click
()
sleep
(
4
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
2
)
###获取订单号###
global
orderno1
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//div[text() = "请领单号 "]/following-sibling::div/span'
)))
sleep
(
0.5
)
orderno1
=
chrome
.
find_element_by_xpath
(
'//div[text() = "请领单号 "]/following-sibling::div/span'
).
text
print
(
'手术请领单号为:'
,
orderno1
)
# 点击业务员名称并输入查询条件,查询出结果
chrome
.
find_element_by_xpath
(
'//div[text()="业务员名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i'
).
click
()
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:员工编码,员工名称,部门编码,部门名称"]'
).
send_keys
(
salesman
)
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:员工编码,员工名称,部门编码,部门名称"]'
).
send_keys
(
Keys
.
ENTER
)
sleep
(
1
)
# 勾选查询出的业务员并点击确定按钮
btn_div
=
chrome
.
find_element_by_xpath
(
'//span/input[@type="radio" and @value="00d92dd7f280359138c1db7ae026525cd"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
btn_div
)
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'(//span[@class="ensureBtn"]/button[1])'
).
click
()
sleep
(
1
)
# 手术类型
chrome
.
find_element_by_xpath
(
'(//input[@placeholder="请选择" and @type="text"])'
).
click
()
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//li[text()="初次髋"]'
).
click
()
sleep
(
1
)
# 手术种类
chrome
.
find_element_by_xpath
(
'(//input[@placeholder="请选择" and @type="text"])[2]'
).
click
()
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//li[text()="髋关节"]'
).
click
()
sleep
(
1
)
#手术日期
chrome
.
find_element_by_xpath
(
'//label[text()="手术日期 "]/following-sibling::div/div'
).
click
()
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//div[ @class ="el-date-table-cell"] // span[text()="31"]'
).
click
()
sleep
(
1
)
#客户信息页签
#填写客户名称
chrome
.
find_element_by_xpath
(
'//div[text()="客户信息"]'
).
click
()
chrome
.
find_element_by_xpath
(
'//div[text()="客户名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i'
).
click
()
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//input[@placeholder="模糊检索:客户编码,客户名称"]'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:客户编码,客户名称"]'
).
send_keys
(
custname
)
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:客户编码,客户名称"]'
).
send_keys
(
Keys
.
ENTER
)
sleep
(
0.5
)
btn_div
=
chrome
.
find_element_by_xpath
(
'//span/input[@type="radio" and @value="04bb72d56ca59576d0c205f2509d66836"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
btn_div
)
chrome
.
find_element_by_xpath
(
'(//button[@class="el-button el-button--primary el-button--default"])[2]'
).
click
()
sleep
(
1
)
#填写配销客户名称
chrome
.
find_element_by_xpath
(
'//div[text()="配销客户名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i'
).
click
()
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//input[@placeholder="模糊检索:客户编码,客商名称"]'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:客户编码,客商名称"]'
).
send_keys
(
custname
)
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:客户编码,客商名称"]'
).
send_keys
(
Keys
.
ENTER
)
sleep
(
0.5
)
btn_div
=
chrome
.
find_element_by_xpath
(
'//span/input[@type="radio" and @value="0c4d395678c596b20aa6c2a2fef3483d4"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
btn_div
)
chrome
.
find_element_by_xpath
(
'(//button[@class="el-button el-button--primary el-button--default"])[2]'
).
click
()
sleep
(
1
)
###仓库信息页###
chrome
.
find_element_by_xpath
(
'//div[text()="仓库信息"]'
).
click
()
sleep
(
1
)
#借入仓库名称
chrome
.
find_element_by_xpath
(
'//div[text()="借入仓库名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i'
).
click
()
# wait.until(ec.visibility_of_element_located((By.XPATH, '//input[@placeholder="模糊检索:仓库编码,仓库名称"]')))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:仓库编码,仓库名称"]'
).
send_keys
(
lendin
)
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:仓库编码,仓库名称"]'
).
send_keys
(
Keys
.
ENTER
)
sleep
(
0.5
)
btn_div
=
chrome
.
find_element_by_xpath
(
'//span/input[@type="radio" and @value="0eb35527d7e9703e44ad78fe510d37655"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
btn_div
)
chrome
.
find_element_by_xpath
(
'(//button[@class="el-button el-button--primary el-button--default"])[2]'
).
click
()
sleep
(
1
)
#借出仓库名称
chrome
.
find_element_by_xpath
(
'//div[text()="借出仓库名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i'
).
click
()
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//input[@placeholder="模糊检索:仓库编码,仓库名称"]'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:仓库编码,仓库名称"]'
).
send_keys
(
lendout
)
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:仓库编码,仓库名称"]'
).
send_keys
(
Keys
.
ENTER
)
sleep
(
0.5
)
btn_div
=
chrome
.
find_element_by_xpath
(
'//span/input[@type="radio" and @value="039a767b6a105e150f2369bb98aae2f68"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
btn_div
)
chrome
.
find_element_by_xpath
(
'(//button[@class="el-button el-button--primary el-button--default"])[2]'
).
click
()
sleep
(
1
)
###子表信息录入###
chrome
.
find_element_by_xpath
(
'//div[text()="主体信息"]'
).
click
()
sleep
(
1
)
# 点击添加商品并输入商品编码,查询出结果
chrome
.
find_element_by_xpath
(
'//span[text()="添加商品"]'
).
click
()
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:商品编码,商品名称"]'
).
send_keys
(
productcode
)
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//input[@placeholder="模糊检索:商品编码,商品名称"]'
).
send_keys
(
Keys
.
ENTER
)
sleep
(
2
)
# 勾选查询出的商品并点击确定按钮
chrome
.
find_element_by_xpath
(
'//th[@class="el-table_21_column_185 multiple-column el-table-column--selection is-leaf headerCellClassName el-table__cell"]/div/label/span/span'
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'(//div[@class="el-dialog__body"]/div[2]/span/button[1]/span)[6]'
).
click
()
sleep
(
3
)
###填写数量价格###
for
i
in
range
(
1
):
wait
.
until
(
ec
.
visibility_of_element_located
(
(
By
.
XPATH
,
'(//td[@colid="col_79" and @f="F_SALES_VOLUMES" and @i=%s])'
%
i
)))
# 定位数量框并输入数量
sleep
(
0.5
)
element
=
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_79" and @f="F_SALES_VOLUMES" and @i=%s])'
%
i
)
chrome
.
execute_script
(
"arguments[0].click();"
,
element
)
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'awsui-input-number-right'
).
send_keys
(
'1'
)
sleep
(
1
)
# 点击其它地方让数量框失焦,让数量真正填入数量框(平台设计如此,不用纠结为啥要此步)
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_84" and @f="F_SALEUNIT_CODE" and @i=%s])'
%
i
).
click
()
sleep
(
1
)
def
return_qltorder
(
self
):
# 返回采购单号
return
orderno1
if
__name__
==
'__main__'
:
step1
=
LoginSys
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
\ No newline at end of file
step2_1
=
SurgicalOrder
()
step2_2
=
PurchaseOrder
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
step2_1
.
data_add_surgical
()
step2_2
.
button_click1
()
qltorder
=
step2_1
.
return_qltorder
()
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment