Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wsDatabasequery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢非
wsDatabasequery
Commits
2223ff0a
Commit
2223ff0a
authored
Feb 07, 2025
by
之约
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新推送企业微信
parent
43c60e13
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
140 additions
and
87 deletions
+140
-87
cutils.py
common/cutils.py
+35
-1
config.py
config.py
+13
-5
AiReviewPage.py
paga/AiReviewPage.py
+1
-1
LoginPage.py
paga/LoginPage.py
+2
-0
test_Aireview.py
script/test_Aireview.py
+46
-39
test_prequalification.py
script/test_prequalification.py
+43
-41
No files found.
common/cutils.py
View file @
2223ff0a
import
json
import
requests
from
selenium.webdriver.support.wait
import
WebDriverWait
from
common.DButils
import
DButils
from
common.untils
import
DriverTools
from
config
import
file_path
from
config
import
file_path
,
wechaturl
,
userid
,
error_answer
def
get_text
(
loc
,
time
=
10
,
fre
=
1
):
...
...
@@ -42,3 +44,35 @@ def read_json(file_name):
list1
.
append
(
temp
)
return
list1
# 发送微信消息
def
error_message
(
text
,
url
=
wechaturl
):
data
=
{
"msgtype"
:
"text"
,
"text"
:
{
"content"
:
text
}
}
requests
.
post
(
url
,
json
=
data
)
# 发送mkdown格式微信消息
def
mk_error_message
(
error_editor
,
error_answer
,
message_id
,
url
=
wechaturl
):
data
=
{
"msgtype"
:
"markdown"
,
"markdown"
:
{
"content"
:
f
"ws推送<font color=
\"
warning
\"
>异常</font>,请相关同事注意。
\n
>问题编辑:<font color=
\"
comment
\"
>{error_editor}</font>
\n
>消息id:<font color=
\"
comment
\"
>{message_id}</font>
\n
>返回消息:<font color=
\"
comment
\"
>{error_answer}</font> "
}
}
requests
.
post
(
url
,
json
=
data
)
def
ws_error
(
find_count
,
user_id
=
userid
,
error_answer_list
=
error_answer
):
data
=
DButils
()
.
select_sql
(
f
"select emp_id,content,id from aicaptain.message_record mr where adviser_id ={user_id} and msg_type != 1 "
f
"and inquiry_msg_meta_id !=0 order by create_time desc limit {find_count} "
)
for
i
in
range
(
len
(
data
)):
for
n
in
error_answer_list
:
if
n
in
data
[
i
][
1
]:
editor
=
DButils
()
.
select_sql
(
f
"select name from aicaptain.job where id= (SELECT job_id FROM aicaptain.employee WHERE "
f
"adviser_id={user_id} and id= {data[i][0]} ); "
)
mk_error_message
(
editor
[
0
][
0
],
n
,
data
[
i
][
2
])
config.py
View file @
2223ff0a
...
...
@@ -31,11 +31,11 @@ updata_traditional_path = path + updata_traditional_name
updata_music_name
=
"审校音频.mp3"
updata_music_path
=
path
+
updata_music_name
word_text
=
r'司令在省城犯了死罪的消息传到村里之前,我们一直认为他是我们这茬人里最有福气的一个。司令是外号,他的乳名叫八月,学名叫孙国栋。我们在村子里念小学时,他的外号就叫响了,连我们那个爱好写诗、开口就合辙押韵的李诗经老师也叫。李老师给我们上语文课,看到黑板不干净,就说:"司令同学,请你上前;抬起你脸,擦擦黑板;小心灰尘,迷了你眼!""唉!"他爽快地答应着走上讲台擦黑板。受李诗经老师影响,我们也喜欢说四言句。李老师说,天下的诗歌、文章,都是从四言句化出来的,只要四言诗作得好,那就是一鞭一道痕,一掌一掴血,一刀一个窟窿,那就没有什么文体能难住你了。星期天我们约司令去放牛,站在大街上 - -他家临街 - -齐声喊叫:"司令司令,你这懒种;日上三竿,太阳晒腚。东洼放牛,南洼割草;沟里摸鱼,河里洗澡;你去不去?不去拉倒。"司令的娘孙寡妇从屋子里走出来,将半截身体探出土墙,不高兴地说:"你们这些孩子,怎么叫俺司令呢?俺有大号的,俺叫孙国栋。""大婶大婶,不要翻脸,我们保证,不再乱喊。"我们真诚地向她道着歉,然后大声喊叫:"司令司令,你真能磨,大闺女上轿,没你罗嗦!"司令攥着一块地瓜从屋子里蹿出来,大声嚷着:"别急别急,各位伙计,若不等我,不够意思!"司令娘对司令说:"往后他们叫你司令不许答应!"司令在我们那班差不多大小的孩子里是个头蹿得最高的,据说他的爹就是个大个子,大个子爹做出大个子儿,天经地义。他的爹外号叫旅长,爹旅长,儿司令,一代更比一代强。也许他的外号就是从他爹的外号的基础上提拔起来的?谁知道呢!司令的爹六○年生活困难时撑死了 - -一架飞机掉在我们村头上,司令的爹和几个村民用担架将受伤的飞行员送到机场,机场里抬出一筐馒头慰劳他们,司令的爹贪食,一口气吃了十七个。口家的路上,走着走着,嘭的一 '
knowledge_text
=
"
测试
"
knowledge_text
=
"
六四
"
find_word_text
=
"测试工程师"
# 测试环境编辑empid
AI_review_empid
=
2372
AI_review_empid
=
7555
AI_Prequalification_empid
=
16583
# 生产环境编辑empid
...
...
@@ -48,13 +48,13 @@ login_url = "https://aistudio.raysgo.com/login"
# login_url = "https://aistudio.5rs.me/login"
# 测试环境用户id
userid
=
10021
64
userid
=
10021
56
# 生产环境用户id
# userid = 1000032332
# 测试环境账号密码
user_name
=
"1
383798838
6"
password
=
"
Aa1012436291
"
user_name
=
"1
767143626
6"
password
=
"
123456
"
# 生产环境账号密码
# user_name = "17711331133"
# password = "Qwe123456"
...
...
@@ -71,3 +71,10 @@ port = 3306
# database_pwd = "4yFSvSBc"
# database = "aireview"
# port = 3306
# 微信机器人url
wechaturl
=
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=6e08818e-de73-4c27-96d5-ac060c5035bf"
# 问题词
error_answer
=
[
"无法回答"
,
"回复超时"
,
"失败"
]
\ No newline at end of file
paga/AiReviewPage.py
View file @
2223ff0a
import
time
from
selenium.webdriver.common.by
import
By
from
Base.BasePage
import
BasePage
from
common.DButils
import
DButils
from
common.untils
import
DriverTools
from
paga.AIEditingRoomPage
import
AIER
from
paga.LoginPage
import
Login
from
common.cutils
import
ws_error
# Ai审校编辑页面
...
...
paga/LoginPage.py
View file @
2223ff0a
...
...
@@ -31,3 +31,5 @@ class Login(BasePage):
script/test_Aireview.py
View file @
2223ff0a
...
...
@@ -11,7 +11,7 @@ from paga.AIEditingRoomPage import AIER
from
paga.AiPrequalificationPage
import
Aiprequalification
from
paga.AiReviewPage
import
Aireview
from
paga.LoginPage
import
Login
from
common.cutils
import
ws_error
# AI审校ui自动化测试
class
TestAireview
:
...
...
@@ -33,48 +33,55 @@ class TestAireview:
DriverTools
.
quit_driver
()
# 图书审校流程
@allure.feature
(
"图书审校流程"
)
def
test_book_review
(
self
):
self
.
aireview
.
book_review
(
updata_pdf_path
)
time
.
sleep
(
3
)
data
=
self
.
dbtuils
.
select_sql
(
f
'SELECT file_name ,status FROM aireview.assistant_task where create_user ={userid} and assistant_code '
'="diction" order by biz_id desc limit 1;'
)
assert
data
[
0
][
0
]
==
updata_pdf_name
# 文本审校流程
@allure.feature
(
"文本审校流程"
)
def
test_text_revierw
(
self
):
self
.
aireview
.
text_revierw
(
word_text
)
time
.
sleep
(
5
)
data
=
self
.
dbtuils
.
select_sql
(
f
"SELECT file_type FROM aireview.assistant_task where create_user ={userid} "
"order by biz_id desc limit 1;"
)
assert
data
[
0
][
0
]
==
"text"
# 繁体字审校流程
@allure.feature
(
"繁体字审校流程"
)
def
test_traditional_review
(
self
):
self
.
aireview
.
traditional_review
(
updata_traditional_path
)
time
.
sleep
(
5
)
data
=
self
.
dbtuils
.
select_sql
(
f
"SELECT assistant_code FROM aireview.assistant_task where create_user ={userid} "
"order by biz_id desc limit 1;"
)
assert
data
[
0
][
0
]
==
"unsimplified"
# 多媒体审校流程
@allure.feature
(
"多媒体审校流程"
)
def
test_media_review
(
self
):
self
.
aireview
.
media_review
([
updata_picture_path
,
updata_video_path
,
updata_qrcode_path
,
updata_music_path
])
time
.
sleep
(
5
)
# @allure.feature("图书审校流程")
# def test_book_review(self):
# self.aireview.book_review(updata_pdf_path)
# time.sleep(3)
# data = self.dbtuils.select_sql(
# f'SELECT file_name ,status FROM aireview.assistant_task where create_user ={userid} and assistant_code '
# '="diction" order by biz_id desc limit 1;')
#
# assert data[0][0] == updata_pdf_name
# 查词查术语流程
@allure.feature
(
"查词查术语流程"
)
def
test_find_word
(
self
):
self
.
aireview
.
find_word
(
knowledge_text
)
time
.
sleep
(
5
)
# # 文本审校流程
# @allure.feature("文本审校流程")
# def test_text_revierw(self):
# self.aireview.text_revierw(word_text)
# time.sleep(5)
# data = self.dbtuils.select_sql(f"SELECT file_type FROM aireview.assistant_task where create_user ={userid} "
# "order by biz_id desc limit 1;")
# assert data[0][0] == "text"
# # 繁体字审校流程
# @allure.feature("繁体字审校流程")
# def test_traditional_review(self):
# self.aireview.traditional_review(updata_traditional_path)
# time.sleep(5)
# data = self.dbtuils.select_sql(f"SELECT assistant_code FROM aireview.assistant_task where create_user ={userid} "
# "order by biz_id desc limit 1;")
# assert data[0][0] == "unsimplified"
# # 多媒体审校流程
# @allure.feature("多媒体审校流程")
# def test_media_review(self):
# self.aireview.media_review([updata_picture_path, updata_video_path, updata_qrcode_path, updata_music_path])
# time.sleep(5)
# # 查词查术语流程
# @allure.feature("查词查术语流程")
# def test_find_word(self):
# self.aireview.find_word(knowledge_text)
# time.sleep(5)
# 知识查证流程
@allure.feature
(
"知识查证流程"
)
def
test_find_knowledge
(
self
):
self
.
aireview
.
find_knowledge
(
knowledge_text
)
time
.
sleep
(
5
)
time
.
sleep
(
5
)
ws_error
(
1
)
script/test_prequalification.py
View file @
2223ff0a
import
time
import
allure
from
common.DButils
import
DButils
from
common.untils
import
DriverTools
from
config
import
user_name
,
password
,
updata_pdf_path
,
login_url
,
userid
,
updata_pdf_name
from
paga.AIEditingRoomPage
import
AIER
from
paga.AiPrequalificationPage
import
Aiprequalification
from
paga.LoginPage
import
Login
# AI预审ui自动化测试
class
TestPrequalification
:
# 类前置
def
setup_class
(
self
):
self
.
login
=
Login
()
self
.
AI
=
AIER
()
self
.
aiprequailification
=
Aiprequalification
()
self
.
dbtuils
=
DButils
()
def
setup_method
(
self
):
self
.
driver
=
DriverTools
.
get_driver
()
.
get
(
login_url
)
self
.
login
.
login
(
user_name
,
password
)
# 类后置
def
teardown_class
(
self
):
DriverTools
.
quit_driver
()
# AI预审流程
@allure.feature
(
"AI预审流程"
)
def
test_uodate_file
(
self
):
self
.
AI
.
to_AI_Prequalification
()
time
.
sleep
(
3
)
self
.
aiprequailification
.
update_pdf
(
updata_pdf_path
)
time
.
sleep
(
300
)
data
=
self
.
dbtuils
.
select_sql
(
f
"SELECT file_name,status FROM aireview.assistant_task where create_user ={userid} and assistant_code "
"='preliminarytrial' order by biz_id desc limit 1;"
)
assert
data
[
0
][
0
]
==
updata_pdf_name
assert
data
[
0
][
1
]
==
99
# import time
#
# import allure
#
# from common.DButils import DButils
# from common.untils import DriverTools
# from config import user_name, password, updata_pdf_path, login_url, userid, updata_pdf_name
# from paga.AIEditingRoomPage import AIER
# from paga.AiPrequalificationPage import Aiprequalification
# from paga.LoginPage import Login
#
#
# # AI预审ui自动化测试
# class TestPrequalification:
# # 类前置
# def setup_class(self):
# self.login = Login()
# self.AI = AIER()
# self.aiprequailification = Aiprequalification()
# self.dbtuils = DButils()
#
# def setup_method(self):
# self.driver = DriverTools.get_driver().get(login_url)
# self.login.login(user_name, password)
#
# # 类后置
# def teardown_class(self):
# DriverTools.quit_driver()
#
# # AI预审流程
# @allure.feature("AI预审流程")
# def test_uodate_file(self):
# self.AI.to_AI_Prequalification()
# time.sleep(3)
# self.aiprequailification.update_pdf(updata_pdf_path)
# time.sleep(300)
# data = self.dbtuils.select_sql(
# f"SELECT file_name,status FROM aireview.assistant_task where create_user ={userid} and assistant_code "
# "='preliminarytrial' order by biz_id desc limit 1;")
# assert data[0][0] == updata_pdf_name
# assert data[0][1] == 99
#
#
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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