mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-11 16:58:31 +03:00
uitests: Add _click_alert_button helper
Centralizes a pattern we were using all over the place Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
8f4341bee8
commit
7342d9a11b
@ -152,9 +152,7 @@ class AddHardware(uiutils.UITestCase):
|
|||||||
volcell = browse.find(newname, "table cell")
|
volcell = browse.find(newname, "table cell")
|
||||||
self.assertTrue(volcell.selected)
|
self.assertTrue(volcell.selected)
|
||||||
browse.find("vol-delete", "push button").click()
|
browse.find("vol-delete", "push button").click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("permanently delete the volume", "Yes")
|
||||||
alert.find_fuzzy("permanently delete the volume", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: volcell.dead)
|
uiutils.check_in_loop(lambda: volcell.dead)
|
||||||
|
|
||||||
# Test browse local
|
# Test browse local
|
||||||
@ -181,9 +179,7 @@ class AddHardware(uiutils.UITestCase):
|
|||||||
browse.find("Choose Volume", "push button").click()
|
browse.find("Choose Volume", "push button").click()
|
||||||
self.assertTrue("/diskvol1" in tab.find("storage-entry").text)
|
self.assertTrue("/diskvol1" in tab.find("storage-entry").text)
|
||||||
finish.click()
|
finish.click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("already in use by", "Yes")
|
||||||
alert.find_fuzzy("already in use by", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: details.active)
|
uiutils.check_in_loop(lambda: details.active)
|
||||||
|
|
||||||
|
|
||||||
@ -248,9 +244,7 @@ class AddHardware(uiutils.UITestCase):
|
|||||||
finish.click()
|
finish.click()
|
||||||
|
|
||||||
# Check MAC validation error
|
# Check MAC validation error
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("00:11:22:33:44:55", "Close")
|
||||||
alert.find_fuzzy("00:11:22:33:44:55", "label")
|
|
||||||
alert.find("Close", "push button").click()
|
|
||||||
|
|
||||||
# Fix MAC
|
# Fix MAC
|
||||||
tab.find("mac-address-enable", "check box").click()
|
tab.find("mac-address-enable", "check box").click()
|
||||||
@ -286,9 +280,7 @@ class AddHardware(uiutils.UITestCase):
|
|||||||
finish.click()
|
finish.click()
|
||||||
|
|
||||||
# Catch a port error
|
# Catch a port error
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("Port must be above 5900", "Close")
|
||||||
alert.find_fuzzy("Port must be above 5900", "label")
|
|
||||||
alert.find("Close", "push button").click()
|
|
||||||
tab.find("graphics-port", "spin button").text = "5920"
|
tab.find("graphics-port", "spin button").text = "5920"
|
||||||
finish.click()
|
finish.click()
|
||||||
uiutils.check_in_loop(lambda: details.active)
|
uiutils.check_in_loop(lambda: details.active)
|
||||||
@ -329,9 +321,7 @@ class AddHardware(uiutils.UITestCase):
|
|||||||
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()
|
finish.click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("device is already in use by", "Yes")
|
||||||
alert.find_fuzzy("device is already in use by", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: details.active)
|
uiutils.check_in_loop(lambda: details.active)
|
||||||
|
|
||||||
# Add USB device dup2
|
# Add USB device dup2
|
||||||
@ -339,9 +329,7 @@ class AddHardware(uiutils.UITestCase):
|
|||||||
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()
|
finish.click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("device is already in use by", "Yes")
|
||||||
alert.find_fuzzy("device is already in use by", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: details.active)
|
uiutils.check_in_loop(lambda: details.active)
|
||||||
|
|
||||||
# Add another USB device
|
# Add another USB device
|
||||||
@ -356,9 +344,7 @@ class AddHardware(uiutils.UITestCase):
|
|||||||
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()
|
finish.click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("device is already in use by", "Yes")
|
||||||
alert.find_fuzzy("device is already in use by", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: details.active)
|
uiutils.check_in_loop(lambda: details.active)
|
||||||
|
|
||||||
|
|
||||||
@ -587,9 +573,7 @@ class AddHardware(uiutils.UITestCase):
|
|||||||
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()
|
finish.click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("non-existent path", "Close")
|
||||||
alert.find_fuzzy("non-existent path")
|
|
||||||
alert.find("Close", "push button").click()
|
|
||||||
|
|
||||||
# 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)
|
||||||
|
@ -75,8 +75,7 @@ class VMMCLI(uiutils.UITestCase):
|
|||||||
|
|
||||||
delete = self.app.topwin
|
delete = self.app.topwin
|
||||||
delete.find_fuzzy("Delete", "button").click()
|
delete.find_fuzzy("Delete", "button").click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("Are you sure", "Yes")
|
||||||
alert.find_fuzzy("Yes", "push button").click()
|
|
||||||
|
|
||||||
# Ensure app exits
|
# Ensure app exits
|
||||||
uiutils.check_in_loop(lambda: not self.app.is_running())
|
uiutils.check_in_loop(lambda: not self.app.is_running())
|
||||||
@ -99,13 +98,11 @@ class VMMCLI(uiutils.UITestCase):
|
|||||||
|
|
||||||
def testShowCLIError(self):
|
def testShowCLIError(self):
|
||||||
self.app.open(extra_opts=["--idontexist"])
|
self.app.open(extra_opts=["--idontexist"])
|
||||||
alert = self.app.root.find("vmm dialog")
|
self._click_alert_button("Unhandled command line", "Close")
|
||||||
alert.find_fuzzy("Unhandled command line")
|
uiutils.check_in_loop(lambda: not self.app.is_running())
|
||||||
|
|
||||||
def testShowConnectBadURI(self):
|
def testShowConnectBadURI(self):
|
||||||
baduri = "fribfrobfroo"
|
baduri = "fribfrobfroo"
|
||||||
self.app = uiutils.VMMDogtailApp(baduri)
|
self.app = uiutils.VMMDogtailApp(baduri)
|
||||||
alert = self.app.root.find("vmm dialog")
|
self._click_alert_button(baduri, "Close")
|
||||||
alert.find_fuzzy(baduri)
|
|
||||||
alert.find_fuzzy("Close", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: not self.app.is_running())
|
uiutils.check_in_loop(lambda: not self.app.is_running())
|
||||||
|
@ -22,9 +22,7 @@ class VMMConnect(uiutils.UITestCase):
|
|||||||
uiutils.check_in_loop(lambda: "Not Connected" in c.text)
|
uiutils.check_in_loop(lambda: "Not Connected" in c.text)
|
||||||
c.click(button=3)
|
c.click(button=3)
|
||||||
self.app.root.find("conn-delete", "menu item").click()
|
self.app.root.find("conn-delete", "menu item").click()
|
||||||
err = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("will remove the connection", "Yes")
|
||||||
err.find_fuzzy("will remove the connection", "label")
|
|
||||||
err.find_fuzzy("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: c.dead)
|
uiutils.check_in_loop(lambda: c.dead)
|
||||||
|
|
||||||
# Launch the dialog, grab some UI pointers
|
# Launch the dialog, grab some UI pointers
|
||||||
@ -61,8 +59,7 @@ class VMMConnect(uiutils.UITestCase):
|
|||||||
c = self.app.root.find_fuzzy(fakehost, "table cell")
|
c = self.app.root.find_fuzzy(fakehost, "table cell")
|
||||||
uiutils.check_in_loop(lambda: "Connecting..." not in c.text,
|
uiutils.check_in_loop(lambda: "Connecting..." not in c.text,
|
||||||
timeout=10)
|
timeout=10)
|
||||||
err = self.app.root.find_fuzzy("vmm dialog", "alert")
|
self._click_alert_button("Unable to connect", "No")
|
||||||
err.find_fuzzy("No", "push button").click()
|
|
||||||
|
|
||||||
# Ensure dialog shows old contents for editing
|
# Ensure dialog shows old contents for editing
|
||||||
uiutils.check_in_loop(lambda: win.showing)
|
uiutils.check_in_loop(lambda: win.showing)
|
||||||
@ -74,8 +71,7 @@ class VMMConnect(uiutils.UITestCase):
|
|||||||
c = self.app.root.find_fuzzy(fakehost, "table cell")
|
c = self.app.root.find_fuzzy(fakehost, "table cell")
|
||||||
uiutils.check_in_loop(lambda: "Connecting..." not in c.text,
|
uiutils.check_in_loop(lambda: "Connecting..." not in c.text,
|
||||||
timeout=10)
|
timeout=10)
|
||||||
err = self.app.root.find_fuzzy("vmm dialog", "alert")
|
self._click_alert_button("Unable to connect", "Yes")
|
||||||
err.find_fuzzy("Yes", "push button").click()
|
|
||||||
c = self.app.root.find_fuzzy(fakehost, "table cell")
|
c = self.app.root.find_fuzzy(fakehost, "table cell")
|
||||||
|
|
||||||
# Test with custom test:///default connection
|
# Test with custom test:///default connection
|
||||||
|
@ -50,9 +50,7 @@ class CreateNet(uiutils.UITestCase):
|
|||||||
|
|
||||||
# Delete it
|
# Delete it
|
||||||
delete.click()
|
delete.click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("permanently delete the network", "Yes")
|
||||||
alert.find_fuzzy("permanently delete the network", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
|
|
||||||
# Ensure it's gone
|
# Ensure it's gone
|
||||||
uiutils.check_in_loop(lambda: cell.dead)
|
uiutils.check_in_loop(lambda: cell.dead)
|
||||||
|
@ -61,9 +61,7 @@ class CreatePool(uiutils.UITestCase):
|
|||||||
|
|
||||||
# Delete it
|
# Delete it
|
||||||
delete.click()
|
delete.click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("permanently delete the pool", "Yes")
|
||||||
alert.find_fuzzy("permanently delete the pool", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
|
|
||||||
# Ensure it's gone
|
# Ensure it's gone
|
||||||
uiutils.check_in_loop(lambda: cell.dead)
|
uiutils.check_in_loop(lambda: cell.dead)
|
||||||
@ -91,9 +89,7 @@ class CreatePool(uiutils.UITestCase):
|
|||||||
_browse_local_path("Choose target directory", "by-path")
|
_browse_local_path("Choose target directory", "by-path")
|
||||||
finish.click()
|
finish.click()
|
||||||
# Catch example error
|
# Catch example error
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("source host name", "Close")
|
||||||
alert.find_fuzzy("source host name", "label")
|
|
||||||
alert.find("Close", "push button").click()
|
|
||||||
win.find("Host Name:", "text").text = "example.com"
|
win.find("Host Name:", "text").text = "example.com"
|
||||||
win.find("pool-source-path-text").text = "foo-iqn"
|
win.find("pool-source-path-text").text = "foo-iqn"
|
||||||
win.find_fuzzy("Initiator IQN:", "check").click()
|
win.find_fuzzy("Initiator IQN:", "check").click()
|
||||||
|
@ -42,9 +42,7 @@ class CreateVol(uiutils.UITestCase):
|
|||||||
volcell.click()
|
volcell.click()
|
||||||
hostwin.find("vol-refresh", "push button").click()
|
hostwin.find("vol-refresh", "push button").click()
|
||||||
hostwin.find("vol-delete", "push button").click()
|
hostwin.find("vol-delete", "push button").click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("permanently delete the volume", "Yes")
|
||||||
alert.find_fuzzy("permanently delete the volume", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: volcell.dead)
|
uiutils.check_in_loop(lambda: volcell.dead)
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,9 +252,7 @@ class Details(uiutils.UITestCase):
|
|||||||
tab.find("Device name:", "text").text = ""
|
tab.find("Device name:", "text").text = ""
|
||||||
appl.click()
|
appl.click()
|
||||||
# Check validation error
|
# Check validation error
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("Error changing VM configuration", "Close")
|
||||||
alert.find_fuzzy("Error changing VM configuration", "label")
|
|
||||||
alert.find("Close", "push button").click()
|
|
||||||
tab.find("Device name:", "text").text = "zbr0"
|
tab.find("Device name:", "text").text = "zbr0"
|
||||||
appl.click()
|
appl.click()
|
||||||
uiutils.check_in_loop(lambda: not appl.sensitive)
|
uiutils.check_in_loop(lambda: not appl.sensitive)
|
||||||
@ -383,9 +381,7 @@ class Details(uiutils.UITestCase):
|
|||||||
delete.find_fuzzy("Delete", "button").click()
|
delete.find_fuzzy("Delete", "button").click()
|
||||||
|
|
||||||
# Will be fixed eventually
|
# Will be fixed eventually
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("Device could not be removed", "OK")
|
||||||
alert.find_fuzzy("Device could not be removed", "label")
|
|
||||||
alert.find("OK", "push button").click()
|
|
||||||
|
|
||||||
c = hwlist.find(disklabel, "table cell")
|
c = hwlist.find(disklabel, "table cell")
|
||||||
self._stop_vm(win)
|
self._stop_vm(win)
|
||||||
@ -410,9 +406,7 @@ class Details(uiutils.UITestCase):
|
|||||||
share = tab.find("Shareable:", "check box")
|
share = tab.find("Shareable:", "check box")
|
||||||
share.click()
|
share.click()
|
||||||
hwlist.find("CPUs", "table cell").click()
|
hwlist.find("CPUs", "table cell").click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("There are unapplied changes", "No")
|
||||||
alert.find_fuzzy("There are unapplied changes", "label")
|
|
||||||
alert.find("No", "push button").click()
|
|
||||||
tab = self._select_hw(win, "IDE Disk 1", "disk-tab")
|
tab = self._select_hw(win, "IDE Disk 1", "disk-tab")
|
||||||
self.assertFalse(share.checked)
|
self.assertFalse(share.checked)
|
||||||
|
|
||||||
@ -439,9 +433,7 @@ class Details(uiutils.UITestCase):
|
|||||||
|
|
||||||
# Now apply changes to running VM, ensure they show up on shutdown
|
# Now apply changes to running VM, ensure they show up on shutdown
|
||||||
win.find("config-apply").click()
|
win.find("config-apply").click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("changes will take effect", "OK")
|
||||||
alert.find_fuzzy("changes will take effect", "label")
|
|
||||||
alert.find("OK", "push button").click()
|
|
||||||
self.assertTrue(share.checked)
|
self.assertTrue(share.checked)
|
||||||
self._stop_vm(win)
|
self._stop_vm(win)
|
||||||
self.assertTrue(not share.checked)
|
self.assertTrue(not share.checked)
|
||||||
@ -450,17 +442,13 @@ class Details(uiutils.UITestCase):
|
|||||||
tab = self._select_hw(win, "Overview", "overview-tab")
|
tab = self._select_hw(win, "Overview", "overview-tab")
|
||||||
tab.find("Description:", "text").text = "hey new description"
|
tab.find("Description:", "text").text = "hey new description"
|
||||||
win.find("XML", "page tab").click()
|
win.find("XML", "page tab").click()
|
||||||
alert = self.app.root.find("vmm dialog")
|
|
||||||
alert.find_fuzzy("changes will be lost")
|
|
||||||
|
|
||||||
# Select 'No', meaning don't abandon changes
|
# Select 'No', meaning don't abandon changes
|
||||||
alert.find("No", "push button").click()
|
self._click_alert_button("changes will be lost", "No")
|
||||||
uiutils.check_in_loop(lambda: tab.showing)
|
uiutils.check_in_loop(lambda: tab.showing)
|
||||||
|
|
||||||
# Try unapplied changes again, this time abandon our changes
|
# Try unapplied changes again, this time abandon our changes
|
||||||
win.find("XML", "page tab").click()
|
win.find("XML", "page tab").click()
|
||||||
alert = self.app.root.find("vmm dialog")
|
self._click_alert_button("changes will be lost", "Yes")
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: not tab.showing)
|
uiutils.check_in_loop(lambda: not tab.showing)
|
||||||
|
|
||||||
def testDetailsXMLEdit(self):
|
def testDetailsXMLEdit(self):
|
||||||
|
@ -122,9 +122,7 @@ class Console(uiutils.UITestCase):
|
|||||||
# Check wrong password handling
|
# Check wrong password handling
|
||||||
passwd.typeText("xx")
|
passwd.typeText("xx")
|
||||||
win.find("Login", "push button").click()
|
win.find("Login", "push button").click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("Viewer authentication error", "OK")
|
||||||
alert.find_fuzzy("Viewer authentication error", "label")
|
|
||||||
alert.find("OK", "push button").click()
|
|
||||||
|
|
||||||
# Check proper password
|
# Check proper password
|
||||||
passwd.typeText("goodp")
|
passwd.typeText("goodp")
|
||||||
@ -185,9 +183,8 @@ class Console(uiutils.UITestCase):
|
|||||||
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
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button(
|
||||||
alert.find("The emulator may not have search permissions")
|
"The emulator may not have search permissions", "Yes")
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
|
|
||||||
# Verify no errors
|
# Verify no errors
|
||||||
uiutils.check_in_loop(lambda: not addhw.showing)
|
uiutils.check_in_loop(lambda: not addhw.showing)
|
||||||
|
@ -30,9 +30,7 @@ class Manager(uiutils.UITestCase):
|
|||||||
c.click()
|
c.click()
|
||||||
smenu.click()
|
smenu.click()
|
||||||
force.click()
|
force.click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("Are you sure you want", "Yes")
|
||||||
alert.find("Are you sure you want", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: run.sensitive, timeout=5)
|
uiutils.check_in_loop(lambda: run.sensitive, timeout=5)
|
||||||
|
|
||||||
run.click()
|
run.click()
|
||||||
@ -158,9 +156,7 @@ class Manager(uiutils.UITestCase):
|
|||||||
c = manager.find_fuzzy("testdriver.xml", "table cell")
|
c = manager.find_fuzzy("testdriver.xml", "table cell")
|
||||||
c.click(button=3)
|
c.click(button=3)
|
||||||
self.app.root.find("conn-delete", "menu item").click()
|
self.app.root.find("conn-delete", "menu item").click()
|
||||||
err = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("will remove the connection", "Yes")
|
||||||
err.find_fuzzy("will remove the connection", "label")
|
|
||||||
err.find_fuzzy("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: not host.showing)
|
uiutils.check_in_loop(lambda: not host.showing)
|
||||||
|
|
||||||
def testManagerDefaultStartup(self):
|
def testManagerDefaultStartup(self):
|
||||||
|
@ -66,9 +66,7 @@ class MediaChange(uiutils.UITestCase):
|
|||||||
browsewin.find("Choose Volume", "push button").click()
|
browsewin.find("Choose Volume", "push button").click()
|
||||||
appl.click()
|
appl.click()
|
||||||
# Check 'already in use' dialog
|
# Check 'already in use' dialog
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("already in use by", "Yes")
|
||||||
alert.find_fuzzy("already in use by", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: not appl.sensitive)
|
uiutils.check_in_loop(lambda: not appl.sensitive)
|
||||||
self.assertTrue("backing" in entry.text)
|
self.assertTrue("backing" in entry.text)
|
||||||
entry.text = ""
|
entry.text = ""
|
||||||
@ -91,9 +89,7 @@ class MediaChange(uiutils.UITestCase):
|
|||||||
self.assertTrue(not entry.text)
|
self.assertTrue(not entry.text)
|
||||||
entry.text = "/dev/sr0"
|
entry.text = "/dev/sr0"
|
||||||
appl.click()
|
appl.click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("changes will take effect", "OK")
|
||||||
alert.find_fuzzy("changes will take effect", "label")
|
|
||||||
alert.find("OK", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: not appl.sensitive)
|
uiutils.check_in_loop(lambda: not appl.sensitive)
|
||||||
self.assertTrue(not entry.text)
|
self.assertTrue(not entry.text)
|
||||||
|
|
||||||
|
@ -31,8 +31,7 @@ class VMMMigrate(uiutils.UITestCase):
|
|||||||
mig = self.app.root.find("Migrate the virtual machine", "frame")
|
mig = self.app.root.find("Migrate the virtual machine", "frame")
|
||||||
mig.find("Advanced", "toggle button").click_expander()
|
mig.find("Advanced", "toggle button").click_expander()
|
||||||
mig.find("Migrate", "push button").click()
|
mig.find("Migrate", "push button").click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button(
|
||||||
alert.find_fuzzy("the.connection.driver:.virDomainMigrate")
|
"the.connection.driver:.virDomainMigrate", "Close")
|
||||||
alert.find("Close", "push button").click()
|
|
||||||
mig.find("Cancel", "push button").click()
|
mig.find("Cancel", "push button").click()
|
||||||
uiutils.check_in_loop(lambda: not mig.showing)
|
uiutils.check_in_loop(lambda: not mig.showing)
|
||||||
|
@ -92,9 +92,7 @@ class NewVM(uiutils.UITestCase):
|
|||||||
|
|
||||||
# Make sure we throw an error if no OS selected
|
# Make sure we throw an error if no OS selected
|
||||||
self.forward(newvm, check=False)
|
self.forward(newvm, check=False)
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("You must select", "OK")
|
||||||
alert.find("You must select", "label")
|
|
||||||
alert.find("OK", "push button").click()
|
|
||||||
|
|
||||||
# Test activating the osentry to grab the popover selection
|
# Test activating the osentry to grab the popover selection
|
||||||
osentry.click()
|
osentry.click()
|
||||||
@ -130,8 +128,7 @@ class NewVM(uiutils.UITestCase):
|
|||||||
|
|
||||||
delete = self.app.root.find_fuzzy("Delete", "frame")
|
delete = self.app.root.find_fuzzy("Delete", "frame")
|
||||||
delete.find_fuzzy("Delete", "button").click()
|
delete.find_fuzzy("Delete", "button").click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("Are you sure", "Yes")
|
||||||
alert.find_fuzzy("Yes", "push button").click()
|
|
||||||
|
|
||||||
# Verify delete dialog and VM dialog are now gone
|
# Verify delete dialog and VM dialog are now gone
|
||||||
uiutils.check_in_loop(lambda: vmwindow.showing is False)
|
uiutils.check_in_loop(lambda: vmwindow.showing is False)
|
||||||
@ -370,8 +367,7 @@ class NewVM(uiutils.UITestCase):
|
|||||||
self.forward(newvm, check=False)
|
self.forward(newvm, check=False)
|
||||||
|
|
||||||
# Disk collision box pops up, hit ok
|
# Disk collision box pops up, hit ok
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("in use", "Yes")
|
||||||
alert.find_fuzzy("Yes", "push button").click()
|
|
||||||
|
|
||||||
self.forward(newvm)
|
self.forward(newvm)
|
||||||
newvm.find_fuzzy("Finish", "button").click()
|
newvm.find_fuzzy("Finish", "button").click()
|
||||||
@ -522,9 +518,7 @@ class NewVM(uiutils.UITestCase):
|
|||||||
# '/' in name will trigger libvirt error
|
# '/' in name will trigger libvirt error
|
||||||
_newvm.find_fuzzy("Name", "text").text = "test/bad"
|
_newvm.find_fuzzy("Name", "text").text = "test/bad"
|
||||||
_newvm.find_fuzzy("Finish", "button").click()
|
_newvm.find_fuzzy("Finish", "button").click()
|
||||||
alert = self.app.root.find("vmm dialog", "alert")
|
self._click_alert_button("Unable to complete install", "Close")
|
||||||
alert.find_fuzzy("Unable to complete install")
|
|
||||||
alert.find_fuzzy("Close", "button").click()
|
|
||||||
return _newvm
|
return _newvm
|
||||||
|
|
||||||
newvm = dofail()
|
newvm = dofail()
|
||||||
|
@ -48,20 +48,18 @@ class Snapshots(uiutils.UITestCase):
|
|||||||
snapname = "offline-root"
|
snapname = "offline-root"
|
||||||
win.find(snapname, "table cell").click()
|
win.find(snapname, "table cell").click()
|
||||||
snaprun.click()
|
snaprun.click()
|
||||||
alert = self.app.root.find_fuzzy("vmm dialog", "alert")
|
self._click_alert_button(
|
||||||
alert.find_fuzzy(
|
"sure you want to run the snapshot '%s'" % snapname,
|
||||||
"sure you want to run the snapshot '%s'" % snapname, "label")
|
"Yes")
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: vmrun.sensitive)
|
uiutils.check_in_loop(lambda: vmrun.sensitive)
|
||||||
|
|
||||||
# Start paused snapshot
|
# Start paused snapshot
|
||||||
snapname = "snap-paused"
|
snapname = "snap-paused"
|
||||||
win.find(snapname, "table cell").click()
|
win.find(snapname, "table cell").click()
|
||||||
snaprun.click()
|
snaprun.click()
|
||||||
alert = self.app.root.find_fuzzy("vmm dialog", "alert")
|
self._click_alert_button(
|
||||||
alert.find_fuzzy(
|
"sure you want to run the snapshot '%s'" % snapname,
|
||||||
"sure you want to run the snapshot '%s'" % snapname, "label")
|
"Yes")
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: vmpause.checked)
|
uiutils.check_in_loop(lambda: vmpause.checked)
|
||||||
|
|
||||||
# Edit snapshot
|
# Edit snapshot
|
||||||
@ -84,9 +82,7 @@ class Snapshots(uiutils.UITestCase):
|
|||||||
|
|
||||||
# Delete it
|
# Delete it
|
||||||
win.find("snapshot-delete", "push button").click()
|
win.find("snapshot-delete", "push button").click()
|
||||||
alert = self.app.root.find_fuzzy("vmm dialog", "alert")
|
self._click_alert_button("permanently delete", "Yes")
|
||||||
alert.find_fuzzy("permanently delete", "label")
|
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
uiutils.check_in_loop(lambda: newc.dead)
|
uiutils.check_in_loop(lambda: newc.dead)
|
||||||
|
|
||||||
# Switch out of window
|
# Switch out of window
|
||||||
|
@ -97,6 +97,12 @@ class UITestCase(unittest.TestCase):
|
|||||||
check_in_loop(lambda: run.sensitive)
|
check_in_loop(lambda: run.sensitive)
|
||||||
return win
|
return win
|
||||||
|
|
||||||
|
def _click_alert_button(self, label_text, button_text):
|
||||||
|
alert = self.app.root.find("vmm dialog", "alert")
|
||||||
|
alert.find_fuzzy(label_text, "label")
|
||||||
|
alert.find(button_text, "push button").click()
|
||||||
|
check_in_loop(lambda: not alert.active)
|
||||||
|
|
||||||
def _walkUIList(self, win, lst, error_cb, reverse=False):
|
def _walkUIList(self, win, lst, error_cb, reverse=False):
|
||||||
"""
|
"""
|
||||||
Toggle down through a UI list like addhardware, net/storage/iface
|
Toggle down through a UI list like addhardware, net/storage/iface
|
||||||
@ -148,23 +154,17 @@ class UITestCase(unittest.TestCase):
|
|||||||
|
|
||||||
# Trying to click away should warn that there's unapplied changes
|
# Trying to click away should warn that there's unapplied changes
|
||||||
win.find("Details", "page tab").click()
|
win.find("Details", "page tab").click()
|
||||||
alert = self.app.root.find("vmm dialog")
|
|
||||||
alert.find_fuzzy("changes will be lost")
|
|
||||||
|
|
||||||
# Select 'No', meaning don't abandon changes
|
# Select 'No', meaning don't abandon changes
|
||||||
alert.find("No", "push button").click()
|
self._click_alert_button("changes will be lost", "No")
|
||||||
check_in_loop(lambda: xmleditor.showing)
|
check_in_loop(lambda: xmleditor.showing)
|
||||||
|
|
||||||
# Click the finish button, but our bogus change should trigger error
|
# Click the finish button, but our bogus change should trigger error
|
||||||
finish.click()
|
finish.click()
|
||||||
alert = self.app.root.find("vmm dialog")
|
self._click_alert_button("(xmlParseDoc|tag.mismatch)", "Close")
|
||||||
alert.find_fuzzy("(xmlParseDoc|tag.mismatch)")
|
|
||||||
alert.find("Close", "push button").click()
|
|
||||||
|
|
||||||
# Try unapplied changes again, this time abandon our changes
|
# Try unapplied changes again, this time abandon our changes
|
||||||
win.find("Details", "page tab").click()
|
win.find("Details", "page tab").click()
|
||||||
alert = self.app.root.find("vmm dialog")
|
self._click_alert_button("changes will be lost", "Yes")
|
||||||
alert.find("Yes", "push button").click()
|
|
||||||
check_in_loop(lambda: not xmleditor.showing)
|
check_in_loop(lambda: not xmleditor.showing)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user