mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
tests: Add XML editing UI tests
This commit is contained in:
@@ -9,21 +9,27 @@ class CreatePool(uiutils.UITestCase):
|
||||
UI tests for the createpool wizard
|
||||
"""
|
||||
|
||||
def _open_create_win(self, hostwin):
|
||||
hostwin.find("pool-add", "push button").click()
|
||||
win = self.app.root.find(
|
||||
"Add a New Storage Pool", "frame")
|
||||
uiutils.check_in_loop(lambda: win.active)
|
||||
return win
|
||||
|
||||
|
||||
##############
|
||||
# Test cases #
|
||||
##############
|
||||
|
||||
def testCreatePool(self):
|
||||
# Open the createnet dialog
|
||||
hostwin = self._open_host_window("Storage")
|
||||
hostwin.find("pool-add", "push button").click()
|
||||
win = self.app.root.find(
|
||||
"Add a New Storage Pool", "frame")
|
||||
win = self._open_create_win(hostwin)
|
||||
|
||||
# Create a simple default dir pool
|
||||
newname = "a-test-new-pool"
|
||||
finish = win.find("Finish", "push button")
|
||||
name = win.find("Name:", "text")
|
||||
self.assertEqual(name.text, "pool")
|
||||
newname = "a-test-new-pool"
|
||||
name.text = newname
|
||||
finish.click()
|
||||
|
||||
@@ -52,10 +58,8 @@ class CreatePool(uiutils.UITestCase):
|
||||
# Ensure it's gone
|
||||
uiutils.check_in_loop(lambda: cell.dead)
|
||||
|
||||
|
||||
# Test a scsi pool
|
||||
hostwin.find("pool-add", "push button").click()
|
||||
uiutils.check_in_loop(lambda: win.active)
|
||||
win = self._open_create_win(hostwin)
|
||||
typ = win.find("Type:", "combo box")
|
||||
newname = "a-scsi-pool"
|
||||
name.text = "a-scsi-pool"
|
||||
@@ -67,8 +71,7 @@ class CreatePool(uiutils.UITestCase):
|
||||
hostwin.find(newname, "table cell")
|
||||
|
||||
# Test a ceph pool
|
||||
hostwin.find("pool-add", "push button").click()
|
||||
uiutils.check_in_loop(lambda: win.active)
|
||||
win = self._open_create_win(hostwin)
|
||||
newname = "a-ceph-pool"
|
||||
name.text = "a-ceph-pool"
|
||||
typ.click()
|
||||
@@ -83,3 +86,29 @@ class CreatePool(uiutils.UITestCase):
|
||||
hostwin.keyCombo("<ctrl>w")
|
||||
uiutils.check_in_loop(lambda: not hostwin.showing and
|
||||
not hostwin.active)
|
||||
|
||||
|
||||
def testCreatePoolXMLEditor(self):
|
||||
hostwin = self._open_host_window("Storage")
|
||||
win = self._open_create_win(hostwin)
|
||||
finish = win.find("Finish", "push button")
|
||||
name = win.find("Name:", "text")
|
||||
|
||||
# Create a new obj with XML edited name, verify it worked
|
||||
tmpname = "objtmpname"
|
||||
newname = "froofroo"
|
||||
name.text = tmpname
|
||||
win.find("XML", "page tab").click()
|
||||
xmleditor = win.find("XML editor")
|
||||
xmleditor.text = xmleditor.text.replace(
|
||||
">%s<" % tmpname, ">%s<" % newname)
|
||||
finish.click()
|
||||
uiutils.check_in_loop(lambda: hostwin.active)
|
||||
cell = hostwin.find(newname, "table cell")
|
||||
cell.click()
|
||||
|
||||
# Do standard xmleditor tests
|
||||
win = self._open_create_win(hostwin)
|
||||
self._test_xmleditor_interactions(win, finish)
|
||||
win.find("Cancel", "push button").click()
|
||||
uiutils.check_in_loop(lambda: not win.visible)
|
||||
|
||||
Reference in New Issue
Block a user