uitests: s/find_pattern/find/g

This commit is contained in:
Cole Robinson 2018-01-19 10:51:33 -05:00
parent 9232a51d55
commit d3b6df8e9a
14 changed files with 244 additions and 244 deletions

View File

@ -13,8 +13,8 @@ class VMMAbout(uiutils.UITestCase):
##############
def testAbout(self):
self.app.root.find_pattern("Help", "menu").click()
self.app.root.find_pattern("About", "menu item").click()
self.app.root.find("Help", "menu").click()
self.app.root.find("About", "menu item").click()
win = self.app.root.find_fuzzy("About", "dialog")
l = win.find_fuzzy("Copyright", "label")

View File

@ -13,20 +13,20 @@ class Details(uiutils.UITestCase):
def _open_details_window(self, vmname="test-clone-simple"):
self.app.root.find_fuzzy(vmname, "table cell").click(button=3)
self.app.root.find_pattern("Open", "menu item").click()
self.app.root.find("Open", "menu item").click()
win = self.app.root.find_pattern("%s on" % vmname, "frame")
win.find_pattern("Details", "radio button").click()
win = self.app.root.find("%s on" % vmname, "frame")
win.find("Details", "radio button").click()
return win
def _open_addhw_window(self, details):
details.find_pattern("add-hardware", "push button").click()
addhw = self.app.root.find_pattern("Add New Virtual Hardware", "frame")
details.find("add-hardware", "push button").click()
addhw = self.app.root.find("Add New Virtual Hardware", "frame")
return addhw
def _select_hw(self, addhw, hwname, tabname):
addhw.find_pattern(hwname, "table cell").click()
tab = addhw.find_pattern(tabname, None)
addhw.find(hwname, "table cell").click()
tab = addhw.find(tabname, None)
uiutils.check_in_loop(lambda: tab.showing)
return tab
@ -41,56 +41,56 @@ class Details(uiutils.UITestCase):
"""
details = self._open_details_window()
addhw = self._open_addhw_window(details)
finish = addhw.find_pattern("Finish", "push button")
finish = addhw.find("Finish", "push button")
# VNC example
tab = self._select_hw(addhw, "Graphics", "graphics-tab")
tab.find_pattern(None, "combo box", "Type:").click_combo_entry()
tab.find(None, "combo box", "Type:").click_combo_entry()
tab.find_fuzzy("VNC", "menu item").click()
tab.find_pattern(None, "combo box", "Listen type:").click_combo_entry()
tab.find(None, "combo box", "Listen type:").click_combo_entry()
tab.find_fuzzy("Address", "menu item").click()
tab.find_pattern(None, "combo box", "Address:").click_combo_entry()
tab.find(None, "combo box", "Address:").click_combo_entry()
tab.find_fuzzy("All interfaces", "menu item").click()
tab.find_pattern("graphics-port-auto", "check").click()
tab.find_pattern("graphics-port", "spin button").text = "1234"
tab.find_pattern(None, "check", "Password:").click()
tab.find("graphics-port-auto", "check").click()
tab.find("graphics-port", "spin button").text = "1234"
tab.find(None, "check", "Password:").click()
passwd = tab.find_fuzzy("graphics-password", "text")
newpass = "foobar"
passwd.typeText(newpass)
tab.find_pattern("Show password", "check").click()
tab.find("Show password", "check").click()
self.assertEqual(passwd.text, newpass)
tab.find_pattern(None, "combo box", "Keymap:").click()
tab.find(None, "combo box", "Keymap:").click()
self.pressKey("Down")
self.pressKey("Down")
self.pressKey("Down")
finish.click()
# Catch a port error
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("Port must be above 5900", "label")
alert.find_pattern("OK", "push button").click()
tab.find_pattern("graphics-port", "spin button").text = "5920"
alert.find("OK", "push button").click()
tab.find("graphics-port", "spin button").text = "5920"
uiutils.check_in_loop(lambda: details.active)
# Spice regular example
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Graphics", "graphics-tab")
tab.find_pattern(None, "combo box", "Type:").click_combo_entry()
tab.find(None, "combo box", "Type:").click_combo_entry()
tab.find_fuzzy("Spice", "menu item").click()
tab.find_pattern("graphics-tlsport-auto", "check").click()
tab.find_pattern("graphics-tlsport", "spin button").text = "5999"
tab.find("graphics-tlsport-auto", "check").click()
tab.find("graphics-tlsport", "spin button").text = "5999"
finish.click()
uiutils.check_in_loop(lambda: details.active)
# Spice GL example
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Graphics", "graphics-tab")
tab.find_pattern(None, "combo box", "Type:").click_combo_entry()
tab.find(None, "combo box", "Type:").click_combo_entry()
tab.find_fuzzy("Spice", "menu item").click()
tab.find_pattern(None, "combo box", "Listen type:").click_combo_entry()
tab.find(None, "combo box", "Listen type:").click_combo_entry()
tab.find_fuzzy("None", "menu item").click()
tab.find_pattern(None, "check box", "OpenGL:").click()
render = tab.find_pattern("graphics-rendernode", "combo box")
tab.find(None, "check box", "OpenGL:").click()
render = tab.find("graphics-rendernode", "combo box")
m = tab.find_fuzzy("Intel Corp", "menu item")
render.click_combo_entry()
self.assertTrue(m.selected)
@ -104,15 +104,15 @@ class Details(uiutils.UITestCase):
"""
details = self._open_details_window()
addhw = self._open_addhw_window(details)
finish = addhw.find_pattern("Finish", "push button")
finish = addhw.find("Finish", "push button")
# Add USB device dup1
tab = self._select_hw(addhw, "USB Host Device", "host-tab")
tab.find_fuzzy("HP Dup USB 1", "table cell").click()
finish.click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("device is already in use by", "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: details.active)
# Add USB device dup2
@ -120,9 +120,9 @@ class Details(uiutils.UITestCase):
tab = self._select_hw(addhw, "USB Host Device", "host-tab")
tab.find_fuzzy("HP Dup USB 2", "table cell").click()
finish.click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("device is already in use by", "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: details.active)
# Add another USB device
@ -137,9 +137,9 @@ class Details(uiutils.UITestCase):
tab = self._select_hw(addhw, "PCI Host Device", "host-tab")
tab.find_fuzzy("(Interface eth0)", "table cell").click()
finish.click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("device is already in use by", "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: details.active)
@ -149,7 +149,7 @@ class Details(uiutils.UITestCase):
"""
details = self._open_details_window()
addhw = self._open_addhw_window(details)
finish = addhw.find_pattern("Finish", "push button")
finish = addhw.find("Finish", "push button")
# Add console device
tab = self._select_hw(addhw, "Console", "char-tab")
@ -163,16 +163,16 @@ class Details(uiutils.UITestCase):
# Add serial+file
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Serial", "char-tab")
tab.find_pattern(None, "combo box", "Device Type:").click()
tab.find(None, "combo box", "Device Type:").click()
tab.find_fuzzy("Output to a file", "menu item").click()
tab.find_pattern(None, "text", "Path:").text = "/tmp/foo.log"
tab.find(None, "text", "Path:").text = "/tmp/foo.log"
finish.click()
uiutils.check_in_loop(lambda: details.active)
# Add udp serial
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Serial", "char-tab")
tab.find_pattern(None, "combo box", "Device Type:").click()
tab.find(None, "combo box", "Device Type:").click()
tab.find_fuzzy("UDP", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
@ -180,9 +180,9 @@ class Details(uiutils.UITestCase):
# Add parallel+device
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Parallel", "char-tab")
tab.find_pattern(None, "combo box", "Device Type:").click()
tab.find(None, "combo box", "Device Type:").click()
tab.find_fuzzy("Physical host character", "menu item").click()
tab.find_pattern(None, "text", "Path:").text = "/dev/parallel0"
tab.find(None, "text", "Path:").text = "/dev/parallel0"
finish.click()
uiutils.check_in_loop(lambda: details.active)
@ -190,7 +190,7 @@ class Details(uiutils.UITestCase):
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Channel", "char-tab")
# Ensures that this is selected by default
tab.find_pattern("com.redhat.spice.0", "combo box")
tab.find("com.redhat.spice.0", "combo box")
finish.click()
uiutils.check_in_loop(lambda: details.active)
@ -203,21 +203,21 @@ class Details(uiutils.UITestCase):
details = self._open_details_window()
addhw = self._open_addhw_window(details)
finish = addhw.find_pattern("Finish", "push button")
finish = addhw.find("Finish", "push button")
# Add File+nbd share
tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
tab.find_pattern(None, "combo box", "Type:").click()
tab.find_pattern("File", "menu item").click()
tab.find_pattern(None, "combo box", "Driver:").click()
tab.find_pattern("Nbd", "menu item").click()
tab.find_pattern(None, "combo box", "Format:").click()
tab.find_pattern("qcow2", "menu item").click()
tab.find_pattern("Browse...", "push button").click()
tab.find(None, "combo box", "Type:").click()
tab.find("File", "menu item").click()
tab.find(None, "combo box", "Driver:").click()
tab.find("Nbd", "menu item").click()
tab.find(None, "combo box", "Format:").click()
tab.find("qcow2", "menu item").click()
tab.find("Browse...", "push button").click()
browsewin = self.app.root.find_pattern(
browsewin = self.app.root.find(
"Choose Storage Volume", "frame")
browsewin.find_pattern("Cancel", "push button").click()
browsewin.find("Cancel", "push button").click()
uiutils.check_in_loop(lambda: addhw.active)
tab.find_fuzzy(None, "text", "Source path:").text = "/foo/source"
@ -229,9 +229,9 @@ class Details(uiutils.UITestCase):
# Add RAM type
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Filesystem", "filesystem-tab")
tab.find_pattern(None, "combo box", "Type:").click()
tab.find_pattern("Ram", "menu item").click()
tab.find_pattern(None, "spin button", "Usage:").text = "12345"
tab.find(None, "combo box", "Type:").click()
tab.find("Ram", "menu item").click()
tab.find(None, "spin button", "Usage:").text = "12345"
tab.find_fuzzy(None, "text", "Target path:").text = "/mem"
finish.click()
uiutils.check_in_loop(lambda: details.active)
@ -243,46 +243,46 @@ class Details(uiutils.UITestCase):
"""
details = self._open_details_window()
addhw = self._open_addhw_window(details)
finish = addhw.find_pattern("Finish", "push button")
finish = addhw.find("Finish", "push button")
# Add input
tab = self._select_hw(addhw, "Input", "input-tab")
tab.find_pattern(None, "combo box", "Type:").click()
tab.find_pattern("EvTouch", "menu item").click()
tab.find(None, "combo box", "Type:").click()
tab.find("EvTouch", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
# Add sound
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Sound", "sound-tab")
tab.find_pattern(None, "combo box", "Model:").click()
tab.find_pattern("ich6", "menu item").click()
tab.find(None, "combo box", "Model:").click()
tab.find("ich6", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
# Add video
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Video", "video-tab")
tab.find_pattern(None, "combo box", "Model:").click()
tab.find_pattern("QXL", "menu item").click()
tab.find(None, "combo box", "Model:").click()
tab.find("QXL", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
# Add watchdog
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Watchdog", "watchdog-tab")
tab.find_pattern(None, "combo box", "Model:").click()
tab.find_pattern("i6300esb", "menu item").click()
tab.find_pattern(None, "combo box", "Action:").click()
tab.find_pattern("Pause the guest", "menu item").click()
tab.find(None, "combo box", "Model:").click()
tab.find("i6300esb", "menu item").click()
tab.find(None, "combo box", "Action:").click()
tab.find("Pause the guest", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
# Add smartcard
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Smartcard", "smartcard-tab")
tab.find_pattern(None, "combo box", "Mode:").click()
tab.find_pattern("Passthrough", "menu item").click()
tab.find(None, "combo box", "Mode:").click()
tab.find("Passthrough", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)
@ -297,21 +297,21 @@ class Details(uiutils.UITestCase):
# Add TPM
self._open_addhw_window(details)
tab = self._select_hw(addhw, "TPM", "tpm-tab")
tab.find_pattern(None, "text", "Device Path:").text = "/tmp/foo"
tab.find(None, "text", "Device Path:").text = "/tmp/foo"
finish.click()
uiutils.check_in_loop(lambda: details.active)
# Add RNG
self._open_addhw_window(details)
tab = self._select_hw(addhw, "RNG", "rng-tab")
tab.find_pattern(None, "text", "Device:").text = "/dev/random"
tab.find(None, "text", "Device:").text = "/dev/random"
finish.click()
uiutils.check_in_loop(lambda: details.active)
# Add Panic
self._open_addhw_window(details)
tab = self._select_hw(addhw, "Panic", "panic-tab")
tab.find_pattern(None, "combo box", "Model:").click()
tab.find_pattern("Hyper-V", "menu item").click()
tab.find(None, "combo box", "Model:").click()
tab.find("Hyper-V", "menu item").click()
finish.click()
uiutils.check_in_loop(lambda: details.active)

View File

@ -15,8 +15,8 @@ class CloneVM(uiutils.UITestCase):
# Launch wizard via right click menu
c = self.app.root.find_fuzzy(vmname, "table cell")
c.click(button=3)
self.app.root.find_pattern("Clone...", "menu item").click()
return self.app.root.find_pattern("Clone Virtual Machine", "frame")
self.app.root.find("Clone...", "menu item").click()
return self.app.root.find("Clone Virtual Machine", "frame")
##############
@ -28,30 +28,30 @@ class CloneVM(uiutils.UITestCase):
Clone test-clone, which is meant to hit many clone code paths
"""
win = self._open_window("test-clone")
win.find_pattern("Clone", "push button").click()
win.find("Clone", "push button").click()
# Verify the new VM popped up
self.app.root.find_pattern("test-clone1", "table cell")
self.app.root.find("test-clone1", "table cell")
def testCloneSimple(self):
"""
Clone test-clone-simple
"""
win = self._open_window("test-clone-simple")
win.find_pattern("Clone", "push button").click()
win.find("Clone", "push button").click()
# Verify the new VM popped up
self.app.root.find_pattern("test-clone-simple-clone", "table cell")
self.app.root.find("test-clone-simple-clone", "table cell")
def testFullClone(self):
"""
Clone test-full-clone, which should error due to lack of space
"""
win = self._open_window("test-clone-full")
win.find_pattern("Clone", "push button").click()
win.find("Clone", "push button").click()
# Verify error dialog popped up
self.app.root.find_pattern(
self.app.root.find(
".*There is not enough free space.*", "label")
def testCloneTweaks(self):
@ -62,20 +62,20 @@ class CloneVM(uiutils.UITestCase):
win.find_fuzzy(None,
"text", "Name").text = "test-new-vm"
win.find_pattern("Details...", "push button").click()
macwin = self.app.root.find_pattern("Change MAC address", "dialog")
macwin.find_pattern(None,
win.find("Details...", "push button").click()
macwin = self.app.root.find("Change MAC address", "dialog")
macwin.find(None,
"text", "New MAC:").text = "00:16:3e:cc:cf:05"
macwin.find_pattern("OK", "push button").click()
macwin.find("OK", "push button").click()
win.find_fuzzy("Clone this disk.*", "combo box").click()
win.find_fuzzy("Details...", "menu item").click()
stgwin = self.app.root.find_pattern("Change storage path", "dialog")
stgwin.find_pattern(None, "text",
stgwin = self.app.root.find("Change storage path", "dialog")
stgwin.find(None, "text",
"New Path:").text = "/dev/default-pool/my-new-path"
stgwin.find_pattern("OK", "push button").click()
stgwin.find("OK", "push button").click()
win.find_pattern("Clone", "push button").click()
win.find("Clone", "push button").click()
# Verify the new VM popped up
self.app.root.find_pattern("test-new-vm", "table cell")
self.app.root.find("test-new-vm", "table cell")

View File

@ -12,30 +12,30 @@ class VMMConnect(uiutils.UITestCase):
def testConnect(self):
# Start with connection delete
c = self.app.root.find_pattern("test testdriver.xml", "table cell")
c = self.app.root.find("test testdriver.xml", "table cell")
c.click(button=3)
self.app.root.find_pattern("conn-disconnect",
self.app.root.find("conn-disconnect",
"menu item").click()
uiutils.check_in_loop(lambda: "Not Connected" in c.text)
c.click(button=3)
self.app.root.find_pattern("conn-delete", "menu item").click()
err = self.app.root.find_pattern("vmm dialog", "alert")
self.app.root.find("conn-delete", "menu item").click()
err = self.app.root.find("vmm dialog", "alert")
err.find_fuzzy("will remove the connection", "label")
err.find_fuzzy("Yes", "push button").click()
uiutils.check_in_loop(lambda: c.dead)
# Launch the dialog, grab some UI pointers
self.app.root.find_pattern("File", "menu").click()
self.app.root.find_pattern("Add Connection...", "menu item").click()
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")
connect = win.find_pattern("Connect", "push button")
connect = win.find("Connect", "push button")
remote = win.find_fuzzy("Connect to remote", "check box")
meth = win.find_pattern("Method", "combo box")
user = win.find_pattern("Username", "text")
host = win.find_pattern("Hostname", "text")
urilabel = win.find_pattern("uri-label", "label")
urientry = win.find_pattern("uri-entry", "text")
meth = win.find("Method", "combo box")
user = win.find("Username", "text")
host = win.find("Hostname", "text")
urilabel = win.find("uri-label", "label")
urientry = win.find("uri-entry", "text")
self.assertTrue(meth.showing is user.showing is host.showing is True)
win.find_fuzzy("Hypervisor", "combo box").click()
@ -71,5 +71,5 @@ class VMMConnect(uiutils.UITestCase):
connect.click()
uiutils.check_in_loop(lambda: win.showing is False)
c = self.app.root.find_pattern("test default", "table cell")
c = self.app.root.find("test default", "table cell")
c.click()

View File

@ -13,80 +13,80 @@ class CreateInterface(uiutils.UITestCase):
def testCreateInterface(self):
# Open the createnet dialog
hostwin = self._open_host_window("Network Interfaces")
hostwin.find_pattern("interface-add", "push button").click()
win = self.app.root.find_pattern(
hostwin.find("interface-add", "push button").click()
win = self.app.root.find(
"Configure network interface", "frame")
# Create a simple default object
newname = "a-test-new-iface"
forward = win.find_pattern("Forward", "push button")
finish = win.find_pattern("Finish", "push button")
forward = win.find("Forward", "push button")
finish = win.find("Finish", "push button")
forward.click()
win.find_pattern("bridge-configure", "push button").click()
bridgewin = self.app.root.find_pattern(
win.find("bridge-configure", "push button").click()
bridgewin = self.app.root.find(
"Bridge configuration", "dialog")
bridgewin.find_pattern(None,
bridgewin.find(None,
"spin button", "Forward delay:").text = "0.05"
bridgewin.find_pattern("OK", "push button").click()
name = win.find_pattern(None, "text", "Name:")
bridgewin.find("OK", "push button").click()
name = win.find(None, "text", "Name:")
name.text = newname
finish.click()
# Select the new object in the host window, then do
# start->stop->delete, for lifecycle testing
uiutils.check_in_loop(lambda: hostwin.active)
cell = hostwin.find_pattern(newname, "table cell")
delete = hostwin.find_pattern("interface-delete", "push button")
start = hostwin.find_pattern("interface-start", "push button")
stop = hostwin.find_pattern("interface-stop", "push button")
cell = hostwin.find(newname, "table cell")
delete = hostwin.find("interface-delete", "push button")
start = hostwin.find("interface-start", "push button")
stop = hostwin.find("interface-stop", "push button")
cell.click()
start.click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("sure you want to start the interface", "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: stop.sensitive)
stop.click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("sure you want to stop the interface", "label")
alert.find_fuzzy("Don't ask me again", "check box").click()
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
# Delete it
uiutils.check_in_loop(lambda: delete.sensitive)
delete.click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("permanently delete the interface", "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
# Ensure it's gone
uiutils.check_in_loop(lambda: cell.dead)
# Click some more UI, but just cancel it, it's a pain to
# figure out clicking checked cell renderers for bond interfaces...
hostwin.find_pattern("interface-add", "push button").click()
hostwin.find("interface-add", "push button").click()
uiutils.check_in_loop(lambda: win.active)
typ = win.find_pattern(None, "combo box", "Interface type:")
typ = win.find(None, "combo box", "Interface type:")
typ.click()
typ.find_pattern("Bond", "menu item").click()
typ.find("Bond", "menu item").click()
forward.click()
win.find_pattern("ip-configure", "push button").click()
ipwin = self.app.root.find_pattern("IP Configuration", "dialog")
ipwin.find_pattern("IPv6", "page tab").click()
combo = ipwin.find_pattern("ipv6-mode", "combo box")
win.find("ip-configure", "push button").click()
ipwin = self.app.root.find("IP Configuration", "dialog")
ipwin.find("IPv6", "page tab").click()
combo = ipwin.find("ipv6-mode", "combo box")
combo.click()
combo.find_pattern("DHCP", "menu item").click()
ipwin.find_pattern("OK", "push button").click()
combo.find("DHCP", "menu item").click()
ipwin.find("OK", "push button").click()
win.find_pattern("bond-configure", "push button").click()
bondwin = self.app.root.find_pattern("Bonding configuration", "dialog")
combo = bondwin.find_pattern(None, "combo box", "Bond monitor mode:")
win.find("bond-configure", "push button").click()
bondwin = self.app.root.find("Bonding configuration", "dialog")
combo = bondwin.find(None, "combo box", "Bond monitor mode:")
combo.click()
combo.find_pattern("miimon", "menu item").click()
bondwin.find_pattern("OK", "push button").click()
combo.find("miimon", "menu item").click()
bondwin.find("OK", "push button").click()
forward = win.find_pattern("Cancel", "push button").click()
forward = win.find("Cancel", "push button").click()
uiutils.check_in_loop(lambda: not win.active)
uiutils.check_in_loop(lambda: hostwin.active)

View File

@ -13,15 +13,15 @@ class CreateNet(uiutils.UITestCase):
def testCreateNet(self):
# Open the createnet dialog
hostwin = self._open_host_window("Virtual Networks")
hostwin.find_pattern("net-add", "push button").click()
win = self.app.root.find_pattern(
hostwin.find("net-add", "push button").click()
win = self.app.root.find(
"Create a new virtual network", "frame")
# Create a simple default network
newname = "a-test-new-net"
forward = win.find_pattern("Forward", "push button")
finish = win.find_pattern("Finish", "push button")
name = win.find_pattern(None, "text", "Network Name:")
forward = win.find("Forward", "push button")
finish = win.find("Finish", "push button")
name = win.find(None, "text", "Network Name:")
name.text = newname
forward.click()
forward.click()
@ -31,10 +31,10 @@ class CreateNet(uiutils.UITestCase):
# Select the new network in the host window, then do
# stop->start->stop->delete, for lifecycle testing
uiutils.check_in_loop(lambda: hostwin.active)
cell = hostwin.find_pattern(newname, "table cell")
delete = hostwin.find_pattern("net-delete", "push button")
start = hostwin.find_pattern("net-start", "push button")
stop = hostwin.find_pattern("net-stop", "push button")
cell = hostwin.find(newname, "table cell")
delete = hostwin.find("net-delete", "push button")
start = hostwin.find("net-start", "push button")
stop = hostwin.find("net-stop", "push button")
cell.click()
stop.click()
@ -46,9 +46,9 @@ class CreateNet(uiutils.UITestCase):
# Delete it
delete.click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("permanently delete the network", "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
# Ensure it's gone
uiutils.check_in_loop(lambda: cell.dead)

View File

@ -13,15 +13,15 @@ class CreatePool(uiutils.UITestCase):
def testCreatePool(self):
# Open the createnet dialog
hostwin = self._open_host_window("Storage")
hostwin.find_pattern("pool-add", "push button").click()
win = self.app.root.find_pattern(
hostwin.find("pool-add", "push button").click()
win = self.app.root.find(
"Add a New Storage Pool", "frame")
# Create a simple default dir pool
newname = "a-test-new-pool"
forward = win.find_pattern("Forward", "push button")
finish = win.find_pattern("Finish", "push button")
name = win.find_pattern(None, "text", "Name:")
forward = win.find("Forward", "push button")
finish = win.find("Finish", "push button")
name = win.find(None, "text", "Name:")
name.text = newname
forward.click()
finish.click()
@ -29,10 +29,10 @@ class CreatePool(uiutils.UITestCase):
# Select the new object in the host window, then do
# stop->start->stop->delete, for lifecycle testing
uiutils.check_in_loop(lambda: hostwin.active)
cell = hostwin.find_pattern(newname, "table cell")
delete = hostwin.find_pattern("pool-delete", "push button")
start = hostwin.find_pattern("pool-start", "push button")
stop = hostwin.find_pattern("pool-stop", "push button")
cell = hostwin.find(newname, "table cell")
delete = hostwin.find("pool-delete", "push button")
start = hostwin.find("pool-start", "push button")
stop = hostwin.find("pool-stop", "push button")
cell.click()
stop.click()
@ -44,28 +44,28 @@ class CreatePool(uiutils.UITestCase):
# Delete it
delete.click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("permanently delete the pool", "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
# Ensure it's gone
uiutils.check_in_loop(lambda: cell.dead)
# Test a scsi pool
hostwin.find_pattern("pool-add", "push button").click()
hostwin.find("pool-add", "push button").click()
uiutils.check_in_loop(lambda: win.active)
typ = win.find_pattern(None, "combo box", "Type:")
typ = win.find(None, "combo box", "Type:")
newname = "a-scsi-pool"
name.text = "a-scsi-pool"
typ.click()
win.find_fuzzy("SCSI Host Adapter", "menu item").click()
forward.click()
finish.click()
hostwin.find_pattern(newname, "table cell")
hostwin.find(newname, "table cell")
# Test a ceph pool
hostwin.find_pattern("pool-add", "push button").click()
hostwin.find("pool-add", "push button").click()
uiutils.check_in_loop(lambda: win.active)
newname = "a-ceph-pool"
name.text = "a-ceph-pool"
@ -75,7 +75,7 @@ class CreatePool(uiutils.UITestCase):
win.find_fuzzy(None, "text", "Host Name:").text = "example.com:1234"
win.find_fuzzy(None, "text", "Source Name:").typeText("frob")
finish.click()
hostwin.find_pattern(newname, "table cell")
hostwin.find(newname, "table cell")
# Ensure host window closes fine
hostwin.click()

View File

@ -13,43 +13,43 @@ class CreateVol(uiutils.UITestCase):
def testCreateVol(self):
# Open the createnet dialog
hostwin = self._open_host_window("Storage")
poolcell = hostwin.find_pattern("default-pool", "table cell")
poolcell = hostwin.find("default-pool", "table cell")
poolcell.click()
hostwin.find_pattern("vol-new", "push button").click()
win = self.app.root.find_pattern(
hostwin.find("vol-new", "push button").click()
win = self.app.root.find(
"Add a Storage Volume", "frame")
# Create a default qcow2 volume
newname = "a-newvol"
finish = win.find_pattern("Finish", "push button")
name = win.find_pattern(None, "text", "Name:")
finish = win.find("Finish", "push button")
name = win.find(None, "text", "Name:")
name.text = newname
win.find_pattern(None, "spin button", "Max Capacity:").text = "10.5"
win.find(None, "spin button", "Max Capacity:").text = "10.5"
finish.click()
# Delete it
vollist = hostwin.find_pattern("vol-list", "table")
volcell = vollist.find_pattern(newname + ".qcow2")
vollist = hostwin.find("vol-list", "table")
volcell = vollist.find(newname + ".qcow2")
volcell.click()
hostwin.find_pattern("vol-refresh", "push button").click()
hostwin.find_pattern("vol-delete", "push button").click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
hostwin.find("vol-refresh", "push button").click()
hostwin.find("vol-delete", "push button").click()
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("permanently delete the volume", "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: volcell.dead)
# Create a raw volume too
hostwin.find_pattern("vol-new", "push button").click()
hostwin.find("vol-new", "push button").click()
uiutils.check_in_loop(lambda: win.active)
newname = "a-newvol.raw"
name.text = newname
combo = win.find_pattern(None, "combo box", "Format:")
combo = win.find(None, "combo box", "Format:")
combo.click()
combo.find_pattern("raw", "menu item").click()
win.find_pattern(None, "spin button", "Allocation:").text = "0.5"
combo.find("raw", "menu item").click()
win.find(None, "spin button", "Allocation:").text = "0.5"
finish.click()
vollist.find_pattern(newname)
vollist.find(newname)
# Ensure host window closes fine
hostwin.keyCombo("<ctrl>w")

View File

@ -12,10 +12,10 @@ class Details(uiutils.UITestCase):
def _open_details_window(self, vmname="test-many-devices"):
self.app.root.find_fuzzy(vmname, "table cell").click(button=3)
self.app.root.find_pattern("Open", "menu item").click()
self.app.root.find("Open", "menu item").click()
win = self.app.root.find_pattern("%s on" % vmname, "frame")
win.find_pattern("Details", "radio button").click()
win = self.app.root.find("%s on" % vmname, "frame")
win.find("Details", "radio button").click()
return win
@ -29,22 +29,22 @@ class Details(uiutils.UITestCase):
HW panel shows itself without raising any error.
"""
win = self._open_details_window()
lst = win.find_pattern("hw-list", "table")
lst = win.find("hw-list", "table")
self._walkUIList(win, lst, lambda: False)
def _testRename(self, origname, newname):
win = self._open_details_window(origname)
# Ensure the Overview page is the first selected
win.find_pattern("Hypervisor Details", "label")
win.find_pattern("Overview", "table cell").click()
win.find("Hypervisor Details", "label")
win.find("Overview", "table cell").click()
oldcell = self.app.root.find_fuzzy(origname, "table cell")
win.find_pattern(None, "text", "Name:").text = newname
win.find_pattern("config-apply", "push button").click()
win.find(None, "text", "Name:").text = newname
win.find("config-apply", "push button").click()
# Confirm lists were updated
self.app.root.find_pattern("%s on" % newname, "frame")
self.app.root.find("%s on" % newname, "frame")
self.app.root.find_fuzzy(newname, "table cell")
# Make sure the old entry is gone
@ -63,7 +63,7 @@ class Details(uiutils.UITestCase):
origname = "test-many-devices"
# Shutdown the VM
self.app.root.find_fuzzy(origname, "table cell").click()
b = self.app.root.find_pattern("Shut Down", "push button")
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)

View File

@ -15,8 +15,8 @@ class Host(uiutils.UITestCase):
Verify that each virtual network displays, without error.
"""
win = self._open_host_window("Virtual Networks")
lst = win.find_pattern("net-list", "table")
errlabel = win.find_pattern("net-error-label", "label")
lst = win.find("net-list", "table")
errlabel = win.find("net-error-label", "label")
self._walkUIList(win, lst, lambda: errlabel.showing)
def testHostStorageSmokeTest(self):
@ -24,8 +24,8 @@ class Host(uiutils.UITestCase):
Verify that each storage pool displays, without error.
"""
win = self._open_host_window("Storage")
lst = win.find_pattern("pool-list", "table")
errlabel = win.find_pattern("pool-error-label", "label")
lst = win.find("pool-list", "table")
errlabel = win.find("pool-error-label", "label")
self._walkUIList(win, lst, lambda: errlabel.showing)
def testHostInterfaceSmokeTest(self):
@ -33,6 +33,6 @@ class Host(uiutils.UITestCase):
Verify that each interface displays, without error.
"""
win = self._open_host_window("Network Interfaces")
lst = win.find_pattern("interface-list", "table")
errlabel = win.find_pattern("interface-error-label", "label")
lst = win.find("interface-list", "table")
errlabel = win.find("interface-error-label", "label")
self._walkUIList(win, lst, lambda: errlabel.showing)

View File

@ -16,8 +16,8 @@ class NewVM(uiutils.UITestCase):
###################
def _open_create_wizard(self):
self.app.root.find_pattern("New", "push button").click()
return self.app.root.find_pattern("New VM", "frame")
self.app.root.find("New", "push button").click()
return self.app.root.find("New VM", "frame")
def _do_simple_import(self, newvm):
# Create default PXE VM
@ -51,12 +51,12 @@ class NewVM(uiutils.UITestCase):
# Delete it from the VM window
vmwindow = self.app.root.find_fuzzy("generic on", "frame")
vmwindow.find_pattern("Virtual Machine", "menu").click()
vmwindow.find_pattern("Delete", "menu item").click()
vmwindow.find("Virtual Machine", "menu").click()
vmwindow.find("Delete", "menu item").click()
delete = self.app.root.find_fuzzy("Delete", "frame")
delete.find_fuzzy("Delete", "button").click()
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("Yes", "push button").click()
# Verify delete dialog and VM dialog are now gone
@ -101,7 +101,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Forward", "button").click()
# Verify that CPU values are non-default
cpus = newvm.find_pattern("cpus", "spin button")
cpus = newvm.find("cpus", "spin button")
uiutils.check_in_loop(lambda: int(cpus.text) > 1, timeout=5)
newvm.find_fuzzy("Forward", "button").click()
newvm.find_fuzzy("Forward", "button").click()
@ -136,10 +136,10 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Network Install", "radio").click()
newvm.find_fuzzy("Forward", "button").click()
newvm.find_pattern(None, "text", "URL").text = (
newvm.find(None, "text", "URL").text = (
"http://vault.centos.org/5.5/os/x86_64/")
version = newvm.find_pattern("install-os-version-label")
version = newvm.find("install-os-version-label")
uiutils.check_in_loop(lambda: "Detecting" in version.text)
uiutils.check_in_loop(
lambda: version.text == "Red Hat Enterprise Linux 5.5",
@ -195,7 +195,7 @@ class NewVM(uiutils.UITestCase):
self.assertFalse(
newvm.find_fuzzy("PXE", "radio").sensitive)
newvm.find_fuzzy("vexpress-a15", "menu item")
newvm.find_pattern("virt", "menu item")
newvm.find("virt", "menu item")
newvm.find_fuzzy("Forward", "button").click()
# Set the import media details
@ -212,7 +212,7 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Forward", "button").click()
# Disk collision box pops up, hit ok
alert = self.app.root.find_pattern("vmm dialog", "alert")
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("Yes", "push button").click()
newvm.find_fuzzy("Forward", "button").click()

View File

@ -25,24 +25,24 @@ class VMMPrefs(uiutils.UITestCase):
##############
def testPrefs(self):
self.app.root.find_pattern("Edit", "menu").click()
self.app.root.find_pattern("Preferences", "menu item").click()
self.app.root.find("Edit", "menu").click()
self.app.root.find("Preferences", "menu item").click()
win = self.app.root.find_fuzzy("Preferences", "frame")
win.find_fuzzy("Enable system tray", "check").click()
win.find_pattern("Polling", "page tab").click()
win.find("Polling", "page tab").click()
win.find_fuzzy(None, "check box",
labeller_text="Poll CPU").click()
win.find_pattern("New VM", "page tab").click()
win.find_pattern("prefs-add-spice-usbredir",
win.find("New VM", "page tab").click()
win.find("prefs-add-spice-usbredir",
"combo box").click()
win.find_pattern("No", "menu item").click()
win.find("No", "menu item").click()
win.find_pattern("Console", "page tab").click()
win.find_pattern("Change...", "push button").click()
win.find("Console", "page tab").click()
win.find("Change...", "push button").click()
keyframe = self.app.root.find_fuzzy("Configure grab", "dialog")
_holdKey("Alt_L")
_holdKey("Z")
@ -52,11 +52,11 @@ class VMMPrefs(uiutils.UITestCase):
_releaseKey("Z")
_releaseKey("Alt_L")
win.find_pattern("Feedback", "page tab").click()
win.find("Feedback", "page tab").click()
win.find_fuzzy(None, "check box",
labeller_text="Force Poweroff").click()
win.find_pattern("General", "page tab").click()
win.find("General", "page tab").click()
win.find_fuzzy("Enable system tray", "check").click()
win.find_fuzzy("Close", "push button").click()

View File

@ -12,10 +12,10 @@ class Snapshots(uiutils.UITestCase):
def _open_snapshots_window(self, vmname="test-snapshots"):
self.app.root.find_fuzzy(vmname, "table cell").click(button=3)
self.app.root.find_pattern("Open", "menu item").click()
self.app.root.find("Open", "menu item").click()
win = self.app.root.find_pattern("%s on" % vmname, "frame")
win.find_pattern("Snapshots", "radio button").click()
win = self.app.root.find("%s on" % vmname, "frame")
win.find("Snapshots", "radio button").click()
return win
@ -28,8 +28,8 @@ class Snapshots(uiutils.UITestCase):
Smoke test to ensure all snapshots show correctly
"""
win = self._open_snapshots_window()
errlabel = win.find_pattern("snapshot-error-label", "label")
lst = win.find_pattern("snapshot-list", "table")
errlabel = win.find("snapshot-error-label", "label")
lst = win.find("snapshot-list", "table")
self._walkUIList(win, lst, lambda: errlabel.showing)
def testSnapshotLifecycle(self):
@ -37,56 +37,56 @@ class Snapshots(uiutils.UITestCase):
Create/delete/start/stop snapshots
"""
win = self._open_snapshots_window()
vmrun = win.find_pattern("Run", "push button")
vmpause = win.find_pattern("Pause", "toggle button")
snaprun = win.find_pattern("snapshot-start", "push button")
vmrun = win.find("Run", "push button")
vmpause = win.find("Pause", "toggle button")
snaprun = win.find("snapshot-start", "push button")
# Start offline snapshot
snapname = "offline-root"
win.find_pattern(snapname, "table cell").click()
win.find(snapname, "table cell").click()
snaprun.click()
alert = self.app.root.find_fuzzy("vmm dialog", "alert")
alert.find_fuzzy(
"sure you want to run snapshot '%s'" % snapname, "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: vmrun.sensitive)
# Start paused snapshot
snapname = "snap-paused"
win.find_pattern(snapname, "table cell").click()
win.find(snapname, "table cell").click()
snaprun.click()
alert = self.app.root.find_fuzzy("vmm dialog", "alert")
alert.find_fuzzy(
"sure you want to run snapshot '%s'" % snapname, "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: vmpause.checked)
# Edit snapshot
desc = win.find_pattern(None, "text", "Description:")
desc = win.find(None, "text", "Description:")
desc.text = "Test description foofoo"
win.find_pattern("snapshot-apply", "push button").click()
win.find_pattern("snapshot-refresh", "push button").click()
win.find("snapshot-apply", "push button").click()
win.find("snapshot-refresh", "push button").click()
self.assertTrue("foofoo" in desc.text)
# Create new snapshot
win.find_pattern("snapshot-add", "push button").click()
newwin = self.app.root.find_pattern("Create snapshot", "frame")
win.find("snapshot-add", "push button").click()
newwin = self.app.root.find("Create snapshot", "frame")
newwin.print_nodes()
snapname = "testnewsnap"
newwin.find_pattern(None, "text", "Name:").text = snapname
newwin.find_pattern(None, "text", "Description:").text = "testdesc"
newwin.find_pattern("Finish", "push button").click()
newwin.find(None, "text", "Name:").text = snapname
newwin.find(None, "text", "Description:").text = "testdesc"
newwin.find("Finish", "push button").click()
uiutils.check_in_loop(lambda: not newwin.showing)
newc = win.find_pattern(snapname, "table cell")
newc = win.find(snapname, "table cell")
uiutils.check_in_loop(lambda: newc.state_selected)
# Delete it
win.find_pattern("snapshot-delete", "push button").click()
win.find("snapshot-delete", "push button").click()
alert = self.app.root.find_fuzzy("vmm dialog", "alert")
alert.find_fuzzy("permanently delete", "label")
alert.find_pattern("Yes", "push button").click()
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: newc.dead)
# Switch out of window
win.find_pattern("Details", "radio button").click()
win.find("Details", "radio button").click()
uiutils.check_in_loop(lambda: not snaprun.showing)

View File

@ -70,7 +70,7 @@ class UITestCase(unittest.TestCase):
if not win.active:
# Should mean an error dialog popped up
self.app.root.find_pattern("Error", "alert")
self.app.root.find("Error", "alert")
raise AssertionError("Error dialog raised?")
if error_cb():
raise AssertionError("Error found on a page")
@ -170,7 +170,7 @@ class VMMDogtailNode(dogtail.tree.Node):
# Widget search helpers #
#########################
def find_pattern(self, name, roleName=None, labeller_text=None):
def find(self, name, roleName=None, labeller_text=None):
"""
Search root for any widget that contains the passed name/role regex
strings.
@ -205,7 +205,7 @@ class VMMDogtailNode(dogtail.tree.Node):
if labeller_text:
labeller_pattern = ".*%s.*" % labeller_text
return self.find_pattern(name_pattern, role_pattern, labeller_pattern)
return self.find(name_pattern, role_pattern, labeller_pattern)
#####################
@ -285,7 +285,7 @@ class VMMDogtailApp(object):
self._proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr)
self._root = dogtail.tree.root.application("virt-manager")
self._topwin = self._root.find_pattern(None, "(frame|dialog|alert)")
self._topwin = self._root.find(None, "(frame|dialog|alert)")
def stop(self):
"""