diff --git a/tests/uitests/cli.py b/tests/uitests/cli.py index 31e2ac231..bd96465ca 100644 --- a/tests/uitests/cli.py +++ b/tests/uitests/cli.py @@ -65,6 +65,23 @@ class VMMCLI(uiutils.UITestCase): self.app.topwin.find_fuzzy( "add-hardware", "button").showing) + def testShowDelete(self): + self.app.open( + extra_opts=["--show-domain-delete", "test-clone"], + window_name="Delete") + # Ensure details opened too + self.app.root.find("test-clone on", "frame", + check_active=False) + + delete = self.app.topwin + delete.find_fuzzy("Delete", "button").click() + alert = self.app.root.find("vmm dialog", "alert") + alert.find_fuzzy("Yes", "push button").click() + + # Ensure app exits + uiutils.check_in_loop(lambda: not self.app.is_running()) + + def testShowRemoteDBusConnect(self): """ Test the remote app dbus connection diff --git a/tests/uitests/utils.py b/tests/uitests/utils.py index b40cc1c6c..e76244a3a 100644 --- a/tests/uitests/utils.py +++ b/tests/uitests/utils.py @@ -300,7 +300,7 @@ class VMMDogtailNode(dogtail.tree.Node): # Widget search helpers # ######################### - def find(self, name, roleName=None, labeller_text=None): + def find(self, name, roleName=None, labeller_text=None, check_active=True): """ Search root for any widget that contains the passed name/role regex strings. @@ -317,7 +317,7 @@ class VMMDogtailNode(dogtail.tree.Node): # Wait for independent windows to become active in the window manager # before we return them. This ensures the window is actually onscreen # so it sidesteps a lot of race conditions - if ret.roleName in ["frame", "dialog", "alert"]: + if ret.roleName in ["frame", "dialog", "alert"] and check_active: check_in_loop(lambda: ret.active) return ret @@ -410,7 +410,8 @@ class VMMDogtailApp(object): def is_running(self): return bool(self._proc and self._proc.poll() is None) - def open(self, extra_opts=None, check_already_running=True, use_uri=True): + def open(self, extra_opts=None, check_already_running=True, use_uri=True, + window_name=None): extra_opts = extra_opts or [] if tests.utils.clistate.debug: @@ -435,7 +436,7 @@ class VMMDogtailApp(object): self.error_if_already_running() self._proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) self._root = dogtail.tree.root.application("virt-manager") - self._topwin = self._root.find(None, "(frame|dialog|alert)") + self._topwin = self._root.find(window_name, "(frame|dialog|alert)") def stop(self): """ diff --git a/virt-manager b/virt-manager index 15d5109f5..d94151843 100755 --- a/virt-manager +++ b/virt-manager @@ -161,6 +161,8 @@ def parse_commandline(): help="Show domain performance window") parser.add_argument("--show-domain-console", metavar="NAME|ID|UUID", help="Show domain graphical console window") + parser.add_argument("--show-domain-delete", metavar="NAME|ID|UUID", + help="Show domain delete window") parser.add_argument("--show-host-summary", action="store_true", help="Show connection details window") @@ -257,6 +259,9 @@ def main(): elif options.show_domain_console: show_window = vmmEngine.CLI_SHOW_DOMAIN_CONSOLE domain = options.show_domain_console + elif options.show_domain_delete: + show_window = vmmEngine.CLI_SHOW_DOMAIN_DELETE + domain = options.show_domain_delete if show_window and options.uri is None: raise RuntimeError("can't use --show-* options without --connect") diff --git a/virtManager/engine.py b/virtManager/engine.py index 492c67db0..8c7bfd79c 100644 --- a/virtManager/engine.py +++ b/virtManager/engine.py @@ -46,6 +46,7 @@ class vmmEngine(vmmGObject): CLI_SHOW_DOMAIN_EDITOR = "editor" CLI_SHOW_DOMAIN_PERFORMANCE = "performance" CLI_SHOW_DOMAIN_CONSOLE = "console" + CLI_SHOW_DOMAIN_DELETE = "delete" CLI_SHOW_HOST_SUMMARY = "summary" @classmethod @@ -480,13 +481,18 @@ class vmmEngine(vmmGObject): if page == self.CLI_SHOW_DOMAIN_PERFORMANCE: details.activate_performance_page() - elif page == self.CLI_SHOW_DOMAIN_EDITOR: + elif (page in [self.CLI_SHOW_DOMAIN_EDITOR, + self.CLI_SHOW_DOMAIN_DELETE]): details.activate_config_page() elif page == self.CLI_SHOW_DOMAIN_CONSOLE: details.activate_console_page() details.show() + if page == self.CLI_SHOW_DOMAIN_DELETE: + from .delete import vmmDeleteDialog + vmmDeleteDialog.show_instance(details, vm) + def _get_manager(self): from .manager import vmmManager return vmmManager.get_instance(None) @@ -506,7 +512,8 @@ class vmmEngine(vmmGObject): vmmHost.show_instance(None, self._connobjs[uri]) elif (show_window in [self.CLI_SHOW_DOMAIN_EDITOR, self.CLI_SHOW_DOMAIN_PERFORMANCE, - self.CLI_SHOW_DOMAIN_CONSOLE]): + self.CLI_SHOW_DOMAIN_CONSOLE, + self.CLI_SHOW_DOMAIN_DELETE]): self._cli_show_vm_helper(uri, clistr, show_window) else: raise RuntimeError("Unknown cli window command '%s'" %