tests: move enter_keys_in_window to base SystemTestsMixin class

This ways it will be available also in DispVM tests (already referenced
there), and others.
This commit is contained in:
Marek Marczykowski-Górecki 2015-11-25 03:14:23 +01:00
parent de275cc917
commit a14e1cc86f
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 18 additions and 18 deletions

View File

@ -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:

View File

@ -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")