import sys
import os
from time import sleep

# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
try:
    from 预定系统.Base.base import *
except ModuleNotFoundError as e:
    print(f"ModuleNotFoundError: {e}")
    print("尝试使用绝对路径导入")
    from 预定系统.Base.base import *

def suite_setup():
    STEP(1, "初始化浏览器")
    login_exhibit_url = 'http://192.168.5.200:8080/#/login/logindf'
    login_exhibit_ngrok_url = 'http://nat.ubainsyun.com:11060/#/login/logindf'
    browser_init(login_exhibit_url)

    wd = GSTORE['wd']
    admin_login("Test02", "ubains@123")
    sleep(5)
    INFO("请检查中控屏软件灯光开启的状态是否正常")
    STEP(2, "检查灯光开启状态")
    # 这是全部灯光关闭后在软件界面上的状态显示
    INFO("请检查中控屏软件的灯光关闭状态显示是否正常")
    SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","Control_Manage","light_all_off")
    # 这是全部灯光开启后在软件界面上的状态显示
    INFO("请检查中控屏软件的灯光开启状态显示是否正常")
    SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","Control_Manage","light_all_on")
    # 这是灯光开启前的截图
    INFO("请检查灯光开启前的监控视频状态是否正常")
    SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","Control_Manage","light_down")
    # 这是灯光开启后的截图
    INFO("请检查灯光开启后的监控视频状态是否正常")
    SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Control_Manage", "light_on")

    STEP(3, "检查窗帘的上升下降状态")
    INFO("请检查窗帘上升状态是否正常")
    SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Control_Manage", "curtain_up")
    INFO("请检查窗帘下降状态是否正常")
    SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Control_Manage", "curtain_down")

    STEP(3, "检查空调开启状态")
    # 这是空调关闭的状态显示
    INFO("请检查空调关闭的状态是否正常")
    SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Control_Manage", "air_condition_off")
    # 这是空调开启的状态显示
    INFO("请检查空调开启的状态是否正常")
    SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Control_Manage", "air_condition_on")

    STEP(4, "检查指挥大屏开启状态")
    # 这是指挥大屏关闭的监控视频显示
    INFO("请检查指挥大屏关闭的监控视频状态是否正常")
    SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Control_Manage", "command_screen_down")
    # 这是指挥大屏开启的监控视频显示
    INFO("请检查指挥大屏开启的监控视频状态是否正常")
    SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Control_Manage", "command_screen_on")

    STEP(5,"检查音乐播放状态")
    # 这是音乐开启播放后的界面显示
    INFO("请检查中控屏软件打开音乐播放后的界面状态显示")
    SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Control_Manage", "music_on")
    # 这是音乐关闭播放后的界面显示
    INFO("请检查中控屏软件关闭音乐播放后的界面状态显示")
    SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Control_Manage", "music_off")



def suite_teardown():
    browser_quit()