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
55e788a5
Commit
55e788a5
authored
Nov 08, 2023
by
章 登恒
Browse files
commit
parent
afd9840b
Changes
1
Hide whitespace changes
Inline
Side-by-side
testcase/test_scene11/scene11_mainflow.py
View file @
55e788a5
...
@@ -16,6 +16,14 @@ custname = 1000486#客户名称
...
@@ -16,6 +16,14 @@ custname = 1000486#客户名称
productcode
=
10005528
#商品编码
productcode
=
10005528
#商品编码
contractnumber
=
'YLTEST77'
#合同/协议号
contractnumber
=
'YLTEST77'
#合同/协议号
ARRIVAL_TEMP
=
24
#到货温度
ARRIVAL_DATE
=
'2023-10-01'
#到货日期
ARRIVAL_TIME
=
'00:00:00'
#到货时间
STASHIP_TEMP
=
24
#启运温度
STASHIP_DATE
=
'2023-11-01'
#启运日期
STASHIP_TIME
=
'00:00:00'
#启运时间
TRANS_MACHINE
=
'冷冻车'
#运输工具
...
@@ -143,6 +151,8 @@ class DealerPurchaseRequisition():
...
@@ -143,6 +151,8 @@ class DealerPurchaseRequisition():
class
DivisionPurchase
():
class
DivisionPurchase
():
def
divisionpurchase
(
self
):
def
divisionpurchase
(
self
):
#打开分配经销商要货菜单
#打开分配经销商要货菜单
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//span[text()="分配经销商要货"]'
)))
sleep
(
0.5
)
order_link
=
chrome
.
find_element_by_xpath
(
'//span[text()="分配经销商要货"]'
)
order_link
=
chrome
.
find_element_by_xpath
(
'//span[text()="分配经销商要货"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
order_link
)
chrome
.
execute_script
(
"arguments[0].click();"
,
order_link
)
sleep
(
2
)
sleep
(
2
)
...
@@ -176,6 +186,154 @@ class DivisionPurchase():
...
@@ -176,6 +186,154 @@ class DivisionPurchase():
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//div[text()="提交成功"]'
)))
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//div[text()="提交成功"]'
)))
print
(
'分配经销商要货成功'
)
print
(
'分配经销商要货成功'
)
class
SalesOrder
(
PurchaseOrder
):
def
button_click1
(
self
,
type
=
2
,
el1
=
'el-loading-spinner'
,
el2
=
'//p[text()="办理成功"]'
):
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="保存"]'
)))
###获取销售订单号###
global
orderno2
orderno2
=
chrome
.
find_element_by_xpath
(
'//div[text() = "销售订单号 "]/following-sibling::div/span'
).
text
if
type
==
1
:
# 保存
# 点击保存按钮
chrome
.
find_element_by_xpath
(
'//span[text()="保存"]'
).
click
()
sleep
(
1
)
# 元素el1不可见时认为保存成功
locator
=
(
By
.
CLASS_NAME
,
f
'
{
el1
}
'
)
wait
.
until_not
(
ec
.
presence_of_element_located
(
locator
))
elif
type
==
2
:
# 提交(提交后界面无弹框)
# 点击提交按钮
chrome
.
find_element_by_xpath
(
'//span[text()="提交"]'
).
click
()
sleep
(
1
)
# 元素el2出现时认为提交成功
locator
=
(
By
.
XPATH
,
f
'
{
el2
}
'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
elif
type
==
3
:
# 提交(提交后界面还有弹框)
# 点击提交按钮
chrome
.
find_element_by_xpath
(
'//span[text()="提交"]'
).
click
()
sleep
(
0.5
)
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//button[@class="el-button el-button--primary el-button--mini awsui-button awsui-button--primary"]/span'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//button[@class="el-button el-button--primary el-button--mini awsui-button awsui-button--primary"]/span'
).
click
()
# 元素el2出现时认为提交成功
locator
=
(
By
.
XPATH
,
f
'
{
el2
}
'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
self
.
closetab
()
print
(
'销售订单提交成功,订单号为:'
,
orderno2
)
def
return_sotorderno
(
self
):
return
orderno2
def
button_click2
(
self
,
type
=
1
,
msg1
=
'办理成功'
):
#审批/驳回订单:type=1为审批/其余为驳回订单
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="审核通过"]'
)))
sleep
(
1
)
if
type
==
1
:
#审核流程
#点击审核通过
chrome
.
find_element_by_xpath
(
'//span[text()="审核通过"]'
).
click
()
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//button[@class="el-button el-button--primary el-button--mini awsui-button awsui-button--primary"]/span'
)))
sleep
(
0.5
)
#点击确定按钮
chrome
.
find_element_by_xpath
(
'//button[@class="el-button el-button--primary el-button--mini awsui-button awsui-button--primary"]/span'
).
click
()
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//textarea[@placeholder="意见留言"]'
)))
sleep
(
0.5
)
#填写审核通过信息
chrome
.
find_element_by_xpath
(
'//textarea[@placeholder="意见留言"]'
).
send_keys
(
'审核通过'
)
sleep
(
0.5
)
#点击发送按钮
chrome
.
find_element_by_xpath
(
'//span[text()="发送"]'
).
click
()
#判断审核成功
locator
=
(
By
.
XPATH
,
'//p[text()="%s"]'
%
msg1
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
print
(
'订单审核成功'
)
else
:
#驳回流程
#点击驳回
chrome
.
find_element_by_xpath
(
'//span[text()="审核驳回"]'
).
click
()
locator
=
(
By
.
XPATH
,
'//textarea[@placeholder="意见留言"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
sleep
(
0.5
)
#填写驳回信息
chrome
.
find_element_by_xpath
(
'//textarea[@placeholder="意见留言"]'
).
send_keys
(
'审核驳回'
)
sleep
(
0.5
)
#点击发送
chrome
.
find_element_by_xpath
(
'//span[text()="发送"]'
).
click
()
#判断驳回成功
locator
=
(
By
.
XPATH
,
'//p[text()="发送成功"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
print
(
'订单驳回成功'
)
self
.
closetab
()
class
Outstore1
(
PurchaseOrder
):
# 出库三步曲
def
outbound_review1
(
self
,
orderno
,
type
=
2
):
#出库复核
# 调用query_click进入表单视图
PurchaseOrder
.
query_click
(
self
,
'出库复核'
,
orderno
,
'vxe-body--column col_19 col--left col--ellipsis dw-click-cell'
)
sleep
(
2
)
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'(//td[@colid="col_105" and @f="F_8VDB5FTL" and @i=0])'
)))
sleep
(
0.5
)
#填写商品信息
for
i
in
range
(
1
):
chrome
.
execute_script
(
"document.getElementsByClassName('vxe-table--footer-wrapper body--wrapper')[0].scrollLeft = 1000"
)
sleep
(
1
)
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'(//td[@colid="col_117" and @f="F_RECHECK_NUM" and @i=%s])'
%
i
)))
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_117" and @f="F_RECHECK_NUM" and @i=%s])'
%
i
).
click
()
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_119" and @f="F_DIF_NUM" and @i=%s])'
%
i
).
click
()
sleep
(
1
)
chrome
.
execute_script
(
"document.getElementsByClassName('vxe-table--body-wrapper body--wrapper')[0].scrollLeft = 3400"
)
sleep
(
1
)
# 填写到货温度
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_135" and @f="F_ARRIVAL_TEMP" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'awsui-input-number-right'
).
send_keys
(
ARRIVAL_TEMP
)
sleep
(
0.5
)
# 填写到货日期
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_136" and @f="F_ARRIVAL_DATE" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
ARRIVAL_DATE
)
sleep
(
0.5
)
# 填写到货时间
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_137" and @f="F_ARRIVAL_TIME" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
ARRIVAL_TIME
)
sleep
(
0.5
)
# 填写启运温度
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_138" and @f="F_STASHIP_TEMP" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'awsui-input-number-right'
).
send_keys
(
STASHIP_TEMP
)
sleep
(
0.5
)
# 填写启运日期
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_139" and @f="F_STASHIP_DATE" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
STASHIP_DATE
)
sleep
(
0.5
)
# 填写启运时间
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_140" and @f="F_STASHIP_TIME" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
STASHIP_TIME
)
sleep
(
0.5
)
# 点击提交按钮
chrome
.
find_element_by_xpath
(
'//span[text()="提交"]'
).
click
()
sleep
(
0.5
)
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//button[@class="el-button el-button--primary el-button--mini awsui-button awsui-button--primary"]/span'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//button[@class="el-button el-button--primary el-button--mini awsui-button awsui-button--primary"]/span'
).
click
()
# 元素el2出现时认为提交成功
locator
=
(
By
.
XPATH
,
'//p[text()="流程结束"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
PurchaseOrder
.
closetab
()
print
(
'出库复核成功'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
@@ -183,6 +341,9 @@ if __name__ == '__main__':
...
@@ -183,6 +341,9 @@ if __name__ == '__main__':
step2_1
=
DealerPurchaseRequisition
()
step2_1
=
DealerPurchaseRequisition
()
step2_2
=
PurchaseOrder
()
step2_2
=
PurchaseOrder
()
step3
=
DivisionPurchase
()
step3
=
DivisionPurchase
()
step4
=
SalesOrder
()
step5_1
=
Outstore
()
step5_2
=
Outstore1
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
step2_1
.
data_add_requisition
()
step2_1
.
data_add_requisition
()
jyhtorder
=
step2_1
.
return_jyhtorder
()
jyhtorder
=
step2_1
.
return_jyhtorder
()
...
@@ -195,6 +356,17 @@ if __name__ == '__main__':
...
@@ -195,6 +356,17 @@ if __name__ == '__main__':
step3
.
divisionpurchase
()
step3
.
divisionpurchase
()
step2_2
.
closetab
()
step2_2
.
closetab
()
step2_2
.
query_click
(
'销售订单'
,
jyhtorder
,
'vxe-body--column col_19 col--center col--ellipsis dw-click-cell'
,
'要货申请订单号'
)
step2_2
.
query_click
(
'销售订单'
,
jyhtorder
,
'vxe-body--column col_19 col--center col--ellipsis dw-click-cell'
,
'要货申请订单号'
)
chrome
.
find_element_by_xpath
(
'//span[text()="提交"]'
).
click
();
sleep
(
1
)
step4
.
button_click1
(
type
=
3
)
chrome
.
find_element_by_xpath
(
'//span[text()="确定"][1]'
).
click
()
sotorderno
=
step4
.
return_sotorderno
()
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//p[text()="办理成功"]'
)))
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
\ No newline at end of file
step2_2
.
query_click
(
'销售订单'
,
jyhtorder
,
'vxe-body--column col_19 col--center col--ellipsis dw-click-cell'
,
'要货申请订单号'
)
step4
.
button_click2
(
msg1
=
'发送成功'
)
step2_2
.
switch_loggin
(
usr4
,
pwd4
)
step5_1
.
deliver_goods
(
sotorderno
)
#仓库发货
step5_1
.
picking_goods
(
sotorderno
)
#仓库拣货
step2_2
.
switch_loggin
(
usr5
,
pwd5
)
step5_2
.
outbound_review1
(
sotorderno
)
#出库复核
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