Commit eeabd6b3 by 之约

修改代码

parent 3c0b4611
......@@ -15,14 +15,14 @@ class DriverTools:
def get_driver(cls):
if cls.__driver is None:
cls.__options = Options()
cls.__options.add_argument('--headless')
cls.__options.add_argument('--disable-gpu')
cls.__options.add_argument('--no-sandbox')
cls.__options.add_argument('--disable-dev-shm-usage')
cls.__options.add_argument('--remote-debugging-port=9222')
cls.__options.add_argument('--window-size=1366x768')
# cls.__options.add_argument('--headless')
# cls.__options.add_argument('--disable-gpu')
# cls.__options.add_argument('--no-sandbox')
# cls.__options.add_argument('--disable-dev-shm-usage')
# cls.__options.add_argument('--remote-debugging-port=9222')
# cls.__options.add_argument('--window-size=1366x768')
cls.__driver = webdriver.Chrome(options=cls.__options)
# cls.__driver.maximize_window()
cls.__driver.maximize_window()
cls.__driver.implicitly_wait(10)
return cls.__driver
......
......@@ -21,7 +21,7 @@ class AITopicplanning(BasePage):
# 示例按钮
self.example_btn = (By.XPATH, "(//div[@id='exampleButton'])[1]")
# 发送按钮
self.send_file = (By.XPATH, "//button[contains(text(),'发送')]")
self.send_file = (By.XPATH, "(//i[@class='ic ic-icon-send'])[1]")
# 图书查询按钮
self.book_file = (By.XPATH, "/html[1]/body[1]/div[2]/div[1]/section[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[2]/div[2]/div[1]/div[1]/span[1]/span[1]/span[2]/input[1]")
# 图书示例按钮
......@@ -63,56 +63,14 @@ class AITopicplanning(BasePage):
self.find_ele(self.send_file).click()
time.sleep(3)
# AI选题策划编辑-写选题策划案
def ai_freshnews2(self):
self.find_ele(self.freshnews_btn).click()
time.sleep(3)
self.find_ele(self.example_btn).click()
time.sleep(3)
self.find_ele(self.send_file).click()
time.sleep(3)
# AI选题策划编辑-生成选题报告
def ai_report(self,Aibook_file_text):
self.find_ele(self.book_file).send_keys(Aibook_file_text)
time.sleep(5)
self.find_ele(self.searchfor_btn).click()
time.sleep(10)
self.find_ele(self.report_btn).click()
time.sleep(5)
self.find_ele(self.template_btn).click()
time.sleep(5)
self.find_ele(self.reporting_btn).click()
time.sleep(5)
#AI选题策划编辑-去竞品分析
def ai_analysis(self,Aibook_file_text):
time.sleep(5)
self.find_ele(self.book_file).send_keys(Aibook_file_text)
time.sleep(5)
self.find_ele(self.searchfor_btn).click()
time.sleep(5)
self.find_ele(self.Accumulated_btn).click()
time.sleep(5)
self.find_ele(self.style_btn).click()
time.sleep(5)
self.find_ele(self.analysis_btn).click()
time.sleep(5)
self.find_ele(self.goanalysis_btn).click()
time.sleep(5)
self.find_ele(self.goanalysis1_btn).click()
time.sleep(5)
self.find_ele(self.competitiveanalysis_btn).click()
time.sleep(5)
# AI选题策划编辑-导出数据
def ai_exportdata(self,Aibook_file_text):
self.find_ele(self.book_file).send_keys(Aibook_file_text)
time.sleep(5)
self.find_ele(self.searchfor_btn).click()
time.sleep(5)
self.find_ele(self.exportdata_btn).click()
time.sleep(3)
# if __name__ == '__main__':
# driver = DriverTools.get_driver().get("https://aistudio.5rs.me/")
# Login().login("17671436261", "Xf123456")
# AIER().to_AI_Topicplanning()
# AITopicplanning().ai_booktitle()
# time.sleep(3)
# DriverTools.quit_driver()
\ No newline at end of file
# import time
# import allure
# from common.DButils import DButils
# from common.untils import DriverTools
# from config import user_name, password,login_url,AiNewmediae_text,updata_AiNewmediae_path
# from paga.AIEditingRoomPage import AIER
# from paga.AIBookreviewPaga import AIBookreview
# from paga.LoginPage import Login
# from common.cutils import ws_error
# # AI书评编辑页面ui自动化测试
# class TestAIBookreview:
# # 类前置
# def setup_class(self):
# self.login = Login()
# self.AIroom = AIER()
# self.aibookreview = AIBookreview()
# self.dbtuils = DButils()
# def setup_method(self):
# self.driver = DriverTools.get_driver().get(login_url)
# self.login.login(user_name, password)
# self.AIroom.to_AI_Bookreview()
# # 类后置
# def teardown_class(self):
# DriverTools.quit_driver()
# # AI书评编辑-文学书评
# @allure.feature("文学书评流程")
# def test_find_Literary(self):
# self.aibookreview.ai_Literary()
# time.sleep(40)
# # AI书评编辑-上传社科书评
# @allure.feature("上传社科书评流程")
# def test_find_AiNewmediae(self):
# self.aibookreview.update_social_btn(updata_AiNewmediae_path)
# time.sleep(80)
# ws_error(2)
# time.sleep(3)
import time
import allure
from common.DButils import DButils
from common.untils import DriverTools
from config import user_name, password,login_url,AiNewmediae_text,updata_AiNewmediae_path
from paga.AIEditingRoomPage import AIER
from paga.AIBookreviewPaga import AIBookreview
from paga.LoginPage import Login
from common.cutils import ws_error
# AI书评编辑页面ui自动化测试
class TestAIBookreview:
# 类前置
def setup_class(self):
self.login = Login()
self.AIroom = AIER()
self.aibookreview = AIBookreview()
self.dbtuils = DButils()
def setup_method(self):
self.driver = DriverTools.get_driver().get(login_url)
self.login.login(user_name, password)
self.AIroom.to_AI_Bookreview()
# 类后置
def teardown_class(self):
DriverTools.quit_driver()
# AI书评编辑-文学书评
@allure.feature("文学书评流程")
def test_find_Literary(self):
self.aibookreview.ai_Literary()
time.sleep(40)
# AI书评编辑-上传社科书评
@allure.feature("上传社科书评流程")
def test_find_AiNewmediae(self):
self.aibookreview.update_social_btn(updata_AiNewmediae_path)
time.sleep(80)
ws_error(2)
time.sleep(3)
......
......@@ -36,39 +36,6 @@ class TestaiSelectedtopic:
ws_error(1)
time.sleep(3)
# AI选题策划编辑-写选题策划案
@allure.feature("写选题策划案流程")
def test_freshnews2(self):
self.aitopicplanning.ai_freshnews2()
time.sleep(90)
ws_error(2)
time.sleep(3)
# AI选题策划编辑-生成选题报告
@allure.feature("生成选题报告流程")
def test_report(self):
self.aitopicplanning.ai_report(Aibook_file_text)
time.sleep(150)
ws_error(1)
time.sleep(3)
# AI选题策划编辑-去竞品分析
@allure.feature("去竞品分析流程")
def test_ai_analysis(self):
self.aitopicplanning.ai_analysis(Aibook_file_text)
time.sleep(50)
ws_error(1)
time.sleep(3)
# AI选题策划编辑-导出数据
@allure.feature("导出数据流程")
def test_ai_exportdata(self):
self.aitopicplanning.ai_exportdata(Aibook_file_text)
time.sleep(15)
ws_error(1)
time.sleep(3)
......
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