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)







