import time

import allure
import pytest

from common.cutils import get_text
from common.untils import DriverTools
from config import user_name, password
from paga.AIEditingRoomPage import AIER
from paga.DigitalEmployeesPage import DEA
from paga.RaysModernPaperBookPage 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()

    # 数字编辑助理流程
    @allure.title("cs1")
    def test_Digital_Editorial_Assistant(self):
        self.login.login(user_name, password)
        time.sleep(3)
        self.RAYSMPB.to_ai_studio()
        self.AIER.to_ai_room()
        self.DEA.meld()
        result1 = get_text(self.DEA.Make_dubbing)
        expect1 = "制作英语听力"
        assert expect1 == result1
        self.DEA.mmcvo()
        result2 = get_text(self.DEA.multi_role)
        expect2 = "制作配音"
        assert expect2 == result2
        self.DEA.mpbokpra()
        self.DEA.Back()
        self.delete.delete()
        self.RAYSMPB.to_ai_studio()
        self.AIER.to_ai_room()
        self.DEA.mpbokpra_input()
        time.sleep(3)
        result3 = get_text(self.DEA.Modern_paper_book)
        expect3 = "制作现代纸书"
        assert expect3 == result3
        self.DEA.Back()
        self.delete.delete()
        self.RAYSMPB.to_ai_studio()
        self.AIER.to_ai_room()
        self.DEA.pifrss()
        time.sleep(2)



