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
0b8d0e97
Commit
0b8d0e97
authored
Oct 31, 2023
by
章 登恒
Browse files
commit
parent
3e85d52d
Changes
3
Hide whitespace changes
Inline
Side-by-side
testcase/test_scene1/scene1_mainflow.py
View file @
0b8d0e97
...
...
@@ -212,8 +212,10 @@ class PurchaseOrder():###普通采购单界面操作
chrome
.
execute_script
(
"arguments[0].click();"
,
order_link
)
sleep
(
5
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'(//iframe[@class="metro-main-frame"])[2]'
))
sleep
(
1
)
# 输入orderno并查询出订单
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//label[text()="%s"]/parent::div/div/div/div/input'
%
qrcond
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//label[text()="%s"]/parent::div/div/div/div/input'
%
qrcond
).
send_keys
(
orderno
)
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//label[text()="%s"]/parent::div/div/div/div/input'
%
qrcond
).
send_keys
(
Keys
.
ENTER
)
...
...
@@ -482,7 +484,7 @@ class Outstore(PurchaseOrder):#出库三步曲
#确定
chrome
.
find_element_by_xpath
(
'//span[text()="确定"]'
).
click
()
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="确认发货"]'
)))
sleep
(
1
)
sleep
(
2
)
# 确认发货
chrome
.
find_element_by_xpath
(
'//span[text()="确认发货"]'
).
click
()
sleep
(
0.5
)
...
...
testcase/test_scene1/scene3_mainflow.py
View file @
0b8d0e97
...
...
@@ -167,7 +167,7 @@ class QuickPurchase():#快速采购单界面操作
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_172" and @f="F_PURUNIT_TXT" and @i=%s])'
%
i
).
click
()
sleep
(
1
)
def
return_
qkpchno
(
self
):
#返回采购单号
def
return_
owtorder
(
self
):
#返回采购单号
return
orderno1
class
SalesOrder
():
...
...
@@ -216,13 +216,13 @@ if __name__ == '__main__':
step3
=
SalesOrder
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
step2_1
.
data_add_quickpurchase
()
qkpchno
=
step2_1
.
return_
qkpchno
()
owtorder
=
step2_1
.
return_
owtorder
()
step2_2
.
button_click1
()
print
(
"快速采购单提交成功,订单号为:"
,
qkpchno
)
print
(
"快速采购单提交成功,订单号为:"
,
owtorder
)
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
step2_2
.
query_click
(
'快速采购订单'
,
qkpchno
,
'vxe-body--column col_19 col--ellipsis dw-click-cell'
)
step2_2
.
query_click
(
'快速采购订单'
,
owtorder
,
'vxe-body--column col_19 col--ellipsis dw-click-cell'
)
step2_2
.
button_click2
()
step3
.
push_wms
(
qkpchno
)
step3
.
push_wms
(
owtorder
)
except
(
Exception
,
AssertionError
)
as
e
:
step6
=
ExceptionHandling
()
traceback
.
print_exc
()
...
...
testcase/test_scene1/scene4_mainflow.py
View file @
0b8d0e97
...
...
@@ -25,11 +25,14 @@ errmsg = '流程四:调拨出库-入库-红冲流程异常,请检查!'#流
class
TransferOut
():
def
data_add_allocate
(
self
):
###打开普调拨出库单###
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//span[text()="调拨出库单"]'
)))
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
(
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")]'
))
...
...
@@ -118,7 +121,7 @@ class TransferOut():
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_110" and @f="F_PURUNIT_CODE" and @i=%s])'
%
i
).
click
()
sleep
(
1
)
def
return_
allono
(
self
):
# 返回采购单号
def
return_
sttorder
(
self
):
# 返回采购单号
return
orderno1
class
TransferIn
():
...
...
@@ -151,7 +154,7 @@ class TransferIn():
assert
status
==
'待收货'
,
f
'调拨入库单状态不正确,当前状态为:"
{
status
}
",正确状态为"待收货"!'
print
(
'调拨入库单自动审核成功,状态为:待收货!'
)
def
return_
tranin
ord
(
self
):
def
return_
ott
ord
er
(
self
):
return
orderno2
class
Instore1
(
Instore
):
...
...
@@ -211,33 +214,114 @@ class Instore1(Instore):
PurchaseOrder
.
button_click1
(
self
,
type
)
print
(
'仓库验收成功'
)
class
TransferOffSetting
(
PurchaseOrder
):
def
ottorder_cancel
(
self
):
chrome
.
find_element_by_xpath
(
'//span[@title="全选/取消"]'
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//span[text()="整单取消"]'
).
click
()
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//span[text()="是"]'
).
click
()
#操作成功
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//p[text()="操作成功"]'
)))
PurchaseOrder
.
closetab
(
self
)
print
(
'订单取消成功'
)
def
ottorder_offset
(
self
,
orderno
):
# 打开菜单
order_link
=
chrome
.
find_element_by_xpath
(
'//span[text()="调拨出库红冲单"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
order_link
)
sleep
(
5
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'(//iframe[@class="metro-main-frame"])[2]'
))
sleep
(
1
)
#点击红冲按钮
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//span[text()="红冲"]'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//span[text()="红冲"]'
).
click
()
sleep
(
1
)
# wait.until(ec.frame_to_be_available_and_switch_to_it((By.XPATH,'//iframe[contains(@name,"awsui-dialog-iframe")]')))
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
# 输入orderno并查询出订单
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//label[text()="调拨出库单号"]/parent::div/div/div/div/input'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//label[text()="调拨出库单号"]/parent::div/div/div/div/input'
).
send_keys
(
orderno
)
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//label[text()="调拨出库单号"]/parent::div/div/div/div/input'
).
send_keys
(
Keys
.
ENTER
)
#勾选订单点击红冲
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//td[@class="vxe-body--column col_19 col--left col--ellipsis dw-click-cell"]'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//span[@title="全选/取消"]'
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//span[text()="整单红冲"]'
).
click
()
#点击确定按钮
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//div[@class="el-message-box__btns"]/button[2]/span'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//div[@class="el-message-box__btns"]/button[2]/span'
).
click
()
sleep
(
2
)
###获取订单号###
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//div[text() = "订单号 "]/following-sibling::div/span'
)))
sleep
(
0.5
)
global
orderno3
orderno3
=
chrome
.
find_element_by_xpath
(
'//div[text() = "订单号 "]/following-sibling::div/span'
).
text
#提交红冲单
PurchaseOrder
.
button_click1
(
self
,
el2
=
'//p[text()="发送成功"]'
)
print
(
'调拨出库红冲单提交成功,单号为:'
,
orderno3
)
def
return_smtorder
(
self
):
return
orderno3
if
__name__
==
'__main__'
:
step1
=
LoginSys
()
step2_1
=
TransferOut
()
step2_2
=
PurchaseOrder
()
step3
=
Outstore
()
step4
=
TransferIn
()
step5
=
Instore1
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
step2_1
.
data_add_allocate
()
#填写主表数据
allono
=
step2_1
.
return_allono
()
step2_2
.
button_click1
()
#提交
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
step2_2
.
query_click
(
'调拨出库单'
,
allono
,
'vxe-body--column col_19 col--left col--ellipsis dw-click-cell'
,
qrcond
=
'调拨出库单号'
)
step2_2
.
button_click2
(
msg1
=
'发送成功'
)
#审核
step3
.
switch_loggin
(
usr4
,
pwd4
)
step3
.
deliver_goods
(
allono
)
# 仓库发货
step3
.
picking_goods
(
allono
)
# 仓库拣货
step3
.
switch_loggin
(
usr5
,
pwd5
)
step3
.
outbound_review
(
allono
,
type
=
3
)
# 出库复核
step3
.
switch_loggin
(
usr1
,
pwd1
)
step4
.
transfer_in
(
allono
)
#检查自动审配订单状态
traninord
=
step4
.
return_traninord
()
#获取调拨入库单号
step5
.
switch_loggin
(
usr4
,
pwd4
)
step5
.
take_over_goods
(
traninord
)
# 仓库收货:1为收货单据撤回,2为提交,其余为保存
step5
.
switch_loggin
(
usr5
,
pwd5
)
step5
.
goods_check
(
traninord
,
type
=
3
)
# 仓库验收:1为保存,否则为提交
step5
.
switch_loggin
(
usr4
,
pwd4
)
step5
.
goods_grounding
(
traninord
)
# 仓库上架:1为保存,否则为提交
try
:
step1
=
LoginSys
()
step2_1
=
TransferOut
()
step2_2
=
PurchaseOrder
()
step3
=
Outstore
()
step4
=
TransferIn
()
step5
=
Instore1
()
step6
=
TransferOffSetting
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
step2_1
.
data_add_allocate
()
#填写主表数据
sttorder
=
step2_1
.
return_sttorder
()
step2_2
.
button_click1
()
#提交
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
step2_2
.
query_click
(
'调拨出库单'
,
sttorder
,
'vxe-body--column col_19 col--left col--ellipsis dw-click-cell'
,
qrcond
=
'调拨出库单号'
)
step2_2
.
button_click2
(
msg1
=
'发送成功'
)
#审核
step3
.
switch_loggin
(
usr4
,
pwd4
)
step3
.
deliver_goods
(
sttorder
)
# 仓库发货
step3
.
picking_goods
(
sttorder
)
# 仓库拣货
step3
.
switch_loggin
(
usr5
,
pwd5
)
step3
.
outbound_review
(
sttorder
,
type
=
3
)
# 出库复核
step3
.
switch_loggin
(
usr1
,
pwd1
)
step4
.
transfer_in
(
sttorder
)
#检查自动审配订单状态
ottorder
=
step4
.
return_ottorder
()
#获取调拨入库单号
# step5.switch_loggin(usr4, pwd4)
# step5.take_over_goods(ottorder) # 仓库收货:1为收货单据撤回,2为提交,其余为保存
# step5.switch_loggin(usr5, pwd5)
# step5.goods_check(ottorder,type=3) # 仓库验收:1为保存,否则为提交
# step5.switch_loggin(usr4, pwd4)
# step5.goods_grounding(ottorder) # 仓库上架:1为保存,否则为提交
step6
.
ottorder_cancel
()
#整单取消调拨入库单
step6
.
switch_loggin
(
usr2
,
pwd2
)
step6
.
ottorder_offset
(
sttorder
)
#新建调拨出库红冲单
smtorder
=
step6
.
return_smtorder
()
step5
.
switch_loggin
(
usr4
,
pwd4
)
step5
.
take_over_goods
(
smtorder
)
# 仓库收货:1为收货单据撤回,2为提交,其余为保存
step5
.
switch_loggin
(
usr5
,
pwd5
)
step5
.
goods_check
(
smtorder
,
type
=
3
)
# 仓库验收:1为保存,否则为提交
step5
.
switch_loggin
(
usr4
,
pwd4
)
step5
.
goods_grounding
(
smtorder
)
# 仓库上架:1为保存,否则为提交
except
(
Exception
,
AssertionError
)
as
e
:
step7
=
ExceptionHandling
()
traceback
.
print_exc
()
step7
.
handle
(
errmsg
,
e
)
finally
:
chrome
.
quit
()
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