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
662d77e6
Commit
662d77e6
authored
Nov 09, 2023
by
章 登恒
Browse files
commit
parent
40c0c6ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
testcase/test_scene11/scene11_mainflow.py
View file @
662d77e6
from
selenium.webdriver.support.select
import
Select
from
selenium.webdriver.support.select
import
Select
from
testcase.test_scene1.scene1_mainflow
import
*
from
testcase.test_scene1.scene1_mainflow
import
*
from
testcase.test_scene4.scene4_mainflow
import
Instore1
SIT_URL
=
'http://scdev.cmic.com.cn:8088/beta/'
#SIT环境地址
SIT_URL
=
'http://scdev.cmic.com.cn:8088/beta/'
#SIT环境地址
#通行证
#通行证
...
@@ -187,11 +188,15 @@ class DivisionPurchase():
...
@@ -187,11 +188,15 @@ class DivisionPurchase():
print
(
'分配经销商要货成功'
)
print
(
'分配经销商要货成功'
)
class
SalesOrder
(
PurchaseOrder
):
class
SalesOrder
(
PurchaseOrder
):
def
button_click1
(
self
,
type
=
2
,
el1
=
'el-loading-spinner'
,
el2
=
'//p[text()="办理成功"]'
):
def
return_sotorderno
(
self
):
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="保存"]'
)))
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="保存"]'
)))
###获取销售订单号###
###获取销售订单号###
global
orderno2
global
orderno2
orderno2
=
chrome
.
find_element_by_xpath
(
'//div[text() = "销售订单号 "]/following-sibling::div/span'
).
text
orderno2
=
chrome
.
find_element_by_xpath
(
'//div[text() = "销售订单号 "]/following-sibling::div/span'
).
text
return
orderno2
def
button_click1
(
self
,
type
=
2
,
el1
=
'el-loading-spinner'
,
el2
=
'//p[text()="办理成功"]'
):
if
type
==
1
:
# 保存
if
type
==
1
:
# 保存
# 点击保存按钮
# 点击保存按钮
chrome
.
find_element_by_xpath
(
'//span[text()="保存"]'
).
click
()
chrome
.
find_element_by_xpath
(
'//span[text()="保存"]'
).
click
()
...
@@ -218,8 +223,7 @@ class SalesOrder(PurchaseOrder):
...
@@ -218,8 +223,7 @@ class SalesOrder(PurchaseOrder):
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
self
.
closetab
()
self
.
closetab
()
print
(
'销售订单提交成功,订单号为:'
,
orderno2
)
print
(
'销售订单提交成功,订单号为:'
,
orderno2
)
def
return_sotorderno
(
self
):
return
orderno2
def
button_click2
(
self
,
type
=
1
,
msg1
=
'办理成功'
):
#审批/驳回订单:type=1为审批/其余为驳回订单
def
button_click2
(
self
,
type
=
1
,
msg1
=
'办理成功'
):
#审批/驳回订单:type=1为审批/其余为驳回订单
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="审核通过"]'
)))
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="审核通过"]'
)))
...
@@ -335,6 +339,69 @@ class Outstore1(PurchaseOrder): # 出库三步曲
...
@@ -335,6 +339,69 @@ class Outstore1(PurchaseOrder): # 出库三步曲
PurchaseOrder
.
closetab
(
self
)
PurchaseOrder
.
closetab
(
self
)
print
(
'出库复核成功'
)
print
(
'出库复核成功'
)
###采购退货单页面操作###
class
SalesReject
(
PurchaseOrder
):
def
relate_order
(
self
,
orderno
,
type
=
2
):
#关联原单退货
#打开销退单
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
)
#关联原单采退
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="关联原单"]'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//span[text()="关联原单"]'
).
click
()
sleep
(
3
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
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
,
'//th[@class="vxe-header--column col_18 col--center col--checkbox col--ellipsis"]/div/span/span'
)))
sleep
(
1
)
chrome
.
find_element_by_xpath
(
'//th[@class="vxe-header--column col_18 col--center col--checkbox col--ellipsis"]/div/span/span'
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//span[text()="销退"]'
).
click
()
sleep
(
0.5
)
# chrome.find_element_by_class_name("el-button el-button--primary el-button--mini").click()
chrome
.
find_element_by_xpath
(
'//button[@class="el-button el-button--primary el-button--mini"]'
).
click
()
sleep
(
3
)
#获取采退单号
# wait.until(ec.presence_of_element_located((By.XPATH, '//span[text()="提交"]')))
# locator = (By.XPATH,'//iframe[contains(@name,"awsui-dialog-iframe")]')
# wait.until(ec.frame_to_be_available_and_switch_to_it(locator))
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="提交"]'
)))
global
orderno3
orderno3
=
chrome
.
find_element_by_xpath
(
'//div[text() = "销退订单号 "]/following-sibling::div/span'
).
text
#选择退货原因
chrome
.
find_element_by_xpath
(
'//label[text() = "退货原因 "]/following-sibling::div//input'
).
click
()
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//li[text()="质量召回"]'
).
click
()
sleep
(
1
)
#保存/提交订单
# 点击提交按钮
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
(
self
)
print
(
"关联原单创建销退单成功,采退单号为:"
,
orderno3
)
def
return_sftorderno
(
self
):
#返回采退单号
return
orderno3
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
step1
=
LoginSys
()
step1
=
LoginSys
()
...
@@ -344,6 +411,9 @@ if __name__ == '__main__':
...
@@ -344,6 +411,9 @@ if __name__ == '__main__':
step4
=
SalesOrder
()
step4
=
SalesOrder
()
step5_1
=
Outstore
()
step5_1
=
Outstore
()
step5_2
=
Outstore1
()
step5_2
=
Outstore1
()
step6
=
SalesReject
()
step7_1
=
Instore
()
step7_2
=
Instore1
()
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
()
...
@@ -356,8 +426,8 @@ if __name__ == '__main__':
...
@@ -356,8 +426,8 @@ 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'
,
'要货申请订单号'
)
step4
.
button_click1
(
type
=
3
)
sotorderno
=
step4
.
return_sotorderno
()
sotorderno
=
step4
.
return_sotorderno
()
step4
.
button_click1
(
type
=
3
)
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
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'
,
'要货申请订单号'
)
step4
.
button_click2
(
msg1
=
'发送成功'
)
step4
.
button_click2
(
msg1
=
'发送成功'
)
...
@@ -366,6 +436,19 @@ if __name__ == '__main__':
...
@@ -366,6 +436,19 @@ if __name__ == '__main__':
step5_1
.
picking_goods
(
sotorderno
)
#仓库拣货
step5_1
.
picking_goods
(
sotorderno
)
#仓库拣货
step2_2
.
switch_loggin
(
usr5
,
pwd5
)
step2_2
.
switch_loggin
(
usr5
,
pwd5
)
step5_2
.
outbound_review1
(
sotorderno
)
#出库复核
step5_2
.
outbound_review1
(
sotorderno
)
#出库复核
step2_2
.
switch_loggin
(
usr2
,
pwd2
)
step6
.
relate_order
(
sotorderno
)
#关联原单采退并提交
sftorderno
=
step6
.
return_sftorderno
()
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
step2_2
.
query_click
(
'销售退货单'
,
sftorderno
,
'vxe-body--column col_19 col--ellipsis dw-click-cell'
,
'销退订单号'
)
step4
.
button_click2
(
msg1
=
'发送成功'
)
#审批采退单
step2_2
.
switch_loggin
(
usr4
,
pwd4
)
step7_1
.
take_over_goods
(
sftorderno
)
#仓库收货
step2_2
.
switch_loggin
(
usr5
,
pwd5
)
step7_2
.
goods_check
(
sftorderno
,
type
=
3
)
#仓库验收
step2_2
.
switch_loggin
(
usr4
,
pwd4
)
step7_1
.
goods_grounding
(
sftorderno
)
#仓库上架
...
...
testcase/test_scene11/test_scene11_mainflow.py
0 → 100644
View file @
662d77e6
from
testcase.test_scene11.scene11_mainflow
import
*
def
test_scene11_mainflow
():
print
(
'
\n
流程十一:经销商要货-销售-销退流程开始!!!'
)
# step1 = LoginSys()
# step1.loginsys(SIT_URL, usr2, pwd2)
step2_1
=
DealerPurchaseRequisition
()
step2_2
=
PurchaseOrder
()
step3
=
DivisionPurchase
()
step4
=
SalesOrder
()
step5_1
=
Outstore
()
step5_2
=
Outstore1
()
step6
=
SalesReject
()
step7_1
=
Instore
()
step7_2
=
Instore1
()
step2_2
.
switch_loggin
(
usr2
,
pwd2
)
step2_1
.
data_add_requisition
()
jyhtorder
=
step2_1
.
return_jyhtorder
()
step2_2
.
button_click1
()
print
(
'经销商要货申请提交成功'
)
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
step2_2
.
query_click
(
'经销商要货申请'
,
jyhtorder
,
'vxe-body--column col_20 col--center col--ellipsis dw-click-cell'
,
'要货申请单号'
)
step2_2
.
button_click2
()
step2_2
.
switch_loggin
(
usr2
,
pwd2
)
step3
.
divisionpurchase
()
step2_2
.
closetab
()
step2_2
.
query_click
(
'销售订单'
,
jyhtorder
,
'vxe-body--column col_19 col--center col--ellipsis dw-click-cell'
,
'要货申请订单号'
)
sotorderno
=
step4
.
return_sotorderno
()
step4
.
button_click1
(
type
=
3
)
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
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
)
#出库复核
step2_2
.
switch_loggin
(
usr2
,
pwd2
)
step6
.
relate_order
(
sotorderno
)
#关联原单采退并提交
sftorderno
=
step6
.
return_sftorderno
()
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
step2_2
.
query_click
(
'销售退货单'
,
sftorderno
,
'vxe-body--column col_19 col--ellipsis dw-click-cell'
,
'销退订单号'
)
step4
.
button_click2
(
msg1
=
'发送成功'
)
#审批采退单
step2_2
.
switch_loggin
(
usr4
,
pwd4
)
step7_1
.
take_over_goods
(
sftorderno
)
#仓库收货
step2_2
.
switch_loggin
(
usr5
,
pwd5
)
step7_2
.
goods_check
(
sftorderno
,
type
=
3
)
#仓库验收
step2_2
.
switch_loggin
(
usr4
,
pwd4
)
step7_1
.
goods_grounding
(
sftorderno
)
#仓库上架
print
(
'流程十一:经销商要货-销售-销退流程结束!!!'
)
chrome
.
quit
()
testcase/test_scene6/test_scene6_mainflow2.py
View file @
662d77e6
...
@@ -49,4 +49,3 @@ def test_scene6_mainflow2():
...
@@ -49,4 +49,3 @@ def test_scene6_mainflow2():
step8
.
button_click2
()
#审核订单
step8
.
button_click2
()
#审核订单
print
(
'流程六:手术请领-销售流程结束!!!'
)
print
(
'流程六:手术请领-销售流程结束!!!'
)
chrome
.
quit
()
\ 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