Пример #1
0
    def get_task_status_from_history_task(self, task_type, vm_name, host_name,
                                          taskstarttime):
        '''
        Get task status from the history task list
        '''
        self.pd_browser_main_map.switch_to_default_content()
        current_tasks_btn = self.pd_browser_main_map.get_current_task_btn()
        current_tasks_btn.click()
        #time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        tasks_popup = self.pd_browser_main_map.get_popup_tasks()
        tasks_popup_cls_attr = tasks_popup.get_attribute("class")
        PD_DebugLog.debug_print("The current task: " + tasks_popup_cls_attr)
        if not "open-state" in tasks_popup_cls_attr:
            # click the button again
            current_tasks_btn.click()
            time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)

        # Step 13: show the task name
        pd_browser_current_task_map = PD_CurrentTasks_UIMap(
            self.pd_client_browser)
        history_link_btn = pd_browser_current_task_map.get_history_task_link()

        now_handle = self.pd_client_browser.current_window_handle  #得到当前窗口句柄
        history_link_btn.click()
        all_handles = self.pd_client_browser.window_handles  #获取所有窗口句柄

        task_result = 'SUCCESS'
        for handle in all_handles:
            if handle != now_handle:
                self.pd_client_browser.switch_to_window(handle)
                time.sleep(1)

        # check the history log
        pd_browser_history_task_map = PD_HistoryTasks_UIMap(
            self.pd_client_browser)
        time.sleep(1)

        task_target = vm_name
        task_result, task_desc = pd_browser_history_task_map.get_task_description(
            task_type, task_target)
        time.sleep(1)
        self.pd_client_browser.switch_to_window(now_handle)

        return task_result, task_desc
Пример #2
0
    def get_task_status_from_history_task(self, task_type, vm_name, host_name, taskstarttime):
        '''
        Get task status from the history task list
        '''
        self.pd_browser_main_map.switch_to_default_content()
        current_tasks_btn = self.pd_browser_main_map.get_current_task_btn()
        current_tasks_btn.click()
        #time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
        tasks_popup = self.pd_browser_main_map.get_popup_tasks()
        tasks_popup_cls_attr = tasks_popup.get_attribute("class")
        PD_DebugLog.debug_print("The current task: " + tasks_popup_cls_attr)
        if not "open-state" in tasks_popup_cls_attr:
            # click the button again
            current_tasks_btn.click()
            time.sleep(TestSpeedControl.TEST_STEP_INTERVAL)
            
        # Step 13: show the task name
        pd_browser_current_task_map = PD_CurrentTasks_UIMap(self.pd_client_browser)
        history_link_btn = pd_browser_current_task_map.get_history_task_link()
        
                
        now_handle = self.pd_client_browser.current_window_handle #得到当前窗口句柄
        history_link_btn.click()
        all_handles = self.pd_client_browser.window_handles #获取所有窗口句柄
        
        task_result = 'SUCCESS'
        for handle in all_handles:
            if handle != now_handle:
                self.pd_client_browser.switch_to_window(handle)
                time.sleep(1)
                
        # check the history log
        pd_browser_history_task_map = PD_HistoryTasks_UIMap(self.pd_client_browser)
        time.sleep(1)

        task_target = vm_name
        task_result, task_desc = pd_browser_history_task_map.get_task_description(
                              task_type, task_target)
        time.sleep(1)
        self.pd_client_browser.switch_to_window(now_handle)
         
        return task_result, task_desc