uitests: Add combo selection helpers and use them

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-08-25 12:46:59 -04:00
parent c405dd2741
commit dc41f61e5e
12 changed files with 201 additions and 309 deletions

View File

@ -62,6 +62,12 @@ class AddHardware(uiutils.UITestCase):
uiutils.check(lambda: tab.showing) uiutils.check(lambda: tab.showing)
return tab return tab
def _finish(self, addhw, check):
addhw.find("Finish", "push button").click()
uiutils.check(lambda: not addhw.active)
if check:
uiutils.check(lambda: check.active)
############## ##############
# Test cases # # Test cases #
@ -73,44 +79,33 @@ class AddHardware(uiutils.UITestCase):
""" """
details = self._open_details_window() details = self._open_details_window()
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# Default SCSI # Default SCSI
tab = self._select_hw(addhw, "Controller", "controller-tab") tab = self._select_hw(addhw, "Controller", "controller-tab")
typ = tab.find("Type:", "combo box") tab.combo_select("Type:", "SCSI")
typ.click_combo_entry() self._finish(addhw, check=details)
tab.find("SCSI", "menu item").click()
finish.click()
uiutils.check(lambda: details.active)
# Virtio SCSI # Virtio SCSI
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
tab = self._select_hw(addhw, "Controller", "controller-tab") tab = self._select_hw(addhw, "Controller", "controller-tab")
typ.click_combo_entry() tab.combo_select("Type:", "SCSI")
tab.find("SCSI", "menu item").click() tab.combo_select("Model:", "VirtIO SCSI")
tab.find("Model:", "combo box").click_combo_entry() self._finish(addhw, check=details)
tab.find("VirtIO SCSI", "menu item").click()
finish.click()
uiutils.check(lambda: details.active)
# USB 2 # USB 2
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
tab = self._select_hw(addhw, "Controller", "controller-tab") tab = self._select_hw(addhw, "Controller", "controller-tab")
typ.click_combo_entry() tab.combo_select("Type:", "USB")
tab.find("USB", "menu item").click() tab.combo_select("Model:", "USB 2")
tab.find("Model:", "combo box").click_combo_entry() self._finish(addhw, check=details)
tab.find("USB 2", "menu item").click()
finish.click()
uiutils.check(lambda: details.active)
# USB 3 # USB 3
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
tab = self._select_hw(addhw, "Controller", "controller-tab") tab = self._select_hw(addhw, "Controller", "controller-tab")
typ.click_combo_entry() tab.combo_select("Type:", "USB")
tab.find("^USB$", "menu item").click() tab.combo_select("Model:", "USB 3")
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 # Can't add more than 1 USB controller, so finish isn't sensitive
finish = addhw.find("Finish", "push button")
uiutils.check(lambda: not finish.sensitive) uiutils.check(lambda: not finish.sensitive)
def testAddCephDisk(self): def testAddCephDisk(self):
@ -119,7 +114,6 @@ class AddHardware(uiutils.UITestCase):
""" """
details = self._open_details_window() details = self._open_details_window()
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# Select ceph volume for disk # Select ceph volume for disk
tab = self._select_hw(addhw, "Storage", "storage-tab") tab = self._select_hw(addhw, "Storage", "storage-tab")
@ -129,8 +123,7 @@ class AddHardware(uiutils.UITestCase):
browse.find_fuzzy("rbd-ceph", "table cell").bring_on_screen().click() browse.find_fuzzy("rbd-ceph", "table cell").bring_on_screen().click()
browse.find_fuzzy("some-rbd-vol", "table cell").click() browse.find_fuzzy("some-rbd-vol", "table cell").click()
browse.find("Choose Volume", "push button").click() browse.find("Choose Volume", "push button").click()
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Check disk details, make sure it correctly selected volume # Check disk details, make sure it correctly selected volume
details.find("IDE Disk 2", "table cell").click() details.find("IDE Disk 2", "table cell").click()
@ -145,34 +138,29 @@ class AddHardware(uiutils.UITestCase):
""" """
details = self._open_details_window() details = self._open_details_window()
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# Default disk # Default disk
tab = self._select_hw(addhw, "Storage", "storage-tab") tab = self._select_hw(addhw, "Storage", "storage-tab")
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Disk with some tweaks # Disk with some tweaks
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
tab = self._select_hw(addhw, "Storage", "storage-tab") tab = self._select_hw(addhw, "Storage", "storage-tab")
tab.find("Bus type:", "combo box").click() tab.combo_select("Bus type:", "VirtIO")
tab.find("VirtIO", "menu item").click()
tab.find("Advanced options", "toggle button").click_expander() tab.find("Advanced options", "toggle button").click_expander()
tab.find("Cache mode:", "combo box").click() tab.combo_select("Cache mode:", "none")
tab.find("none", "menu item").click()
# Size too big # Size too big
tab.find("GiB", "spin button").text = "2000" tab.find("GiB", "spin button").text = "2000"
finish.click() self._finish(addhw, check=None)
self._click_alert_button("not enough free space", "Close") self._click_alert_button("not enough free space", "Close")
tab.find("GiB", "spin button").text = "1.5" tab.find("GiB", "spin button").text = "1.5"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Managed storage tests # Managed storage tests
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
tab = self._select_hw(addhw, "Storage", "storage-tab") tab = self._select_hw(addhw, "Storage", "storage-tab")
tab.find_fuzzy("Select or create", "radio").click() tab.find_fuzzy("Select or create", "radio").click()
finish.click() self._finish(addhw, check=None)
self._click_alert_button("storage path must be specified", "OK") self._click_alert_button("storage path must be specified", "OK")
tab.find("storage-browse", "push button").click() tab.find("storage-browse", "push button").click()
browse = self.app.root.find("vmm-storage-browser") browse = self.app.root.find("vmm-storage-browser")
@ -218,9 +206,9 @@ class AddHardware(uiutils.UITestCase):
browse.find("diskvol1", "table cell").click() browse.find("diskvol1", "table cell").click()
browse.find("Choose Volume", "push button").click() browse.find("Choose Volume", "push button").click()
uiutils.check(lambda: "/diskvol1" in storageent.text) uiutils.check(lambda: "/diskvol1" in storageent.text)
finish.click() self._finish(addhw, check=None)
self._click_alert_button("already in use by", "No") self._click_alert_button("already in use by", "No")
finish.click() self._finish(addhw, check=None)
self._click_alert_button("already in use by", "Yes") self._click_alert_button("already in use by", "Yes")
uiutils.check(lambda: details.active) uiutils.check(lambda: details.active)
@ -228,23 +216,18 @@ class AddHardware(uiutils.UITestCase):
# choose file for floppy # choose file for floppy
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
tab = self._select_hw(addhw, "Storage", "storage-tab") tab = self._select_hw(addhw, "Storage", "storage-tab")
tab.find("Device type:", "combo box").click() tab.combo_select("Device type:", "Floppy device")
tab.find("Floppy device", "menu item").click()
diskradio = tab.find_fuzzy("Create a disk image", "radio") diskradio = tab.find_fuzzy("Create a disk image", "radio")
uiutils.check(lambda: not diskradio.sensitive) uiutils.check(lambda: not diskradio.sensitive)
tab.find("storage-entry").text = "/dev/default-pool/bochs-vol" tab.find("storage-entry").text = "/dev/default-pool/bochs-vol"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# empty cdrom # empty cdrom
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
tab = self._select_hw(addhw, "Storage", "storage-tab") tab = self._select_hw(addhw, "Storage", "storage-tab")
tab.find("Device type:", "combo box").click() tab.combo_select("Device type:", "CDROM device")
tab.find("CDROM device", "menu item").click() tab.combo_select("Bus type:", "SCSI")
tab.find("Bus type:", "combo box").click() self._finish(addhw, check=details)
tab.find("SCSI", "menu item").click()
finish.click()
uiutils.check(lambda: details.active)
@_search_permissions_decorator @_search_permissions_decorator
def testAddDiskSearchPermsCheckbox(self, uri, tmpdir): def testAddDiskSearchPermsCheckbox(self, uri, tmpdir):
@ -256,12 +239,11 @@ class AddHardware(uiutils.UITestCase):
# Say 'No' but path should still work due to test driver # Say 'No' but path should still work due to test driver
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
tab = self._select_hw(addhw, "Storage", "storage-tab") tab = self._select_hw(addhw, "Storage", "storage-tab")
tab.find_fuzzy("Select or create", "radio").click() tab.find_fuzzy("Select or create", "radio").click()
path = tmpdir + "/foo1.img" path = tmpdir + "/foo1.img"
tab.find("storage-entry").text = path tab.find("storage-entry").text = path
finish.click() self._finish(addhw, check=None)
self._click_alert_button("emulator may not have", "No") self._click_alert_button("emulator may not have", "No")
uiutils.check(lambda: details.active) uiutils.check(lambda: details.active)
@ -271,7 +253,7 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("Select or create", "radio").click() tab.find_fuzzy("Select or create", "radio").click()
path = tmpdir + "/foo2.img" path = tmpdir + "/foo2.img"
tab.find("storage-entry").text = path tab.find("storage-entry").text = path
finish.click() self._finish(addhw, check=None)
alert = self.app.root.find_fuzzy("vmm dialog", "alert") alert = self.app.root.find_fuzzy("vmm dialog", "alert")
alert.find_fuzzy("Don't ask", "check box").click() alert.find_fuzzy("Don't ask", "check box").click()
self._click_alert_button("emulator may not have", "No") self._click_alert_button("emulator may not have", "No")
@ -283,8 +265,7 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("Select or create", "radio").click() tab.find_fuzzy("Select or create", "radio").click()
path = tmpdir + "/foo3.img" path = tmpdir + "/foo3.img"
tab.find("storage-entry").text = path tab.find("storage-entry").text = path
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
@_search_permissions_decorator @_search_permissions_decorator
def testAddDiskSearchPermsSuccess(self, uri, tmpdir): def testAddDiskSearchPermsSuccess(self, uri, tmpdir):
@ -296,12 +277,11 @@ class AddHardware(uiutils.UITestCase):
# Say 'Yes' # Say 'Yes'
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
tab = self._select_hw(addhw, "Storage", "storage-tab") tab = self._select_hw(addhw, "Storage", "storage-tab")
tab.find_fuzzy("Select or create", "radio").click() tab.find_fuzzy("Select or create", "radio").click()
path = tmpdir + "/foo1.img" path = tmpdir + "/foo1.img"
tab.find("storage-entry").text = path tab.find("storage-entry").text = path
finish.click() self._finish(addhw, check=None)
self._click_alert_button("emulator may not have", "Yes") self._click_alert_button("emulator may not have", "Yes")
uiutils.check(lambda: details.active) uiutils.check(lambda: details.active)
@ -311,8 +291,7 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("Select or create", "radio").click() tab.find_fuzzy("Select or create", "radio").click()
path = tmpdir + "/foo3.img" path = tmpdir + "/foo3.img"
tab.find("storage-entry").text = path tab.find("storage-entry").text = path
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
@_search_permissions_decorator @_search_permissions_decorator
def testAddDiskSearchPermsFail(self, uri, tmpdir): def testAddDiskSearchPermsFail(self, uri, tmpdir):
@ -325,12 +304,11 @@ class AddHardware(uiutils.UITestCase):
# Say 'Yes' and it should fail, then blacklist the paths # Say 'Yes' and it should fail, then blacklist the paths
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
tab = self._select_hw(addhw, "Storage", "storage-tab") tab = self._select_hw(addhw, "Storage", "storage-tab")
tab.find_fuzzy("Select or create", "radio").click() tab.find_fuzzy("Select or create", "radio").click()
path = tmpdir + "/foo1.img" path = tmpdir + "/foo1.img"
tab.find("storage-entry").text = path tab.find("storage-entry").text = path
finish.click() self._finish(addhw, check=None)
self._click_alert_button("emulator may not have", "Yes") self._click_alert_button("emulator may not have", "Yes")
alert = self.app.root.find("vmm dialog", "alert") alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("Errors were encountered", "label") alert.find_fuzzy("Errors were encountered", "label")
@ -344,8 +322,7 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("Select or create", "radio").click() tab.find_fuzzy("Select or create", "radio").click()
path = tmpdir + "/foo2.img" path = tmpdir + "/foo2.img"
tab.find("storage-entry").text = path tab.find("storage-entry").text = path
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
def testAddNetworks(self): def testAddNetworks(self):
""" """
@ -353,46 +330,35 @@ class AddHardware(uiutils.UITestCase):
""" """
details = self._open_details_window() details = self._open_details_window()
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# Basic network + opts # Basic network + opts
tab = self._select_hw(addhw, "Network", "network-tab") tab = self._select_hw(addhw, "Network", "network-tab")
src = tab.find(None, "combo box", "Network source:") tab.combo_select("net-source", "Virtual network 'default'")
src.click()
tab.find_fuzzy("Virtual network 'default' : NAT", "menu item").click()
tab.find("MAC Address Field", "text").text = "00:11:00:11:00:11" tab.find("MAC Address Field", "text").text = "00:11:00:11:00:11"
tab.find("Device model:", "combo box").click_combo_entry() tab.combo_select("Device model:", "virtio")
tab.find("virtio", "menu item").click() self._finish(addhw, check=details)
finish.click()
uiutils.check(lambda: details.active)
# Manual macvtap # Manual macvtap
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Network", "network-tab") tab = self._select_hw(addhw, "Network", "network-tab")
src.click() tab.combo_select("net-source", "Macvtap device...")
tab.find_fuzzy("Macvtap device...", "menu item").click()
tab.find("Device name:", "text").text = "macvtapfoo7" tab.find("Device name:", "text").text = "macvtapfoo7"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Manual bridge. Also trigger MAC collision # Manual bridge. Also trigger MAC collision
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Network", "network-tab") tab = self._select_hw(addhw, "Network", "network-tab")
tab.find("mac-address-enable", "check box").click() tab.find("mac-address-enable", "check box").click()
src.click() tab.combo_select("net-source", "Bridge device...")
self.pressKey("End")
tab.find_fuzzy("Bridge device...", "menu item").click()
tab.find("Device name:", "text").text = "zbr0" tab.find("Device name:", "text").text = "zbr0"
finish.click() self._finish(addhw, check=None)
# Check MAC validation error # Check MAC validation error
self._click_alert_button("00:11:22:33:44:55", "Close") self._click_alert_button("00:11:22:33:44:55", "Close")
# Fix MAC # Fix MAC
tab.find("mac-address-enable", "check box").click() tab.find("mac-address-enable", "check box").click()
tab.find("MAC Address Field", "text").text = "00:11:0A:11:00:11" tab.find("MAC Address Field", "text").text = "00:11:0A:11:00:11"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
def testAddGraphics(self): def testAddGraphics(self):
@ -401,16 +367,12 @@ class AddHardware(uiutils.UITestCase):
""" """
details = self._open_details_window() details = self._open_details_window()
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# VNC example # VNC example
tab = self._select_hw(addhw, "Graphics", "graphics-tab") tab = self._select_hw(addhw, "Graphics", "graphics-tab")
tab.find("Type:", "combo box").click_combo_entry() tab.combo_select("Type:", "VNC")
tab.find_fuzzy("VNC", "menu item").click() tab.combo_select("Listen type:", "Address")
tab.find("Listen type:", "combo box").click_combo_entry() tab.combo_select("Address:", "All interfaces")
tab.find_fuzzy("Address", "menu item").click()
tab.find("Address:", "combo box").click_combo_entry()
tab.find_fuzzy("All interfaces", "menu item").click()
tab.find("graphics-port-auto", "check").click() tab.find("graphics-port-auto", "check").click()
tab.find("graphics-port", "spin button").text = "1234" tab.find("graphics-port", "spin button").text = "1234"
tab.find("Password:", "check").click() tab.find("Password:", "check").click()
@ -421,37 +383,26 @@ class AddHardware(uiutils.UITestCase):
uiutils.check(lambda: passwd.text == newpass) uiutils.check(lambda: passwd.text == newpass)
tab.find("Show password", "check").click() tab.find("Show password", "check").click()
uiutils.check(lambda: passwd.text != newpass) uiutils.check(lambda: passwd.text != newpass)
finish.click() self._finish(addhw, check=None)
# Catch a port error # Catch a port error
self._click_alert_button("Port must be above 5900", "Close") self._click_alert_button("Port must be above 5900", "Close")
tab.find("graphics-port", "spin button").text = "5920" tab.find("graphics-port", "spin button").text = "5920"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Spice regular example # Spice regular example
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Graphics", "graphics-tab") tab = self._select_hw(addhw, "Graphics", "graphics-tab")
tab.find("Type:", "combo box").click_combo_entry() tab.combo_select("Type:", "Spice")
tab.find_fuzzy("Spice", "menu item").click() self._finish(addhw, check=details)
finish.click()
uiutils.check(lambda: details.active)
# Spice GL example # Spice GL example
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Graphics", "graphics-tab") tab = self._select_hw(addhw, "Graphics", "graphics-tab")
tab.find("Type:", "combo box").click_combo_entry() tab.combo_select("Type:", "Spice")
tab.find_fuzzy("Spice", "menu item").click() tab.combo_select("Listen type:", "None")
tab.find("Listen type:", "combo box").click_combo_entry()
tab.find_fuzzy("None", "menu item").click()
tab.find("OpenGL:", "check box").click() tab.find("OpenGL:", "check box").click()
render = tab.find("graphics-rendernode", "combo box") tab.combo_check_default("graphics-rendernode", "0000")
m = tab.find_fuzzy("Intel Corp", "menu item") self._finish(addhw, check=details)
render.click_combo_entry()
uiutils.check(lambda: m.selected)
self.pressKey("Escape")
finish.click()
uiutils.check(lambda: details.active)
def testAddHosts(self): def testAddHosts(self):
""" """
@ -459,20 +410,18 @@ class AddHardware(uiutils.UITestCase):
""" """
details = self._open_details_window() details = self._open_details_window()
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# Add USB device dup1 # Add USB device dup1
tab = self._select_hw(addhw, "USB Host Device", "host-tab") tab = self._select_hw(addhw, "USB Host Device", "host-tab")
tab.find_fuzzy("HP Dup USB 1", "table cell").click() tab.find_fuzzy("HP Dup USB 1", "table cell").click()
finish.click() self._finish(addhw, check=None)
self._click_alert_button("device is already in use by", "Yes") self._click_alert_button("device is already in use by", "Yes")
uiutils.check(lambda: details.active)
# Add USB device dup2 # Add USB device dup2
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "USB Host Device", "host-tab") tab = self._select_hw(addhw, "USB Host Device", "host-tab")
tab.find_fuzzy("HP Dup USB 2", "table cell").click() tab.find_fuzzy("HP Dup USB 2", "table cell").click()
finish.click() self._finish(addhw, check=None)
self._click_alert_button("device is already in use by", "Yes") self._click_alert_button("device is already in use by", "Yes")
uiutils.check(lambda: details.active) uiutils.check(lambda: details.active)
@ -480,14 +429,13 @@ class AddHardware(uiutils.UITestCase):
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "USB Host Device", "host-tab") tab = self._select_hw(addhw, "USB Host Device", "host-tab")
tab.find_fuzzy("Cruzer Micro 256", "table cell").click() tab.find_fuzzy("Cruzer Micro 256", "table cell").click()
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Add PCI device # Add PCI device
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "PCI Host Device", "host-tab") tab = self._select_hw(addhw, "PCI Host Device", "host-tab")
tab.find_fuzzy("(Interface eth0)", "table cell").click() tab.find_fuzzy("(Interface eth0)", "table cell").click()
finish.click() self._finish(addhw, check=None)
self._click_alert_button("device is already in use by", "Yes") self._click_alert_button("device is already in use by", "Yes")
uiutils.check(lambda: details.active) uiutils.check(lambda: details.active)
@ -498,40 +446,30 @@ class AddHardware(uiutils.UITestCase):
""" """
details = self._open_details_window() details = self._open_details_window()
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# Add console device # Add console device
tab = self._select_hw(addhw, "Console", "char-tab") tab = self._select_hw(addhw, "Console", "char-tab")
tab.find("Device Type:", "combo box").click() tab.combo_select("Device Type:", "Pseudo TTY")
tab.find_fuzzy("Pseudo TTY", "menu item").click() tab.combo_select("Type:", "Hypervisor default")
tab.find("Type:", "combo box").click_combo_entry() self._finish(addhw, check=details)
tab.find_fuzzy("Hypervisor default", "menu item").click()
finish.click()
uiutils.check(lambda: details.active)
# Add serial+file # Add serial+file
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Serial", "char-tab") tab = self._select_hw(addhw, "Serial", "char-tab")
tab.find("Device Type:", "combo box").click() tab.combo_select("Device Type:", "Output to a file")
tab.find_fuzzy("Output to a file", "menu item").click()
tab.find("Path:", "text").text = "/tmp/foo.log" tab.find("Path:", "text").text = "/tmp/foo.log"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Parallel", "char-tab") tab = self._select_hw(addhw, "Parallel", "char-tab")
tab.find("Device Type:", "combo box").click() tab.combo_select("Device Type:", "UNIX")
tab.find_fuzzy("UNIX", "menu item").click() self._finish(addhw, check=details)
finish.click()
uiutils.check(lambda: details.active)
# Add spicevmc channel # Add spicevmc channel
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Channel", "char-tab") tab = self._select_hw(addhw, "Channel", "char-tab")
# Ensures that this is selected by default combo = tab.combo_select("Device Type:", ".*spicevmc.*")
tab.find("com.redhat.spice.0", "combo box") self._finish(addhw, check=details)
finish.click()
uiutils.check(lambda: details.active)
def testAddLXCFilesystem(self): def testAddLXCFilesystem(self):
@ -542,16 +480,12 @@ class AddHardware(uiutils.UITestCase):
details = self._open_details_window() details = self._open_details_window()
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# Add File+nbd share # Add File+nbd share
tab = self._select_hw(addhw, "Filesystem", "filesystem-tab") tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
tab.find("Type:", "combo box").click() tab.combo_select("Type:", "File")
tab.find("File", "menu item").click() tab.combo_select("Driver:", "Nbd")
tab.find("Driver:", "combo box").click() tab.combo_select("Format:", "qcow2")
tab.find("Nbd", "menu item").click()
tab.find("Format:", "combo box").click_combo_entry()
tab.find("qcow2", "menu item").click()
source = tab.find("Source path:", "text") source = tab.find("Source path:", "text")
source.text = "/foo/source" source.text = "/foo/source"
@ -573,113 +507,97 @@ class AddHardware(uiutils.UITestCase):
# Use this to test some error.py logic for truncating large errors # Use this to test some error.py logic for truncating large errors
badtarget = "a" * 1024 badtarget = "a" * 1024
tab.find("Target path:", "text").text = badtarget tab.find("Target path:", "text").text = badtarget
finish.click() self._finish(addhw, check=None)
self._click_alert_button("aaa...", "Close") self._click_alert_button("aaa...", "Close")
tab.find("Target path:", "text").text = "/foo/target" tab.find("Target path:", "text").text = "/foo/target"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Add RAM type # Add RAM type
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Filesystem", "filesystem-tab") tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
tab.find("Type:", "combo box").click() tab.combo_select("Type:", "Ram")
tab.find("Ram", "menu item").click()
tab.find("Usage:", "spin button").text = "12345" tab.find("Usage:", "spin button").text = "12345"
tab.find("Target path:", "text").text = "/mem" tab.find("Target path:", "text").text = "/mem"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
def testAddHWMisc(self): def testAddHWMisc1(self):
""" """
Add one each of simple devices Add some simple devices
""" """
details = self._open_details_window() details = self._open_details_window()
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# Add input # Add input
tab = self._select_hw(addhw, "Input", "input-tab") tab = self._select_hw(addhw, "Input", "input-tab")
tab.find("Type:", "combo box").click() tab.combo_select("Type:", "EvTouch")
tab.find("EvTouch", "menu item").click() self._finish(addhw, check=details)
finish.click()
uiutils.check(lambda: details.active)
# Add sound # Add sound
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Sound", "sound-tab") tab = self._select_hw(addhw, "Sound", "sound-tab")
tab.find("Model:", "combo box").click_combo_entry() tab.combo_select("Model:", "HDA")
tab.find("HDA", "menu item").click() self._finish(addhw, check=details)
finish.click()
uiutils.check(lambda: details.active)
# Add video # Add video
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Video", "video-tab") tab = self._select_hw(addhw, "Video", "video-tab")
tab.find("Model:", "combo box").click_combo_entry() tab.combo_select("Model:", "Virtio")
tab.find("Virtio", "menu item").click() self._finish(addhw, check=details)
finish.click()
uiutils.check(lambda: details.active)
# Add watchdog # Add watchdog
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Watchdog", "watchdog-tab") tab = self._select_hw(addhw, "Watchdog", "watchdog-tab")
tab.find("Model:", "combo box").click() tab.combo_select("Model:", "I6300")
tab.find("I6300", "menu item").click() tab.combo_select("Action:", "Pause the guest")
tab.find("Action:", "combo box").click() self._finish(addhw, check=details)
tab.find("Pause the guest", "menu item").click()
finish.click()
uiutils.check(lambda: details.active)
# Add smartcard # Add smartcard
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Smartcard", "smartcard-tab") tab = self._select_hw(addhw, "Smartcard", "smartcard-tab")
tab.find("Mode:", "combo box").click() tab.combo_select("Mode:", "Passthrough")
tab.find("Passthrough", "menu item").click() self._finish(addhw, check=details)
finish.click()
uiutils.check(lambda: details.active) def testAddHWMisc2(self):
"""
Add some more simple devices"
"""
details = self._open_details_window()
addhw = self._open_addhw_window(details)
# Add basic filesystem # Add basic filesystem
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Filesystem", "filesystem-tab") tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
tab.find("Source path:", "text").text = "/foo/source" tab.find("Source path:", "text").text = "/foo/source"
tab.find("Target path:", "text").text = "/foo/target" tab.find("Target path:", "text").text = "/foo/target"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Add TPM # Add TPM
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "TPM", "tpm-tab") tab = self._select_hw(addhw, "TPM", "tpm-tab")
tab.find("Model:", "combo").click() tab.combo_select("Model:", "TIS")
tab.find("TIS", "menu item").click() tab.combo_select("Backend:", "Passthrough")
tab.find("Backend:", "combo").click()
tab.find("Passthrough", "menu item").click()
tab.find("Device Path:", "text").text = "/tmp/foo" tab.find("Device Path:", "text").text = "/tmp/foo"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Add RNG # Add RNG
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "RNG", "rng-tab") tab = self._select_hw(addhw, "RNG", "rng-tab")
tab.find("Host Device:", "text").text = "/dev/random" tab.find("Host Device:", "text").text = "/dev/random"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
# Add Panic # Add Panic
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "Panic", "panic-tab") tab = self._select_hw(addhw, "Panic", "panic-tab")
tab.find("Model:", "combo box").click() tab.combo_select("Model:", "Hyper-V")
tab.find("Hyper-V", "menu item").click() self._finish(addhw, check=details)
finish.click()
uiutils.check(lambda: details.active)
# Add vsock # Add vsock
self._open_addhw_window(details) self._open_addhw_window(details)
tab = self._select_hw(addhw, "VirtIO VSOCK", "vsock-tab") tab = self._select_hw(addhw, "VirtIO VSOCK", "vsock-tab")
tab.find("vsock-auto").click() tab.find("vsock-auto").click()
tab.find("vsock-cid").text = "7" tab.find("vsock-cid").text = "7"
finish.click() self._finish(addhw, check=details)
uiutils.check(lambda: details.active)
def testAddHWCornerCases(self): def testAddHWCornerCases(self):
@ -688,14 +606,13 @@ class AddHardware(uiutils.UITestCase):
""" """
details = self._open_details_window("test-many-devices") details = self._open_details_window("test-many-devices")
addhw = self._open_addhw_window(details) addhw = self._open_addhw_window(details)
finish = addhw.find("Finish", "push button")
# Test cancel # Test cancel
addhw.find("Cancel", "push button").click() addhw.find("Cancel", "push button").click()
# Test live adding, error dialog, click no # Test live adding, error dialog, click no
self._open_addhw_window(details) self._open_addhw_window(details)
finish.click() self._finish(addhw, check=None)
alert = self.app.root.find("vmm dialog", "alert") alert = self.app.root.find("vmm dialog", "alert")
alert.find( alert.find(
"This device could not be attached to the running machine", "This device could not be attached to the running machine",
@ -706,7 +623,7 @@ class AddHardware(uiutils.UITestCase):
# Test live adding, error dialog, click yes # Test live adding, error dialog, click yes
self._open_addhw_window(details) self._open_addhw_window(details)
finish.click() self._finish(addhw, check=None)
alert = self.app.root.find("vmm dialog", "alert") alert = self.app.root.find("vmm dialog", "alert")
alert.find( alert.find(
"This device could not be attached to the running machine", "This device could not be attached to the running machine",
@ -722,7 +639,6 @@ class AddHardware(uiutils.UITestCase):
self.app.open(xmleditor_enabled=True) self.app.open(xmleditor_enabled=True)
details = self._open_details_window() details = self._open_details_window()
win = self._open_addhw_window(details) win = self._open_addhw_window(details)
finish = win.find("Finish", "push button")
# Disk test, change path and make sure we error it is missing # Disk test, change path and make sure we error it is missing
win.find("XML", "page tab").click() win.find("XML", "page tab").click()
@ -730,14 +646,14 @@ class AddHardware(uiutils.UITestCase):
origpath = "/var/lib/libvirt/images/test-clone-simple.qcow2" origpath = "/var/lib/libvirt/images/test-clone-simple.qcow2"
newpath = "/FOO/XMLEDIT/test1.img" newpath = "/FOO/XMLEDIT/test1.img"
xmleditor.text = xmleditor.text.replace(origpath, newpath) xmleditor.text = xmleditor.text.replace(origpath, newpath)
finish.click() self._finish(win, check=None)
self._click_alert_button("non-existent path", "Close") self._click_alert_button("non-existent path", "Close")
# Undo the bad change, change bus/target # Undo the bad change, change bus/target
xmleditor.text = xmleditor.text.replace(newpath, origpath) xmleditor.text = xmleditor.text.replace(newpath, origpath)
xmleditor.text = xmleditor.text.replace("hdb", "xvda") xmleditor.text = xmleditor.text.replace("hdb", "xvda")
xmleditor.text = xmleditor.text.replace("ide", "xen") xmleditor.text = xmleditor.text.replace("ide", "xen")
finish.click() self._finish(win, check=details)
# Verify the changes applied # Verify the changes applied
details.find("Xen Disk 1").click() details.find("Xen Disk 1").click()
@ -758,6 +674,7 @@ class AddHardware(uiutils.UITestCase):
uiutils.check(lambda: not xmleditor.showing) uiutils.check(lambda: not xmleditor.showing)
# Do standard xmleditor tests # Do standard xmleditor tests
finish = win.find("Finish", "push button")
self._test_xmleditor_interactions(win, finish) self._test_xmleditor_interactions(win, finish)
win.find("Cancel", "push button").click() win.find("Cancel", "push button").click()
uiutils.check(lambda: not win.visible) uiutils.check(lambda: not win.visible)

View File

@ -71,8 +71,7 @@ class CloneVM(uiutils.UITestCase):
"text", "New MAC:").text = "00:16:3e:cc:cf:05" "text", "New MAC:").text = "00:16:3e:cc:cf:05"
macwin.find("OK", "push button").click() macwin.find("OK", "push button").click()
win.find_fuzzy("Clone this disk.*", "combo box").click() win.combo_select("Clone this disk.*", "Details...")
win.find_fuzzy("Details...", "menu item").click()
stgwin = self.app.root.find("Change storage path", "dialog") stgwin = self.app.root.find("Change storage path", "dialog")
stgwin.find(None, "text", stgwin.find(None, "text",
"New Path:").text = "/dev/default-pool/my-new-path" "New Path:").text = "/dev/default-pool/my-new-path"

View File

@ -39,20 +39,15 @@ class VMMConnect(uiutils.UITestCase):
uiutils.check(lambda: user.showing is host.showing is True) uiutils.check(lambda: user.showing is host.showing is True)
# Select all HV options # Select all HV options
hvcombo = win.find_fuzzy("Hypervisor", "combo box") win.combo_select("Hypervisor", "QEMU/KVM user session")
def _click_hv(hvname): win.combo_select("Hypervisor", r"^QEMU/KVM$")
hvcombo.click() win.combo_select("Hypervisor", "Xen")
hvcombo.find_fuzzy(hvname, "menu item").click() win.combo_select("Hypervisor", "Bhyve")
_click_hv("user session") win.combo_select("Hypervisor", "Virtuozzo")
_click_hv("QEMU/KVM") win.combo_select("Hypervisor", r".*LXC.*")
_click_hv("Xen")
_click_hv("Bhyve")
_click_hv("Virtuozzo")
_click_hv("LXC")
# Test a simple selection # Test a simple selection
win.find_fuzzy("Hypervisor", "combo box").click() win.combo_select("Hypervisor", "QEMU/KVM user session")
win.find_fuzzy("QEMU/KVM user session", "menu item").click()
uiutils.check(lambda: user.showing is host.showing is False) uiutils.check(lambda: user.showing is host.showing is False)
uiutils.check(lambda: urilabel.text == "qemu:///session") uiutils.check(lambda: urilabel.text == "qemu:///session")
@ -67,7 +62,7 @@ class VMMConnect(uiutils.UITestCase):
uiutils.check(lambda: ":///session" not in urilabel.text) uiutils.check(lambda: ":///session" not in urilabel.text)
# Relaunch the dialog, confirm it doesn't overwrite content # Relaunch the dialog, confirm it doesn't overwrite content
_click_hv("LXC") win.combo_select("Hypervisor", ".*LXC.*")
uiutils.check(lambda: "lxc" in urilabel.text) uiutils.check(lambda: "lxc" in urilabel.text)
self.app.root.find("File", "menu").click() self.app.root.find("File", "menu").click()
self.app.root.find("Add Connection...", "menu item").click() self.app.root.find("Add Connection...", "menu item").click()
@ -76,7 +71,7 @@ class VMMConnect(uiutils.UITestCase):
# Enter a failing URI, make sure error is raised, and we can # Enter a failing URI, make sure error is raised, and we can
# fall back to the dialog # fall back to the dialog
_click_hv("Xen") win.combo_select("Hypervisor", "Xen")
remote.click() remote.click()
user.text = "fribuser" user.text = "fribuser"
connect.click() connect.click()
@ -111,7 +106,7 @@ class VMMConnect(uiutils.UITestCase):
self.app.root.find("File", "menu").click() self.app.root.find("File", "menu").click()
self.app.root.find("Add Connection...", "menu item").click() self.app.root.find("Add Connection...", "menu item").click()
win = self.app.root.find_fuzzy("Add Connection", "dialog") win = self.app.root.find_fuzzy("Add Connection", "dialog")
_click_hv("Custom URI") win.combo_select("Hypervisor", "Custom URI")
urientry.text = "test:///default" urientry.text = "test:///default"
connect.click() connect.click()
@ -120,7 +115,7 @@ class VMMConnect(uiutils.UITestCase):
self.app.root.find("File", "menu").click() self.app.root.find("File", "menu").click()
self.app.root.find("Add Connection...", "menu item").click() self.app.root.find("Add Connection...", "menu item").click()
win = self.app.root.find_fuzzy("Add Connection", "dialog") win = self.app.root.find_fuzzy("Add Connection", "dialog")
_click_hv("Custom URI") win.combo_select("Hypervisor", "Custom URI")
urientry.text = "test:///default" urientry.text = "test:///default"
connect.click() connect.click()

View File

@ -70,11 +70,9 @@ class CreatePool(uiutils.UITestCase):
# Test a disk pool # Test a disk pool
win = self._open_create_win(hostwin) win = self._open_create_win(hostwin)
typ = win.find("Type:", "combo box") win.combo_select("Type:", "disk:")
newname = "a-disk-pool" newname = "a-disk-pool"
name.text = "a-disk-pool" name.text = "a-disk-pool"
typ.click()
win.find_fuzzy("Physical Disk", "menu item").click()
win.find("source-browse").click() win.find("source-browse").click()
_browse_local_path("Choose source path", "console") _browse_local_path("Choose source path", "console")
finish.click() finish.click()
@ -82,11 +80,9 @@ class CreatePool(uiutils.UITestCase):
# Test a iscsi pool # Test a iscsi pool
win = self._open_create_win(hostwin) win = self._open_create_win(hostwin)
typ = win.find("Type:", "combo box") win.combo_select("Type:", "iscsi:")
newname = "a-iscsi-pool" newname = "a-iscsi-pool"
name.text = "a-iscsi-pool" name.text = "a-iscsi-pool"
typ.click()
win.find_fuzzy("iSCSI", "menu item").click()
win.find("target-browse").click() win.find("target-browse").click()
_browse_local_path("Choose target directory", "by-path") _browse_local_path("Choose target directory", "by-path")
finish.click() finish.click()
@ -101,28 +97,21 @@ class CreatePool(uiutils.UITestCase):
# Test a logical pool # Test a logical pool
win = self._open_create_win(hostwin) win = self._open_create_win(hostwin)
typ = win.find("Type:", "combo box") win.combo_select("Type:", "logical:")
newname = "a-lvm-pool" newname = "a-lvm-pool"
name.text = "a-lvm-pool" name.text = "a-lvm-pool"
typ.click()
win.find_fuzzy("LVM", "menu item").click() win.combo_check_default("Volgroup", "testvg1")
srcname = win.find_fuzzy("Volgroup", "combo") win.combo_select("Volgroup", "testvg2")
srcnametext = win.find_fuzzy("pool-source-name-text")
uiutils.check(lambda: srcnametext.text == "testvg1")
srcname.click_combo_entry()
win.find_fuzzy("testvg2", "menu item").click()
finish.click() finish.click()
hostwin.find(newname, "table cell") hostwin.find(newname, "table cell")
# Test a scsi pool # Test a scsi pool
win = self._open_create_win(hostwin) win = self._open_create_win(hostwin)
typ = win.find("Type:", "combo box") win.combo_select("Type:", "scsi:")
newname = "a-scsi-pool" newname = "a-scsi-pool"
name.text = "a-scsi-pool" name.text = "a-scsi-pool"
typ.click() win.combo_select("Source Adapter:", "host2")
win.find_fuzzy("SCSI Host Adapter", "menu item").click()
win.find_fuzzy("Source Adapter:", "combo").click_combo_entry()
win.find_fuzzy("host2", "menu item").click()
finish.click() finish.click()
hostwin.find(newname, "table cell") hostwin.find(newname, "table cell")
@ -130,8 +119,7 @@ class CreatePool(uiutils.UITestCase):
win = self._open_create_win(hostwin) win = self._open_create_win(hostwin)
newname = "a-ceph-pool" newname = "a-ceph-pool"
name.text = "a-ceph-pool" name.text = "a-ceph-pool"
typ.click() win.combo_select("Type:", "rbd:")
win.find_fuzzy("RADOS Block", "menu item").click()
win.find_fuzzy("Host Name:", "text").text = "example.com:1234" win.find_fuzzy("Host Name:", "text").text = "example.com:1234"
win.find_fuzzy("pool-source-name-text", "text").typeText("frob") win.find_fuzzy("pool-source-name-text", "text").typeText("frob")
finish.click() finish.click()

View File

@ -49,16 +49,13 @@ class NewVM(uiutils.UITestCase):
self.app.root.find("File", "menu").click() self.app.root.find("File", "menu").click()
self.app.root.find("Add Connection...", "menu item").click() self.app.root.find("Add Connection...", "menu item").click()
win = self.app.root.find_fuzzy("Add Connection", "dialog") win = self.app.root.find_fuzzy("Add Connection", "dialog")
win.find_fuzzy("Hypervisor", "combo box").click() win.combo_select("Hypervisor", "Custom URI")
win.find_fuzzy("Custom URI", "menu item").click()
win.find("uri-entry", "text").text = "test:///default" win.find("uri-entry", "text").text = "test:///default"
win.find("Connect", "push button").click() win.find("Connect", "push button").click()
# Open the new VM wizard, select a connection # Open the new VM wizard, select a connection
newvm = self._open_create_wizard() newvm = self._open_create_wizard()
combo = newvm.find("create-conn") newvm.combo_select("create-conn", ".*testdriver.xml.*")
combo.click()
combo.find_fuzzy("testdriver.xml").click()
self.forward(newvm) self.forward(newvm)
# Verify media-combo contents for testdriver.xml # Verify media-combo contents for testdriver.xml
@ -72,8 +69,7 @@ class NewVM(uiutils.UITestCase):
self.back(newvm) self.back(newvm)
back = newvm.find_fuzzy("Back", "button") back = newvm.find_fuzzy("Back", "button")
uiutils.check(lambda: not back.sensitive) uiutils.check(lambda: not back.sensitive)
combo.click() newvm.combo_select("create-conn", ".*test default.*")
combo.find_fuzzy("test default").click()
self.forward(newvm) self.forward(newvm)
cdrom.click_combo_entry() cdrom.click_combo_entry()
uiutils.check(lambda: "/dev/sr1" not in cdrom.fmt_nodes()) uiutils.check(lambda: "/dev/sr1" not in cdrom.fmt_nodes())
@ -312,9 +308,8 @@ class NewVM(uiutils.UITestCase):
newvm = self._open_create_wizard() newvm = self._open_create_wizard()
newvm.find_fuzzy("Architecture options", "toggle").click() newvm.find_fuzzy("Architecture options", "toggle").click()
newvm.find_fuzzy("Architecture", "combo").click() newvm.combo_select("Architecture", ".*ppc64.*")
newvm.find_fuzzy("ppc64", "menu item").click() newvm.combo_check_default("Machine Type", ".*pseries.*")
newvm.find_fuzzy("pseries", "menu item")
newvm.find_fuzzy("Import", "radio").click() newvm.find_fuzzy("Import", "radio").click()
newvm.find_fuzzy(None, newvm.find_fuzzy(None,
@ -517,8 +512,7 @@ class NewVM(uiutils.UITestCase):
newvm = self._open_create_wizard() newvm = self._open_create_wizard()
newvm.find_fuzzy("Architecture options", "toggle").click() newvm.find_fuzzy("Architecture options", "toggle").click()
newvm.find_fuzzy("Xen Type", "combo").click() newvm.combo_select("Xen Type", ".*paravirt.*")
newvm.find_fuzzy("paravirt", "menu item").click()
newvm.find_fuzzy("Import", "radio").click() newvm.find_fuzzy("Import", "radio").click()
newvm.find_fuzzy(None, newvm.find_fuzzy(None,
@ -729,9 +723,7 @@ class NewVM(uiutils.UITestCase):
newvm.find("oslist-popover").find_fuzzy("generic").click() newvm.find("oslist-popover").find_fuzzy("generic").click()
self.forward(newvm) self.forward(newvm)
self.forward(newvm) self.forward(newvm)
combo = newvm.find(None, "combo box", "Network source:") newvm.combo_check_default("net-source", "Usermode")
# For some reason atspi reports the internal combo value
uiutils.check(lambda: combo.name == "user")
newvm.find_fuzzy("Finish", "button").click() newvm.find_fuzzy("Finish", "button").click()
self.app.root.find_fuzzy("vm1 on", "frame") self.app.root.find_fuzzy("vm1 on", "frame")
@ -752,9 +744,7 @@ class NewVM(uiutils.UITestCase):
newvm.find("oslist-popover").find_fuzzy("generic").click() newvm.find("oslist-popover").find_fuzzy("generic").click()
self.forward(newvm) self.forward(newvm)
self.forward(newvm) self.forward(newvm)
combo = newvm.find(None, "combo box", "Network source:") newvm.combo_check_default("net-source", "Bridge")
# For some reason atspi reports the internal combo value
uiutils.check(lambda: combo.name == 'bridge')
warnlabel = newvm.find_fuzzy("suitable default network", "label") warnlabel = newvm.find_fuzzy("suitable default network", "label")
uiutils.check(lambda: warnlabel.onscreen) uiutils.check(lambda: warnlabel.onscreen)
newvm.find("Device name:", "text").text = "foobr0" newvm.find("Device name:", "text").text = "foobr0"
@ -807,9 +797,8 @@ class NewVM(uiutils.UITestCase):
newvm.find("oslist-popover").find_fuzzy("generic").click() newvm.find("oslist-popover").find_fuzzy("generic").click()
self.forward(newvm) self.forward(newvm)
self.forward(newvm) self.forward(newvm)
combo = newvm.find(None, "combo box", "Network source:") newvm.find("Network selection", "toggle button").click_expander()
# For some reason atspi reports the internal combo value newvm.combo_check_default("net-source", "Bridge")
uiutils.check(lambda: combo.name == 'bridge')
devname = newvm.find("Device name:", "text") devname = newvm.find("Device name:", "text")
uiutils.check(lambda: devname.text == "testsuitebr0") uiutils.check(lambda: devname.text == "testsuitebr0")

View File

@ -71,9 +71,7 @@ class CreateVol(uiutils.UITestCase):
# Create a qcow2 with backing file # Create a qcow2 with backing file
newname = "aaa-qcow2-backing.qcow2" newname = "aaa-qcow2-backing.qcow2"
name.text = newname name.text = newname
combo = win.find("Format:", "combo box") win.combo_select("Format:", "qcow2")
combo.click_combo_entry()
combo.find("qcow2", "menu item").click()
win.find("Backing store").click_expander() win.find("Backing store").click_expander()
win.find("Browse...").click() win.find("Browse...").click()
browsewin = self.app.root.find("vmm-storage-browser") browsewin = self.app.root.find("vmm-storage-browser")
@ -98,9 +96,7 @@ class CreateVol(uiutils.UITestCase):
win = self._open_create_win(hostwin) win = self._open_create_win(hostwin)
# Using previous name so we collide # Using previous name so we collide
name.text = newname name.text = newname
combo = win.find("Format:", "combo box") win.combo_select("Format:", "raw")
combo.click_combo_entry()
combo.find("raw", "menu item").click()
cap = win.find("Max Capacity:", "spin button") cap = win.find("Max Capacity:", "spin button")
alloc = win.find("Allocation:", "spin button") alloc = win.find("Allocation:", "spin button")
alloc.text = "50.0" alloc.text = "50.0"

View File

@ -241,14 +241,13 @@ class Details(uiutils.UITestCase):
# Network values w/ macvtap manual # Network values w/ macvtap manual
tab = self._select_hw(win, "NIC :54:32:10", "network-tab") tab = self._select_hw(win, "NIC :54:32:10", "network-tab")
src = tab.find("Network source:", "combo box") src = tab.find("net-source")
src.click() src.click()
self.pressKey("Home") self.pressKey("Home")
tab.find_fuzzy("Macvtap device...", tab.find_fuzzy("Macvtap device...",
"menu item").bring_on_screen().click() "menu item").bring_on_screen().click()
tab.find("Device name:", "text").text = "fakedev12" tab.find("Device name:", "text").text = "fakedev12"
tab.find("Device model:", "combo box").click_combo_entry() tab.combo_select("Device model:", "rtl8139")
tab.find("rtl8139", "menu item").click()
appl.click() appl.click()
uiutils.check(lambda: not appl.sensitive) uiutils.check(lambda: not appl.sensitive)
@ -276,13 +275,11 @@ class Details(uiutils.UITestCase):
# Graphics # Graphics
tab = self._select_hw(win, "Display VNC", "graphics-tab") tab = self._select_hw(win, "Display VNC", "graphics-tab")
tab.find("Type:", "combo box").click_combo_entry() tab.combo_select("Type:", "Spice")
tab.find("Spice server", "menu item").click()
appl.click() appl.click()
uiutils.check(lambda: not appl.sensitive) uiutils.check(lambda: not appl.sensitive)
tab.find("Type:", "combo box").click_combo_entry() tab.combo_select("Type:", "VNC")
tab.find("VNC server", "menu item").click()
appl.click() appl.click()
uiutils.check(lambda: not appl.sensitive) uiutils.check(lambda: not appl.sensitive)
@ -321,31 +318,26 @@ class Details(uiutils.UITestCase):
# Controller SCSI # Controller SCSI
tab = self._select_hw( tab = self._select_hw(
win, "Controller VirtIO SCSI 9", "controller-tab") win, "Controller VirtIO SCSI 9", "controller-tab")
tab.find("controller-model", "combo box").click_combo_entry() tab.combo_select("controller-model", "Hypervisor")
tab.find("Hypervisor default", "menu item").click()
tab.find("SCSI Disk 1 on 9:0:0:0", "table cell") tab.find("SCSI Disk 1 on 9:0:0:0", "table cell")
appl.click() appl.click()
uiutils.check(lambda: not appl.sensitive) uiutils.check(lambda: not appl.sensitive)
# Controller USB # Controller USB
tab = self._select_hw(win, "Controller USB 0", "controller-tab") tab = self._select_hw(win, "Controller USB 0", "controller-tab")
tab.find("controller-model", "combo box").click_combo_entry() tab.combo_select("controller-model", "USB 2")
tab.find("USB 2", "menu item").click()
appl.click() appl.click()
uiutils.check(lambda: not appl.sensitive) uiutils.check(lambda: not appl.sensitive)
tab = self._select_hw(win, "Controller USB 0", "controller-tab") tab = self._select_hw(win, "Controller USB 0", "controller-tab")
tab.find("controller-model", "combo box").click_combo_entry() tab.combo_select("controller-model", "USB 3")
tab.find("USB 3", "menu item").click()
appl.click() appl.click()
uiutils.check(lambda: not appl.sensitive) uiutils.check(lambda: not appl.sensitive)
# Filesystem tweaks # Filesystem tweaks
tab = self._select_hw(win, "Filesystem /target/", "filesystem-tab") tab = self._select_hw(win, "Filesystem /target/", "filesystem-tab")
tab.find("Driver:", "combo box").click() tab.combo_select("Driver:", "Path")
tab.find("Path", "menu item").click() tab.combo_select("Write Policy:", "Immediate")
tab.find("Write Policy:", "combo box").click()
tab.find("Immediate", "menu item").click()
tab.find("Source path:", "text").text = "/frib1" tab.find("Source path:", "text").text = "/frib1"
tab.find("Target path:", "text").text = "newtarget" tab.find("Target path:", "text").text = "newtarget"
tab.find_fuzzy("Export filesystem", "check box").click() tab.find_fuzzy("Export filesystem", "check box").click()
@ -355,8 +347,7 @@ class Details(uiutils.UITestCase):
# Smartcard tweaks # Smartcard tweaks
tab = self._select_hw(win, "Smartcard", "smartcard-tab") tab = self._select_hw(win, "Smartcard", "smartcard-tab")
tab.find("smartcard-mode", "combo box").click_combo_entry() tab.combo_select("smartcard-mode", "Passthrough")
tab.find("Passthrough", "menu item").click()
appl.click() appl.click()
uiutils.check(lambda: not appl.sensitive) uiutils.check(lambda: not appl.sensitive)

View File

@ -178,8 +178,7 @@ class Console(uiutils.UITestCase):
uiutils.check(lambda: tab.showing) uiutils.check(lambda: tab.showing)
tab.find("Select or create", "radio button").click() tab.find("Select or create", "radio button").click()
tab.find("storage-entry").text = fname tab.find("storage-entry").text = fname
tab.find("Bus type:", "combo box").click() tab.combo_select("Bus type:", "SCSI")
tab.find("SCSI", "menu item").click()
addhw.find("Finish", "push button").click() addhw.find("Finish", "push button").click()
# Verify permission dialog pops up, ask to change # Verify permission dialog pops up, ask to change

View File

@ -18,8 +18,7 @@ class VMMMigrate(uiutils.UITestCase):
self.app.root.find("File", "menu").click() self.app.root.find("File", "menu").click()
self.app.root.find("Add Connection...", "menu item").click() self.app.root.find("Add Connection...", "menu item").click()
win = self.app.root.find_fuzzy("Add Connection", "dialog") win = self.app.root.find_fuzzy("Add Connection", "dialog")
win.find_fuzzy("Hypervisor", "combo box").click() win.combo_select("Hypervisor", "Custom URI")
win.find_fuzzy("Custom URI", "menu item").click()
win.find("uri-entry", "text").text = "test:///default" win.find("uri-entry", "text").text = "test:///default"
win.find("Connect", "push button").click() win.find("Connect", "push button").click()

View File

@ -34,38 +34,30 @@ class VMMPrefs(uiutils.UITestCase):
win.find("Polling", "page tab").click() win.find("Polling", "page tab").click()
tab = pollingtab tab = pollingtab
uiutils.check(lambda: tab.onscreen) uiutils.check(lambda: tab.onscreen)
tab.find_fuzzy(None, "check box", "Poll CPU").click() tab.find("Poll CPU", "check box").click()
tab.find_fuzzy(None, "check box", "Poll Disk").click() tab.find("Poll Disk", "check box").click()
tab.find_fuzzy(None, "check box", "Poll Memory").click() tab.find("Poll Memory", "check box").click()
tab.find_fuzzy(None, "check box", "Poll Network").click() tab.find("Poll Network", "check box").click()
period = tab.find_fuzzy("cpu-poll", "spin button") period = tab.find_fuzzy("cpu-poll", "spin button")
period.click() period.click()
period.text = "5" period.text = "5"
win.find("New VM", "page tab").click() win.find("New VM", "page tab").click()
tab = newvmtab tab = newvmtab
newvmtab.print_nodes()
uiutils.check(lambda: tab.onscreen) uiutils.check(lambda: tab.onscreen)
tab.find_fuzzy(None, "check box", "sound device").click() tab.find("Add sound device", "check box").click()
tab.find(None, "combo box", "CPU default:").click() tab.combo_select("CPU default:", "Copy host")
tab.find_fuzzy("Copy host", "menu item").click() tab.combo_select("Storage format:", "Raw")
tab.find(None, "combo box", "Storage format:").click() tab.combo_select("prefs-add-spice-usbredir", "No")
tab.find("Raw", "menu item").click() tab.combo_select("Graphics type", "VNC")
tab.find("prefs-add-spice-usbredir", "combo box").click()
tab.find("No", "menu item").click()
tab.find_fuzzy("Graphics type", "combo box").click()
tab.find("VNC", "menu item").click()
win.find("Console", "page tab").click() win.find("Console", "page tab").click()
tab = consoletab tab = consoletab
uiutils.check(lambda: tab.onscreen) uiutils.check(lambda: tab.onscreen)
tab.find(None, "combo box", "SPICE USB").click() tab.combo_select("SPICE USB", "Manual redirect")
tab.find_fuzzy("Manual redirect", "menu item").click() tab.combo_select("Resize guest", "On")
tab.find_fuzzy(None, "combo box", "Resize guest").click() tab.combo_select("Graphical console scaling", "Always")
tab.find("On", "menu item").click() tab.find("Force console", "check box").click()
tab.find_fuzzy(None, "combo box", "console scaling").click()
tab.find_fuzzy("Always", "menu item").click()
tab.find_fuzzy(None, "check box", "Force console").click()
tab.find("Change...", "push button").click() tab.find("Change...", "push button").click()
keyframe = self.app.root.find_fuzzy("Configure grab", "dialog") keyframe = self.app.root.find_fuzzy("Configure grab", "dialog")
@ -90,12 +82,12 @@ class VMMPrefs(uiutils.UITestCase):
win.find("Feedback", "page tab").click() win.find("Feedback", "page tab").click()
tab = feedbacktab tab = feedbacktab
uiutils.check(lambda: tab.onscreen) uiutils.check(lambda: tab.onscreen)
tab.find_fuzzy(None, "check box", "Force Poweroff").click() tab.find("Force Poweroff", "check box").click()
tab.find_fuzzy(None, "check box", "Poweroff/Reboot").click() tab.find("Poweroff/Reboot", "check box").click()
tab.find_fuzzy(None, "check box", "Pause").click() tab.find("Pause", "check box").click()
tab.find_fuzzy(None, "check box", "Device removal").click() tab.find("Device removal", "check box").click()
tab.find_fuzzy(None, "check box", "Unapplied changes").click() tab.find("Unapplied changes", "check box").click()
tab.find_fuzzy(None, "check box", "Deleting storage").click() tab.find("Deleting storage", "check box").click()
win.find("General", "page tab").click() win.find("General", "page tab").click()
win.find_fuzzy("Enable system tray", "check").click() win.find_fuzzy("Enable system tray", "check").click()

View File

@ -392,6 +392,28 @@ class VMMDogtailNode(dogtail.tree.Node):
return self.find(name_pattern, role_pattern, labeller_pattern) return self.find(name_pattern, role_pattern, labeller_pattern)
##########################
# Higher level behaviors #
##########################
def combo_select(self, combolabel, itemlabel):
"""
Lookup the combo, click it, select the menu item
"""
combo = self.find(combolabel, "combo box")
combo.click_combo_entry()
combo.find(itemlabel, "menu item").click()
def combo_check_default(self, combolabel, itemlabel):
"""
Lookup the combo and verify the menu item is selected
"""
combo = self.find(combolabel, "combo box")
combo.click_combo_entry()
item = combo.find(itemlabel, "menu item")
check(lambda: item.selected)
dogtail.rawinput.pressKey("Escape")
##################### #####################
# Debugging helpers # # Debugging helpers #

View File

@ -84,6 +84,11 @@
<property name="halign">start</property> <property name="halign">start</property>
<property name="hexpand">False</property> <property name="hexpand">False</property>
<signal name="changed" handler="on_net_source_changed" swapped="no"/> <signal name="changed" handler="on_net_source_changed" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="net-source-atkobject">
<property name="AtkObject::accessible-name">net-source</property>
</object>
</child>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>