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
bb95b2ed
Commit
bb95b2ed
authored
Oct 25, 2023
by
章 登恒
Browse files
commit
parent
37e5bfc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
testcase/test_scene1/scene1_mainflow.py
View file @
bb95b2ed
...
...
@@ -37,6 +37,8 @@ warehousename = '北京强生非WMS仓'#仓库名称
contractnumber
=
41007
#合同号
salesman
=
'杨春刚'
#业务员名称
productcode
=
10156326
#商品编码
productdate
=
'2023-10-01'
expirdate
=
'2026-09-30'
class
LoginSys
():
#登录
...
...
@@ -72,7 +74,7 @@ class PurchaseOrder():#普通采购单界面操作
# 获取订单号
global
orderno1
orderno1
=
chrome
.
find_element_by_xpath
(
'//div[text() = "订单号 "]/following-sibling::div/span'
).
text
print
(
orderno1
)
print
(
'普通采购单号为'
,
orderno1
)
#填写仓库信息
chrome
.
find_element_by_xpath
(
'//div[text()="仓库名称 "]/following-sibling::div/div/div/div/div/div/div/div/span/span/i'
).
click
()
...
...
@@ -177,13 +179,13 @@ class PurchaseOrder():#普通采购单界面操作
print
(
'订单提交成功'
)
self
.
closetab
()
def
query_click
(
self
):
#查询出订单并点击
order_link
=
chrome
.
find_element_by_xpath
(
'//span[text()="
普通采购订单"]'
)
def
query_click
(
self
,
menu_name
,
orderno
,
el
):
#查询出订单并点击
order_link
=
chrome
.
find_element_by_xpath
(
'//span[text()="
%s"]'
%
menu_name
)
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
)
# 输入采购单号并查询
chrome
.
find_element_by_xpath
(
'//label[text()="订单号"]/parent::div/div/div/div/input'
).
send_keys
(
orderno
1
)
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
)
sleep
(
3
)
...
...
@@ -193,13 +195,15 @@ class PurchaseOrder():#普通采购单界面操作
#点击采购单
# chrome.find_element_by_xpath(
# '//span[text()="%s"]//parent::div/parent::td//preceding-sibling::td[1]/div/span' % orderno1).click()
chrome
.
find_element_by_xpath
(
'//td[@class="vxe-body--column col_19 col--last col--ellipsis dw-click-cell"]/div/span'
).
click
()
element
=
chrome
.
find_element_by_xpath
(
'//td[@class="%s"]/div/span'
%
el
)
element
.
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为保存,否则为提交
self
.
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
)
...
...
@@ -246,25 +250,116 @@ class PurchaseOrder():#普通采购单界面操作
self
.
closetab
()
def
approve_order
(
self
,
type
=
1
):
#审核/驳回订单:type=1为审核通过,否则为审核驳回
self
.
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
)
self
.
button_click2
(
type
)
class
Instore
(
PurchaseOrder
):
def
take_over_goods
(
self
,
orderno
,
type
=
2
):
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
)
chrome
.
find_element_by_xpath
(
'//span[text()="收货"]'
).
click
()
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//span[text()="确定"]'
)))
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'//span[text()="确定"]'
).
click
()
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//span[text()="提交"]'
)))
sleep
(
0.5
)
self
.
button_click3
(
type
)
def
button_click3
(
self
,
type
):
if
type
==
1
:
chrome
.
find_element_by_xpath
(
'//span[text()="单据撤回"]'
).
click
()
elif
type
==
2
:
chrome
.
find_element_by_xpath
(
'//span[text()="提交"]'
).
click
()
wait
.
until
(
ec
.
presence_of_element_located
((
By
.
XPATH
,
'//p[text()="提交成功"]'
)))
print
(
"收货成功"
)
PurchaseOrder
.
closetab
(
self
)
else
:
chrome
.
find_element_by_xpath
(
'//span[text()="保存"]'
).
click
()
def
goods_check
(
self
,
orderno
,
type
=
2
):
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
)
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
):
#填写生产批号
element
=
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_161" and @f="F_PRO_NUM" and @i=%s])'
%
i
)
chrome
.
execute_script
(
"arguments[0].click();"
,
element
)
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
'ZDH'
+
orderno
)
sleep
(
1
)
# 填写生产日期
element
=
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_162" and @f="F_PRODUCR_DATE" and @i=%s])'
%
i
)
chrome
.
execute_script
(
"arguments[0].click();"
,
element
)
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
productdate
)
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_161" and @f="F_PRO_NUM" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
# 填写失效日期
element
=
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_163" and @f="F_PERIOD_DATE" and @i=%s])'
%
i
)
chrome
.
execute_script
(
"arguments[0].click();"
,
element
)
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
expirdate
)
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_161" and @f="F_PRO_NUM" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
#填写灭菌批号
element
=
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_165" and @f="F_STE_NUM" and @i=%s])'
%
i
)
chrome
.
execute_script
(
"arguments[0].click();"
,
element
)
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
'ZDH'
+
orderno
)
sleep
(
1
)
# 填写灭菌日期
element
=
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_166" and @f="F_STE_DATE" and @i=%s])'
%
i
)
chrome
.
execute_script
(
"arguments[0].click();"
,
element
)
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
productdate
)
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_165" and @f="F_STE_NUM" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
# 填写灭菌失效日期
element
=
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_167" and @f="F_STE_LOSE_DATE" and @i=%s])'
%
i
)
chrome
.
execute_script
(
"arguments[0].click();"
,
element
)
sleep
(
0.5
)
chrome
.
find_element_by_class_name
(
'el-input__inner'
).
send_keys
(
expirdate
)
sleep
(
0.5
)
chrome
.
find_element_by_xpath
(
'(//td[@colid="col_165" and @f="F_STE_NUM" and @i=%s])'
%
i
).
click
()
sleep
(
0.5
)
PurchaseOrder
.
button_click1
(
self
,
type
)
print
(
'仓库验收成功'
)
if
__name__
==
'__main__'
:
step1
=
LoginSys
()
step2
=
PurchaseOrder
()
step3
=
Instore
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
#登录系统
step2
.
data_add
()
#填写表单数据
step2
.
button_click1
()
#1为保存,否则为提交
# step2.commitorder(1)#1为保存,否则为提交
step2
.
switch_loggin
(
usr1
,
pwd1
)
#切换登录
step2
.
approve_order
()
#1为审核通过,否则为审核驳回
purchord
=
step2
.
return_pchno
()
#获取采购订单号
\ No newline at end of file
purchord
=
step2
.
return_pchno
()
#获取采购订单号
step3
.
switch_loggin
(
usr4
,
pwd4
)
step3
.
take_over_goods
(
purchord
)
#1为收货单据撤回,2为提交,其余为保存
step3
.
switch_loggin
(
usr5
,
pwd5
)
step3
.
goods_check
(
purchord
)
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