From 3cb717dced517c6405ee487c21cbceed3966f419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 24 Jun 2016 12:15:32 +0200 Subject: [PATCH] tests: add --sync to xdotool windowactivate This may help getting less errors from xdotool... --- tests/vm_qrexec_gui.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/vm_qrexec_gui.py b/tests/vm_qrexec_gui.py index fbff923d..d8ed9965 100644 --- a/tests/vm_qrexec_gui.py +++ b/tests/vm_qrexec_gui.py @@ -127,7 +127,7 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin): time.sleep(0.5) subprocess.check_call( ['xdotool', 'search', '--name', title, - 'windowactivate', 'type', 'exit\n']) + 'windowactivate', '--sync', 'type', 'exit\n']) wait_count = 0 while subprocess.call(['xdotool', 'search', '--name', title], @@ -168,7 +168,7 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin): time.sleep(0.5) subprocess.check_call( ['xdotool', 'search', '--name', title, - 'windowactivate', 'type', 'exit\n']) + 'windowactivate', '--sync', 'type', 'exit\n']) wait_count = 0 while subprocess.call(['xdotool', 'search', '--name', title], @@ -1097,25 +1097,24 @@ class TC_20_DispVMMixin(qubes.tests.SystemTestsMixin): replace('(', '\(').replace(')', '\)') time.sleep(1) if "gedit" in window_title: - subprocess.check_call(['xdotool', 'search', '--name', window_title, - 'windowactivate', 'type', 'test test 2\n']) + subprocess.check_call(['xdotool', 'windowactivate', '--sync', winid, + 'type', 'test test 2\n']) time.sleep(0.5) - subprocess.check_call(['xdotool', 'search', '--name', window_title, + subprocess.check_call(['xdotool', 'key', 'ctrl+s', 'ctrl+q']) elif "emacs" in window_title: - subprocess.check_call(['xdotool', 'search', '--name', window_title, - 'windowactivate', 'type', 'test test 2\n']) + subprocess.check_call(['xdotool', 'windowactivate', '--sync', winid, + 'type', 'test test 2\n']) time.sleep(0.5) - subprocess.check_call(['xdotool', 'search', '--name', window_title, + subprocess.check_call(['xdotool', 'key', 'ctrl+x', 'ctrl+s']) - subprocess.check_call(['xdotool', 'search', '--name', window_title, + subprocess.check_call(['xdotool', 'key', 'ctrl+x', 'ctrl+c']) elif "vim" in window_title: - subprocess.check_call(['xdotool', 'search', '--name', window_title, - 'windowactivate', 'key', 'i', - 'type', 'test test 2\n']) + subprocess.check_call(['xdotool', 'windowactivate', '--sync', winid, + 'key', 'i', 'type', 'test test 2\n']) subprocess.check_call( - ['xdotool', 'search', '--name', window_title, + ['xdotool', 'key', 'Escape', 'colon', 'w', 'q', 'Return']) else: self.fail("Unknown editor window: {}".format(window_title)) @@ -1190,7 +1189,7 @@ class TC_30_Gui_daemon(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase): # Type and copy some text subprocess.check_call(['xdotool', 'search', '--name', window_title, - 'windowactivate', + 'windowactivate', '--sync', 'type', '{}'.format(test_string)]) # second xdotool call because type --terminator do not work (SEGV) # additionally do not use search here, so window stack will be empty