Commit 07724401 by 1161899172@qq.com

修改

parent 2a2acf8e
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="py.test" />
</component>
</module>
\ No newline at end of file
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.10 (venv)" /> <option name="sdkName" value="Python 3.10 (venv)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (kuangjia) (2)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="NewModuleRootManager">
<orderEntry type="jdk" jdkName="Python 3.8" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
...@@ -57,3 +57,9 @@ class BasePage: ...@@ -57,3 +57,9 @@ class BasePage:
alert = self.driver.switch_to.alert alert = self.driver.switch_to.alert
text = alert.text text = alert.text
return text return text
#
def windows_change(self, num):
self.driver.switch_to.window(self.driver.window_handles[num])
def close_window(self):
self.driver.close()
import time
import pytest
from kuangjia.common.cutils import get_text
from kuangjia.common.untils import DriverTools
from kuangjia.config import user_name, password
from kuangjia.paga.AIeditingroom import AIER
from kuangjia.paga.Digitaleditorialassistant import DEA
from kuangjia.paga.RAYSmodernpaperbook import RAYSMPB
from kuangjia.paga.DelPage import Del
from kuangjia.paga.LoginPage import Login
class TestCreate:
# 类前置
def setup_class(self):
self.login = Login()
self.AIER = AIER()
self.RAYSMPB= RAYSMPB()
self.DEA = DEA()
self.delete = Del()
def setup_method(self):
self.driver = DriverTools.get_driver().get('https://rays7.5rs.me/login')
# 类后置
def teardown_class(self):
DriverTools.quit_driver()
# 数字编辑助理流程
def test_test1(self):
self.login.login(user_name, password)
time.sleep(3)
self.RAYSMPB.to_ai_studio()
self.AIER.to_ai_room()
self.DEA.Digital_editing()
# result = get_text(self.DEA.Make_dubbing)
# expect = "制作配听"
# assert expect == result
# print(expect)
time.sleep(2)
self.delete.delete()
import time
from selenium.webdriver.common.by import By
from kuangjia.Base.BasePage import BasePage
#AI编辑工作室首页
class AIER(BasePage):
def __init__(self):
super().__init__('web')
# AI编辑室
self.AI_editing_room = (By.XPATH, "//li[contains(text(),'AI')]")
#点击AI编辑室
def to_ai_room(self):
time.sleep(1)
self.find_ele(self.AI_editing_room).click()
time.sleep(3)
self.windows_change(-1)
time.sleep(1)
...@@ -7,6 +7,7 @@ from selenium.webdriver.support.wait import WebDriverWait ...@@ -7,6 +7,7 @@ from selenium.webdriver.support.wait import WebDriverWait
from kuangjia.Base.BasePage import BasePage from kuangjia.Base.BasePage import BasePage
from kuangjia.common.cutils import get_text from kuangjia.common.cutils import get_text
from kuangjia.common.untils import DriverTools from kuangjia.common.untils import DriverTools
from kuangjia.config import user_name, password
from kuangjia.paga.CodePage import Code from kuangjia.paga.CodePage import Code
from kuangjia.paga.CreatePage import Create from kuangjia.paga.CreatePage import Create
from kuangjia.paga.LoginPage import Login from kuangjia.paga.LoginPage import Login
...@@ -16,8 +17,6 @@ from kuangjia.paga.GivePage import Give ...@@ -16,8 +17,6 @@ from kuangjia.paga.GivePage import Give
class Del(BasePage): class Del(BasePage):
def __init__(self): def __init__(self):
super().__init__('web') super().__init__('web')
# 点击返回按钮
self.reader_fan = (By.XPATH, "/html/body/div[1]/div/section/div[1]/div[1]/div[1]/button/span")
# 点击书刊管理按钮 # 点击书刊管理按钮
self.reader_return = (By.XPATH, "/html/body/div[1]/div/div/div[2]/ul/li[2]/ul/li[2]") self.reader_return = (By.XPATH, "/html/body/div[1]/div/div/div[2]/ul/li[2]/ul/li[2]")
# 定位书刊搜索 # 定位书刊搜索
...@@ -37,11 +36,9 @@ class Del(BasePage): ...@@ -37,11 +36,9 @@ class Del(BasePage):
self.person_name = (By.XPATH, "//span[@class='title-text']") self.person_name = (By.XPATH, "//span[@class='title-text']")
def delete(self): def delete(self):
self.find_ele(self.reader_fan).click()
time.sleep(1)
self.find_ele(self.reader_return).click() self.find_ele(self.reader_return).click()
time.sleep(1) time.sleep(1)
self.find_ele(self.reader_content).send_keys("UI自动化书刊") self.find_ele(self.reader_content).send_keys("红楼梦")
time.sleep(1) time.sleep(1)
self.find_ele(self.reader_query).click() self.find_ele(self.reader_query).click()
time.sleep(1) time.sleep(1)
...@@ -56,7 +53,7 @@ class Del(BasePage): ...@@ -56,7 +53,7 @@ class Del(BasePage):
if __name__ == '__main__': if __name__ == '__main__':
DriverTools.get_driver().get('https://rays7.5rs.me/login') DriverTools.get_driver().get('https://rays7.5rs.me/login')
Login().login() Login().login(user_name,password)
Create().create() Create().create()
Code().code() Code().code()
Give().give() Give().give()
......
import time
from selenium.webdriver.common.by import By
from kuangjia.Base.BasePage import BasePage
from kuangjia.common.cutils import get_text
from kuangjia.common.untils import DriverTools
from kuangjia.config import password, user_name
from kuangjia.paga.LoginPage import Login
class DEA(BasePage):
def __init__(self):
super().__init__('web')
# 数字编辑助理
self.Digital_editorial_assistant = (By.XPATH,"/html[1]/body[1]/div[1]/div[1]/section[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[6]/div[1]/div[1]/div[1]")
# 更多
self.More = (By.XPATH, "//div[@class='button-list-item more-btn']")
# 制作英语听力配音
self.Make_English_listening_dubbing = (
By.XPATH, "//div[@class='button-type-list']//div[1]//div[2]//div[1]//div[1]//div[1]")
# 输入框
self.Input_field = (By.XPATH, "//div[@class='Editor-inner']")
# 发送
self.send = (By.XPATH, "//button[@class='send-button']")
# 推送英语配音
self.Make_dubbing = (By.XPATH, "/html[1]/body[1]/div[1]/div[1]/section[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[11]/div[1]/div[1]/div[2]/div[2]/div[1]/div[2]/div[1]/button[1]/span[1]")
# 制作多角色配音
self.Make_multi_character_voice_overs = (By.XPATH, "//div[@class='button-type-list']//div[1]//div[2]//div[2]//div[1]//div[1]")
# 推送多角色配音
self.multi_role = (By.XPATH, "/html[1]/body[1]/div[1]/div[1]/section[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[11]/div[1]/div[1]/div[2]/div[2]/div[1]/div[2]/div[1]/button[1]/span[1]")
# 现代纸书一键制作
self.Modern_paper_book_one_key_production_resource_allocation = (By.XPATH, "//div[contains(@class,'ant-popover button-list-more-popover ant-popover-placement-topRight')]//div[2]//div[2]//div[1]//div[1]//div[1]")
# 书刊名称输入框
self.Book_title = (By.XPATH, "//input[@placeholder='请输入书刊名称']")
# 点击查询
self.Click_query = (By.XPATH, "//div[@class='CreatBookModal-header']//span")
# 勾选应用音频
self.Audio_frequency = (By.XPATH, "//div[@class='sourceType']//label[2]//span[1]//input[1]")
# 勾选应用读者交流圈
self.Reader_circle = (By.XPATH, "//label[3]//span[1]//input[1]")
# 一键制作
self.click_fabrication = (By.XPATH, "//button[@class='ant-btn ant-btn-primary']//span")
#
self.Home_page = (By.XPATH, "//span[@class='clickable']")
#
self.Home_page01 = (By.XPATH, "//div[@class='system-title']")
def Digital_editing(self):
time.sleep(1)
# self.find_ele(self.Digital_editorial_assistant).click()
# time.sleep(1)
self.find_ele(self.More).click()
time.sleep(1)
self.find_ele(self.Make_English_listening_dubbing).click()
time.sleep(2)
self.windows_change(-1)
self.close_window()
self.windows_change(-1)
self.find_ele(self.Input_field).send_keys("制作英语听力")
time.sleep(2)
self.find_ele(self.send).click()
time.sleep(6)
# a = get_text(self.Make_dubbing)
# print(a)
self.find_ele(self.Make_dubbing).click()
time.sleep(3)
self.windows_change(-1)
self.close_window()
self.windows_change(-1)
self.find_ele(self.More).click()
time.sleep(1)
self.find_ele(self.Make_multi_character_voice_overs).click()
time.sleep(2)
self.windows_change(-1)
self.close_window()
self.windows_change(-1)
self.find_ele(self.Input_field).send_keys("英语配音")
time.sleep(2)
self.find_ele(self.send).click()
time.sleep(6)
self.find_ele(self.multi_role).click()
time.sleep(3)
self.windows_change(-1)
self.close_window()
self.windows_change(-1)
self.find_ele(self.More).click()
time.sleep(3)
self.find_ele(self.Modern_paper_book_one_key_production_resource_allocation).click()
time.sleep(2)
self.find_ele(self.Book_title).send_keys("红楼梦")
time.sleep(2)
self.find_ele(self.Click_query).click()
time.sleep(6)
# self.find_ele(self.Audio_frequency).click()
# time.sleep(1)
# self.find_ele(self.Reader_circle).click()
# time.sleep(1)
self.find_ele(self.click_fabrication).click()
time.sleep(2)
self.find_ele(self.Home_page).click()
time.sleep(2)
self.find_ele(self.Home_page01).click()
time.sleep(5)
if __name__ == '__main__':
DriverTools.get_driver().get('https://rays7.5rs.me/login')
Login().login(user_name, password)
DEA().Digital_editing()
DriverTools.quit_driver()
...@@ -4,6 +4,7 @@ from selenium.webdriver.common.by import By ...@@ -4,6 +4,7 @@ from selenium.webdriver.common.by import By
from kuangjia.Base.BasePage import BasePage from kuangjia.Base.BasePage import BasePage
from kuangjia.common.untils import DriverTools from kuangjia.common.untils import DriverTools
from kuangjia.config import user_name, password
from kuangjia.paga.CodePage import Code from kuangjia.paga.CodePage import Code
from kuangjia.paga.CreatePage import Create from kuangjia.paga.CreatePage import Create
from kuangjia.paga.LoginPage import Login from kuangjia.paga.LoginPage import Login
...@@ -63,7 +64,7 @@ class Give(BasePage): ...@@ -63,7 +64,7 @@ class Give(BasePage):
if __name__ == '__main__': if __name__ == '__main__':
DriverTools.get_driver().get('https://rays7.5rs.me/login') DriverTools.get_driver().get('https://rays7.5rs.me/login')
Login().login() Login().login(user_name,password)
time.sleep(3) time.sleep(3)
Create().create() Create().create()
Code().code() Code().code()
......
...@@ -4,8 +4,7 @@ from selenium.webdriver.common.by import By ...@@ -4,8 +4,7 @@ from selenium.webdriver.common.by import By
from kuangjia.Base.BasePage import BasePage from kuangjia.Base.BasePage import BasePage
from kuangjia.common.untils import DriverTools from kuangjia.common.untils import DriverTools
from kuangjia.common.cutils import get_text from kuangjia.config import password, user_name
from kuangjia.config import user_name, password
class Login(BasePage): class Login(BasePage):
...@@ -29,5 +28,5 @@ class Login(BasePage): ...@@ -29,5 +28,5 @@ class Login(BasePage):
if __name__ == '__main__': if __name__ == '__main__':
DriverTools.get_driver().get('https://rays7.5rs.me/login') DriverTools.get_driver().get('https://rays7.5rs.me/login')
Login().login() Login().login(user_name,password)
DriverTools.quit_driver() DriverTools.quit_driver()
import time
from selenium.webdriver.common.by import By
from kuangjia.Base.BasePage import BasePage
#RASY现代纸书首页
class RAYSMPB(BasePage):
def __init__(self):
super().__init__('web')
# AI编辑工作室
self.AI_editing_studio = (By.XPATH, "//div[@class='system-title']")
#点击AI编辑工作室
def to_ai_studio(self):
time.sleep(1)
self.find_ele(self.AI_editing_studio).click()
[pytest]
disable_test_id_escaping_and_forfeit_all_rights_to_community_support = True
;addopts = -s --html=report/admin/test_admin_login.html --self-contained-html
;addopts = pytest.main([r'--alluredir=./report/temp_jsonreport'])
testpaths = ./script
python_files = test*
python_classes = Test*
python_functions = test*
\ No newline at end of file
import time
import pytest
from common.cutils import get_text
from common.untils import DriverTools
from config import user_name, password
from paga.AIeditingroom import AIER
from paga.Digitaleditorialassistant import DEA
from paga.RAYSmodernpaperbook import RAYSMPB
from paga.DelPage import Del
from paga.LoginPage import Login
class TestCreate:
# 类前置
def setup_class(self):
self.login = Login()
self.AIER = AIER()
self.RAYSMPB= RAYSMPB()
self.DEA = DEA()
self.delete = Del()
def setup_method(self):
self.driver = DriverTools.get_driver().get('https://rays7.5rs.me/login')
# 类后置
def teardown_class(self):
DriverTools.quit_driver()
# 数字编辑助理流程
def test_test1(self):
self.login.login(user_name, password)
time.sleep(3)
self.RAYSMPB.to_ai_studio()
self.AIER.to_ai_room()
self.DEA.Digital_editing()
# result = get_text(self.DEA.Make_dubbing)
# expect = "制作配听"
# assert expect == result
# print(expect)
time.sleep(2)
self.delete.delete()
import time
import pytest
from kuangjia.common.cutils import get_text
from kuangjia.common.untils import DriverTools
from kuangjia.config import user_name, password
from kuangjia.paga.CodePage import Code
from kuangjia.paga.CreatePage import Create
from kuangjia.paga.DelPage import Del
from kuangjia.paga.GivePage import Give
from kuangjia.paga.LoginPage import Login
class TestCreate:
# 类前置
def setup_class(self):
self.login = Login()
self.create = Create()
self.code = Code()
self.give = Give()
self.delete = Del()
def setup_method(self):
self.driver = DriverTools.get_driver().get('https://rays7.5rs.me/login')
# 类后置
def teardown_class(self):
DriverTools.quit_driver()
# 创建书刊流程
def test_test1(self):
self.login.login(user_name, password)
time.sleep(3)
self.create.create()
self.code.code()
self.give.give()
self.delete.delete()
result = get_text(self.delete.person_name)
expect = "RAYS现代纸书"
assert expect == result
print(expect)
@pytest.mark.parametrize("user,password,result",
[("黑泽爽子", "Rmb11111", "密码错误"), ("鉴湖分社1", "Rmb88888", "账号不存在")])
def test_add(self, user, password, result):
self.login.login(user, password)
time.sleep(1)
a = get_text(self.login.login_info)
assert result == a
print(a)
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