tests: handle Whonix in simple GUI tests
Whonix VMs have always hostname of 'host', so handle that when searching for a window based on its title.
This commit is contained in:
parent
f064a4c6ea
commit
33255964c7
@ -75,29 +75,30 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
self.assertEquals(self.testvm1.get_power_state(), "Running")
|
self.assertEquals(self.testvm1.get_power_state(), "Running")
|
||||||
self.testvm1.run("xterm")
|
self.testvm1.run("xterm")
|
||||||
wait_count = 0
|
wait_count = 0
|
||||||
|
title = 'user@{}'.format(self.testvm1.name)
|
||||||
|
if self.template.count("whonix"):
|
||||||
|
title = 'user@host'
|
||||||
while subprocess.call(
|
while subprocess.call(
|
||||||
['xdotool', 'search', '--name', 'user@{}'.
|
['xdotool', 'search', '--name', title],
|
||||||
format(self.testvm1.name)],
|
|
||||||
stdout=open(os.path.devnull, 'w'),
|
stdout=open(os.path.devnull, 'w'),
|
||||||
stderr=subprocess.STDOUT) > 0:
|
stderr=subprocess.STDOUT) > 0:
|
||||||
wait_count += 1
|
wait_count += 1
|
||||||
if wait_count > 100:
|
if wait_count > 100:
|
||||||
self.fail("Timeout while waiting for gnome-terminal window")
|
self.fail("Timeout while waiting for xterm window")
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
['xdotool', 'search', '--name', 'user@{}'.format(self.testvm1.name),
|
['xdotool', 'search', '--name', title,
|
||||||
'windowactivate', 'type', 'exit\n'])
|
'windowactivate', 'type', 'exit\n'])
|
||||||
|
|
||||||
wait_count = 0
|
wait_count = 0
|
||||||
while subprocess.call(['xdotool', 'search', '--name',
|
while subprocess.call(['xdotool', 'search', '--name', title],
|
||||||
'user@{}'.format(self.testvm1.name)],
|
|
||||||
stdout=open(os.path.devnull, 'w'),
|
stdout=open(os.path.devnull, 'w'),
|
||||||
stderr=subprocess.STDOUT) == 0:
|
stderr=subprocess.STDOUT) == 0:
|
||||||
wait_count += 1
|
wait_count += 1
|
||||||
if wait_count > 100:
|
if wait_count > 100:
|
||||||
self.fail("Timeout while waiting for gnome-terminal "
|
self.fail("Timeout while waiting for xterm "
|
||||||
"termination")
|
"termination")
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
@ -109,10 +110,12 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
self.testvm1.start()
|
self.testvm1.start()
|
||||||
self.assertEquals(self.testvm1.get_power_state(), "Running")
|
self.assertEquals(self.testvm1.get_power_state(), "Running")
|
||||||
self.testvm1.run("gnome-terminal")
|
self.testvm1.run("gnome-terminal")
|
||||||
|
title = 'user@{}'.format(self.testvm1.name)
|
||||||
|
if self.template.count("whonix"):
|
||||||
|
title = 'user@host'
|
||||||
wait_count = 0
|
wait_count = 0
|
||||||
while subprocess.call(
|
while subprocess.call(
|
||||||
['xdotool', 'search', '--name', 'user@{}'.
|
['xdotool', 'search', '--name', title],
|
||||||
format(self.testvm1.name)],
|
|
||||||
stdout=open(os.path.devnull, 'w'),
|
stdout=open(os.path.devnull, 'w'),
|
||||||
stderr=subprocess.STDOUT) > 0:
|
stderr=subprocess.STDOUT) > 0:
|
||||||
wait_count += 1
|
wait_count += 1
|
||||||
@ -122,12 +125,11 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
['xdotool', 'search', '--name', 'user@{}'.format(self.testvm1.name),
|
['xdotool', 'search', '--name', title,
|
||||||
'windowactivate', 'type', 'exit\n'])
|
'windowactivate', 'type', 'exit\n'])
|
||||||
|
|
||||||
wait_count = 0
|
wait_count = 0
|
||||||
while subprocess.call(['xdotool', 'search', '--name',
|
while subprocess.call(['xdotool', 'search', '--name', title],
|
||||||
'user@{}'.format(self.testvm1.name)],
|
|
||||||
stdout=open(os.path.devnull, 'w'),
|
stdout=open(os.path.devnull, 'w'),
|
||||||
stderr=subprocess.STDOUT) == 0:
|
stderr=subprocess.STDOUT) == 0:
|
||||||
wait_count += 1
|
wait_count += 1
|
||||||
@ -149,30 +151,31 @@ class TC_00_AppVMMixin(qubes.tests.SystemTestsMixin):
|
|||||||
wait=True) == 0:
|
wait=True) == 0:
|
||||||
xterm_desktop_path = xterm_desktop_path_debian
|
xterm_desktop_path = xterm_desktop_path_debian
|
||||||
self.testvm1.run("qubes-desktop-run {}".format(xterm_desktop_path))
|
self.testvm1.run("qubes-desktop-run {}".format(xterm_desktop_path))
|
||||||
|
title = 'user@{}'.format(self.testvm1.name)
|
||||||
|
if self.template.count("whonix"):
|
||||||
|
title = 'user@host'
|
||||||
wait_count = 0
|
wait_count = 0
|
||||||
while subprocess.call(
|
while subprocess.call(
|
||||||
['xdotool', 'search', '--name', 'user@{}'.
|
['xdotool', 'search', '--name', title],
|
||||||
format(self.testvm1.name)],
|
|
||||||
stdout=open(os.path.devnull, 'w'),
|
stdout=open(os.path.devnull, 'w'),
|
||||||
stderr=subprocess.STDOUT) > 0:
|
stderr=subprocess.STDOUT) > 0:
|
||||||
wait_count += 1
|
wait_count += 1
|
||||||
if wait_count > 100:
|
if wait_count > 100:
|
||||||
self.fail("Timeout while waiting for gnome-terminal window")
|
self.fail("Timeout while waiting for xterm window")
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
['xdotool', 'search', '--name', 'user@{}'.format(self.testvm1.name),
|
['xdotool', 'search', '--name', title,
|
||||||
'windowactivate', 'type', 'exit\n'])
|
'windowactivate', 'type', 'exit\n'])
|
||||||
|
|
||||||
wait_count = 0
|
wait_count = 0
|
||||||
while subprocess.call(['xdotool', 'search', '--name',
|
while subprocess.call(['xdotool', 'search', '--name', title],
|
||||||
'user@{}'.format(self.testvm1.name)],
|
|
||||||
stdout=open(os.path.devnull, 'w'),
|
stdout=open(os.path.devnull, 'w'),
|
||||||
stderr=subprocess.STDOUT) == 0:
|
stderr=subprocess.STDOUT) == 0:
|
||||||
wait_count += 1
|
wait_count += 1
|
||||||
if wait_count > 100:
|
if wait_count > 100:
|
||||||
self.fail("Timeout while waiting for gnome-terminal "
|
self.fail("Timeout while waiting for xterm "
|
||||||
"termination")
|
"termination")
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user