uitests: Use our loop check() helper for all asserts

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-08-25 09:48:56 -04:00
parent 627fa2f611
commit 73b61ffbc9
17 changed files with 428 additions and 429 deletions

View File

@ -26,4 +26,4 @@ class VMMAbout(uiutils.UITestCase):
print("Current year=%s not in about.ui dialog!" % curyear)
win.keyCombo("<ESC>")
uiutils.check_in_loop(lambda: win.visible is False)
uiutils.check(lambda: win.visible is False)

View File

@ -59,7 +59,7 @@ class AddHardware(uiutils.UITestCase):
def _select_hw(self, addhw, hwname, tabname):
addhw.find(hwname, "table cell").click()
tab = addhw.find(tabname, None)
uiutils.check_in_loop(lambda: tab.showing)
uiutils.check(lambda: tab.showing)
return tab
@ -81,7 +81,7 @@ class AddHardware(uiutils.UITestCase):
typ.click_combo_entry()
tab.find("SCSI", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Virtio SCSI
addhw = self._open_addhw_window(details)
@ -91,7 +91,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Model:", "combo box").click_combo_entry()
tab.find("VirtIO SCSI", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# USB 2
addhw = self._open_addhw_window(details)
@ -101,7 +101,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Model:", "combo box").click_combo_entry()
tab.find("USB 2", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# USB 3
addhw = self._open_addhw_window(details)
@ -111,7 +111,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Model:", "combo box").click_combo_entry()
tab.find("USB 3", "menu item").click()
# Can't add more than 1 USB controller, so finish isn't sensitive
self.assertFalse(finish.sensitive)
uiutils.check(lambda: not finish.sensitive)
def testAddCephDisk(self):
"""
@ -130,14 +130,14 @@ class AddHardware(uiutils.UITestCase):
browse.find_fuzzy("some-rbd-vol", "table cell").click()
browse.find("Choose Volume", "push button").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Check disk details, make sure it correctly selected volume
details.find("IDE Disk 2", "table cell").click()
tab = details.find("disk-tab")
uiutils.check_in_loop(lambda: tab.showing)
uiutils.check(lambda: tab.showing)
disk_path = tab.find("disk-source-path")
self.assertTrue("rbd://" in disk_path.text)
uiutils.check(lambda: "rbd://" in disk_path.text)
def testAddDisks(self):
"""
@ -150,7 +150,7 @@ class AddHardware(uiutils.UITestCase):
# Default disk
tab = self._select_hw(addhw, "Storage", "storage-tab")
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Disk with some tweaks
addhw = self._open_addhw_window(details)
@ -166,7 +166,7 @@ class AddHardware(uiutils.UITestCase):
self._click_alert_button("not enough free space", "Close")
tab.find("GiB", "spin button").text = "1.5"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Managed storage tests
addhw = self._open_addhw_window(details)
@ -184,15 +184,15 @@ class AddHardware(uiutils.UITestCase):
newname = "a-newvol"
newvol.find("Name:", "text").text = newname
newvol.find("Finish", "push button").click()
uiutils.check_in_loop(lambda: not newvol.showing)
uiutils.check(lambda: not newvol.showing)
volcell = browse.find(newname, "table cell")
self.assertTrue(volcell.selected)
uiutils.check(lambda: volcell.selected)
browse.find("vol-refresh", "push button").click()
volcell = browse.find(newname, "table cell")
self.assertTrue(volcell.selected)
uiutils.check(lambda: volcell.selected)
browse.find("vol-delete", "push button").click()
self._click_alert_button("permanently delete the volume", "Yes")
uiutils.check_in_loop(lambda: volcell.dead)
uiutils.check(lambda: volcell.dead)
# Test browse local
browse.find("Browse Local", "push button").click()
@ -205,9 +205,10 @@ class AddHardware(uiutils.UITestCase):
fname = "COPYING"
chooser.find(fname, "table cell").click()
chooser.find("Open", "push button").click()
uiutils.check_in_loop(lambda: not chooser.showing)
uiutils.check_in_loop(lambda: addhw.active)
self.assertTrue(("/" + fname) in tab.find("storage-entry").text)
uiutils.check(lambda: not chooser.showing)
uiutils.check(lambda: addhw.active)
storageent = tab.find("storage-entry")
uiutils.check(lambda: ("/" + fname) in storageent.text)
# Reopen dialog, select a volume, etic
tab.find("storage-browse", "push button").click()
@ -216,12 +217,12 @@ class AddHardware(uiutils.UITestCase):
browse.find_fuzzy("disk-pool", "table cell").click()
browse.find("diskvol1", "table cell").click()
browse.find("Choose Volume", "push button").click()
self.assertTrue("/diskvol1" in tab.find("storage-entry").text)
uiutils.check(lambda: "/diskvol1" in storageent.text)
finish.click()
self._click_alert_button("already in use by", "No")
finish.click()
self._click_alert_button("already in use by", "Yes")
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# choose file for floppy
@ -229,11 +230,11 @@ class AddHardware(uiutils.UITestCase):
tab = self._select_hw(addhw, "Storage", "storage-tab")
tab.find("Device type:", "combo box").click()
tab.find("Floppy device", "menu item").click()
self.assertFalse(
tab.find_fuzzy("Create a disk image", "radio").sensitive)
diskradio = tab.find_fuzzy("Create a disk image", "radio")
uiutils.check(lambda: not diskradio.sensitive)
tab.find("storage-entry").text = "/dev/default-pool/bochs-vol"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# empty cdrom
addhw = self._open_addhw_window(details)
@ -243,7 +244,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Bus type:", "combo box").click()
tab.find("SCSI", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
@_search_permissions_decorator
def testAddDiskSearchPermsCheckbox(self, uri, tmpdir):
@ -262,7 +263,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("storage-entry").text = path
finish.click()
self._click_alert_button("emulator may not have", "No")
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Say 'don't ask again'
addhw = self._open_addhw_window(details)
@ -274,7 +275,7 @@ class AddHardware(uiutils.UITestCase):
alert = self.app.root.find_fuzzy("vmm dialog", "alert")
alert.find_fuzzy("Don't ask", "check box").click()
self._click_alert_button("emulator may not have", "No")
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Confirm it doesn't ask about path again
addhw = self._open_addhw_window(details)
@ -283,7 +284,7 @@ class AddHardware(uiutils.UITestCase):
path = tmpdir + "/foo3.img"
tab.find("storage-entry").text = path
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
@_search_permissions_decorator
def testAddDiskSearchPermsSuccess(self, uri, tmpdir):
@ -302,7 +303,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("storage-entry").text = path
finish.click()
self._click_alert_button("emulator may not have", "Yes")
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Confirm it doesn't ask about path again
addhw = self._open_addhw_window(details)
@ -311,7 +312,7 @@ class AddHardware(uiutils.UITestCase):
path = tmpdir + "/foo3.img"
tab.find("storage-entry").text = path
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
@_search_permissions_decorator
def testAddDiskSearchPermsFail(self, uri, tmpdir):
@ -335,7 +336,7 @@ class AddHardware(uiutils.UITestCase):
alert.find_fuzzy("Errors were encountered", "label")
alert.find_fuzzy("Don't ask", "check box").click()
alert.find_fuzzy("OK", "push button").click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Confirm it doesn't ask about path again
addhw = self._open_addhw_window(details)
@ -344,7 +345,7 @@ class AddHardware(uiutils.UITestCase):
path = tmpdir + "/foo2.img"
tab.find("storage-entry").text = path
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
def testAddNetworks(self):
"""
@ -363,7 +364,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Device model:", "combo box").click_combo_entry()
tab.find("virtio", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Manual macvtap
self._open_addhw_window(details)
@ -372,7 +373,7 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("Macvtap device...", "menu item").click()
tab.find("Device name:", "text").text = "macvtapfoo7"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Manual bridge. Also trigger MAC collision
self._open_addhw_window(details)
@ -391,7 +392,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("mac-address-enable", "check box").click()
tab.find("MAC Address Field", "text").text = "00:11:0A:11:00:11"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
def testAddGraphics(self):
@ -417,16 +418,16 @@ class AddHardware(uiutils.UITestCase):
newpass = "foobar"
passwd.typeText(newpass)
tab.find("Show password", "check").click()
uiutils.check_in_loop(lambda: passwd.text == newpass)
uiutils.check(lambda: passwd.text == newpass)
tab.find("Show password", "check").click()
uiutils.check_in_loop(lambda: passwd.text != newpass)
uiutils.check(lambda: passwd.text != newpass)
finish.click()
# Catch a port error
self._click_alert_button("Port must be above 5900", "Close")
tab.find("graphics-port", "spin button").text = "5920"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Spice regular example
self._open_addhw_window(details)
@ -434,7 +435,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Type:", "combo box").click_combo_entry()
tab.find_fuzzy("Spice", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Spice GL example
self._open_addhw_window(details)
@ -447,10 +448,10 @@ class AddHardware(uiutils.UITestCase):
render = tab.find("graphics-rendernode", "combo box")
m = tab.find_fuzzy("Intel Corp", "menu item")
render.click_combo_entry()
self.assertTrue(m.selected)
uiutils.check(lambda: m.selected)
self.pressKey("Escape")
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
def testAddHosts(self):
"""
@ -465,7 +466,7 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("HP Dup USB 1", "table cell").click()
finish.click()
self._click_alert_button("device is already in use by", "Yes")
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add USB device dup2
self._open_addhw_window(details)
@ -473,14 +474,14 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("HP Dup USB 2", "table cell").click()
finish.click()
self._click_alert_button("device is already in use by", "Yes")
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add another USB device
self._open_addhw_window(details)
tab = self._select_hw(addhw, "USB Host Device", "host-tab")
tab.find_fuzzy("Cruzer Micro 256", "table cell").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add PCI device
self._open_addhw_window(details)
@ -488,7 +489,7 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("(Interface eth0)", "table cell").click()
finish.click()
self._click_alert_button("device is already in use by", "Yes")
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
def testAddChars(self):
@ -506,7 +507,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Type:", "combo box").click_combo_entry()
tab.find_fuzzy("Hypervisor default", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add serial+file
self._open_addhw_window(details)
@ -515,14 +516,14 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("Output to a file", "menu item").click()
tab.find("Path:", "text").text = "/tmp/foo.log"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Parallel", "char-tab")
tab.find("Device Type:", "combo box").click()
tab.find_fuzzy("UNIX", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add spicevmc channel
self._open_addhw_window(details)
@ -530,7 +531,7 @@ class AddHardware(uiutils.UITestCase):
# Ensures that this is selected by default
tab.find("com.redhat.spice.0", "combo box")
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
def testAddLXCFilesystem(self):
@ -559,12 +560,12 @@ class AddHardware(uiutils.UITestCase):
browsewin.find_fuzzy("default-pool", "table cell").click()
browsewin.find_fuzzy("bochs-vol", "table cell").click()
choose = browsewin.find("Choose Volume")
uiutils.check_in_loop(lambda: not choose.sensitive)
uiutils.check(lambda: not choose.sensitive)
browsewin.find_fuzzy("dir-vol", "table cell").click()
uiutils.check_in_loop(lambda: choose.sensitive)
uiutils.check(lambda: choose.sensitive)
choose.click()
uiutils.check_in_loop(lambda: addhw.active)
uiutils.check_in_loop(
uiutils.check(lambda: addhw.active)
uiutils.check(
lambda: source.text == "/dev/default-pool/dir-vol")
tab.find_fuzzy("Export filesystem", "check").click()
@ -575,7 +576,7 @@ class AddHardware(uiutils.UITestCase):
self._click_alert_button("aaa...", "Close")
tab.find("Target path:", "text").text = "/foo/target"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add RAM type
self._open_addhw_window(details)
@ -585,7 +586,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Usage:", "spin button").text = "12345"
tab.find("Target path:", "text").text = "/mem"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
def testAddHWMisc(self):
@ -601,7 +602,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Type:", "combo box").click()
tab.find("EvTouch", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add sound
self._open_addhw_window(details)
@ -609,7 +610,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Model:", "combo box").click_combo_entry()
tab.find("HDA", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add video
self._open_addhw_window(details)
@ -617,7 +618,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Model:", "combo box").click_combo_entry()
tab.find("Virtio", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add watchdog
self._open_addhw_window(details)
@ -627,7 +628,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Action:", "combo box").click()
tab.find("Pause the guest", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add smartcard
self._open_addhw_window(details)
@ -635,7 +636,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Mode:", "combo box").click()
tab.find("Passthrough", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add basic filesystem
self._open_addhw_window(details)
@ -643,7 +644,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Source path:", "text").text = "/foo/source"
tab.find("Target path:", "text").text = "/foo/target"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add TPM
self._open_addhw_window(details)
@ -654,14 +655,14 @@ class AddHardware(uiutils.UITestCase):
tab.find("Passthrough", "menu item").click()
tab.find("Device Path:", "text").text = "/tmp/foo"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add RNG
self._open_addhw_window(details)
tab = self._select_hw(addhw, "RNG", "rng-tab")
tab.find("Host Device:", "text").text = "/dev/random"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add Panic
self._open_addhw_window(details)
@ -669,7 +670,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Model:", "combo box").click()
tab.find("Hyper-V", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Add vsock
self._open_addhw_window(details)
@ -677,7 +678,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("vsock-auto").click()
tab.find("vsock-cid").text = "7"
finish.click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
def testAddHWCornerCases(self):
@ -700,7 +701,7 @@ class AddHardware(uiutils.UITestCase):
"label")
alert.find("Details", "toggle button").click_expander()
alert.find("No", "push button").click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
# Test live adding, error dialog, click yes
self._open_addhw_window(details)
@ -711,7 +712,7 @@ class AddHardware(uiutils.UITestCase):
"label")
alert.find("Details", "toggle button").click_expander()
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: alert.dead)
uiutils.check(lambda: alert.dead)
def testAddHWXMLEdit(self):
"""
@ -739,7 +740,7 @@ class AddHardware(uiutils.UITestCase):
# Verify the changes applied
details.find("Xen Disk 1").click()
uiutils.check_in_loop(lambda: details.active)
uiutils.check(lambda: details.active)
win = self._open_addhw_window(details)
tab = self._select_hw(win, "Storage", "storage-tab")
tab.find_fuzzy("Select or create", "radio").click()
@ -751,11 +752,11 @@ class AddHardware(uiutils.UITestCase):
# Select XML, switch to new dev type, verify we change focus
win.find("XML", "page tab").click()
xmleditor = win.find("XML editor")
uiutils.check_in_loop(lambda: xmleditor.showing)
uiutils.check(lambda: xmleditor.showing)
tab = self._select_hw(win, "Network", "network-tab")
uiutils.check_in_loop(lambda: not xmleditor.showing)
uiutils.check(lambda: not xmleditor.showing)
# Do standard xmleditor tests
self._test_xmleditor_interactions(win, finish)
win.find("Cancel", "push button").click()
uiutils.check_in_loop(lambda: not win.visible)
uiutils.check(lambda: not win.visible)

View File

@ -15,55 +15,48 @@ class VMMCLI(uiutils.UITestCase):
def testShowNewVM(self):
self.app.open(extra_opts=["--show-domain-creator"])
self.assertEqual(self.app.topwin.name, "New VM")
uiutils.check(lambda: self.app.topwin.name == "New VM")
self.app.topwin.keyCombo("<alt>F4")
uiutils.check_in_loop(lambda: self.app.is_running() is False)
uiutils.check(lambda: self.app.is_running() is False)
def testShowHost(self):
self.app.open(extra_opts=["--show-host-summary"])
self.assertEqual(self.app.topwin.name,
"test testdriver.xml Connection Details")
self.assertEqual(
self.app.topwin.find_fuzzy("Name:", "text").text,
"test testdriver.xml")
uiutils.check(lambda: self.app.topwin.name == "test testdriver.xml Connection Details")
nametext = self.app.topwin.find_fuzzy("Name:", "text")
uiutils.check(lambda: nametext.text == "test testdriver.xml")
self.app.topwin.keyCombo("<alt>F4")
uiutils.check_in_loop(lambda: self.app.is_running() is False)
uiutils.check(lambda: self.app.is_running() is False)
def testShowDetails(self):
self.app.open(extra_opts=["--show-domain-editor", "test-clone-simple"])
self.assertTrue("test-clone-simple on" in self.app.topwin.name)
self.assertFalse(
self.app.topwin.find_fuzzy(
"Guest is not running", "label").showing)
self.assertTrue(
self.app.topwin.find_fuzzy(
"add-hardware", "button").showing)
uiutils.check(lambda: "test-clone-simple on" in self.app.topwin.name)
rlabel = self.app.topwin.find_fuzzy("Guest is not running", "label")
uiutils.check(lambda: not rlabel.showing)
addhw = self.app.topwin.find_fuzzy("add-hardware", "button")
uiutils.check(lambda: addhw.showing)
self.app.topwin.keyCombo("<alt>F4")
uiutils.check_in_loop(lambda: self.app.is_running() is False)
uiutils.check(lambda: self.app.is_running() is False)
def testShowPerformance(self):
self.app.open(extra_opts=["--show-domain-performance",
"test-clone-simple"])
self.assertTrue("test-clone-simple on" in self.app.topwin.name)
self.assertFalse(
self.app.topwin.find_fuzzy(
"Guest is not running", "label").showing)
self.assertTrue(
self.app.topwin.find_fuzzy("CPU usage", "label").showing)
uiutils.check(lambda: "test-clone-simple on" in self.app.topwin.name)
rlabel = self.app.topwin.find_fuzzy("Guest is not running", "label")
uiutils.check(lambda: not rlabel.showing)
cpulabel = self.app.topwin.find_fuzzy("CPU usage", "label")
uiutils.check(lambda: cpulabel.showing)
def testShowConsole(self):
self.app.open(extra_opts=["--show-domain-console", "test-clone-simple"])
self.assertTrue("test-clone-simple on" in self.app.topwin.name)
self.assertTrue(
self.app.topwin.find_fuzzy(
"Guest is not running", "label").showing)
self.assertFalse(
self.app.topwin.find_fuzzy(
"add-hardware", "button").showing)
uiutils.check(lambda: "test-clone-simple on" in self.app.topwin.name)
rlabel = self.app.topwin.find_fuzzy("Guest is not running", "label")
uiutils.check(lambda: rlabel.showing)
addhw = self.app.topwin.find_fuzzy("add-hardware", "button")
uiutils.check(lambda: not addhw.showing)
def testShowDelete(self):
self.app.open(
@ -78,7 +71,7 @@ class VMMCLI(uiutils.UITestCase):
self._click_alert_button("Are you sure", "Yes")
# Ensure app exits
uiutils.check_in_loop(lambda: not self.app.is_running())
uiutils.check(lambda: not self.app.is_running())
def testShowRemoteDBusConnect(self):
@ -88,11 +81,11 @@ class VMMCLI(uiutils.UITestCase):
self.app.open()
newapp = uiutils.VMMDogtailApp("test:///default")
newapp.open(check_already_running=False)
uiutils.check_in_loop(lambda: not newapp.is_running())
uiutils.check(lambda: not newapp.is_running())
import dogtail.tree
vapps = [a for a in dogtail.tree.root.applications() if
a.name == "virt-manager"]
self.assertEqual(len(vapps), 1)
uiutils.check(lambda: len(vapps) == 1)
self.app.topwin.find("test default", "table cell")
@ -100,18 +93,18 @@ class VMMCLI(uiutils.UITestCase):
# Unknown option
self.app.open(extra_opts=["--idontexist"])
self._click_alert_button("Unhandled command line", "Close")
uiutils.check_in_loop(lambda: not self.app.is_running())
uiutils.check(lambda: not self.app.is_running())
# Missing VM
self.app.open(extra_opts=["--show-domain-delete", "IDONTEXIST"])
self._click_alert_button("does not have VM", "Close")
uiutils.check_in_loop(lambda: not self.app.is_running())
uiutils.check(lambda: not self.app.is_running())
# Bad URI
baduri = "fribfrobfroo"
self.app = uiutils.VMMDogtailApp(baduri)
self._click_alert_button(baduri, "Close")
uiutils.check_in_loop(lambda: not self.app.is_running())
uiutils.check(lambda: not self.app.is_running())
def testCLITraceLibvirt(self):
self.app.open(extra_opts=["--trace-libvirt=mainloop"])

View File

@ -19,11 +19,11 @@ class VMMConnect(uiutils.UITestCase):
c.click(button=3)
self.app.root.find("conn-disconnect",
"menu item").click()
uiutils.check_in_loop(lambda: "Not Connected" in c.text)
uiutils.check(lambda: "Not Connected" in c.text)
c.click(button=3)
self.app.root.find("conn-delete", "menu item").click()
self._click_alert_button("will remove the connection", "Yes")
uiutils.check_in_loop(lambda: c.dead)
uiutils.check(lambda: c.dead)
# Launch the dialog, grab some UI pointers
self.app.root.find("File", "menu").click()
@ -36,7 +36,7 @@ class VMMConnect(uiutils.UITestCase):
host = win.find("Hostname", "text")
urilabel = win.find("uri-label", "label")
urientry = win.find("uri-entry", "text")
assert user.showing is host.showing is True
uiutils.check(lambda: user.showing is host.showing is True)
# Select all HV options
hvcombo = win.find_fuzzy("Hypervisor", "combo box")
@ -53,26 +53,26 @@ class VMMConnect(uiutils.UITestCase):
# Test a simple selection
win.find_fuzzy("Hypervisor", "combo box").click()
win.find_fuzzy("QEMU/KVM user session", "menu item").click()
assert user.showing is host.showing is False
assert urilabel.text == "qemu:///session"
uiutils.check(lambda: user.showing is host.showing is False)
uiutils.check(lambda: urilabel.text == "qemu:///session")
# Cancel the dialog
win.find_fuzzy("Cancel", "push button").click()
uiutils.check_in_loop(lambda: not win.showing)
uiutils.check(lambda: not win.showing)
# Reopen it, confirm content changed
self.app.root.find("File", "menu").click()
self.app.root.find("Add Connection...", "menu item").click()
win = self.app.root.find_fuzzy("Add Connection", "dialog")
assert ":///session" not in urilabel.text
uiutils.check(lambda: ":///session" not in urilabel.text)
# Relaunch the dialog, confirm it doesn't overwrite content
_click_hv("LXC")
uiutils.check_in_loop(lambda: "lxc" in urilabel.text)
uiutils.check(lambda: "lxc" in urilabel.text)
self.app.root.find("File", "menu").click()
self.app.root.find("Add Connection...", "menu item").click()
uiutils.check_in_loop(lambda: win.active)
uiutils.check_in_loop(lambda: "lxc" in urilabel.text)
uiutils.check(lambda: win.active)
uiutils.check(lambda: "lxc" in urilabel.text)
# Enter a failing URI, make sure error is raised, and we can
# fall back to the dialog
@ -83,33 +83,31 @@ class VMMConnect(uiutils.UITestCase):
self._click_alert_button("hostname is required", "OK")
fakeipv6 = "fe80::1"
host.text = fakeipv6
assert urilabel.text == "xen+ssh://fribuser@[%s]/" % fakeipv6
uiutils.check(lambda: urilabel.text == "xen+ssh://fribuser@[%s]/" % fakeipv6)
fakehost = "ix8khfyidontexistkdjur.com"
host.text = fakehost + ":12345"
assert urilabel.text == "xen+ssh://fribuser@%s:12345/" % fakehost
uiutils.check(lambda: urilabel.text == "xen+ssh://fribuser@%s:12345/" % fakehost)
connect.click()
uiutils.check_in_loop(lambda: win.showing is True)
uiutils.check(lambda: win.showing is True)
c = self.app.root.find_fuzzy(fakehost, "table cell")
uiutils.check_in_loop(lambda: "Connecting..." not in c.text,
timeout=10)
uiutils.check(lambda: "Connecting..." not in c.text, timeout=10)
self._click_alert_button("Unable to connect", "No")
# Ensure dialog shows old contents for editing
uiutils.check_in_loop(lambda: win.showing)
assert fakehost in host.text
uiutils.check(lambda: win.showing)
uiutils.check(lambda: fakehost in host.text)
# This time say 'yes'
connect.click()
uiutils.check_in_loop(lambda: win.showing is True)
uiutils.check(lambda: win.showing is True)
c = self.app.root.find_fuzzy(fakehost, "table cell")
uiutils.check_in_loop(lambda: "Connecting..." not in c.text,
timeout=10)
uiutils.check(lambda: "Connecting..." not in c.text, timeout=10)
self._click_alert_button("Unable to connect", "Yes")
c = self.app.root.find_fuzzy(fakehost, "table cell")
# Test with custom test:///default connection
uiutils.check_in_loop(lambda: win.showing is False)
uiutils.check(lambda: win.showing is False)
self.app.root.find("File", "menu").click()
self.app.root.find("Add Connection...", "menu item").click()
win = self.app.root.find_fuzzy("Add Connection", "dialog")
@ -118,7 +116,7 @@ class VMMConnect(uiutils.UITestCase):
connect.click()
# Do it again to make sure things don't explode
uiutils.check_in_loop(lambda: win.showing is False)
uiutils.check(lambda: win.showing is False)
self.app.root.find("File", "menu").click()
self.app.root.find("Add Connection...", "menu item").click()
win = self.app.root.find_fuzzy("Add Connection", "dialog")
@ -127,17 +125,17 @@ class VMMConnect(uiutils.UITestCase):
connect.click()
# Try various connect/disconnect routines
uiutils.check_in_loop(lambda: win.showing is False)
uiutils.check(lambda: win.showing is False)
c = self.app.root.find("test default", "table cell")
c.click(button=3)
self.app.root.find("conn-disconnect", "menu item").click()
uiutils.check_in_loop(lambda: "Not Connected" in c.text)
uiutils.check(lambda: "Not Connected" in c.text)
c.click(button=3)
self.app.root.find("conn-connect", "menu item").click()
c = self.app.root.find("test default", "table cell")
c.click(button=3)
self.app.root.find("conn-disconnect", "menu item").click()
uiutils.check_in_loop(lambda: "Not Connected" in c.text)
uiutils.check(lambda: "Not Connected" in c.text)
c.doubleClick()
c = self.app.root.find("test default", "table cell")
c.click()

View File

@ -30,14 +30,14 @@ class CreateNet(uiutils.UITestCase):
# Create a simple default network
name = win.find("Name:", "text")
finish = win.find("Finish", "push button")
self.assertEqual(name.text, "network")
uiutils.check(lambda: name.text == "network")
newname = "a-test-new-net"
name.text = newname
finish.click()
# Select the new network in the host window, then do
# stop->start->stop->delete, for lifecycle testing
uiutils.check_in_loop(lambda: hostwin.active)
uiutils.check(lambda: hostwin.active)
cell = hostwin.find(newname, "table cell")
delete = hostwin.find("net-delete", "push button")
start = hostwin.find("net-start", "push button")
@ -45,20 +45,20 @@ class CreateNet(uiutils.UITestCase):
cell.click()
stop.click()
uiutils.check_in_loop(lambda: start.sensitive)
uiutils.check(lambda: start.sensitive)
start.click()
uiutils.check_in_loop(lambda: stop.sensitive)
uiutils.check(lambda: stop.sensitive)
stop.click()
uiutils.check_in_loop(lambda: delete.sensitive)
uiutils.check(lambda: delete.sensitive)
# Delete it, clicking No first
delete.click()
self._click_alert_button("permanently delete the network", "No")
uiutils.check_in_loop(lambda: not cell.dead)
uiutils.check(lambda: not cell.dead)
delete.click()
self._click_alert_button("permanently delete the network", "Yes")
# Ensure it's gone
uiutils.check_in_loop(lambda: cell.dead)
uiutils.check(lambda: cell.dead)
def testCreateNetXMLEditor(self):
@ -80,7 +80,7 @@ class CreateNet(uiutils.UITestCase):
xmleditor.text = xmleditor.text.replace(
">%s<" % tmpname, ">%s<" % newname)
finish.click()
uiutils.check_in_loop(lambda: hostwin.active)
uiutils.check(lambda: hostwin.active)
cell = hostwin.find(newname, "table cell")
cell.click()
@ -88,12 +88,12 @@ class CreateNet(uiutils.UITestCase):
win = self._open_create_win(hostwin)
self._test_xmleditor_interactions(win, finish)
win.find("Cancel", "push button").click()
uiutils.check_in_loop(lambda: not win.visible)
uiutils.check(lambda: not win.visible)
# Ensure host window closes fine
hostwin.click()
hostwin.keyCombo("<ctrl>w")
uiutils.check_in_loop(lambda: not hostwin.showing and
uiutils.check(lambda: not hostwin.showing and
not hostwin.active)
def testCreateNetMulti(self):
@ -112,8 +112,10 @@ class CreateNet(uiutils.UITestCase):
win.find("Isolated", "menu item").click()
win.find("IPv4 configuration").click_expander()
win.find("ipv4-network").text = "192.168.100.0/25"
assert win.find("ipv4-start").text == "192.168.100.64"
assert win.find("ipv4-end").text == "192.168.100.126"
ipv4start = win.find("ipv4-start")
ipv4end = win.find("ipv4-end")
uiutils.check(lambda: ipv4start.text == "192.168.100.64")
uiutils.check(lambda: ipv4end.text == "192.168.100.126")
win.find("Enable DHCPv4").click()
win.find("Enable IPv4").click()
win.find("IPv6 configuration").click_expander()
@ -134,16 +136,16 @@ class CreateNet(uiutils.UITestCase):
self._click_alert_button("Error creating virtual network", "Close")
win.find("ipv6-end").text = "fd00:beef:10:6::1:f1"
finish.click()
uiutils.check_in_loop(lambda: hostwin.active)
uiutils.check(lambda: hostwin.active)
# More option work
win = self._open_create_win(hostwin)
win.find("Name:", "text").text = "newnet2"
devicelist = win.find("net-devicelist")
uiutils.check_in_loop(lambda: not devicelist.visible)
uiutils.check(lambda: not devicelist.visible)
win.find("net-mode").click()
win.find("SR-IOV", "menu item").click()
uiutils.check_in_loop(lambda: devicelist.visible)
uiutils.check(lambda: devicelist.visible)
# Just confirm this is here
win.find("No available device", "menu item")
win.find("net-mode").click()
@ -152,7 +154,7 @@ class CreateNet(uiutils.UITestCase):
win.find("Physical device", "menu item").click()
win.find("net-device").text = "fakedev0"
finish.click()
uiutils.check_in_loop(lambda: hostwin.active)
uiutils.check(lambda: hostwin.active)
def testCreateNetSRIOV(self):
"""

View File

@ -13,7 +13,7 @@ class CreatePool(uiutils.UITestCase):
hostwin.find("pool-add", "push button").click()
win = self.app.root.find(
"Add a New Storage Pool", "frame")
uiutils.check_in_loop(lambda: win.active)
uiutils.check(lambda: win.active)
return win
@ -32,20 +32,20 @@ class CreatePool(uiutils.UITestCase):
# Enter the filename and select it
chooser.find(usepath, "table cell").click()
obutton = chooser.find("Open", "push button")
uiutils.check_in_loop(lambda: obutton.sensitive)
uiutils.check(lambda: obutton.sensitive)
obutton.click()
uiutils.check_in_loop(lambda: not chooser.showing)
uiutils.check_in_loop(lambda: win.active)
uiutils.check(lambda: not chooser.showing)
uiutils.check(lambda: win.active)
# Create a simple default dir pool
self.assertEqual(name.text, "pool")
uiutils.check(lambda: name.text == "pool")
newname = "a-test-new-pool"
name.text = newname
finish.click()
# Select the new object in the host window, then do
# stop->start->stop->delete, for lifecycle testing
uiutils.check_in_loop(lambda: hostwin.active)
uiutils.check(lambda: hostwin.active)
cell = hostwin.find(newname, "table cell")
delete = hostwin.find("pool-delete", "push button")
start = hostwin.find("pool-start", "push button")
@ -53,20 +53,20 @@ class CreatePool(uiutils.UITestCase):
cell.click()
stop.click()
uiutils.check_in_loop(lambda: start.sensitive)
uiutils.check(lambda: start.sensitive)
start.click()
uiutils.check_in_loop(lambda: stop.sensitive)
uiutils.check(lambda: stop.sensitive)
stop.click()
uiutils.check_in_loop(lambda: delete.sensitive)
uiutils.check(lambda: delete.sensitive)
# Delete it, clicking 'No' first
delete.click()
self._click_alert_button("permanently delete the pool", "No")
uiutils.check_in_loop(lambda: not cell.dead)
uiutils.check(lambda: not cell.dead)
delete.click()
self._click_alert_button("permanently delete the pool", "Yes")
# Ensure it's gone
uiutils.check_in_loop(lambda: cell.dead)
uiutils.check(lambda: cell.dead)
# Test a disk pool
win = self._open_create_win(hostwin)
@ -108,7 +108,7 @@ class CreatePool(uiutils.UITestCase):
win.find_fuzzy("LVM", "menu item").click()
srcname = win.find_fuzzy("Volgroup", "combo")
srcnametext = win.find_fuzzy("pool-source-name-text")
uiutils.check_in_loop(lambda: srcnametext.text == "testvg1")
uiutils.check(lambda: srcnametext.text == "testvg1")
srcname.click_combo_entry()
win.find_fuzzy("testvg2", "menu item").click()
finish.click()
@ -140,7 +140,7 @@ class CreatePool(uiutils.UITestCase):
# Ensure host window closes fine
hostwin.click()
hostwin.keyCombo("<ctrl>w")
uiutils.check_in_loop(lambda: not hostwin.showing and
uiutils.check(lambda: not hostwin.showing and
not hostwin.active)
@ -160,7 +160,7 @@ class CreatePool(uiutils.UITestCase):
xmleditor.text = xmleditor.text.replace(
">%s<" % tmpname, ">%s<" % newname)
finish.click()
uiutils.check_in_loop(lambda: hostwin.active)
uiutils.check(lambda: hostwin.active)
cell = hostwin.find(newname, "table cell")
cell.click()
@ -168,4 +168,4 @@ class CreatePool(uiutils.UITestCase):
win = self._open_create_win(hostwin)
self._test_xmleditor_interactions(win, finish)
win.find("Cancel", "push button").click()
uiutils.check_in_loop(lambda: not win.visible)
uiutils.check(lambda: not win.visible)

View File

@ -1,7 +1,6 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
import time
import unittest.mock
import tests
@ -28,14 +27,14 @@ class NewVM(uiutils.UITestCase):
oldtext = pagenumlabel.text
newvm.find_fuzzy("Forward", "button").click()
if check:
uiutils.check_in_loop(lambda: pagenumlabel.text != oldtext)
uiutils.check(lambda: pagenumlabel.text != oldtext)
def back(self, newvm, check=True):
pagenumlabel = newvm.find("pagenum-label")
oldtext = pagenumlabel.text
newvm.find_fuzzy("Back", "button").click()
if check:
uiutils.check_in_loop(lambda: pagenumlabel.text != oldtext)
uiutils.check(lambda: pagenumlabel.text != oldtext)
##############
@ -72,12 +71,12 @@ class NewVM(uiutils.UITestCase):
# Back up, select test:///default, verify media-combo is now empty
self.back(newvm)
back = newvm.find_fuzzy("Back", "button")
uiutils.check_in_loop(lambda: not back.sensitive)
uiutils.check(lambda: not back.sensitive)
combo.click()
combo.find_fuzzy("test default").click()
self.forward(newvm)
cdrom.click_combo_entry()
self.assertTrue("/dev/sr1" not in cdrom.fmt_nodes())
uiutils.check(lambda: "/dev/sr1" not in cdrom.fmt_nodes())
def testNewVMManualDefault(self):
"""
@ -89,7 +88,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Manual", "radio").click()
self.forward(newvm)
osentry = newvm.find("oslist-entry")
uiutils.check_in_loop(lambda: not osentry.text)
uiutils.check(lambda: not osentry.text)
# Make sure we throw an error if no OS selected
self.forward(newvm, check=False)
@ -101,7 +100,7 @@ class NewVM(uiutils.UITestCase):
newvm.find("oslist-popover")
osentry.click()
self.pressKey("Enter")
uiutils.check_in_loop(lambda: osentry.text == "Generic OS")
uiutils.check(lambda: osentry.text == "Generic OS")
# Verify back+forward still keeps Generic selected
self.sleep(.5)
@ -109,8 +108,8 @@ class NewVM(uiutils.UITestCase):
self.sleep(.5)
self.forward(newvm)
self.sleep(.5)
uiutils.check_in_loop(lambda: "Generic" in osentry.text)
uiutils.check_in_loop(lambda: osentry.onscreen)
uiutils.check(lambda: "Generic" in osentry.text)
uiutils.check(lambda: osentry.onscreen)
# The sleeps shouldn't be required, but this test continues to be
# flakey, so this is an attempt to fix it.
@ -132,7 +131,7 @@ class NewVM(uiutils.UITestCase):
self._click_alert_button("Are you sure", "Yes")
# Verify delete dialog and VM dialog are now gone
uiutils.check_in_loop(lambda: vmwindow.showing is False)
uiutils.check(lambda: vmwindow.showing is False)
def testNewVMCDROM(self):
@ -164,38 +163,38 @@ class NewVM(uiutils.UITestCase):
browser.find_fuzzy("Choose Volume", "button").click()
osentry = newvm.find("oslist-entry")
uiutils.check_in_loop(lambda: browser.showing is False)
uiutils.check_in_loop(lambda: osentry.text == "None detected")
uiutils.check(lambda: browser.showing is False)
uiutils.check(lambda: osentry.text == "None detected")
# Change distro to win8
newvm.find_fuzzy("Automatically detect", "check").click()
osentry.click()
osentry.text = "windows 8"
popover = newvm.find("oslist-popover")
uiutils.check_in_loop(lambda: popover.onscreen)
uiutils.check(lambda: popover.onscreen)
# Verify Escape resets the text entry
self.pressKey("Escape")
uiutils.check_in_loop(lambda: not popover.onscreen)
assert osentry.text == ""
uiutils.check(lambda: not popover.onscreen)
uiutils.check(lambda: osentry.text == "")
# Re-enter text
osentry.text = "windows 8"
uiutils.check_in_loop(lambda: popover.onscreen)
uiutils.check(lambda: popover.onscreen)
popover.find_fuzzy("include-eol").click()
popover.find_fuzzy(r"\(win8\)").click()
uiutils.check_in_loop(lambda: not popover.onscreen)
uiutils.check(lambda: not popover.onscreen)
foundtext = osentry.text
# Start typing again, and exit, make sure it resets to previous entry
osentry.click()
osentry.text = "foo"
uiutils.check_in_loop(lambda: popover.onscreen)
uiutils.check(lambda: popover.onscreen)
self.pressKey("Escape")
uiutils.check_in_loop(lambda: not popover.onscreen)
assert osentry.text == foundtext
uiutils.check(lambda: not popover.onscreen)
uiutils.check(lambda: osentry.text == foundtext)
self.forward(newvm)
# Verify that CPU values are non-default
cpus = newvm.find("cpus", "spin button")
uiutils.check_in_loop(lambda: int(cpus.text) > 1, timeout=5)
uiutils.check(lambda: int(cpus.text) > 1, timeout=5)
self.forward(newvm)
self.forward(newvm)
@ -206,7 +205,8 @@ class NewVM(uiutils.UITestCase):
# Verify CDROM media is inserted
vmwindow = self.app.root.find_fuzzy("win8 on", "frame")
vmwindow.find_fuzzy("IDE CDROM", "table cell").click()
self.assertTrue("iso-vol" in vmwindow.find("media-entry").text)
mediaent = vmwindow.find("media-entry")
uiutils.check(lambda: "iso-vol" in mediaent.text)
# Change boot autostart
vmwindow.find_fuzzy("Boot", "table cell").click()
@ -222,7 +222,7 @@ class NewVM(uiutils.UITestCase):
vmwindow.find("add-hardware", "push button").click()
addhw = self.app.root.find("Add New Virtual Hardware", "frame")
addhw.find("Finish", "push button").click()
uiutils.check_in_loop(lambda: vmwindow.active)
uiutils.check(lambda: vmwindow.active)
# Select the new disk, change the bus to USB
vmwindow.find_fuzzy("IDE Disk 2", "table cell").click()
@ -231,21 +231,21 @@ class NewVM(uiutils.UITestCase):
tab = vmwindow.find("disk-tab")
tab.find("Disk bus:", "text").text = "usb"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Device is now 'USB Disk 1'
c = hwlist.find("USB Disk 1", "table cell")
self.assertTrue(c.state_selected)
uiutils.check(lambda: c.state_selected)
tab.find("Removable:", "check box").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Start the install, close via the VM window
vmwindow.find_fuzzy("Begin Installation", "button").click()
uiutils.check_in_loop(lambda: newvm.showing is False)
uiutils.check(lambda: newvm.showing is False)
vmwindow = self.app.root.find_fuzzy("win8 on", "frame")
vmwindow.find_fuzzy("File", "menu").click()
vmwindow.find_fuzzy("Quit", "menu item").click()
uiutils.check_in_loop(lambda: self.app.is_running())
uiutils.check(lambda: self.app.is_running())
def testNewVMURL(self):
@ -259,7 +259,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Network Install", "radio").click()
self.forward(newvm)
osentry = newvm.find("oslist-entry")
uiutils.check_in_loop(lambda: osentry.text.startswith("Waiting"))
uiutils.check(lambda: osentry.text.startswith("Waiting"))
url = "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/10/Fedora/x86_64/os/"
oslabel = "Fedora 10"
@ -267,16 +267,16 @@ class NewVM(uiutils.UITestCase):
newvm.find("install-urlopts-expander").click_expander()
newvm.find("install-urlopts-entry").text = "foo=bar"
uiutils.check_in_loop(lambda: osentry.text == oslabel, timeout=10)
uiutils.check(lambda: osentry.text == oslabel, timeout=10)
# Move forward, then back, ensure OS stays selected
self.forward(newvm)
self.back(newvm)
uiutils.check_in_loop(lambda: osentry.text == oslabel)
uiutils.check(lambda: osentry.text == oslabel)
# Disable autodetect, make sure OS still selected
newvm.find_fuzzy("Automatically detect", "check").click()
uiutils.check_in_loop(lambda: osentry.text == oslabel)
uiutils.check(lambda: osentry.text == oslabel)
self.forward(newvm)
self.back(newvm)
@ -284,14 +284,15 @@ class NewVM(uiutils.UITestCase):
osentry.click()
self.pressKey("Down")
popover = newvm.find("oslist-popover")
uiutils.check_in_loop(lambda: popover.showing)
self.assertTrue(newvm.find("include-eol", "check").isChecked)
uiutils.check(lambda: popover.showing)
includeeol = newvm.find("include-eol", "check")
uiutils.check(lambda: includeeol.isChecked)
# Re-enable autodetect, check for detecting text
newvm.find_fuzzy("Automatically detect", "check").click()
uiutils.check_in_loop(lambda: not popover.showing)
uiutils.check_in_loop(lambda: "Detecting" in osentry.text)
uiutils.check_in_loop(lambda: osentry.text == oslabel, timeout=10)
uiutils.check(lambda: not popover.showing)
uiutils.check(lambda: "Detecting" in osentry.text)
uiutils.check(lambda: osentry.text == oslabel, timeout=10)
# Progress the install
self.forward(newvm)
@ -301,10 +302,10 @@ class NewVM(uiutils.UITestCase):
progress = self.app.root.find_fuzzy(
"Creating Virtual Machine", "frame")
uiutils.check_in_loop(lambda: not progress.showing, timeout=120)
uiutils.check(lambda: not progress.showing, timeout=120)
self.app.root.find_fuzzy("fedora10 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
def testNewPPC64(self):
@ -330,7 +331,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("vm-ppc64 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
def testNewVMAArch64UEFI(self):
"""
@ -353,7 +354,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("vm1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
def testNewVMArmKernel(self):
"""
@ -366,13 +367,14 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Virt Type", "combo").click()
KVM = newvm.find_fuzzy("KVM", "menu item")
TCG = newvm.find_fuzzy("TCG", "menu item")
self.assertTrue(KVM.focused)
self.assertTrue(TCG.showing)
uiutils.check(lambda: KVM.focused)
uiutils.check(lambda: TCG.showing)
# Validate some initial defaults
newvm.find_fuzzy("Import", "radio").click()
newvm.find_fuzzy("Import", "radio").click()
self.assertFalse(newvm.find_fuzzy("Local", "radio").sensitive)
local = newvm.find_fuzzy("Local", "radio")
uiutils.check(lambda: not local.sensitive)
newvm.find_fuzzy("Machine Type", "combo").click()
self.sleep(.2)
newvm.find_fuzzy("canon", "menu item").click()
@ -396,9 +398,8 @@ class NewVM(uiutils.UITestCase):
self.forward(newvm)
newvm.find_fuzzy("Finish", "button").click()
time.sleep(1)
uiutils.check(lambda: not newvm.showing)
self.app.root.find_fuzzy("vm1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
def testNewVMContainerApp(self):
@ -418,7 +419,7 @@ class NewVM(uiutils.UITestCase):
self._click_alert_button("path is required", "OK")
newvm.find("install-app-browse").click()
self._select_storagebrowser_volume("default-pool", "aaa-unused.qcow2")
uiutils.check_in_loop(lambda: "aaa-unused.qcow2" in apptext.text)
uiutils.check(lambda: "aaa-unused.qcow2" in apptext.text)
self.forward(newvm)
self.forward(newvm)
@ -429,9 +430,8 @@ class NewVM(uiutils.UITestCase):
self.forward(newvm)
newvm.find_fuzzy("Finish", "button").click()
time.sleep(1)
uiutils.check(lambda: not newvm.showing)
self.app.root.find_fuzzy("container1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
def testNewVMContainerTree(self):
@ -452,15 +452,14 @@ class NewVM(uiutils.UITestCase):
newvm.find("install-oscontainer-browse").click()
self._select_storagebrowser_volume("default-pool", "dir-vol")
uiutils.check_in_loop(lambda: "dir-vol" in dirtext.text)
uiutils.check(lambda: "dir-vol" in dirtext.text)
self.forward(newvm)
self.forward(newvm)
newvm.find_fuzzy("Finish", "button").click()
time.sleep(1)
uiutils.check(lambda: not newvm.showing)
self.app.root.find_fuzzy("container1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
def testNewVMContainerVZ(self):
@ -481,7 +480,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("container1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
def testNewVMContainerBootstrap(self):
@ -499,9 +498,8 @@ class NewVM(uiutils.UITestCase):
import tempfile
tmpdir = tempfile.TemporaryDirectory()
newvm.find_fuzzy("Create OS directory", "check box").click()
self.sleep(.5)
rootdir = newvm.find_fuzzy(None, "text", "root directory")
self.assertTrue(".local/share/libvirt" in rootdir.text)
uiutils.check(lambda: ".local/share/libvirt" in rootdir.text)
rootdir.text = tmpdir.name
newvm.find("install-oscontainer-source-uri").text = "docker://alpine"
newvm.find("install-oscontainer-root-passwd").text = "foobar"
@ -509,11 +507,10 @@ class NewVM(uiutils.UITestCase):
self.forward(newvm)
newvm.find_fuzzy("Finish", "button").click()
prog = self.app.root.find("Creating Virtual Machine", "frame")
uiutils.check_in_loop(lambda: not prog.showing, timeout=30)
uiutils.check(lambda: not prog.showing, timeout=30)
time.sleep(1)
uiutils.check(lambda: not newvm.showing)
self.app.root.find_fuzzy("container1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
def testNewVMXenPV(self):
@ -538,7 +535,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("vm1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
def testNewVMInstallFail(self):
@ -562,7 +559,7 @@ class NewVM(uiutils.UITestCase):
# Closing dialog should trigger storage cleanup path
newvm.find_fuzzy("Cancel", "button").click()
uiutils.check_in_loop(lambda: not newvm.visible)
uiutils.check(lambda: not newvm.visible)
# Run again
newvm = dofail()
@ -574,7 +571,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("test-foo on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
def testNewVMCustomizeXMLEdit(self):
@ -591,7 +588,7 @@ class NewVM(uiutils.UITestCase):
nonexistpath = "/dev/foovmm-idontexist"
existpath = "/dev/default-pool/testvol1.img"
newvm.find("media-entry").text = nonexistpath
uiutils.check_in_loop(
uiutils.check(
lambda: newvm.find("oslist-entry").text == "None detected")
newvm.find_fuzzy("Automatically detect", "check").click()
newvm.find("oslist-entry").text = "generic"
@ -612,15 +609,14 @@ class NewVM(uiutils.UITestCase):
finish = win.find("config-apply")
win.find_fuzzy("Boot", "table cell").click()
tab = win.find("boot-tab")
self.assertEqual(
tab.find("Enable boot menu", "check box").checked, False)
bootmenu = tab.find("Enable boot menu", "check box")
uiutils.check(lambda: not bootmenu.checked)
win.find("XML", "page tab").click()
xmleditor.text = xmleditor.text.replace(
"<os>", "<os><bootmenu enable='yes'/>")
finish.click()
win.find("Details", "page tab").click()
self.assertEqual(
tab.find("Enable boot menu", "check box").checked, True)
uiutils.check(lambda: bootmenu.checked)
# Change a device setting with the XML editor
win.find_fuzzy("NIC", "table cell").click()
@ -634,30 +630,31 @@ class NewVM(uiutils.UITestCase):
# Finish install.
win.find_fuzzy("Begin Installation", "button").click()
uiutils.check_in_loop(lambda: win.dead)
uiutils.check(lambda: win.dead)
win = self.app.root.find_fuzzy("%s on" % vmname, "frame")
win.find("Details", "radio button").click()
# Verify VM change stuck
win.find_fuzzy("Boot", "table cell").click()
tab = win.find("boot-tab")
self.assertEqual(
tab.find("Enable boot menu", "check box").checked, True)
bootmenu = tab.find("Enable boot menu", "check box")
uiutils.check(lambda: bootmenu.checked)
# Verify device change stuck
win.find_fuzzy("NIC", "table cell").click()
tab = win.find("network-tab")
self.assertEqual(
tab.find("Device name:", "text").text, newbrname)
devname = tab.find("Device name:", "text")
uiutils.check(lambda: devname.text == newbrname)
# Verify install media is handled correctly after XML customize
win.find_fuzzy("IDE CDROM 1", "table cell").click()
tab = win.find("disk-tab")
self.assertEqual(tab.find("media-entry").text, existpath)
mediaent = tab.find("media-entry")
uiutils.check(lambda: mediaent.text == existpath)
win.find("Shut Down", "push button").click()
run = win.find("Run", "push button")
uiutils.check_in_loop(lambda: run.sensitive)
self.assertEqual(tab.find("media-entry").text, "")
uiutils.check(lambda: run.sensitive)
uiutils.check(lambda: mediaent.text == "")
# Verify default disk storage was actually created. This has some
# special handling in domain.py
@ -703,17 +700,18 @@ class NewVM(uiutils.UITestCase):
newvm.find("install-import-browse").click()
browsewin = self.app.root.find("vmm-storage-browser")
# Insensitive for remote connection
assert browsewin.find("Browse Local").sensitive is False
browselocal = browsewin.find("Browse Local")
uiutils.check(lambda: browselocal.sensitive is False)
# Close the browser and reopen
browsewin.find("Cancel").click()
uiutils.check_in_loop(lambda: not browsewin.active)
uiutils.check(lambda: not browsewin.active)
# Reopen, select storage
newvm.find("install-import-browse").click()
browsewin = self.app.root.find("vmm-storage-browser")
browsewin.find_fuzzy("default-pool", "table cell").click()
browsewin.find_fuzzy("bochs-vol", "table cell").click()
browsewin.find("Choose Volume").click()
uiutils.check_in_loop(
uiutils.check(
lambda: importtext.text == "/dev/default-pool/bochs-vol")
self.forward(newvm)
@ -721,7 +719,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("vm1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
def testNewVMSession(self):
"""
@ -740,11 +738,11 @@ class NewVM(uiutils.UITestCase):
self.forward(newvm)
combo = newvm.find(None, "combo box", "Network source:")
# For some reason atspi reports the internal combo value
assert combo.name == "user"
uiutils.check(lambda: combo.name == "user")
newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("vm1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
def testNewVMEmptyConn(self):
"""
@ -763,14 +761,14 @@ class NewVM(uiutils.UITestCase):
self.forward(newvm)
combo = newvm.find(None, "combo box", "Network source:")
# For some reason atspi reports the internal combo value
assert combo.name == 'bridge'
uiutils.check(lambda: combo.name == 'bridge')
warnlabel = newvm.find_fuzzy("suitable default network", "label")
assert warnlabel.onscreen
uiutils.check(lambda: warnlabel.onscreen)
newvm.find("Device name:", "text").text = "foobr0"
newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("vm1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
def testNewVMInactiveNetwork(self):
"""
@ -797,7 +795,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Finish", "button").click()
self._click_alert_button("start the network", "Yes")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)
@unittest.mock.patch.dict('os.environ', {"VIRTINST_TEST_SUITE": "1"})
def testNewVMDefaultBridge(self):
@ -818,9 +816,10 @@ class NewVM(uiutils.UITestCase):
self.forward(newvm)
combo = newvm.find(None, "combo box", "Network source:")
# For some reason atspi reports the internal combo value
assert combo.name == 'bridge'
assert newvm.find("Device name:", "text").text == "testsuitebr0"
uiutils.check(lambda: combo.name == 'bridge')
devname = newvm.find("Device name:", "text")
uiutils.check(lambda: devname.text == "testsuitebr0")
newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("vm1 on", "frame")
uiutils.check_in_loop(lambda: not newvm.showing)
uiutils.check(lambda: not newvm.showing)

View File

@ -13,7 +13,7 @@ class CreateVol(uiutils.UITestCase):
hostwin.find("vol-new", "push button").click()
win = self.app.root.find(
"Add a Storage Volume", "frame")
uiutils.check_in_loop(lambda: win.active)
uiutils.check(lambda: win.active)
return win
@ -34,7 +34,7 @@ class CreateVol(uiutils.UITestCase):
name = win.find("Name:", "text")
# Create a default qcow2 volume
self.assertEqual(name.text, "vol")
uiutils.check(lambda: name.text == "vol")
newname = "a-newvol"
name.text = newname
win.find("Max Capacity:", "spin button").text = "10.5"
@ -49,11 +49,11 @@ class CreateVol(uiutils.UITestCase):
volcell = vollist.find(newname + ".qcow2")
hostwin.find("vol-delete", "push button").click()
self._click_alert_button("permanently delete the volume", "Yes")
uiutils.check_in_loop(lambda: volcell.dead)
uiutils.check(lambda: volcell.dead)
# Ensure host window closes fine
hostwin.keyCombo("<ctrl>w")
uiutils.check_in_loop(lambda: not hostwin.showing and
uiutils.check(lambda: not hostwin.showing and
not hostwin.active)
def testCreateVolMisc(self):
@ -79,7 +79,7 @@ class CreateVol(uiutils.UITestCase):
browsewin = self.app.root.find("vmm-storage-browser")
# Test cancel button
browsewin.find("Cancel", "push button").click()
uiutils.check_in_loop(lambda: not browsewin.active)
uiutils.check(lambda: not browsewin.active)
win.find("Browse...").click()
browsewin = self.app.root.find("vmm-storage-browser")
# Test browse local opening
@ -89,8 +89,9 @@ class CreateVol(uiutils.UITestCase):
chooser.keyCombo("<alt>F4")
browsewin.find_fuzzy("default-pool", "table cell").click()
browsewin.find("bochs-vol", "table cell").doubleClick()
uiutils.check_in_loop(lambda: not browsewin.active)
assert "bochs-vol" in win.find("backing-store").text
uiutils.check(lambda: not browsewin.active)
backingstore = win.find("backing-store")
uiutils.check(lambda: "bochs-vol" in backingstore.text)
finish.click()
vollist.find(newname)
@ -106,15 +107,15 @@ class CreateVol(uiutils.UITestCase):
alloc.text = "50.0"
alloc.click()
self.pressKey("Enter")
uiutils.check_in_loop(lambda: cap.text == "50.0")
uiutils.check(lambda: cap.text == "50.0")
cap.text = "1.0"
cap.click()
self.pressKey("Enter")
uiutils.check_in_loop(lambda: alloc.text == "1.0")
uiutils.check(lambda: alloc.text == "1.0")
alloc.text = "0.5"
alloc.click()
self.pressKey("Enter")
assert cap.text == "1.0"
uiutils.check(lambda: cap.text == "1.0")
finish.click()
self._click_alert_button("Error validating volume", "Close")
@ -157,11 +158,11 @@ class CreateVol(uiutils.UITestCase):
xmleditor.text = xmleditor.text.replace(
">%s.qcow2<" % tmpname, ">%s<" % newname)
finish.click()
uiutils.check_in_loop(lambda: hostwin.active)
uiutils.check(lambda: hostwin.active)
vollist.find(newname)
# Do standard xmleditor tests
win = self._open_create_win(hostwin)
self._test_xmleditor_interactions(win, finish)
win.find("Cancel", "push button").click()
uiutils.check_in_loop(lambda: not win.visible)
uiutils.check(lambda: not win.visible)

View File

@ -19,18 +19,18 @@ class Details(uiutils.UITestCase):
self.pressKey("Down")
c.click()
tab = win.find(tabname, None)
uiutils.check_in_loop(lambda: tab.showing)
uiutils.check(lambda: tab.showing)
return tab
def _stop_vm(self, win):
run = win.find("Run", "push button")
win.find("Shut Down", "push button").click()
uiutils.check_in_loop(lambda: run.sensitive)
uiutils.check(lambda: run.sensitive)
def _start_vm(self, win):
run = win.find("Run", "push button")
run.click()
uiutils.check_in_loop(lambda: not run.sensitive)
uiutils.check(lambda: not run.sensitive)
##############
@ -74,7 +74,7 @@ class Details(uiutils.UITestCase):
self.app.root.find_fuzzy(newname, "table cell")
# Make sure the old entry is gone
uiutils.check_in_loop(lambda: origname not in oldcell.name)
uiutils.check(lambda: origname not in oldcell.name)
def testDetailsRenameSimple(self):
"""
@ -92,7 +92,7 @@ class Details(uiutils.UITestCase):
b = self.app.root.find("Shut Down", "push button")
b.click()
# This insures the VM finished shutting down
uiutils.check_in_loop(lambda: b.sensitive is False)
uiutils.check(lambda: b.sensitive is False)
self._testRename(origname, "test-new-name")
@ -109,7 +109,7 @@ class Details(uiutils.UITestCase):
tab.find("Description:", "text").text = "hey new description"
tab.find("Title:", "text").text = "hey new title"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# There's no hotplug operations after this point
self._stop_vm(win)
@ -118,33 +118,33 @@ class Details(uiutils.UITestCase):
tab = self._select_hw(win, "Memory", "memory-tab")
tab.find("Memory allocation:", "spin button").text = "300"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# vCPUs
tab = self._select_hw(win, "CPUs", "cpu-tab")
tab.find("vCPU allocation:", "spin button").text = "4"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Static CPU config
# more cpu config: host-passthrough, copy, clear CPU, manual
tab.find("cpu-model").click_combo_entry()
tab.find_fuzzy("Clear CPU", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
tab.find("cpu-model").click_combo_entry()
tab.find("coreduo", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
tab.find("cpu-model").click_combo_entry()
tab.find("Application Default", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
tab.find_fuzzy("Copy host").click()
tab.find("cpu-model").click_combo_entry()
tab.find("Hypervisor Default", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# CPU topology
tab.find_fuzzy("Topology", "toggle button").click_expander()
@ -153,8 +153,9 @@ class Details(uiutils.UITestCase):
tab.find("Cores:", "spin button").typeText("2")
tab.find("Threads:", "spin button").typeText("2")
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
self.assertTrue(tab.find_fuzzy("vCPU allocation", "spin").text == "32")
uiutils.check(lambda: not appl.sensitive)
vcpualloc = tab.find_fuzzy("vCPU allocation", "spin")
uiutils.check(lambda: vcpualloc.text == "32")
def testDetailsEditDomain2(self):
@ -169,18 +170,18 @@ class Details(uiutils.UITestCase):
# OS edits
tab = self._select_hw(win, "OS information", "os-tab")
entry = tab.find("oslist-entry")
self.assertEqual(entry.text, "Fedora")
uiutils.check(lambda: entry.text == "Fedora")
entry.click()
self.pressKey("Down")
popover = win.find("oslist-popover")
popover.find("include-eol").click()
entry.text = "fedora12"
popover.find_fuzzy("fedora12").bring_on_screen().click()
uiutils.check_in_loop(lambda: not popover.visible)
self.assertEqual(entry.text, "Fedora 12")
uiutils.check(lambda: not popover.visible)
uiutils.check(lambda: entry.text == "Fedora 12")
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
self.assertEqual(entry.text, "Fedora 12")
uiutils.check(lambda: not appl.sensitive)
uiutils.check(lambda: entry.text == "Fedora 12")
# Boot tweaks
@ -201,7 +202,7 @@ class Details(uiutils.UITestCase):
tab.find("Floppy 1", "table cell").click()
tab.find("boot-moveup", "push button").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Kernel boot
tab.find_fuzzy("Direct kernel boot", "toggle button").click_expander()
@ -211,13 +212,14 @@ class Details(uiutils.UITestCase):
browsewin.find("default-pool", "table cell").click()
browsewin.find("bochs-vol", "table cell").click()
browsewin.find("Choose Volume", "push button").click()
uiutils.check_in_loop(lambda: win.active)
self.assertTrue("bochs" in tab.find("Kernel path:", "text").text)
uiutils.check(lambda: win.active)
kernelpath = tab.find("Kernel path:", "text")
uiutils.check(lambda: "bochs" in kernelpath.text)
tab.find("Initrd path:", "text").text = "/tmp/initrd"
tab.find("DTB path:", "text").text = "/tmp/dtb"
tab.find("Kernel args:", "text").text = "console=ttyS0"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
def testDetailsEditDiskNet(self):
@ -237,7 +239,7 @@ class Details(uiutils.UITestCase):
tab.find("Cache mode:", "text").text = "unsafe"
tab.find("Discard mode:", "text").text = "unmap"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Network values w/ macvtap manual
@ -251,7 +253,7 @@ class Details(uiutils.UITestCase):
tab.find("Device model:", "combo box").click_combo_entry()
tab.find("rtl8139", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Manual bridge
src.click()
@ -263,7 +265,7 @@ class Details(uiutils.UITestCase):
self._click_alert_button("Error changing VM configuration", "Close")
tab.find("Device name:", "text").text = "zbr0"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
def testDetailsEditDevices(self):
@ -280,26 +282,26 @@ class Details(uiutils.UITestCase):
tab.find("Type:", "combo box").click_combo_entry()
tab.find("Spice server", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
tab.find("Type:", "combo box").click_combo_entry()
tab.find("VNC server", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Sound device
tab = self._select_hw(win, "Sound sb16", "sound-tab")
tab.find("Model:", "text").text = "ac97"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Host device
tab = self._select_hw(win, "PCI 0000:00:19.0", "host-tab")
tab.find("ROM BAR:", "check box").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Video device
@ -307,7 +309,7 @@ class Details(uiutils.UITestCase):
tab.find("Model:", "text").text = "virtio"
tab.find("3D acceleration:", "check box").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Watchdog
@ -316,7 +318,7 @@ class Details(uiutils.UITestCase):
tab.find("Action:", "text").click()
self.pressKey("Down")
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Controller SCSI
@ -326,19 +328,19 @@ class Details(uiutils.UITestCase):
tab.find("Hypervisor default", "menu item").click()
tab.find("SCSI Disk 1 on 9:0:0:0", "table cell")
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Controller USB
tab = self._select_hw(win, "Controller USB 0", "controller-tab")
tab.find("controller-model", "combo box").click_combo_entry()
tab.find("USB 2", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
tab = self._select_hw(win, "Controller USB 0", "controller-tab")
tab.find("controller-model", "combo box").click_combo_entry()
tab.find("USB 3", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Filesystem tweaks
@ -351,7 +353,7 @@ class Details(uiutils.UITestCase):
tab.find("Target path:", "text").text = "newtarget"
tab.find_fuzzy("Export filesystem", "check box").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# Smartcard tweaks
@ -359,16 +361,16 @@ class Details(uiutils.UITestCase):
tab.find("smartcard-mode", "combo box").click_combo_entry()
tab.find("Passthrough", "menu item").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check(lambda: not appl.sensitive)
# vsock tweaks
tab = self._select_hw(win, "VirtIO VSOCK", "vsock-tab")
addr = tab.find("vsock-cid")
auto = tab.find("vsock-auto")
self.assertTrue(addr.text == "5")
uiutils.check(lambda: addr.text == "5")
auto.click()
uiutils.check_in_loop(lambda: not addr.visible)
uiutils.check(lambda: not addr.visible)
appl.click()
@ -393,22 +395,22 @@ class Details(uiutils.UITestCase):
c = hwlist.find(disklabel, "table cell")
self._stop_vm(win)
self.assertTrue(c.text != disklabel)
uiutils.check(lambda: c.text != disklabel)
# Remove a device for offline VM
tab = self._select_hw(win, "SCSI CDROM 1", "disk-tab")
win.find("config-remove", "push button").click()
delete = self.app.root.find_fuzzy("Remove Disk", "frame")
delete.find_fuzzy("Delete", "button").click()
uiutils.check_in_loop(lambda: win.active)
uiutils.check(lambda: win.active)
# Cancelling changes
tab = self._select_hw(win, "IDE Disk 1", "disk-tab")
share = tab.find("Shareable:", "check box")
self.assertFalse(share.checked)
uiutils.check(lambda: not share.checked)
share.click()
win.find("config-cancel").click()
self.assertFalse(share.checked)
uiutils.check(lambda: not share.checked)
# Unapplied, clicking no
share = tab.find("Shareable:", "check box")
@ -416,7 +418,7 @@ class Details(uiutils.UITestCase):
hwlist.find("CPUs", "table cell").click()
self._click_alert_button("There are unapplied changes", "No")
tab = self._select_hw(win, "IDE Disk 1", "disk-tab")
self.assertFalse(share.checked)
uiutils.check(lambda: not share.checked)
# Unapplied changes but clicking yes
share.click()
@ -426,25 +428,25 @@ class Details(uiutils.UITestCase):
alert.find_fuzzy("Don't warn", "check box").click()
alert.find("Yes", "push button").click()
tab = self._select_hw(win, "IDE Disk 1", "disk-tab")
self.assertTrue(share.checked)
uiutils.check(lambda: share.checked)
# Make sure no unapplied changes option sticks
share.click()
self._select_hw(win, "CPUs", "cpu-tab")
tab = self._select_hw(win, "IDE Disk 1", "disk-tab")
self.assertTrue(share.checked)
uiutils.check(lambda: share.checked)
# VM State change doesn't refresh UI
share.click()
self._start_vm(win)
self.assertTrue(not share.checked)
uiutils.check(lambda: not share.checked)
# Now apply changes to running VM, ensure they show up on shutdown
win.find("config-apply").click()
self._click_alert_button("changes will take effect", "OK")
self.assertTrue(share.checked)
uiutils.check(lambda: share.checked)
self._stop_vm(win)
self.assertTrue(not share.checked)
uiutils.check(lambda: not share.checked)
# Unapplied changes should warn when switching to XML tab
tab = self._select_hw(win, "Overview", "overview-tab")
@ -452,12 +454,12 @@ class Details(uiutils.UITestCase):
win.find("XML", "page tab").click()
# Select 'No', meaning don't abandon changes
self._click_alert_button("changes will be lost", "No")
uiutils.check_in_loop(lambda: tab.showing)
uiutils.check(lambda: tab.showing)
# Try unapplied changes again, this time abandon our changes
win.find("XML", "page tab").click()
self._click_alert_button("changes will be lost", "Yes")
uiutils.check_in_loop(lambda: not tab.showing)
uiutils.check(lambda: not tab.showing)
def testDetailsXMLEdit(self):
"""
@ -474,8 +476,8 @@ class Details(uiutils.UITestCase):
xmleditor.text = xmleditor.text.replace(">5</vcpu", ">8</vcpu")
finish.click()
win.find("Details", "page tab").click()
self.assertEqual(
tab.find("vCPU allocation:", "spin button").text, "8")
vcpualloc = tab.find("vCPU allocation:", "spin button")
uiutils.check(lambda: vcpualloc.text == "8")
# Make some disk edits
tab = self._select_hw(win, "IDE Disk 1", "disk-tab")
@ -485,7 +487,8 @@ class Details(uiutils.UITestCase):
xmleditor.text = xmleditor.text.replace(origpath, newpath)
finish.click()
win.find("Details", "page tab").click()
self.assertTrue(win.find("disk-source-path").text, newpath)
disksrc = win.find("disk-source-path")
uiutils.check(lambda: disksrc.text == newpath)
# Do standard xmleditor tests
self._test_xmleditor_interactions(win, finish)

View File

@ -39,7 +39,7 @@ class Host(uiutils.UITestCase):
delete = win.find("net-delete", "push button")
stop = win.find("net-stop", "push button")
stop.click()
uiutils.check_in_loop(lambda: delete.sensitive)
uiutils.check(lambda: delete.sensitive)
win.find("XML", "page tab").click()
xmleditor = win.find("XML editor")
origdev = "virbr0"
@ -47,7 +47,8 @@ class Host(uiutils.UITestCase):
xmleditor.text = xmleditor.text.replace(origdev, newdev)
finish.click()
win.find("Details", "page tab").click()
self.assertEqual(win.find("net-device").text, newdev)
netdev = win.find("net-device")
uiutils.check(lambda: netdev.text == newdev)
# Rename it
win.find("default", "table cell").click()
@ -90,7 +91,7 @@ class Host(uiutils.UITestCase):
delete = win.find("pool-delete", "push button")
stop = win.find("pool-stop", "push button")
stop.click()
uiutils.check_in_loop(lambda: delete.sensitive)
uiutils.check(lambda: delete.sensitive)
win.find("XML", "page tab").click()
xmleditor = win.find("XML editor")
origpath = "/dev/default-pool"
@ -98,7 +99,8 @@ class Host(uiutils.UITestCase):
xmleditor.text = xmleditor.text.replace(origpath, newpath)
finish.click()
win.find("Details", "page tab").click()
self.assertEqual(win.find("pool-location").text, newpath)
poolloc = win.find("pool-location")
uiutils.check(lambda: poolloc.text == newpath)
# Rename it
win.find("default", "table cell").click()
@ -124,18 +126,18 @@ class Host(uiutils.UITestCase):
vol1 = vollist.find("backingl1.img", "table cell")
vol2 = vollist.find("UPPER", "table cell")
assert vol1.onscreen
assert not vol2.onscreen
uiutils.check(lambda: vol1.onscreen)
uiutils.check(lambda: not vol2.onscreen)
win.find("Size", "table column header").click()
win.find("Size", "table column header").click()
uiutils.check_in_loop(lambda: not vol1.onscreen)
assert vol2.onscreen
uiutils.check(lambda: not vol1.onscreen)
uiutils.check(lambda: vol2.onscreen)
vol2.click(button=3)
self.app.root.find("Copy Volume Path", "menu item").click()
from gi.repository import Gdk, Gtk
clipboard = Gtk.Clipboard.get_default(Gdk.Display.get_default())
assert clipboard.wait_for_text() == "/dev/default-pool/UPPER"
uiutils.check(lambda: clipboard.wait_for_text() == "/dev/default-pool/UPPER")
def testHostConn(self):
"""
@ -146,7 +148,7 @@ class Host(uiutils.UITestCase):
c = manager.find_fuzzy("testdriver.xml", "table cell")
c.click(button=3)
self.app.root.find("conn-disconnect", "menu item").click()
uiutils.check_in_loop(lambda: "Not Connected" in c.text)
uiutils.check(lambda: "Not Connected" in c.text)
# Open Host Details from right click menu
c.click(button=3)
@ -168,15 +170,15 @@ class Host(uiutils.UITestCase):
# Open the manager window
win.find("File", "menu").click()
win.find("View Manager", "menu item").click()
uiutils.check_in_loop(lambda: manager.active)
uiutils.check(lambda: manager.active)
# Confirm connection row is named differently in manager
manager.find("FOOBAR", "table cell")
# Close the manager
manager.keyCombo("<alt>F4")
uiutils.check_in_loop(lambda: win.active)
uiutils.check(lambda: win.active)
# Quit app from the file menu
win.find("File", "menu").click()
win.find("Quit", "menu item").click()
uiutils.check_in_loop(lambda: not self.app.is_running())
uiutils.check(lambda: not self.app.is_running())

View File

@ -58,16 +58,16 @@ class Console(uiutils.UITestCase):
"""
win = self.app.topwin
con = win.find("console-gfx-viewport")
self.assertTrue(con.showing)
uiutils.check(lambda: con.showing)
win.find("Virtual Machine", "menu").click()
win.find("Take Screenshot", "menu item").click()
chooser = self.app.root.find(None, "file chooser")
fname = chooser.find("Name", "text").text
self.pressKey("Enter")
uiutils.check_in_loop(lambda: os.path.exists(fname))
uiutils.check(lambda: os.path.exists(fname))
os.unlink(fname)
self.assertTrue(lambda: win.active)
uiutils.check(lambda: win.active)
win.find("Send Key", "menu").click()
win.find(r"Ctrl\+Alt\+F1", "menu item").click()
@ -81,25 +81,25 @@ class Console(uiutils.UITestCase):
win.find("^View$", "menu").click()
win.find("Resize to VM", "menu item").click()
newsize = win.size
self.assertTrue(oldsize != newsize)
uiutils.check(lambda: oldsize != newsize)
# Fullscreen testing
win.find("^View$", "menu").click()
win.find("Fullscreen", "check menu item").click()
fstb = win.find("Fullscreen Toolbar")
self.assertTrue(fstb.showing)
self.assertTrue(win.size != newsize)
uiutils.check(lambda: fstb.showing)
uiutils.check(lambda: win.size != newsize)
# Wait for toolbar to hide, then reveal it again
uiutils.check_in_loop(lambda: not fstb.showing, timeout=5)
uiutils.check(lambda: not fstb.showing, timeout=5)
self.point(win.position[0] + win.size[0] / 2, 0)
uiutils.check_in_loop(lambda: fstb.showing)
uiutils.check(lambda: fstb.showing)
# Click stuff and exit fullscreen
win.find("Fullscreen Send Key").click()
self.pressKey("Escape")
win.find("Fullscreen Exit").click()
self.assertTrue(win.size == newsize)
uiutils.check(lambda: win.size == newsize)
@_vm_wrapper("uitests-vnc-standard")
def testConsoleVNCStandard(self):
@ -115,9 +115,9 @@ class Console(uiutils.UITestCase):
"""
win = self.app.topwin
con = win.find("console-gfx-viewport")
self.assertTrue(not con.showing)
uiutils.check(lambda: not con.showing)
passwd = win.find("Password:", "password text")
uiutils.check_in_loop(lambda: passwd.showing)
uiutils.check(lambda: passwd.showing)
# Check wrong password handling
passwd.typeText("xx")
@ -127,7 +127,7 @@ class Console(uiutils.UITestCase):
# Check proper password
passwd.typeText("goodp")
win.find("Login", "push button").click()
uiutils.check_in_loop(lambda: con.showing)
uiutils.check(lambda: con.showing)
@_vm_wrapper("uitests-vnc-password")
def testConsoleVNCPassword(self):
@ -144,9 +144,9 @@ class Console(uiutils.UITestCase):
"""
win = self.app.topwin
term = win.find("Serial Terminal")
self.assertTrue(term.showing)
uiutils.check(lambda: term.showing)
term.typeText("help\n")
self.assertTrue("COMMANDS" in term.text)
uiutils.check(lambda: "COMMANDS" in term.text)
@_vm_wrapper("uitests-spice-specific")
@ -157,7 +157,7 @@ class Console(uiutils.UITestCase):
"""
win = self.app.topwin
con = win.find("console-gfx-viewport")
self.assertTrue(con.showing)
uiutils.check(lambda: con.showing)
# Just ensure the dialog pops up, can't really test much more
# than that
@ -175,7 +175,7 @@ class Console(uiutils.UITestCase):
addhw = self.app.root.find("Add New Virtual Hardware", "frame")
addhw.find("Storage", "table cell").click()
tab = addhw.find("storage-tab", None)
uiutils.check_in_loop(lambda: tab.showing)
uiutils.check(lambda: tab.showing)
tab.find("Select or create", "radio button").click()
tab.find("storage-entry").text = fname
tab.find("Bus type:", "combo box").click()
@ -187,33 +187,33 @@ class Console(uiutils.UITestCase):
"The emulator may not have search permissions", "Yes")
# Verify no errors
uiutils.check_in_loop(lambda: not addhw.showing)
uiutils.check_in_loop(lambda: win.active)
uiutils.check(lambda: not addhw.showing)
uiutils.check(lambda: win.active)
# Hot unplug the disk
win.find("SCSI Disk 1", "table cell").click()
tab = win.find("disk-tab", None)
uiutils.check_in_loop(lambda: tab.showing)
uiutils.check(lambda: tab.showing)
win.find("config-remove").click()
delete = self.app.root.find_fuzzy("Remove Disk", "frame")
delete.find_fuzzy("Delete", "button").click()
uiutils.check_in_loop(lambda: not delete.active)
assert os.path.exists(fname)
uiutils.check(lambda: not delete.active)
uiutils.check(lambda: os.path.exists(fname))
# Change CDROM
win.find("IDE CDROM 1", "table cell").click()
tab = win.find("disk-tab", None)
entry = win.find("media-entry")
appl = win.find("config-apply")
uiutils.check_in_loop(lambda: tab.showing)
uiutils.check(lambda: tab.showing)
entry.text = fname
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
self.assertTrue(entry.text == fname)
uiutils.check(lambda: not appl.sensitive)
uiutils.check(lambda: entry.text == fname)
entry.click_secondary_icon()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
self.assertTrue(not entry.text)
uiutils.check(lambda: not appl.sensitive)
uiutils.check(lambda: not entry.text)
@_vm_wrapper("uitests-hotplug")

View File

@ -31,18 +31,18 @@ class Manager(uiutils.UITestCase):
smenu.click()
force.click()
self._click_alert_button("Are you sure you want", "Yes")
uiutils.check_in_loop(lambda: run.sensitive, timeout=5)
uiutils.check(lambda: run.sensitive, timeout=5)
run.click()
uiutils.check_in_loop(lambda: not run.sensitive, timeout=5)
uiutils.check(lambda: not run.sensitive, timeout=5)
pause.click()
uiutils.check_in_loop(lambda: pause.checked, timeout=5)
uiutils.check(lambda: pause.checked, timeout=5)
smenu.click()
save.click()
uiutils.check_in_loop(lambda: run.sensitive, timeout=5)
self.assertTrue("Saved" in c.text)
uiutils.check(lambda: run.sensitive, timeout=5)
uiutils.check(lambda: "Saved" in c.text)
run.click()
uiutils.check_in_loop(lambda: shutdown.sensitive, timeout=5)
uiutils.check(lambda: shutdown.sensitive, timeout=5)
def testVMLifecycle(self):
self._testVMLifecycle()
@ -146,26 +146,26 @@ class Manager(uiutils.UITestCase):
self.app.root.find("conn-disconnect", "menu item").click()
# Ensure all those windows aren't showing
uiutils.check_in_loop(lambda: not migrate.showing)
uiutils.check_in_loop(lambda: not clone.showing)
uiutils.check_in_loop(lambda: not create.showing)
uiutils.check_in_loop(lambda: not details.showing)
uiutils.check_in_loop(lambda: not delete.showing)
uiutils.check(lambda: not migrate.showing)
uiutils.check(lambda: not clone.showing)
uiutils.check(lambda: not create.showing)
uiutils.check(lambda: not details.showing)
uiutils.check(lambda: not delete.showing)
# Delete the connection, ensure the host dialog disappears
c = manager.find_fuzzy("testdriver.xml", "table cell")
c.click(button=3)
self.app.root.find("conn-delete", "menu item").click()
self._click_alert_button("will remove the connection", "Yes")
uiutils.check_in_loop(lambda: not host.showing)
uiutils.check(lambda: not host.showing)
def testManagerDefaultStartup(self):
self.app.open(use_uri=False)
manager = self.app.topwin
errlabel = manager.find("error-label")
uiutils.check_in_loop(
uiutils.check(
lambda: "Checking for virtualization" in errlabel.text)
uiutils.check_in_loop(
uiutils.check(
lambda: "File->Add Connection" in errlabel.text)
uiutils.check_in_loop(
uiutils.check(
lambda: "appropriate QEMU/KVM" in errlabel.text)

View File

@ -25,28 +25,28 @@ class MediaChange(uiutils.UITestCase):
hw.find("Floppy 1", "table cell").click()
combo.click_combo_entry()
combo.find(r"Floppy_install_label \(/dev/fdb\)")
self.assertTrue(entry.text == "No media detected (/dev/fda)")
uiutils.check(lambda: entry.text == "No media detected (/dev/fda)")
entry.click()
entry.click_secondary_icon()
self.assertTrue(not entry.text)
uiutils.check(lambda: not entry.text)
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
self.assertTrue(not entry.text)
uiutils.check(lambda: not appl.sensitive)
uiutils.check(lambda: not entry.text)
appl.click()
# Enter /dev/fdb, after apply it should change to pretty label
entry.text = "/dev/fdb"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
uiutils.check_in_loop(lambda:
uiutils.check(lambda: not appl.sensitive)
uiutils.check(lambda:
entry.text == "Floppy_install_label (/dev/fdb)")
# Specify manual path
path = "/tmp/aaaaaaaaaaaaaaaaaaaaaaa.img"
entry.text = path
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
self.assertEqual(entry.text, path)
uiutils.check(lambda: not appl.sensitive)
uiutils.check(lambda: entry.text == path)
# Go to Floppy 2, make sure previous path is in recent list
hw.find("Floppy 2", "table cell").click()
@ -67,12 +67,12 @@ class MediaChange(uiutils.UITestCase):
appl.click()
# Check 'already in use' dialog
self._click_alert_button("already in use by", "Yes")
uiutils.check_in_loop(lambda: not appl.sensitive)
self.assertTrue("backing" in entry.text)
uiutils.check(lambda: not appl.sensitive)
uiutils.check(lambda: "backing" in entry.text)
entry.text = ""
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
self.assertTrue(not entry.text)
uiutils.check(lambda: not appl.sensitive)
uiutils.check(lambda: not entry.text)
def testMediaHotplug(self):
@ -86,15 +86,15 @@ class MediaChange(uiutils.UITestCase):
# CDROM + physical
hw.find("IDE CDROM 1", "table cell").click()
self.assertTrue(not entry.text)
uiutils.check(lambda: not entry.text)
entry.text = "/dev/sr0"
appl.click()
self._click_alert_button("changes will take effect", "OK")
uiutils.check_in_loop(lambda: not appl.sensitive)
self.assertTrue(not entry.text)
uiutils.check(lambda: not appl.sensitive)
uiutils.check(lambda: not entry.text)
# Shutdown the VM, verify change shows up
win.find("Shut Down", "push button").click()
run = win.find("Run", "push button")
uiutils.check_in_loop(lambda: run.sensitive)
self.assertTrue(entry.text == "Fedora12_media (/dev/sr0)")
uiutils.check(lambda: run.sensitive)
uiutils.check(lambda: entry.text == "Fedora12_media (/dev/sr0)")

View File

@ -23,7 +23,7 @@ class VMMMigrate(uiutils.UITestCase):
win.find("uri-entry", "text").text = "test:///default"
win.find("Connect", "push button").click()
uiutils.check_in_loop(lambda: win.showing is False)
uiutils.check(lambda: win.showing is False)
c = self.app.root.find("test-many-devices", "table cell")
c.click(button=3)
self.app.root.find("Migrate...", "menu item").click()
@ -34,4 +34,4 @@ class VMMMigrate(uiutils.UITestCase):
self._click_alert_button(
"the.connection.driver:.virDomainMigrate", "Close")
mig.find("Cancel", "push button").click()
uiutils.check_in_loop(lambda: not mig.showing)
uiutils.check(lambda: not mig.showing)

View File

@ -24,16 +24,16 @@ class VMMPrefs(uiutils.UITestCase):
consoletab = win.find("console-tab")
feedbacktab = win.find("feedback-tab")
uiutils.check_in_loop(lambda: not feedbacktab.onscreen)
uiutils.check(lambda: not feedbacktab.onscreen)
tab = generaltab
uiutils.check_in_loop(lambda: tab.onscreen)
uiutils.check(lambda: tab.onscreen)
tab.find_fuzzy("Enable system tray", "check").click()
tab.find_fuzzy("Enable XML").click()
tab.find_fuzzy("libguestfs VM").click()
win.find("Polling", "page tab").click()
tab = pollingtab
uiutils.check_in_loop(lambda: tab.onscreen)
uiutils.check(lambda: tab.onscreen)
tab.find_fuzzy(None, "check box", "Poll CPU").click()
tab.find_fuzzy(None, "check box", "Poll Disk").click()
tab.find_fuzzy(None, "check box", "Poll Memory").click()
@ -45,7 +45,7 @@ class VMMPrefs(uiutils.UITestCase):
win.find("New VM", "page tab").click()
tab = newvmtab
newvmtab.print_nodes()
uiutils.check_in_loop(lambda: tab.onscreen)
uiutils.check(lambda: tab.onscreen)
tab.find_fuzzy(None, "check box", "sound device").click()
tab.find(None, "combo box", "CPU default:").click()
tab.find_fuzzy("Copy host", "menu item").click()
@ -58,7 +58,7 @@ class VMMPrefs(uiutils.UITestCase):
win.find("Console", "page tab").click()
tab = consoletab
uiutils.check_in_loop(lambda: tab.onscreen)
uiutils.check(lambda: tab.onscreen)
tab.find(None, "combo box", "SPICE USB").click()
tab.find_fuzzy("Manual redirect", "menu item").click()
tab.find_fuzzy(None, "combo box", "Resize guest").click()
@ -89,7 +89,7 @@ class VMMPrefs(uiutils.UITestCase):
win.find("Feedback", "page tab").click()
tab = feedbacktab
uiutils.check_in_loop(lambda: tab.onscreen)
uiutils.check(lambda: tab.onscreen)
tab.find_fuzzy(None, "check box", "Force Poweroff").click()
tab.find_fuzzy(None, "check box", "Poweroff/Reboot").click()
tab.find_fuzzy(None, "check box", "Pause").click()
@ -101,7 +101,7 @@ class VMMPrefs(uiutils.UITestCase):
win.find_fuzzy("Enable system tray", "check").click()
win.find_fuzzy("Close", "push button").click()
uiutils.check_in_loop(lambda: win.visible is False)
uiutils.check(lambda: win.visible is False)
def testPrefsXMLEditor(self):
@ -114,10 +114,10 @@ class VMMPrefs(uiutils.UITestCase):
detailswin.find("XML", "page tab").click()
uiutils.drag(detailswin, 400, 400)
warnlabel = detailswin.find_fuzzy("XML editing is disabled")
self.assertTrue(warnlabel.visible)
uiutils.check(lambda: warnlabel.visible)
origtext = xmleditor.text
xmleditor.typeText("1234abcd")
self.assertEqual(xmleditor.text, origtext)
uiutils.check(lambda: xmleditor.text == origtext)
managerwin.grabFocus()
managerwin.click()
@ -126,7 +126,7 @@ class VMMPrefs(uiutils.UITestCase):
prefswin = self.app.root.find_fuzzy("Preferences", "frame")
prefswin.find_fuzzy("Enable XML").click()
prefswin.find_fuzzy("Close", "push button").click()
uiutils.check_in_loop(lambda: prefswin.visible is False)
uiutils.check(lambda: prefswin.visible is False)
managerwin.keyCombo("<alt>F4")
detailswin.click()
@ -134,7 +134,7 @@ class VMMPrefs(uiutils.UITestCase):
"><title>FOOTITLE</title>", 1)
finish.click()
detailswin.find("Details", "page tab").click()
uiutils.check_in_loop(lambda:
uiutils.check(lambda:
detailswin.find("Title:", "text").text == "FOOTITLE")
def testPrefsKeyfile(self):

View File

@ -49,17 +49,17 @@ class Snapshots(uiutils.UITestCase):
win.find(snapname, "table cell").click()
snaprun.click()
self._click_alert_button("run the snapshot '%s'" % snapname, "No")
uiutils.check_in_loop(lambda: not vmrun.sensitive)
uiutils.check(lambda: not vmrun.sensitive)
snaprun.click()
self._click_alert_button("run the snapshot '%s'" % snapname, "Yes")
uiutils.check_in_loop(lambda: vmrun.sensitive)
uiutils.check(lambda: vmrun.sensitive)
# Start paused snapshot
snapname = "snap-paused"
win.find(snapname, "table cell").click()
snaprun.click()
self._click_alert_button("run the snapshot '%s'" % snapname, "Yes")
uiutils.check_in_loop(lambda: vmpause.checked)
uiutils.check(lambda: vmpause.checked)
# Edit snapshot
descui = win.find("snapshot-description")
@ -67,7 +67,7 @@ class Snapshots(uiutils.UITestCase):
descui.text = desc
win.find("snapshot-apply", "push button").click()
win.find("snapshot-refresh", "push button").click()
uiutils.check_in_loop(lambda: descui.text == desc)
uiutils.check(lambda: descui.text == desc)
# Apply by clicking away
desc += " ROUND2"
descui.text = desc
@ -81,17 +81,17 @@ class Snapshots(uiutils.UITestCase):
newwin.find("Name:", "text").text = snapname
newwin.find("Description:", "text").text = "testdesc"
newwin.find("Finish", "push button").click()
uiutils.check_in_loop(lambda: not newwin.showing)
uiutils.check(lambda: not newwin.showing)
newc = win.find(snapname, "table cell")
uiutils.check_in_loop(lambda: newc.state_selected)
uiutils.check(lambda: newc.state_selected)
# Delete it
win.find("snapshot-delete", "push button").click()
self._click_alert_button("permanently delete", "No")
uiutils.check_in_loop(lambda: not newc.dead)
uiutils.check(lambda: not newc.dead)
win.find("snapshot-delete", "push button").click()
self._click_alert_button("permanently delete", "Yes")
uiutils.check_in_loop(lambda: newc.dead)
uiutils.check(lambda: newc.dead)
# Recreate another snapshot with the same name
win.find("snapshot-add", "push button").click()
@ -99,13 +99,13 @@ class Snapshots(uiutils.UITestCase):
snapname = "testnewsnap"
newwin.find("Name:", "text").text = snapname
newwin.find("Finish", "push button").click()
uiutils.check_in_loop(lambda: not newwin.showing)
uiutils.check(lambda: not newwin.showing)
newc = win.find(snapname, "table cell")
uiutils.check_in_loop(lambda: newc.state_selected)
uiutils.check(lambda: newc.state_selected)
# Switch out of window
win.find("Details", "radio button").click()
uiutils.check_in_loop(lambda: not snaprun.showing)
uiutils.check(lambda: not snaprun.showing)
def testSnapshotMisc1(self):
"""
@ -123,20 +123,20 @@ class Snapshots(uiutils.UITestCase):
# Create new snapshot
win.find("snapshot-add", "push button").click()
self._click_alert_button("not become part of the snapshot", "Cancel")
uiutils.check_in_loop(lambda: win.active)
uiutils.check(lambda: win.active)
win.find("snapshot-add", "push button").click()
self._click_alert_button("not become part of the snapshot", "OK")
newwin = self.app.root.find("Create snapshot", "frame")
snapname1 = "testnewsnap1"
newwin.find("Name:", "text").text = snapname1
newwin.find("Finish", "push button").click()
uiutils.check_in_loop(lambda: not newwin.showing)
uiutils.check(lambda: not newwin.showing)
newc = win.find(snapname1, "table cell")
uiutils.check_in_loop(lambda: newc.state_selected)
uiutils.check(lambda: newc.state_selected)
# Start the VM, create another snapshot
vmrun.click()
uiutils.check_in_loop(lambda: not vmrun.sensitive)
uiutils.check(lambda: not vmrun.sensitive)
win.find("snapshot-add", "push button").click()
newwin = self.app.root.find("Create snapshot", "frame")
# Force validation error
@ -151,16 +151,16 @@ class Snapshots(uiutils.UITestCase):
snapname2 = "testnewsnap2"
newwin.find("Name:", "text").text = snapname2
newwin.find("Finish", "push button").click()
uiutils.check_in_loop(lambda: not newwin.showing)
uiutils.check(lambda: not newwin.showing)
newc = win.find(snapname2, "table cell")
uiutils.check_in_loop(lambda: newc.state_selected)
uiutils.check(lambda: newc.state_selected)
# Trigger another managed save warning
smenu = win.find("Menu", "toggle button")
smenu.click()
save = smenu.find("Save", "menu item")
save.click()
uiutils.check_in_loop(lambda: vmrun.sensitive)
uiutils.check(lambda: vmrun.sensitive)
win.find(snapname1, "table cell").click(button=3)
self.app.root.find("Start snapshot", "menu item").click()
self._click_alert_button("run the snapshot '%s'" % snapname1, "Yes")
@ -178,6 +178,6 @@ class Snapshots(uiutils.UITestCase):
self.releaseKey("Shift_L")
win.find("snapshot-delete").click()
self._click_alert_button("permanently delete", "Yes")
uiutils.check_in_loop(lambda: cell1.dead)
uiutils.check_in_loop(lambda: cell2.dead)
uiutils.check_in_loop(lambda: win.active)
uiutils.check(lambda: cell1.dead)
uiutils.check(lambda: cell2.dead)
uiutils.check(lambda: win.active)

View File

@ -94,14 +94,14 @@ class UITestCase(unittest.TestCase):
if shutdown:
win.find("Shut Down", "push button").click()
run = win.find("Run", "push button")
check_in_loop(lambda: run.sensitive)
check(lambda: run.sensitive)
return win
def _click_alert_button(self, label_text, button_text):
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy(label_text, "label")
alert.find(button_text, "push button").click()
check_in_loop(lambda: not alert.active)
check(lambda: not alert.active)
def _select_storagebrowser_volume(self, pool, vol):
browsewin = self.app.root.find("vmm-storage-browser")
@ -132,7 +132,7 @@ class UITestCase(unittest.TestCase):
idx += cells_per_selection
continue
self.assertTrue(cell.state_selected)
check(lambda: cell.state_selected)
dogtail.rawinput.pressKey(reverse and "Up" or "Down")
if not win.active:
@ -145,9 +145,9 @@ class UITestCase(unittest.TestCase):
idx += cells_per_selection
if idx >= len(all_cells):
# Last cell, selection shouldn't have changed
self.assertTrue(cell.state_selected)
check(lambda: cell.state_selected)
else:
self.assertTrue(not cell.state_selected)
check(lambda: not cell.state_selected)
def _test_xmleditor_interactions(self, win, finish):
"""
@ -162,7 +162,7 @@ class UITestCase(unittest.TestCase):
win.find("Details", "page tab").click()
# Select 'No', meaning don't abandon changes
self._click_alert_button("changes will be lost", "No")
check_in_loop(lambda: xmleditor.showing)
check(lambda: xmleditor.showing)
# Click the finish button, but our bogus change should trigger error
finish.click()
@ -171,7 +171,7 @@ class UITestCase(unittest.TestCase):
# Try unapplied changes again, this time abandon our changes
win.find("Details", "page tab").click()
self._click_alert_button("changes will be lost", "Yes")
check_in_loop(lambda: not xmleditor.showing)
check(lambda: not xmleditor.showing)
class _FuzzyPredicate(dogtail.predicate.Predicate):
@ -235,7 +235,7 @@ class _FuzzyPredicate(dogtail.predicate.Predicate):
self._name, self._roleName, self._labeller_text, e)
def check_in_loop(func, timeout=2):
def check(func, timeout=2):
"""
Run the passed func in a loop every .1 seconds until timeout is hit or
the func returns True.
@ -329,7 +329,7 @@ class VMMDogtailNode(dogtail.tree.Node):
screen, helps reduce some test flakiness
"""
# pylint: disable=arguments-differ,signature-differs
check_in_loop(lambda: self.onscreen)
check(lambda: self.onscreen)
dogtail.tree.Node.click(self, *args, **kwargs)
def bring_on_screen(self, key_name="Down", max_tries=100):
@ -368,7 +368,7 @@ class VMMDogtailNode(dogtail.tree.Node):
# before we return them. This ensures the window is actually onscreen
# so it sidesteps a lot of race conditions
if ret.roleName in ["frame", "dialog", "alert"] and check_active:
check_in_loop(lambda: ret.active)
check(lambda: ret.active)
return ret
def find_fuzzy(self, name, roleName=None, labeller_text=None):