Commit 8358178d by 宋鹏博

添加示例自动化流程

parent 60e7a1fd
...@@ -12,10 +12,8 @@ caps = { ...@@ -12,10 +12,8 @@ caps = {
"appActivity": "com.android.settings.Settings" # 启动应用界面名 "appActivity": "com.android.settings.Settings" # 启动应用界面名
} }
appium_server_url = "http://127.0.0.1:4723/wd/hub" appium_server_url = "http://127.0.0.1:4723/wd/hub"
# 本机测试路径
# path = r"D:\uifile\\" # 路径
# path = path[0:-1]
# 服务器路径
path = file_path + "/uifile/" path = file_path + "/uifile/"
updata_pdf_name = "七下英语活页.pdf" updata_pdf_name = "七下英语活页.pdf"
...@@ -57,7 +55,7 @@ userid = 1000032332 ...@@ -57,7 +55,7 @@ userid = 1000032332
# 测试环境账号密码 # 测试环境账号密码
# user_name = "13837988386" # user_name = "13837988386"
# password = "Aa1012436291" # password = "Aa1012436291"
# # 生产环境账号密码 # 生产环境账号密码
user_name = "17711331133" user_name = "17711331133"
password = "Qwe123456" password = "Qwe123456"
...@@ -73,3 +71,15 @@ user = "aireview110" ...@@ -73,3 +71,15 @@ user = "aireview110"
database_pwd = "4yFSvSBc" database_pwd = "4yFSvSBc"
database = "aireview" database = "aireview"
port = 3306 port = 3306
# 生产环境示例数据
example_knowlage_file_name = "审校能力【知识性差错】.pdf"
example_Content_risk_file_name = "审校能力【内容风险】.pdf"
error_count_konwlage = 24
error_count_Content_risk = 22
example_knowlage = (example_knowlage_file_name, error_count_konwlage, 1)
example_Content_risk = (example_Content_risk_file_name, error_count_Content_risk, 2)
# # 测试环境示例数据
# example_file_name_list = ("示例一:医疗.pdf", "示例四:党政.pdf")
# error_count_list = (9, 0)
import time import time
from urllib.parse import urlparse, parse_qs
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from Base.BasePage import BasePage from Base.BasePage import BasePage
from config import example_knowlage_file_name, example_Content_risk_file_name
# Ai审校编辑页面 # Ai审校编辑页面
...@@ -51,6 +53,18 @@ class Aireview(BasePage): ...@@ -51,6 +53,18 @@ class Aireview(BasePage):
# 开始审校按钮 # 开始审校按钮
self.start_review_btn = (By.XPATH, "//button[@type='button']") self.start_review_btn = (By.XPATH, "//button[@type='button']")
# 示例
self.example_btn = (By.XPATH, "//span[contains(text(),'示例')]")
# 示例知识性差错文件
self.example_knowlage_file = (By.XPATH,f"//div[@class='example-box']//span[contains(text(),'{example_knowlage_file_name}')]")
# 示例内容风险文件
self.example_Content_risk_file = (By.XPATH, f"//div[@class='example-box']//span[contains(text(),'{example_Content_risk_file_name}')]")
# 审校记录
self.review_record = (By.XPATH, "//span[contains(text(),'审校记录')]")
# 图书审校 # 图书审校
def book_review(self, updata_path): def book_review(self, updata_path):
self.find_ele(self.book_review_btn).click() self.find_ele(self.book_review_btn).click()
...@@ -112,3 +126,35 @@ class Aireview(BasePage): ...@@ -112,3 +126,35 @@ class Aireview(BasePage):
self.find_ele(self.input_box).send_keys(text) self.find_ele(self.input_box).send_keys(text)
time.sleep(1) time.sleep(1)
self.find_ele(self.send_btn).click() self.find_ele(self.send_btn).click()
# 示例审校
def review_example_knowlage_file(self):
self.find_ele(self.book_review_btn).click()
time.sleep(10)
self.find_ele(self.example_btn).click()
time.sleep(10)
self.find_ele(self.example_knowlage_file).click()
time.sleep(10)
self.find_ele(self.send_btn).click()
time.sleep(10)
self.find_ele(self.more_find).click()
time.sleep(10)
self.find_ele(self.start_review_btn).click()
def review_Content_risk_example_file(self):
self.find_ele(self.book_review_btn).click()
time.sleep(10)
self.find_ele(self.example_btn).click()
time.sleep(10)
self.find_ele(self.example_Content_risk_file).click()
time.sleep(10)
self.find_ele(self.send_btn).click()
time.sleep(10)
self.find_ele(self.more_find).click()
time.sleep(10)
self.find_ele(self.start_review_btn).click()
# 去审校记录
def to_review_record(self):
self.find_ele(self.review_record).click()
time.sleep(5)
import time import time
import allure import allure
import pytest
from common.DButils import DButils from common.DButils import DButils
from common.untils import DriverTools from common.untils import DriverTools
from config import user_name, password, word_text, \ from config import user_name, password, word_text, \
updata_traditional_path, updata_music_path, updata_qrcode_path, updata_video_path, updata_picture_path, \ updata_traditional_path, updata_music_path, updata_qrcode_path, updata_video_path, updata_picture_path, \
knowledge_text, login_url, userid, updata_pdf_path, updata_pdf_name knowledge_text, login_url, userid, updata_pdf_path, updata_pdf_name, \
example_knowlage, example_Content_risk
from paga.AIEditingRoomPage import AIER from paga.AIEditingRoomPage import AIER
from paga.AiPrequalificationPage import Aiprequalification from paga.AiPrequalificationPage import Aiprequalification
from paga.AiReviewPage import Aireview from paga.AiReviewPage import Aireview
...@@ -43,6 +45,25 @@ class TestAireview: ...@@ -43,6 +45,25 @@ class TestAireview:
assert data[0][0] == updata_pdf_name assert data[0][0] == updata_pdf_name
# 示例文件审校
@allure.feature("示例审校流程")
@pytest.mark.parametrize("example_file_name,error_count,count", [example_knowlage, example_Content_risk])
def test_example(self, example_file_name, error_count, count):
if count == 1:
self.aireview.review_example_knowlage_file()
time.sleep(5)
self.aireview.review_Content_risk_example_file()
time.sleep(5)
else:
data = self.dbtuils.select_sql(
f"select biz_id from aireview.assistant_task where file_name ='{example_file_name}' and DATE("
"create_time) = CURDATE() order by create_time desc ;")
result = self.dbtuils.select_sql(
f"SELECT coordinates FROM aireview.assistant_fusion_item where biz_id = {data[0][0]}")
assert len(result) == error_count
for i in range(len(result)):
assert result[i] is not None
# 文本审校流程 # 文本审校流程
@allure.feature("文本审校流程") @allure.feature("文本审校流程")
def test_text_revierw(self): def test_text_revierw(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment