def __init__(self):
     self.log = logging.getLogger(__name__)
     self.log.info("AppSetting init --")
     self.hexMeetHJTWindow = HexmeetWindowSingleton().getHexmeetWindow()
     self.setting_page = self.hexMeetHJTWindow.GroupControl(
         searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext").GroupControl(
             searchDepth=2,
             AutomationId=
             "CHomeDlg.m_pWgtContext.m_pStackedWgtContent.CSettingsForm")
예제 #2
0
 def __init__(self):
     self.hexMeetWindow = HexmeetWindowSingleton().getHexmeetWindow()
     self.reserve_meeting_page = self.hexMeetWindow.GroupControl(
         searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext")
     self.participants_page = self.reserve_meeting_page.GroupControl(
         searchDepth=2,
         AutomationId=
         "CHomeDlg.m_pWgtContext.m_pStackedWgtContent.CWebBrowserWrapperForm"
     )
     self.join_meeting_page = self.hexMeetWindow.WindowControl(
         searchDepth=1, AutomationId="CHomeDlg.CJoinConfDlg")
예제 #3
0
class UserLogin:
    def __init__(self):
        self.hjt_windows = HexmeetWindowSingleton().getHexmeetWindow()
        self.login_windows = auto.WindowControl(
            searchDepth=1, ClassName="ev_app::views::CLoginDlg")
        self.login_page = self.login_windows.CustomControl(
            searchDepth=1, AutomationId="CLoginDlg.m_pStackedWgtContent")

    def go_to_login_page(self):
        self.hjt_windows.GroupControl(searchDepth=1, AutomationId="CHomeDlg.m_pWgtOperationBar")\
            .ImageControl(searchDepth=3, AutomationId="CHomeDlg.m_pWgtOperationBar.m_pWgtLoginUserInfo.horizontalWidget.m_pLblAvatar").Click()
        self.hjt_windows.WindowControl(
            searchDepth=1,
            ClassName="ev_app::views::CMyInfoDlg").ButtonControl(
                searchDepth=2, Name="退出登录").Click()

    def fill_in_server_address(self, server_address):
        server_address_edit = self.login_page.EditControl(
            searchDepth=3,
            AutomationId=
            "CLoginDlg.m_pStackedWgtContent.CLoginInfoForm.verticalWidget_3.m_pEditServer"
        )
        server_address_edit.SendKeys("{BACK}" * 40)
        server_address_edit.SendKeys(server_address)

    def fill_in_account(self, accout):
        accout_edit = self.login_page.EditControl(
            searchDepth=3,
            AutomationId=
            "CLoginDlg.m_pStackedWgtContent.CLoginInfoForm.verticalWidget_4.m_pEditAccount"
        )
        accout_edit.SendKeys("{BACK}" * 40)
        accout_edit.SendKeys(accout)

    def fill_in_password(self, password):
        password_edit = self.login_page.EditControl(
            searchDepth=3,
            AutomationId=
            "CLoginDlg.m_pStackedWgtContent.CLoginInfoForm.verticalWidget_5.m_pEditPassword"
        )
        password_edit.SendKeys("{BACK}" * 40)
        password_edit.SendKeys(password)

    def user_login_commit(self):
        self.login_page.ButtonControl(searchDepth=3, Name="登录").Click()

    def login_fail_commit(self):
        self.login_windows.WindowControl(
            searchDepth=1, ClassName="ev_app::views::AlertDlg").ButtonControl(
                searchDepth=3, Name="确定").Click()
예제 #4
0
 def click_upgrade_notice(self):
     sleep(2)
     log.info("click OK button")
     try:
         HexmeetWindowSingleton().getHexmeetWindow().GroupControl(
             searchDepth=1,
             AutomationId="CHomeDlg.m_pWgtContext").ButtonControl(
                 searchDepth=8, Name="确定").Click()
     except:
         print()
class AppVersion:
    def __init__(self):
        self.hexMeetHJTWindow = HexmeetWindowSingleton().getHexmeetWindow()
        self.app_setting = AppSetting()

    def getAppVersion(self):
        self.app_setting.go_to_setting_page()
        sleep(1)
        setting_form_page = self.hexMeetHJTWindow.GroupControl(
            searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext").GroupControl(
                searchDepth=2,
                AutomationId=
                "CHomeDlg.m_pWgtContext.m_pStackedWgtContent.CSettingsForm")
        setting_form_page.ListItemControl(searchDepth=3, Name="关于").Click()
        sleep(1)
        version = setting_form_page.TextControl(
            searchDepth=7,
            AutomationId=
            "CHomeDlg.m_pWgtContext.m_pStackedWgtContent.CSettingsForm.twgtSettingsPages.qt_tabwidget_stackedwidget.tabSettingsAbout.scrollArea.qt_scrollarea_viewport.scrollAreaWidgetContents.m_pLabVersion"
        ).Name
        return version.split(":", 1)[1]
class UnRegisterCall:
    def __init__(self):
        self.hjt_windows = HexmeetWindowSingleton().getHexmeetWindow()
        self.login_windows = auto.WindowControl(
            searchDepth=1, ClassName="ev_app::views::CLoginDlg")
        self.login_page = self.login_windows.CustomControl(
            searchDepth=1, AutomationId="CLoginDlg.m_pStackedWgtContent")

    def go_to_unregister_call_page(self):
        self.hjt_windows.GroupControl(searchDepth=1, AutomationId="CHomeDlg.m_pWgtOperationBar") \
            .ImageControl(searchDepth=3, AutomationId="CHomeDlg.m_pWgtOperationBar.m_pWgtLoginUserInfo.horizontalWidget.m_pLblAvatar").Click()
        self.hjt_windows.WindowControl(
            searchDepth=1,
            ClassName="ev_app::views::CMyInfoDlg").ButtonControl(
                searchDepth=2, Name="退出登录").Click()
        self.login_windows.ButtonControl(searchDepth=2, Name="返回").Click()
        self.login_page.ButtonControl(searchDepth=3, Name="加入会议").Click()

    def fill_in_server_address(self, server_address):
        server_address_edit = self.login_page.EditControl(
            searchDepth=3,
            AutomationId=
            "CLoginDlg.m_pStackedWgtContent.CLoginJoinConfForm.verticalWidget.m_pEditServer"
        )
        server_address_edit.SendKeys("{BACK}" * 40)
        server_address_edit.SendKeys(server_address)

    def fill_in_conference_id(self, conference_id):
        """暂时改变不了值"""
        self.login_windows.TextControl(searchDepth=2, Name="加入会议").Click()
        x, y = auto.GetCursorPos()
        # Normal PC auto.Click(x + 55, y + 95)
        # Hihg DPI
        auto.Click(x + 45, y + 75)
        auto.SendKeys("{BACK}" * 40)
        auto.SendKeys(conference_id)
        # conference_id_edit = self.login_page.ComboBoxControl(searchDepth=3, AutomationId="CLoginDlg.m_pStackedWgtContent.CLoginJoinConfForm.verticalWidget.m_pCmbBoxConfNumber")
        # conference_id_edit.SendKeys("{BACK}" * 40)
        # conference_id_edit.SendKeys(conference_id)

    def append_password(self, password):
        self.login_windows.TextControl(searchDepth=2, Name="加入会议").Click()
        x, y = auto.GetCursorPos()
        # Normal PC auto.Click(x + 55, y + 95)
        # Hihg DPI
        auto.Click(x + 45, y + 75)
        auto.SendKeys(password)

    def fill_in_display_name(self, display_name):
        display_name_edit = self.login_page.EditControl(
            searchDepth=3,
            AutomationId=
            "CLoginDlg.m_pStackedWgtContent.CLoginJoinConfForm.verticalWidget.m_pEditDisplayName"
        )
        display_name_edit.SendKeys("{BACK}" * 40)
        display_name_edit.SendKeys(display_name)

    def fill_in_password(self, password):
        fill_in_password = auto.WindowControl(searchInterval=1, ClassName="ev_app::views::CInputPasswordWidget").GroupControl(searchDepth=1, AutomationId="CInputPasswordWidget.verticalWidget_2") \
            .EditControl(searchDepth=1, AutomationId="CInputPasswordWidget.verticalWidget_2.m_pInputPasswordEdit")
        fill_in_password.Click()
        fill_in_password.SendKeys(password + "{ENTER}")

    def change_microphone_setting(self):
        self.login_page.CheckBoxControl(searchDepth=3, Name="关闭麦克风").Click()

    def change_camera_setting(self):
        self.login_page.CheckBoxControl(searchDepth=3, Name="关闭摄像头").Click()

    def user_join_commit(self):
        self.login_page.ButtonControl(searchDepth=3, Name="加入").Click()

    def login_fail_commit(self):
        self.login_windows.WindowControl(
            searchDepth=1, ClassName="ev_app::views::AlertDlg").ButtonControl(
                searchDepth=3, Name="确定").Click()

    def fill_in_conference_password(self, password):
        auto.WindowControl(searchDepth=1, ClassName="ev_app::views::CInputPasswordWidget").EditControl(searchDepth=2, AutomationId="CInputPasswordWidget.verticalWidget_2.m_pInputPasswordEdit") \
            .SendKeys(password + "{ENTER}")

    def login_from_unregister_call_page(self):
        self.login_windows.ButtonControl(searchDepth=2, Name="返回").Click()
        sleep(1)
        self.login_windows.ButtonControl(searchDepth=4, Name="登录").Click()
        sleep(1)
        self.login_windows.ButtonControl(searchDepth=4, Name="登录").Click()

    def close_hjt(self):
        self.login_windows.GroupControl(
            searchDepth=1,
            AutomationId="CLoginDlg.m_pWgtTitlebar").ButtonControl(
                searchDepth=1,
                AutomationId="CLoginDlg.m_pWgtTitlebar.m_pBtnClose").Click()
 def __init__(self):
     self.hjt_windows = HexmeetWindowSingleton().getHexmeetWindow()
     self.login_windows = auto.WindowControl(
         searchDepth=1, ClassName="ev_app::views::CLoginDlg")
     self.login_page = self.login_windows.CustomControl(
         searchDepth=1, AutomationId="CLoginDlg.m_pStackedWgtContent")
예제 #8
0
import pytest
import allure
from time import sleep
import uiautomation as auto

from HexmeetPkg.Common import CallType, MicStatus, CameraStatus
from HexmeetPkg.HexmeetWindowsSingleton import HexmeetWindowSingleton
from HexmeetPkg.OperateInMeetingPageObject import OperateInMeeting
from HexmeetPkg.ReserveMeetingPageObject import ReserveMeeting
from HexmeetPkg.joinAMeetingPageObject import JoinAMeeting

hjt_singleton = HexmeetWindowSingleton()
reserve_meeting = ReserveMeeting()
join_a_meeting = JoinAMeeting()
remote_user = "******"
password = "******"

call_matrix = [
    (CallType.Video, MicStatus.MUTE, CameraStatus.MUTE),
    (CallType.Video, MicStatus.MUTE, CameraStatus.UMUTE),
    (CallType.Video, MicStatus.UMUTE, CameraStatus.MUTE),
    (CallType.Video, MicStatus.UMUTE, CameraStatus.UMUTE),
    (CallType.Audio, MicStatus.MUTE, CameraStatus.MUTE),
    (CallType.Audio, MicStatus.MUTE, CameraStatus.UMUTE),
    (CallType.Audio, MicStatus.UMUTE, CameraStatus.MUTE),
    (CallType.Audio, MicStatus.UMUTE, CameraStatus.UMUTE),
]


@allure.parent_suite("预约会议")
@allure.feature("测试HEXMEET APP的设置预约会议操作")
 def __init__(self):
     self.hexMeetHJTWindow = HexmeetWindowSingleton().getHexmeetWindow()
     self.app_setting = AppSetting()
class AppSetting:
    def __init__(self):
        self.log = logging.getLogger(__name__)
        self.log.info("AppSetting init --")
        self.hexMeetHJTWindow = HexmeetWindowSingleton().getHexmeetWindow()
        self.setting_page = self.hexMeetHJTWindow.GroupControl(
            searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext").GroupControl(
                searchDepth=2,
                AutomationId=
                "CHomeDlg.m_pWgtContext.m_pStackedWgtContent.CSettingsForm")

    def go_to_setting_page(self):
        self.log.info("go_to_setting_page")
        self.hexMeetHJTWindow.GroupControl(
            searchDepth=1,
            AutomationId="CHomeDlg.m_pWgtOperationBar").ListControl(
                searchDepth=2,
                ClassName="ev_app::custom_controls::CHomeMenuListView").Click(
                )
        x, y = auto.GetCursorPos()
        auto.Click(x, y + 70)

    def chang_bandwidth(self, value):
        """
        values are
        384K,512K,768K,1M,1.5M,2M,3M,4M
        """
        self.log.info("chang_bandwidth")
        self.go_to_setting_page()
        sleep(3)
        self.setting_page.TextControl(searchDepth=9, Name="呼叫速率").Click()
        x, y = auto.GetCursorPos()
        auto.Click(x, y + 40)
        self.setting_page.ListItemControl(searchDepth=11, Name=value).Click()

    def chang_language(self, language):
        """
        languages are
        English,简体中文
        """
        self.log.info("chang_language")
        self.go_to_setting_page()
        sleep(3)
        if self.setting_page.TextControl(searchDepth=9, Name="语言").Exists():
            self.setting_page.TextControl(searchDepth=9, Name="语言").Click()
        else:
            self.setting_page.TextControl(searchDepth=9,
                                          Name="Language").Click()

        x, y = auto.GetCursorPos()
        auto.Click(x, y + 40)
        self.setting_page.ListItemControl(searchDepth=11,
                                          Name=language).Click()

    def change_snapshot_path(self):
        self.log.info("change_snapshot_path")
        sleep(3)
        self.go_to_setting_page()
        self.setting_page.ButtonControl(
            searchDepth=9,
            AutomationId=
            "CHomeDlg.m_pWgtContext.m_pStackedWgtContent.CSettingsForm.twgtSettingsPages.qt_tabwidget_stackedwidget"
            ".tabSettingsGeneral.m_pScrollGeneral.qt_scrollarea_viewport.scaSettingsGeneral.scorllGeneralWidght"
            ".m_pWgtSnapshotPathPanel.m_pBtnChangeSnapshotPath").Click()
        sleep(1)
        self.hexMeetHJTWindow.WindowControl(searchDepth=1,
                                            Name="请选择截图文件存放位置:").ButtonControl(
                                                searchDepth=1,
                                                Name="选择文件夹").Click()

    def change_auto_login(self):
        self.log.info("change_auto_login")
        self.go_to_setting_page()
        self.setting_page.CheckBoxControl(searchDepth=9, Name="自动登录").Click()

    def change_auto_answer(self):
        self.log.info("change_auto_answer")
        self.go_to_setting_page()
        self.setting_page.CheckBoxControl(searchDepth=9, Name="自动应答").Click()

    def change_disable_prompt(self):
        self.log.info("change_disable_prompt")
        self.go_to_setting_page()
        self.setting_page.CheckBoxControl(searchDepth=10, Name="关闭提示").Click()

    def change_to_full_mode_meeting(self):
        self.log.info("change_to_full_mode_meeting")
        self.go_to_setting_page()
        self.setting_page.TextControl(searchDepth=9, Name="应用").Click()
        auto.WheelDown(5)
        self.setting_page.CheckBoxControl(searchDepth=9,
                                          Name="进入会议时全屏显示").Click()
        sleep(1)
        self.go_to_setting_page()
예제 #11
0
 def __init__(self):
     self.hexMeetWindow = HexmeetWindowSingleton().getHexmeetWindow()
     self.contact_page = self.hexMeetWindow.GroupControl(
         searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext")
예제 #12
0
class Contact:
    def __init__(self):
        self.hexMeetWindow = HexmeetWindowSingleton().getHexmeetWindow()
        self.contact_page = self.hexMeetWindow.GroupControl(
            searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext")

    def __contact_page_click(self):
        self.hexMeetWindow.GroupControl(
            searchDepth=1, AutomationId="CHomeDlg.m_pWgtOperationBar"
        ).ListControl(
            searchDepth=2,
            AutomationId=
            "CHomeDlg.m_pWgtOperationBar.verticalWidget_4.m_pLvMenus").Click()

    def __meeting_page_click(self):
        self.__contact_page_click()
        x, y = auto.GetCursorPos()
        auto.Click(x, y - 70)

    def go_to_contact_organization_page_search(self, name):
        self.__meeting_page_click()
        self.__contact_page_click()
        self.contact_page.RadioButtonControl(searchDepth=11,
                                             Name="组织机构").Click()
        sleep(1)
        self.contact_page.EditControl(searchDepth=11,
                                      Name="请输入名称").SendKeys(name + "{ENTER}")

    def return_from_person_info_page(self):
        log.info("Return from person info page")
        self.contact_page.TextControl(searchDepth=9, Name="用户详情").Click()
        x, y = auto.GetCursorPos()
        auto.Click(x - 302, y)

    def call_from_favorite(self, name, call_type=CallType.Video):
        log.info("call_from_favorite")
        self.__meeting_page_click()
        self.__contact_page_click()
        self.contact_page.TextControl(searchDepth=13, Name=name + " ").Click()
        sleep(1)
        operate_in_meeting = OperateInMeeting()
        if call_type == CallType.Video:
            log.info("Video call")
            self.contact_page.TextControl(searchDepth=11, Name="视频呼叫").Click()
            sleep(20)
            operate_in_meeting.hangup_call()
        else:
            log.info("Audio call")
            self.contact_page.TextControl(searchDepth=11, Name="语音呼叫").Click()
            sleep(20)
            operate_in_meeting.audio_only_hangup()
        # self.return_from_person_info_page()

    def call_from_organization(self, name, call_type=CallType.Video):
        log.info("call_from_organization")
        # 点击会议,再点击通讯录,返回通讯录的原始页面
        self.contact_page.TextControl(searchDepth=12, Name="中创软件测试中心").Click()
        sleep(1)
        operate_in_meeting = OperateInMeeting()
        if call_type == CallType.Video:
            log.info("Video call")
            self.contact_page.TextControl(searchDepth=11, Name="视频呼叫").Click()
            sleep(20)
            operate_in_meeting.hangup_call()
        else:
            log.info("Audio call")
            self.contact_page.TextControl(searchDepth=11, Name="语音呼叫").Click()
            sleep(20)
            operate_in_meeting.audio_only_hangup()
        # self.return_from_person_info_page()

    def click_upgrade_notice(self):
        sleep(2)
        log.info("click OK button")
        try:
            HexmeetWindowSingleton().getHexmeetWindow().GroupControl(
                searchDepth=1,
                AutomationId="CHomeDlg.m_pWgtContext").ButtonControl(
                    searchDepth=8, Name="确定").Click()
        except:
            print()
예제 #13
0
class ReserveMeeting:
    def __init__(self):
        self.hexMeetWindow = HexmeetWindowSingleton().getHexmeetWindow()
        self.reserve_meeting_page = self.hexMeetWindow.GroupControl(
            searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext")
        self.participants_page = self.reserve_meeting_page.GroupControl(
            searchDepth=2,
            AutomationId=
            "CHomeDlg.m_pWgtContext.m_pStackedWgtContent.CWebBrowserWrapperForm"
        )
        self.join_meeting_page = self.hexMeetWindow.WindowControl(
            searchDepth=1, AutomationId="CHomeDlg.CJoinConfDlg")

    def __start_time_pos(self):
        self.hexMeetWindow.TextControl(searchDepth=10, Name="开始时间").Click()
        return auto.GetCursorPos()

    def __meeting_duration_pos(self):
        self.hexMeetWindow.TextControl(searchDepth=10, Name="会议时长").Click()
        return auto.GetCursorPos()

    def go_to_meeting_page(self):
        log.info("Go to the meeting page")
        self.hexMeetWindow.GroupControl(
            searchDepth=1,
            AutomationId="CHomeDlg.m_pWgtOperationBar").ListControl(
                searchDepth=2,
                ClassName="ev_app::custom_controls::CHomeMenuListView").Click(
                )
        x, y = auto.GetCursorPos()
        # auto.Click(x, y - 70)
        # high DPI
        auto.Click(x, y - 55)
        sleep(4)
        self.click_upgrade_notice()

    def reserve_meeting_from_panel(self):
        log.info("Reserve  meeting from panel")
        self.go_to_meeting_page()
        sleep(2)
        self.hexMeetWindow.GroupControl(
            searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext").TextControl(
                searchDepth=9, Name="预约会议").Click()

    def create_now_meeting_from_panel(self):
        log.info("From panel, choose immediate meeting")
        self.go_to_meeting_page()
        sleep(2)
        self.hexMeetWindow.GroupControl(
            searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext").TextControl(
                searchDepth=8, Name="立即会议").Click()

    def choose_date(self):
        log.info("Change date")
        x, y = self.__start_time_pos()
        auto.Click(x + 160, y)

    def choose_time(self):
        log.info("Change time")
        x, y = self.__start_time_pos()
        auto.Click(x + 250, y)
        auto.SetCursorPos(x + 250, y + 80)
        auto.WheelDown(3)
        auto.Click(x + 500, y)

    def choose_now(self):
        log.info("Choose now")
        self.participants_page.TextControl(searchDepth=8, Name="现在").Click()

    def choose_duration(self):
        log.info("Change duration")
        x, y = self.__meeting_duration_pos()
        auto.Click(x + 160, y)
        auto.SetCursorPos(x + 120, y + 100)
        auto.WheelDown(3)
        sleep(1)
        auto.Click(x + 500, y)

    def fill_password(self, password):
        log.info("Fill in password:"******"请输入会议密码").SendKeys(password)

    def same_layout(self):
        log.info("Choose same layout")
        self.reserve_meeting_page.TextControl(searchDepth=12,
                                              Name="相同分屏").Click()

    def auto_redial(self):
        log.info("Choose auto redial")
        self.reserve_meeting_page.TextControl(searchDepth=12,
                                              Name="自动重拨").Click()

    def mute_after_join(self):
        log.info("choose mute after join")
        self.reserve_meeting_page.TextControl(searchDepth=12,
                                              Name="入会自动静音").Click()

    def fill_meeting_notes(self, note):
        log.info("Fill in the meeting notes")
        self.reserve_meeting_page.EditControl(searchDepth=11,
                                              Name="请输入会议备注").SendKeys(note)

    def choose_favorite_contact(self):
        log.info("Choose favorite contact")
        self.reserve_meeting_page.TextControl(searchDepth=7,
                                              Name="添加与会者(0)").Click()
        self.reserve_meeting_page.TextControl(searchDepth=10,
                                              Name=favorite_user).Click()
        self.reserve_meeting_page.TextControl(searchDepth=8, Name="确定").Click()

    def choose_participants(self, name):
        log.info("Find a participant")
        self.reserve_meeting_page.TextControl(searchDepth=7,
                                              Name="添加与会者(0)").Click()
        self.participants_page.RadioButtonControl(searchDepth=8,
                                                  Name="组织机构").Click()
        self.participants_page.EditControl(
            searchDepth=11, Name="请输入名称").SendKeys(name + "{ENTER}")
        sleep(1)
        self.participants_page.TextControl(searchDepth=10,
                                           Name="中创软件测试中心").Click()
        sleep(1)
        self.participants_page.TextControl(searchDepth=6, Name="确定").Click()

    def reserve_confirm(self):
        log.info("Confirm reservation")
        self.participants_page.ButtonControl(searchDepth=5, Name="确定").Click()

    def delete_reserve_meeting(self):
        log.info("Delete the reserved meeting")
        self.reserve_meeting_page.CustomControl(searchDepth=12,
                                                Name="会议详情").Click()
        self.reserve_meeting_page.TextControl(searchDepth=10,
                                              Name="删除会议").Click()
        self.reserve_meeting_page.ButtonControl(searchDepth=7,
                                                Name="确认 ").Click()
        sleep(2)

    def edit_reserve_meeting(self):
        log.info("Edit the reserved meeting")
        self.participants_page.TextControl(searchDepth=10, Name="编辑会议").Click()
        sleep(1)
        self.participants_page.ButtonControl(searchDepth=5, Name="确定").Click()

    def return_from_reserve_meeting(self):
        """无法取得返回的控件,只能通过像素点"""
        log.info("Go back the main reserve meeting page")
        self.participants_page.TextControl(searchDepth=7,
                                           Name="会议基本信息:").Click()
        x, y = auto.GetCursorPos()
        auto.Click(x - 60, y - 60)

    def terminate_now_meeting(self):
        log.info("Terminate the meeting")
        self.click_upgrade_notice()
        self.participants_page.CustomControl(searchDepth=10,
                                             Name="结束会议").Click()
        sleep(1)
        self.reserve_meeting_page.ButtonControl(searchDepth=7,
                                                Name="确认 ").Click()

    def create_a_now_meeting_and_join(self):
        log.info("Create an immediate meeting and join")
        self.go_to_meeting_page()
        self.reserve_meeting_page.TextControl(searchDepth=8,
                                              Name="立即会议").Click()
        sleep(3)
        self.reserve_confirm()
        sleep(15)
        self.return_from_reserve_meeting()
        JoinAMeeting().join_now_meeting_from_reserved_item()

    def meeting_control_after_create(self):
        log.info("Go to meeting control")
        self.participants_page.TextControl(searchDepth=8, Name="进入会控").Click()

    def meeting_control_from_panel(self):
        log.info("Go to meeting control from panel")
        self.participants_page.CustomControl(searchDepth=10,
                                             Name="控制会议").Click()

    def clear_reserved_meeting(self):
        log.info("Cleared un_deleted meetings")
        self.click_upgrade_notice()
        while self.reserve_meeting_page.CustomControl(searchDepth=12,
                                                      Name="会议详情").Exists(1):
            self.reserve_meeting_page.CustomControl(searchDepth=12,
                                                    Name="会议详情").Click()
            sleep(2)
            if self.reserve_meeting_page.TextControl(searchDepth=11,
                                                     Name="结束会议").Exists(1):
                self.reserve_meeting_page.TextControl(searchDepth=11,
                                                      Name="结束会议").Click()
            if self.reserve_meeting_page.TextControl(searchDepth=11,
                                                     Name="删除会议").Exists(1):
                self.reserve_meeting_page.TextControl(searchDepth=11,
                                                      Name="删除会议").Click()
            self.reserve_meeting_page.ButtonControl(searchDepth=8,
                                                    Name="确认 ").Click()
            sleep(3)

    def invite_others_control_now_meeting(self, name):
        sleep(1)
        self.reserve_meeting_page.ButtonControl(searchDepth=8,
                                                Name="邀请").Click()
        sleep(1)
        self.reserve_meeting_page.EditControl(searchDepth=11,
                                              Name="输入用户/终端名称").SendKeys(name)
        sleep(1)
        self.reserve_meeting_page.ButtonControl(searchDepth=7,
                                                Name="< 返回").Click()
        sleep(1)
        self.reserve_meeting_page.ButtonControl(searchDepth=7,
                                                Name="< 返回").Click()

    def click_upgrade_notice(self):
        sleep(5)
        log.info("click OK button")
        try:
            HexmeetWindowSingleton().getHexmeetWindow().GroupControl(
                searchDepth=1,
                AutomationId="CHomeDlg.m_pWgtContext").ButtonControl(
                    searchDepth=8, Name="确定").Click()
        except:
            print("")
 def __init__(self):
     # print("__init__")
     self.hexMeetWindow = HexmeetWindowSingleton().getHexmeetWindow()
class JoinAMeeting:
    def __init__(self):
        # print("__init__")
        self.hexMeetWindow = HexmeetWindowSingleton().getHexmeetWindow()

    def go_to_meeting_page(self):
        log.info("Go to the meeting page")
        self.hexMeetWindow.GroupControl(
            searchDepth=1,
            AutomationId="CHomeDlg.m_pWgtOperationBar").ListControl(
                searchDepth=2,
                ClassName="ev_app::custom_controls::CHomeMenuListView").Click(
                )
        x, y = auto.GetCursorPos()
        auto.Click(x, y - 70)

    def mute_mic(self, micstatus=MicStatus.MUTE):
        log.info("Mute Umute the Miccrophone")
        join_window = auto.WindowControl(
            searchDepth=1, ClassName="ev_app::views::CHomeDlg").WindowControl(
                searchDepth=1, AutomationId="CHomeDlg.CJoinConfDlg")
        mic_checkbox = join_window.CheckBoxControl(
            searchDepth=2,
            AutomationId=
            "CHomeDlg.CJoinConfDlg.verticalWidget_2.m_pChkBoxDisableMic")
        if micstatus == MicStatus.UMUTE and mic_checkbox.GetTogglePattern(
        ).ToggleState == 1:
            mic_checkbox.Click()
        elif micstatus == MicStatus.MUTE and mic_checkbox.GetTogglePattern(
        ).ToggleState == 0:
            mic_checkbox.Click()

    def mute_camera(self, camerastatus=CameraStatus.UMUTE):
        log.info("Mute/Umute Camera")
        join_window = auto.WindowControl(
            searchDepth=1, ClassName="ev_app::views::CHomeDlg").WindowControl(
                searchDepth=1, AutomationId="CHomeDlg.CJoinConfDlg")
        camera_checkbox = join_window.CheckBoxControl(
            searchDepth=2,
            AutomationId=
            "CHomeDlg.CJoinConfDlg.verticalWidget_2.m_pChkBoxDisableCamera")
        if camerastatus == CameraStatus.MUTE and camera_checkbox.GetTogglePattern(
        ).ToggleState == 0:
            camera_checkbox.Click()
        elif camerastatus == CameraStatus.UMUTE and camera_checkbox.GetTogglePattern(
        ).ToggleState == 1:
            camera_checkbox.Click()

    def make_call(self,
                  calltype=CallType.Video,
                  micstatus=MicStatus.UMUTE,
                  camerastatus=CameraStatus.UMUTE):
        log.info(
            "Combination video/Audio call with Mic/Camera with Mute/Umute")
        join_window = auto.WindowControl(
            searchDepth=1, ClassName="ev_app::views::CHomeDlg").WindowControl(
                searchDepth=1, AutomationId="CHomeDlg.CJoinConfDlg")
        video_call = join_window.ButtonControl(
            searchDepth=3,
            AutomationId=
            "CHomeDlg.CJoinConfDlg.verticalWidget_2.horizontalWidget.m_pBtnVideoJoin"
        )
        audio_call = join_window.ButtonControl(
            searchDepth=3,
            AutomationId=
            "CHomeDlg.CJoinConfDlg.verticalWidget_2.horizontalWidget.m_pBtnAudioJoin"
        )
        self.mute_mic(micstatus)
        self.mute_camera(camerastatus)

        if calltype == CallType.Video:
            log.info("Video call")
            video_call.Click()
        else:
            log.info("Audio call")
            audio_call.Click()

    def make_call_and_drop(self,
                           calltype=CallType.Video,
                           micstatus=MicStatus.UMUTE,
                           camerastatus=CameraStatus.UMUTE):
        log.info(
            "Combination video/Audio call with Mic/Camera with Mute/Umute")
        join_window = auto.WindowControl(
            searchDepth=1, ClassName="ev_app::views::CHomeDlg").WindowControl(
                searchDepth=1, AutomationId="CHomeDlg.CJoinConfDlg")
        video_call = join_window.ButtonControl(
            searchDepth=3,
            AutomationId=
            "CHomeDlg.CJoinConfDlg.verticalWidget_2.horizontalWidget.m_pBtnVideoJoin"
        )
        audio_call = join_window.ButtonControl(
            searchDepth=3,
            AutomationId=
            "CHomeDlg.CJoinConfDlg.verticalWidget_2.horizontalWidget.m_pBtnAudioJoin"
        )
        self.mute_mic(micstatus)
        self.mute_camera(camerastatus)
        operate_in_meeting = OperateInMeeting()
        if calltype == CallType.Video:
            log.info("Video call")
            video_call.Click()
            sleep(20)
            operate_in_meeting.hangup_call()
        else:
            log.info("Audio call")
            audio_call.Click()
            sleep(20)
            operate_in_meeting.audio_only_hangup()

    def join_now_meeting_from_panel(self,
                                    calltype=CallType.Video,
                                    micstatus=MicStatus.UMUTE,
                                    camerastatus=CameraStatus.UMUTE):
        log.info("Make a call from the panel")
        self.click_upgrade_notice()
        self.hexMeetWindow.GroupControl(
            searchDepth=1, AutomationId="CHomeDlg.m_pWgtContext").TextControl(
                searchDepth=8, Name="加入会议").Click()
        self.make_call(calltype, micstatus, camerastatus)

    def join_now_meeting_from_top_menu(self,
                                       calltype=CallType.Video,
                                       micstatus=MicStatus.UMUTE,
                                       camerastatus=CameraStatus.UMUTE):
        log.info("Make a call from top menu")
        self.click_upgrade_notice()
        self.hexMeetWindow.GroupControl(
            searchDepth=1,
            AutomationId="CHomeDlg.m_pWgtTitleBar").ButtonControl(
                searchDepth=1,
                AutomationId="CHomeDlg.m_pWgtTitleBar.m_pBtnJoinConf").Click()
        self.make_call(calltype, micstatus, camerastatus)

    def join_now_meeting_from_top_menu_hangup(self,
                                              calltype=CallType.Video,
                                              micstatus=MicStatus.UMUTE,
                                              camerastatus=CameraStatus.UMUTE):
        log.info("Make a call from top menu")
        self.click_upgrade_notice()
        self.hexMeetWindow.GroupControl(
            searchDepth=1,
            AutomationId="CHomeDlg.m_pWgtTitleBar").ButtonControl(
                searchDepth=1,
                AutomationId="CHomeDlg.m_pWgtTitleBar.m_pBtnJoinConf").Click()
        self.make_call_and_drop(calltype, micstatus, camerastatus)

    def join_now_meeting_from_reserved_item(self,
                                            calltype=CallType.Video,
                                            micstatus=MicStatus.UMUTE,
                                            camerastatus=CameraStatus.UMUTE):
        log.info("Make a call from reserved meeting itself")
        self.click_upgrade_notice()
        self.hexMeetWindow.GroupControl(
            searchDepth=1,
            AutomationId="CHomeDlg.m_pWgtContext").CustomControl(
                searchDepth=12, Name="加入会议").Click()
        self.make_call(calltype, micstatus, camerastatus)

    def join_now_meeting_from_reserved_item_and_hangup(
            self,
            calltype=CallType.Video,
            micstatus=MicStatus.UMUTE,
            camerastatus=CameraStatus.UMUTE):
        log.info("Make a call from reserved meeting itself")
        self.click_upgrade_notice()
        self.hexMeetWindow.GroupControl(
            searchDepth=1,
            AutomationId="CHomeDlg.m_pWgtContext").CustomControl(
                searchDepth=12, Name="加入会议").Click()
        self.make_call_and_drop(calltype, micstatus, camerastatus)

    def is_in_meeting(self):
        return auto.WindowControl(searchDepth=1, ClassName="ev_app::views::CLayoutBackgroundDlg").WindowControl(
            searchDepth=1, ClassName="ev_app::views::CLayoutCoverDlg") \
            .GroupControl(searchDepth=2,
                          AutomationId="CLayoutBackgroundDlg.CLayoutPeopleSettingDlg.CLayoutCoverDlg.CLayoutCellCoverDlg.m_pWgtContent").Exists()

    def click_upgrade_notice(self):
        sleep(5)
        log.info("click OK button")
        try:
            HexmeetWindowSingleton().getHexmeetWindow().GroupControl(
                searchDepth=1,
                AutomationId="CHomeDlg.m_pWgtContext").ButtonControl(
                    searchDepth=8, Name="确定").Click()
        except:
            print()