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
856f593d
Commit
856f593d
authored
Oct 30, 2023
by
章 登恒
Browse files
commit
parent
419144b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
testcase/test_scene1/scene1_mainflow.py
View file @
856f593d
import
datetime
import
datetime
import
logging
import
threading
import
threading
import
time
import
time
import
traceback
import
traceback
...
@@ -508,7 +509,25 @@ class Outstore(PurchaseOrder):#出库三步曲
...
@@ -508,7 +509,25 @@ class Outstore(PurchaseOrder):#出库三步曲
PurchaseOrder
.
button_click1
(
self
,
type
,
el2
=
'//p[text()="流程结束"]'
)
PurchaseOrder
.
button_click1
(
self
,
type
,
el2
=
'//p[text()="流程结束"]'
)
print
(
'出库复核成功'
)
print
(
'出库复核成功'
)
class
ExceptionHandling
():
def
handle
(
self
,
errmsg
,
e
):
#获取项目路径
pro_path
=
get_pro_path
()
#截图
imgInfo
=
getErrorPhoto
(
chrome
)
#获取信息
imgName
=
imgInfo
[
0
]
image_path
=
imgInfo
[
1
]
info
=
errmsg
+
repr
(
e
)
now
=
get_time
()
# writeFile_append(pro_path + '/logs/logerror%s.txt' % now, info)
#发邮件
send_email1
(
image_path
,
info
)
#写日志
fmt_str
=
'%(asctime)s %(thread)d %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s'
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
fmt_str
,
filename
=
pro_path
+
'/logs/logerror%s.txt'
%
now
)
logging
.
error
(
errmsg
)
logging
.
error
(
traceback
.
format_exc
())
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
try
:
try
:
...
@@ -542,17 +561,9 @@ if __name__ == '__main__':
...
@@ -542,17 +561,9 @@ if __name__ == '__main__':
step5
.
switch_loggin
(
usr5
,
pwd5
)
step5
.
switch_loggin
(
usr5
,
pwd5
)
step5
.
outbound_review
(
rejpurchord
)
#出库复核
step5
.
outbound_review
(
rejpurchord
)
#出库复核
except
Exception
as
e
:
except
Exception
as
e
:
print
(
'errmsg'
)
step6
=
ExceptionHandling
(
)
traceback
.
print_exc
()
traceback
.
print_exc
()
pro_path
=
get_pro_path
()
step6
.
handle
(
errmsg
,
e
)
imgInfo
=
getErrorPhoto
(
chrome
)
imgName
=
imgInfo
[
0
]
image_path
=
imgInfo
[
1
]
print
(
imgName
,
image_path
)
print
(
repr
(
e
))
info
=
errmsg
+
repr
(
e
)
now
=
get_time
()
writeFile_append
(
pro_path
+
'/logs/logerror%s.txt'
%
now
,
info
)
send_email1
(
image_path
,
info
)
finally
:
finally
:
chrome
.
quit
()
chrome
.
quit
()
testcase/test_scene1/scene3_mainflow.py
View file @
856f593d
...
@@ -35,7 +35,7 @@ salcust = 1000486
...
@@ -35,7 +35,7 @@ salcust = 1000486
productcode
=
10156326
#商品编码
productcode
=
10156326
#商品编码
productdate
=
'2023-10-01'
#生产日期
productdate
=
'2023-10-01'
#生产日期
expirdate
=
'2026-09-30'
#失效日期
expirdate
=
'2026-09-30'
#失效日期
errmsg
=
'流程三:
特一级/
经销商向总代采购,货从供应商发(经销商快采快销场景)流程异常,请检查!'
#流程异常提示信息
errmsg
=
'流程三:经销商向总代采购,货从供应商发(经销商快采快销场景)流程异常,请检查!'
#流程异常提示信息
class
QuickPurchase
():
#快速采购单界面操作
class
QuickPurchase
():
#快速采购单界面操作
def
data_add_quickpurchase
(
self
):
#填写表单数据
def
data_add_quickpurchase
(
self
):
#填写表单数据
...
@@ -222,14 +222,13 @@ class SalesOrder():
...
@@ -222,14 +222,13 @@ class SalesOrder():
status
=
chrome
.
find_element_by_xpath
(
'//td[@class="vxe-body--column col_107 col--ellipsis"]/div/div'
).
text
status
=
chrome
.
find_element_by_xpath
(
'//td[@class="vxe-body--column col_107 col--ellipsis"]/div/div'
).
text
assert
status
==
'待出库'
,
f
'销售订单推送WMS失败,当前状态为:"
{
status
}
",正确状态为"待出库"!'
assert
status
==
'待出库'
,
f
'销售订单推送WMS失败,当前状态为:"
{
status
}
",正确状态为"待出库"!'
print
(
'销售订单推送WMS成功'
)
print
(
'销售订单推送WMS成功'
)
# chrome.execute_script("document.getElementsByClassName('vxe-table--body-wrapper body--wrapper')[0].scrollLeft = 7900")
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
try
:
try
:
step1
=
LoginSys
()
step1
=
LoginSys
1
()
step2_1
=
QuickPurchase
()
step2_1
=
QuickPurchase
()
step2_2
=
PurchaseOrder
()
step2_2
=
PurchaseOrder
()
step3
=
SalesOrder
()
step3
=
SalesOrder
()
...
@@ -243,18 +242,10 @@ if __name__ == '__main__':
...
@@ -243,18 +242,10 @@ if __name__ == '__main__':
step2_2
.
button_click2
()
step2_2
.
button_click2
()
step3
.
push_wms
(
qkpchno
)
step3
.
push_wms
(
qkpchno
)
except
(
Exception
,
AssertionError
)
as
e
:
except
(
Exception
,
AssertionError
)
as
e
:
print
(
'errmsg'
)
step6
=
ExceptionHandling
(
)
traceback
.
print_exc
()
traceback
.
print_exc
()
pro_path
=
get_pro_path
()
step6
.
handle
(
errmsg
,
e
)
imgInfo
=
getErrorPhoto
(
chrome
)
imgName
=
imgInfo
[
0
]
image_path
=
imgInfo
[
1
]
print
(
imgName
,
image_path
)
print
(
repr
(
e
))
info
=
errmsg
+
repr
(
e
)
now
=
get_time
()
writeFile_append
(
pro_path
+
'/logs/logerror%s.txt'
%
now
,
info
)
send_email1
(
image_path
,
info
)
finally
:
finally
:
chrome
.
quit
()
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