diff --git a/tests/__init__.py b/tests/__init__.py index b46a83c6..f75be979 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -361,6 +361,24 @@ class SystemTestsMixin(object): ) time.sleep(0.1) + def enter_keys_in_window(self, title, keys): + """ + Search for window with given title, then enter listed keys there. + The function will wait for said window to appear. + + :param title: title of window + :param keys: list of keys to enter, as for `xdotool key` + :return: None + """ + + # 'xdotool search --sync' sometimes crashes on some race when + # accessing window properties + self.wait_for_window(title) + command = ['xdotool', 'search', '--name', title, + 'windowactivate', + 'key'] + keys + subprocess.check_call(command) + def shutdown_and_wait(self, vm, timeout=60): vm.shutdown() while timeout > 0: diff --git a/tests/vm_qrexec_gui.py b/tests/vm_qrexec_gui.py index d7d442d9..f601d3d3 100644 --- a/tests/vm_qrexec_gui.py +++ b/tests/vm_qrexec_gui.py @@ -54,24 +54,6 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin): self.testvm1 = self.qc[self.testvm1.qid] self.testvm2 = self.qc[self.testvm2.qid] - def enter_keys_in_window(self, title, keys): - """ - Search for window with given title, then enter listed keys there. - The function will wait for said window to appear. - - :param title: title of window - :param keys: list of keys to enter, as for `xdotool key` - :return: None - """ - - # 'xdotool search --sync' sometimes crashes on some race when - # accessing window properties - self.wait_for_window(title) - command = ['xdotool', 'search', '--name', title, - 'windowactivate', - 'key'] + keys - subprocess.check_call(command) - def test_000_start_shutdown(self): self.testvm1.start() self.assertEquals(self.testvm1.get_power_state(), "Running")