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:
parent
de275cc917
commit
a14e1cc86f
@ -361,6 +361,24 @@ class SystemTestsMixin(object):
|
|||||||
)
|
)
|
||||||
time.sleep(0.1)
|
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):
|
def shutdown_and_wait(self, vm, timeout=60):
|
||||||
vm.shutdown()
|
vm.shutdown()
|
||||||
while timeout > 0:
|
while timeout > 0:
|
||||||
|
@ -54,24 +54,6 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
self.testvm1 = self.qc[self.testvm1.qid]
|
self.testvm1 = self.qc[self.testvm1.qid]
|
||||||
self.testvm2 = self.qc[self.testvm2.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):
|
def test_000_start_shutdown(self):
|
||||||
self.testvm1.start()
|
self.testvm1.start()
|
||||||
self.assertEquals(self.testvm1.get_power_state(), "Running")
|
self.assertEquals(self.testvm1.get_power_state(), "Running")
|
||||||
|
Loading…
Reference in New Issue
Block a user