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
f64f196d
Commit
f64f196d
authored
Oct 28, 2023
by
章 登恒
Browse files
commit
parent
6d3b94e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
testcase/test_scene1/scene1_mainflow.py
View file @
f64f196d
...
...
@@ -217,12 +217,12 @@ class PurchaseOrder():###普通采购单界面操作
#点击订单,进入表单视图
chrome
.
find_element_by_xpath
(
'//td[@class="%s"]'
%
el
).
click
()
sleep
(
1
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
def
commit_order
(
self
,
type
=
2
):
#保存/提交订单:type=1为保存,否则为提交
#调用query_click查询并打开订单,进入表单视图
self
.
query_click
(
'普通采购订单'
,
orderno1
,
'vxe-body--column col_19 col--last col--ellipsis dw-click-cell'
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
#等待表单视图加载完
locator
=
(
By
.
XPATH
,
'//span[text()="提交"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
...
...
@@ -247,6 +247,8 @@ class PurchaseOrder():###普通采购单界面操作
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
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
()
...
...
@@ -282,11 +284,7 @@ class PurchaseOrder():###普通采购单界面操作
def
approve_order
(
self
,
type
=
1
):
#审核/驳回订单:type=1为审核通过,否则为审核驳回
#调用query_click进入表单视图
self
.
query_click
(
'普通采购订单'
,
orderno1
,
'vxe-body--column col_19 col--last col--ellipsis dw-click-cell'
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
locator
=
(
By
.
XPATH
,
'//span[text()="审核通过"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
sleep
(
2
)
sleep
(
1
)
#调用button_click2审批/驳回
self
.
button_click2
(
type
)
...
...
@@ -294,8 +292,6 @@ class Instore(PurchaseOrder):#入库三步曲
def
take_over_goods
(
self
,
orderno
,
type
=
2
):
#仓库收货
#调用query_click进入表单视图
PurchaseOrder
.
query_click
(
self
,
'仓库收货'
,
orderno
,
'vxe-body--column col_19 col--left col--last col--ellipsis dw-click-cell'
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//span[text()="收货"]'
)))
sleep
(
0.5
)
#点击收货
...
...
@@ -322,13 +318,12 @@ class Instore(PurchaseOrder):#入库三步曲
def
goods_check
(
self
,
orderno
,
type
=
2
):
#仓库验收
#调用query_click进入表单视图
PurchaseOrder
.
query_click
(
self
,
'仓库验收'
,
orderno
,
'vxe-body--column col_19 col--left col--ellipsis dw-click-cell'
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="提交"]'
)))
sleep
(
1.5
)
#浏览器页面右滑
chrome
.
execute_script
(
"document.getElementsByClassName('vxe-table--
footer
-wrapper body--wrapper')[0].scrollLeft = 2000"
)
chrome
.
execute_script
(
"document.getElementsByClassName('vxe-table--
body
-wrapper body--wrapper')[0].scrollLeft = 2000"
)
sleep
(
1
)
# chrome.execute_script("document.getElementsByClassName('vxe-table--footer-wrapper body--wrapper')[0].scrollLeft = 2000")
# chrome.execute_script("document.getElementsByClassName('vxe-table--body-wrapper body--wrapper')[0].scrollTop = %s*30;" % i)
#填写商品信息
for
i
in
range
(
1
):
...
...
@@ -389,8 +384,6 @@ class Instore(PurchaseOrder):#入库三步曲
#调用query_click打开表单视图
PurchaseOrder
.
query_click
(
self
,
'仓库上架'
,
orderno
,
'vxe-body--column col_19 col--left col--ellipsis dw-click-cell'
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//span[text()="提交"]'
)))
sleep
(
0.5
)
# 调用button_click1保存/提交订单
...
...
@@ -452,8 +445,6 @@ class PurchaseReject(PurchaseOrder):
def
commit_order
(
self
,
orderno
,
type
=
2
):
#保存/提交订单:type=1为保存,否则为提交
#查询出订单并点击
PurchaseOrder
.
query_click
(
self
,
'采购退货单'
,
orderno
,
'vxe-body--column col_19 col--last col--ellipsis dw-click-cell'
,
qrcond
=
'采退单号'
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
locator
=
(
By
.
XPATH
,
'//span[text()="提交"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
sleep
(
2
)
...
...
@@ -463,11 +454,7 @@ class PurchaseReject(PurchaseOrder):
def
approve_order
(
self
,
orderno
,
type
=
1
):
#审核/驳回订单:type=1为审核通过,否则为审核驳回
#调用query_click进入表单视图
PurchaseOrder
.
query_click
(
self
,
'采购退货单'
,
orderno
,
'vxe-body--column col_19 col--last col--ellipsis dw-click-cell'
,
qrcond
=
'采退单号'
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
locator
=
(
By
.
XPATH
,
'//span[text()="审核通过"]'
)
wait
.
until
(
ec
.
presence_of_element_located
(
locator
))
sleep
(
2
)
sleep
(
1
)
#调用button_click2审核/驳回订单
PurchaseOrder
.
button_click2
(
self
,
type
,
msg1
=
'发送成功'
)
...
...
@@ -475,8 +462,6 @@ class Outstore(PurchaseOrder):#出库三步曲
def
deliver_goods
(
self
,
orderno
):
#仓库发货
#调用query_click进入表单视图
PurchaseOrder
.
query_click
(
self
,
'仓库发货'
,
orderno
,
'vxe-body--column col_19 col--last col--ellipsis dw-click-cell'
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
0.5
)
wait
.
until
(
ec
.
visibility_of_element_located
((
By
.
XPATH
,
'//span[text()="确认发货"]'
)))
sleep
(
1
)
#确认发货
...
...
@@ -498,7 +483,7 @@ class Outstore(PurchaseOrder):#出库三步曲
def
picking_goods
(
self
,
orderno
,
type
=
2
):
#仓库拣货
# 调用query_click进入表单视图
PurchaseOrder
.
query_click
(
self
,
'仓库拣货'
,
orderno
,
'vxe-body--column col_19 col--left col--ellipsis dw-click-cell'
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")
]'
))
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//span[text()="提交"
]'
))
)
#调用button_click1保存/提交
PurchaseOrder
.
button_click1
(
self
,
type
)
print
(
'仓库拣货成功'
)
...
...
@@ -507,7 +492,6 @@ class Outstore(PurchaseOrder):#出库三步曲
# 调用query_click进入表单视图
PurchaseOrder
.
query_click
(
self
,
'出库复核'
,
orderno
,
'vxe-body--column col_19 col--left col--ellipsis dw-click-cell'
)
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
,
'(//td[@colid="col_105" and @f="F_8VDB5FTL" and @i=0])'
)))
sleep
(
0.5
)
#填写商品信息
...
...
testcase/test_scene1/scene3_mainflow.py
View file @
f64f196d
...
...
@@ -15,6 +15,7 @@ from airtest_selenium.proxy import *
from
selenium.webdriver.support
import
expected_conditions
as
ec
from
selenium.webdriver.support.wait
import
WebDriverWait
from
testcase.test_scene1.scene1_mainflow
import
*
from
selenium.webdriver.common.action_chains
import
ActionChains
from
public.mail1
import
send_email1
from
public.tools
import
*
...
...
@@ -42,11 +43,13 @@ class QuickPurchase():#快速采购单界面操作
###打开快速采购订单###
order_link
=
chrome
.
find_element_by_xpath
(
'//span[text()="快速采购订单"]'
)
chrome
.
execute_script
(
"arguments[0].click();"
,
order_link
)
sleep
(
0.5
)
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
(
4
)
sleep
(
5
)
chrome
.
switch_to
.
frame
(
chrome
.
find_element_by_xpath
(
'//iframe[contains(@name,"awsui-dialog-iframe")]'
))
sleep
(
2
)
...
...
@@ -182,10 +185,61 @@ 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
):
#返回采购单号
return
orderno1
class
SalesOrder
():
def
push_wms
(
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
)
#切换到已办页面
chrome
.
find_element_by_xpath
(
'//li[text()="已办"]'
).
click
()
sleep
(
0.5
)
wait
.
until_not
(
ec
.
presence_of_element_located
((
By
.
CLASS_NAME
,
'el-loading-mask'
)))
#操作上面滚动条
ac
=
ActionChains
(
chrome
)
el1
=
chrome
.
find_element_by_xpath
(
'//div[text()="订单日期"]'
)
el2
=
chrome
.
find_element_by_xpath
(
'//div[@id="dw-searcher-area-div"]/div[1]/div/div[3]/div'
)
ac
.
move_to_element
(
el1
).
perform
()
ac
.
drag_and_drop_by_offset
(
el2
,
0
,
100
).
perform
()
sleep
(
0.5
)
# 输入orderno并查询出订单
chrome
.
find_element_by_xpath
(
'//label[text()="关联来源单号"]/parent::div/div/div/div/input'
).
send_keys
(
orderno
)
sleep
(
0.5
)
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_104 col--ellipsis dw-click-cell"]'
)))
sleep
(
0.5
)
salesorder
=
chrome
.
find_element_by_xpath
(
'//td[@class="vxe-body--column col_104 col--ellipsis dw-click-cell"]/div/div'
).
text
print
(
'生成的销售订单号为:'
,
salesorder
)
status
=
chrome
.
find_element_by_xpath
(
'//td[@class="vxe-body--column col_107 col--ellipsis"]/div/div'
).
text
assert
status
==
'待出库'
,
f
'销售订单推送WMS失败,当前状态为:"
{
status
}
",正确状态为"待出库"!'
print
(
'销售订单推送WMS成功'
)
# chrome.execute_script("document.getElementsByClassName('vxe-table--body-wrapper body--wrapper')[0].scrollLeft = 7900")
if
__name__
==
'__main__'
:
step1
=
LoginSys
()
step2
=
QuickPurchase
()
step2_1
=
QuickPurchase
()
step2_2
=
PurchaseOrder
()
step3
=
SalesOrder
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
step2
.
data_add_quickpurchase
()
step2_1
.
data_add_quickpurchase
()
qkpchno
=
step2_1
.
return_qkpchno
()
step2_2
.
button_click1
()
print
(
"快速采购单提交成功,订单号为:"
,
qkpchno
)
step2_2
.
switch_loggin
(
usr1
,
pwd1
)
step2_2
.
query_click
(
'快速采购订单'
,
qkpchno
,
'vxe-body--column col_19 col--ellipsis dw-click-cell'
)
step2_2
.
button_click2
()
step3
.
push_wms
(
qkpchno
)
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