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
3d1fe462
Commit
3d1fe462
authored
Oct 26, 2023
by
章 登恒
Browse files
commit
parent
de31e028
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/mail1.py
View file @
3d1fe462
...
...
@@ -5,14 +5,14 @@ from email.mime.multipart import MIMEMultipart
from
email.mime.application
import
MIMEApplication
from
email.mime.image
import
MIMEImage
send_usr
=
'1
8627022503@163
.com'
# 发件人
send_pwd
=
'
EBJFCICTFEONFQEO
'
# 授权码,邮箱设置
reverse
=
'1
8627022503@163
.com'
# 接收者
send_usr
=
'1
171089625@qq
.com'
# 发件人
send_pwd
=
'
qkkucauovkbvgjje
'
# 授权码,邮箱设置
reverse
=
'1
171089625@qq
.com'
# 接收者
content
=
'2022<p>python官网链接如下:</p>'
\
'<p><a href="https://www.python.org">python</a></p>'
#content 内容设置
html_img
=
'<p>{content}<br><img src="cid:image1"></br></p>'
# html格式添加图片
email_server
=
'smtp.
163
.com'
email_server
=
'smtp.
qq
.com'
email_title
=
'脚本执行成功了'
# 邮件主题
def
send_email1
(
image_path
,
email_title
):
...
...
@@ -21,9 +21,9 @@ def send_email1(image_path,email_title):
msg
[
'From'
]
=
send_usr
# 发件人
msg
[
'To'
]
=
Header
(
'xhs'
,
'utf-8'
)
# 收件人--这里是昵称
# msg.attach(MIMEText(content,'html','utf-8')) # 构建邮件正文,不能多次构造
attchment
=
MIMEApplication
(
open
(
r
'D:/test.xlsx'
,
'rb'
).
read
())
# 文件
attchment
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
'test.png'
)
msg
.
attach
(
attchment
)
# 添加附件到邮件
#
attchment = MIMEApplication(open(r'D:/test.xlsx','rb').read()) # 文件
#
attchment.add_header('Content-Disposition','attachment',filename='test.png')
#
msg.attach(attchment) # 添加附件到邮件
# f = open("D:\\PycharmProjects\\cmic_python_JobLog\\xhsmail\\2023-04-30_090212.png", 'rb') #打开图片
f
=
open
(
image_path
,
'rb'
)
#打开图片
msgimage
=
MIMEImage
(
f
.
read
())
...
...
testcase/test_scene1/scene1_mainflow.py
View file @
3d1fe462
...
...
@@ -37,9 +37,9 @@ warehousename = '北京强生非WMS仓'#仓库名称
contractnumber
=
41007
#合同号
salesman
=
'杨春刚'
#业务员名称
productcode
=
10156326
#商品编码
productdate
=
'2023-10-01'
expirdate
=
'2026-09-30'
productdate
=
'2023-10-01'
#生产日期
expirdate
=
'2026-09-30'
#失效日期
errmsg
=
'流程一:采购_采退流程异常,请检查!'
#流程异常提示信息
class
LoginSys
():
#登录
def
loginsys
(
self
,
url
,
usr
,
pwd
):
...
...
@@ -288,12 +288,10 @@ class Instore(PurchaseOrder):
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
(
0.5
)
chrome
.
execute_script
(
"document.getElementsByClassName('vxe-table--footer-wrapper body--wrapper')[0].scrollLeft = 2000"
)
sleep
(
1.5
)
chrome
.
execute_script
(
"document.getElementsByClassName('vxe-table--footer-wrapper body--wrapper')[0].scrollLeft = 2000"
)
sleep
(
1
)
# chrome.execute_script(
# "document.getElementsByClassName('vxe-table--body-wrapper body--wrapper')[0].scrollTop = %s*30;" % i)
# 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
)
...
...
@@ -468,39 +466,50 @@ class Outstore(PurchaseOrder):
if
__name__
==
'__main__'
:
step1
=
LoginSys
()
step2
=
PurchaseOrder
()
step3
=
Instore
()
step4
=
PurchaseReject
()
step5
=
Outstore
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
#登录系统
step2
.
data_add
()
#填写表单数据
step2
.
button_click1
()
#1为保存,否则为提交
# step2.commit_order(1)#提交采购单:1为保存,否则为提交
step2
.
switch_loggin
(
usr1
,
pwd1
)
#切换登录
step2
.
approve_order
()
#1为审核通过,否则为审核驳回
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
)
#仓库验收:1为保存,否则为提交
step3
.
switch_loggin
(
usr4
,
pwd4
)
step3
.
goods_grounding
(
purchord
)
#仓库上架:1为保存,否则为提交
step4
.
switch_loggin
(
usr2
,
pwd2
)
step4
.
relate_order
(
purchord
)
#创建采退单1为保存,否则为提交
rejpurchord
=
step4
.
return_rejpchno
()
# step4.commit_order(rejpurchord)#提交采退单:1为保存,否则为提交
step4
.
switch_loggin
(
usr1
,
pwd1
)
step4
.
approve_order
(
rejpurchord
)
step4
.
switch_loggin
(
usr4
,
pwd4
)
step5
.
deliver_goods
(
rejpurchord
)
step5
.
picking_goods
(
rejpurchord
)
step5
.
switch_loggin
(
usr5
,
pwd5
)
step5
.
outbound_review
(
rejpurchord
)
try
:
step1
=
LoginSys1
()
step2
=
PurchaseOrder
()
step3
=
Instore
()
step4
=
PurchaseReject
()
step5
=
Outstore
()
step1
.
loginsys
(
SIT_URL
,
usr2
,
pwd2
)
#登录系统
step2
.
data_add
()
#填写表单数据
step2
.
button_click1
()
#1为保存,否则为提交
# step2.commit_order(1)#提交采购单:1为保存,否则为提交
step2
.
switch_loggin
(
usr1
,
pwd1
)
#切换登录
step2
.
approve_order
()
#1为审核通过,否则为审核驳回
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
)
#仓库验收:1为保存,否则为提交
step3
.
switch_loggin
(
usr4
,
pwd4
)
step3
.
goods_grounding
(
purchord
)
#仓库上架:1为保存,否则为提交
step4
.
switch_loggin
(
usr2
,
pwd2
)
step4
.
relate_order
(
purchord
)
#创建采退单1为保存,否则为提交
rejpurchord
=
step4
.
return_rejpchno
()
#获取采退单号
# step4.commit_order(rejpurchord)#提交采退单:1为保存,否则为提交
step4
.
switch_loggin
(
usr1
,
pwd1
)
step4
.
approve_order
(
rejpurchord
)
#审核/驳回采退单:type=1为审核通过,否则为审核驳回
step4
.
switch_loggin
(
usr4
,
pwd4
)
step5
.
deliver_goods
(
rejpurchord
)
#仓库发货
step5
.
picking_goods
(
rejpurchord
)
#仓库拣货
step5
.
switch_loggin
(
usr5
,
pwd5
)
step5
.
outbound_review
(
rejpurchord
)
#出库复核
except
Exception
as
e
:
print
(
'errmsg'
)
traceback
.
print_exc
()
pro_path
=
get_pro_path
()
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
:
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