uitests: Cover more createvm validation checks

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-08-23 14:26:51 -04:00
parent e3be4b677e
commit 95bf8bf6b9
5 changed files with 71 additions and 21 deletions

View File

@ -1641,6 +1641,19 @@ ba</description>
</permissions>
</target>
<volume type='file'>
<name>aaa-unused.qcow2</name>
<capacity>1000000</capacity>
<allocation>50000</allocation>
<target>
<format type='qcow2'/>
<permissions>
<mode>0700</mode>
<owner>10736</owner>
<group>10736</group>
</permissions>
</target>
</volume>
<volume type='file'>
<name>default-vol</name>
<capacity>1000000</capacity>

View File

@ -408,7 +408,7 @@ class AddHardware(uiutils.UITestCase):
tab.find("Nbd", "menu item").click()
tab.find("Format:", "combo box").click_combo_entry()
tab.find("qcow2", "menu item").click()
tab.find("Target path:", "text").text = "/foo/target"
source = tab.find("Source path:", "text")
source.text = "/foo/source"
tab.find("Browse...", "push button").click()
@ -425,6 +425,12 @@ class AddHardware(uiutils.UITestCase):
lambda: source.text == "/dev/default-pool/dir-vol")
tab.find_fuzzy("Export filesystem", "check").click()
# Use this to test some error.py logic for truncating large errors
badtarget = "a" * 1024
tab.find("Target path:", "text").text = badtarget
finish.click()
self._click_alert_button("aaa...", "Close")
tab.find("Target path:", "text").text = "/foo/target"
finish.click()
uiutils.check_in_loop(lambda: details.active)

View File

@ -411,8 +411,14 @@ class NewVM(uiutils.UITestCase):
self.forward(newvm)
# Set custom init
newvm.find_fuzzy(None,
"text", "application path").text = "/sbin/init"
apptext = newvm.find_fuzzy(None, "text", "application path")
apptext.text = ""
self.forward(newvm, check=False)
self._click_alert_button("path is required", "OK")
newvm.find("install-app-browse").click()
self._select_storagebrowser_volume("default-pool", "aaa-unused.qcow2")
uiutils.check_in_loop(lambda: "aaa-unused.qcow2" in apptext.text)
self.forward(newvm)
self.forward(newvm)
# Trigger back, to ensure disk page skipping works
@ -438,8 +444,15 @@ class NewVM(uiutils.UITestCase):
self.forward(newvm)
# Set directory path
newvm.find_fuzzy(None,
"text", "root directory").text = "/tmp"
dirtext = newvm.find_fuzzy(None, "text", "root directory")
dirtext.text = ""
self.forward(newvm, check=False)
self._click_alert_button("path is required", "OK")
newvm.find("install-oscontainer-browse").click()
self._select_storagebrowser_volume("default-pool", "dir-vol")
uiutils.check_in_loop(lambda: "dir-vol" in dirtext.text)
self.forward(newvm)
self.forward(newvm)
newvm.find_fuzzy("Finish", "button").click()
@ -574,16 +587,20 @@ class NewVM(uiutils.UITestCase):
vmname = "fooxmleditvm"
newvm.find_fuzzy("Local install media", "radio").click()
newvm.find_fuzzy("Forward", "button").click()
nonexistpath = "/dev/foovmm-idontexist"
existpath = "/dev/default-pool/testvol1.img"
newvm.find("media-entry").text = existpath
newvm.find("media-entry").text = nonexistpath
uiutils.check_in_loop(
lambda: newvm.find("oslist-entry").text == "None detected")
newvm.find_fuzzy("Automatically detect", "check").click()
newvm.find("oslist-entry").text = "generic"
newvm.find("oslist-popover").find_fuzzy("generic").click()
newvm.find_fuzzy("Forward", "button").click()
newvm.find_fuzzy("Forward", "button").click()
newvm.find_fuzzy("Forward", "button").click()
self.forward(newvm, check=False)
self._click_alert_button("Error setting installer", "OK")
newvm.find("media-entry").text = existpath
self.forward(newvm)
self.forward(newvm)
self.forward(newvm)
newvm.find_fuzzy("Customize", "check").click()
newvm.find_fuzzy("Name", "text").text = vmname
newvm.find_fuzzy("Finish", "button").click()
@ -657,6 +674,29 @@ class NewVM(uiutils.UITestCase):
newvm.find_fuzzy("Import", "radio").click()
self.forward(newvm)
importtext = newvm.find_fuzzy(None, "text", "existing storage")
# Click forward, hitting missing OS error
self.forward(newvm, check=False)
self._click_alert_button("select an OS", "OK")
# Set OS
newvm.find("oslist-entry").text = "generic"
newvm.find("oslist-popover").find_fuzzy("generic").click()
# Click forward, hitting missing Import path error
self.forward(newvm, check=False)
self._click_alert_button("import is required", "OK")
# Click forward, but Import path doesn't exist
importtext.text = "/dev/default-pool/idontexist"
self.forward(newvm, check=False)
self._click_alert_button("import path must point", "OK")
# Click forward, but Import path is in use, and exit
importtext.text = "/dev/default-pool/default-vol"
self.forward(newvm, check=False)
self._click_alert_button("in use", "No")
# storagebrowser bits
newvm.find("install-import-browse").click()
@ -672,12 +712,9 @@ class NewVM(uiutils.UITestCase):
browsewin.find_fuzzy("default-pool", "table cell").click()
browsewin.find_fuzzy("bochs-vol", "table cell").click()
browsewin.find("Choose Volume").click()
importtext = newvm.find_fuzzy(None, "text", "existing storage")
uiutils.check_in_loop(
lambda: importtext.text == "/dev/default-pool/bochs-vol")
newvm.find("oslist-entry").text = "generic"
newvm.find("oslist-popover").find_fuzzy("generic").click()
self.forward(newvm)
self.forward(newvm)

View File

@ -281,9 +281,9 @@ class VMMDogtailNode(dogtail.tree.Node):
if self.roleName in ["menu", "menu item", "frame"]:
return True
screen = Gdk.Screen.get_default()
return (self.position[0] > 0 and
return (self.position[0] >= 0 and
self.position[0] + self.size[0] < screen.get_width() and
self.position[1] > 0 and
self.position[1] >= 0 and
self.position[1] + self.size[1] < screen.get_height())
def click_secondary_icon(self):

View File

@ -1581,7 +1581,7 @@ class vmmCreateVM(vmmGObjectUI):
if not template:
return self.err.val_err(_("A template name is required."))
# Validate media location
# Build the installer and Guest instance
try:
if init:
self._gdata.init = init
@ -1599,12 +1599,6 @@ class vmmCreateVM(vmmGObjectUI):
fsdev.source = template
self._gdata.filesystem = fsdev
except Exception as e:
msg = _("Error setting install media location.")
return self.err.val_err(msg, e)
# Build the installer and Guest instance
try:
self._gdata.location = location
self._gdata.cdrom = cdrom
self._gdata.extra_args = extra