def manager_conn_delete(self, conn_label): c = self.manager_get_conn_cell(conn_label) c.click(button=3) menu = self.root.find("conn-menu", "menu") menu.find("conn-delete", "menu item").click() self.click_alert_button("will remove the connection", "Yes") utils.check(lambda: c.dead)
def manager_test_conn_window_cleanup(self, conn_label, childwin): # Give time for the child window to appear and possibly grab focus self.sleep(1) self.get_manager(check_active=False) dogtail.rawinput.drag(childwin.title_coordinates(), (1000, 1000)) self.manager_conn_disconnect(conn_label) utils.check(lambda: not childwin.showing)
def manager_conn_disconnect(self, conn_label): c = self.manager_get_conn_cell(conn_label) c.click() utils.check(lambda: c.state_selected) c.click(button=3) menu = self.root.find("conn-menu", "menu") menu.find("conn-disconnect", "menu item").click() utils.check(lambda: "Not Connected" in c.text) return c
def select_storagebrowser_volume(self, pool, vol, doubleclick=False): browsewin = self.find_window("vmm-storage-browser") browsewin.find_fuzzy(pool, "table cell").click() volcell = browsewin.find_fuzzy(vol, "table cell") if doubleclick: volcell.doubleClick() else: volcell.click() browsewin.find_fuzzy("Choose Volume").click() utils.check(lambda: not browsewin.active)
def find_details_window(self, vmname, click_details=False, shutdown=False): win = self.find_window("%s on" % vmname, "frame") if click_details: win.find("Details", "radio button").click() if shutdown: win.find("Shut Down", "push button").click() run = win.find("Run", "push button") utils.check(lambda: run.sensitive) return win
def _do_click(): vmcell.click() vmcell.click(button=3) menu = self.root.find("vm-action-menu") utils.check(lambda: menu.onscreen) if needs_shutdown: smenu = menu.find("Shut Down", "menu") smenu.point() utils.check(lambda: smenu.onscreen) item = smenu.find(action, "menu item") else: item = menu.find(action, "menu item") utils.check(lambda: item.onscreen) item.point() utils.check(lambda: item.state_selected) item.click() return menu
def click_alert_button(self, label_text, button_text): alert = self.find_window("vmm dialog", "alert") alert.find_fuzzy(label_text, "label") alert.find(button_text, "push button").click() utils.check(lambda: not alert.active)
def check(self, *args, **kwargs): return utils.check(*args, **kwargs)
def manager_vm_action(self, vmname, confirm_click_no=False, run=False, shutdown=False, destroy=False, reset=False, reboot=False, pause=False, resume=False, save=False, restore=False, clone=False, migrate=False, delete=False, details=False): manager = self.get_manager() vmcell = manager.find(vmname + "\n", "table cell") if run: action = "Run" if shutdown: action = "Shut Down" if reboot: action = "Reboot" if reset: action = "Force Reset" if destroy: action = "Force Off" if pause: action = "Pause" if resume: action = "Resume" if save: action = "Save" if restore: action = "Restore" if clone: action = "Clone" if migrate: action = "Migrate" if delete: action = "Delete" if details: action = "Open" needs_shutdown = shutdown or destroy or reset or reboot or save needs_confirm = needs_shutdown or pause def _do_click(): vmcell.click() vmcell.click(button=3) menu = self.root.find("vm-action-menu") utils.check(lambda: menu.onscreen) if needs_shutdown: smenu = menu.find("Shut Down", "menu") smenu.point() utils.check(lambda: smenu.onscreen) item = smenu.find(action, "menu item") else: item = menu.find(action, "menu item") utils.check(lambda: item.onscreen) item.point() utils.check(lambda: item.state_selected) item.click() return menu m = _do_click() if needs_confirm: if confirm_click_no: self.click_alert_button("Are you sure", "No") m = _do_click() self.click_alert_button("Are you sure", "Yes") utils.check(lambda: not m.onscreen)
def manager_conn_connect(self, conn_label): c = self.manager_get_conn_cell(conn_label) c.click(button=3) self.root.find("conn-connect", "menu item").click() utils.check(lambda: "Not Connected" not in c.text) return c
def manager_createconn(self, uri): win = self.manager_open_createconn() win.combo_select("Hypervisor", "Custom URI") win.find("uri-entry", "text").set_text(uri) win.find("Connect", "push button").click() utils.check(lambda: win.showing is False)