def is_task_finished(tab, page, task_name, expected_status, clear_tasks_after_success=True): el = None try: if not sel.is_displayed(tasks_table) or not tabs.is_tab_selected(tab): sel.force_navigate(page) el = tasks_table.find_row_by_cells({ 'task_name': task_name, 'state': expected_status }) if el is None: return False except Exception: return False # throw exception if status is error if 'Error' in sel.get_attribute(sel.element('.//td/img', root=el), 'title'): raise Exception("Task {} errored".format(task_name)) if clear_tasks_after_success: # Remove all finished tasks so they wouldn't poison other tests toolbar.select('Delete Tasks', 'Delete All', invokes_alert=True) sel.handle_alert(cancel=False) return True
def is_vm_analysis_finished(vm_name): """ Check if analysis is finished - if not, reload page """ el = None try: if not pytest.sel.is_displayed(tasks.tasks_table) or \ not tabs.is_tab_selected('All VM Analysis Tasks'): pytest.sel.force_navigate('tasks_all_vm') el = tasks.tasks_table.find_row_by_cells({ 'task_name': "Scan from Vm {}".format(vm_name), 'state': 'finished' }) if el is None: return False except: return False # throw exception if status is error if 'Error' in sel.get_attribute(sel.element('.//td/img', root=el), 'title'): raise Exception("Smart State Analysis errored") # Remove all finished tasks so they wouldn't poison other tests tb.select('Delete Tasks', 'Delete All', invokes_alert=True) sel.handle_alert(cancel=False) return True
def is_host_analysis_finished(): """ Check if analysis is finished - if not, reload page """ if not sel.is_displayed(tasks.tasks_table) or not tabs.is_tab_selected("All Other Tasks"): sel.force_navigate("tasks_all_other") host_analysis_finished = tasks.tasks_table.find_row_by_cells( {"task_name": "SmartState Analysis for '{}'".format(host_name), "state": "Finished"} ) return host_analysis_finished is not None
def is_datastore_analysis_finished(): """ Check if analysis is finished - if not, reload page """ if not sel.is_displayed(tasks.tasks_table) or not tabs.is_tab_selected('All Other Tasks'): sel.force_navigate('tasks_all_other') host_analysis_finished = tasks.tasks_table.find_row_by_cells({ 'task_name': "SmartState Analysis for [{}]".format(datastore_name), 'state': 'Finished' }) return host_analysis_finished is not None
def is_vm_analysis_finished(): """ Check if analysis is finished - if not, reload page """ if not pytest.sel.is_displayed(tasks.tasks_table) or \ not tabs.is_tab_selected('All VM Analysis Tasks'): pytest.sel.force_navigate('tasks_all_vm') vm_analysis_finished = tasks.tasks_table.find_row_by_cells({ 'task_name': "Scan from Vm {}".format(vm.name), 'state': 'finished' }) return vm_analysis_finished is not None
def is_host_analysis_finished(): """ Check if analysis is finished - if not, reload page """ if not sel.is_displayed(tasks.tasks_table) or not tabs.is_tab_selected('All Other Tasks'): sel.force_navigate('tasks_all_other') host_analysis_finished = tasks.tasks_table.find_row_by_cells({ 'task_name': "SmartState Analysis for '{}'".format(test_host.name), 'state': 'Finished' }) if host_analysis_finished: # Delete the task tasks.tasks_table.select_row_by_cells({ 'task_name': "SmartState Analysis for '{}'".format(test_host.name), 'state': 'Finished' }) tb.select('Delete Tasks', 'Delete', invokes_alert=True) sel.handle_alert() return host_analysis_finished is not None
def is_host_analysis_finished(): """ Check if analysis is finished - if not, reload page """ if not sel.is_displayed(tasks.tasks_table) or not tabs.is_tab_selected( 'All Other Tasks'): sel.force_navigate('tasks_all_other') host_analysis_finished = tasks.tasks_table.find_row_by_cells({ 'task_name': "SmartState Analysis for '{}'".format(host_name), 'state': 'Finished' }) if host_analysis_finished: # Delete the task tasks.tasks_table.select_row_by_cells({ 'task_name': "SmartState Analysis for '{}'".format(host_name), 'state': 'Finished' }) tb.select('Delete Tasks', 'Delete', invokes_alert=True) sel.handle_alert() return host_analysis_finished is not None
def am_i_here(self): return match_location(controller='miq_task', title='All UI Tasks') and \ tabs.is_tab_selected(self.tab_name)
def am_i_here(self): return match_location(controller="miq_task", title="All UI Tasks") and tabs.is_tab_selected(self.tab_name)
def am_i_here(self): if match_location(title='Configuration', controller='configuration'): return tabs.is_tab_selected('Default Views')