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.AiNewmediaeditorPage import AiNewmediaeditor
from paga.LoginPage import Login
from common.cutils import ws_error

# AI新媒体编辑页面ui自动化测试
class TestAiNewmediaeditor:
    # 类前置
    def setup_class(self):
        self.login = Login()
        self.AIroom = AIER()
        self.ainewmediaeditorPage = AiNewmediaeditor()
        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_Newmediaeditor()

    # 类后置
    def teardown_class(self):
        DriverTools.quit_driver()

    # AI新媒体编辑-微博流程
    @allure.feature("微博流程")
    def test_find_Weibo(self):
        self.ainewmediaeditorPage.ai_Weibo()
        time.sleep(30)

    # AI新媒体编辑-上传直播间口播稿
    @allure.feature("上传直播间口播稿流程")
    def test_find_broadcasting(self):
        self.ainewmediaeditorPage.update_ai_broadcasting(AiNewmediae_text,updata_AiNewmediae_path)
        time.sleep(50)
        ws_error(2)
        time.sleep(3)






