uitests: Add details editing tests

This commit is contained in:
Cole Robinson 2018-01-20 17:25:16 -05:00
parent d3137419d0
commit c68cd7bb00
4 changed files with 233 additions and 20 deletions

View File

@ -246,11 +246,12 @@ class AddHardware(uiutils.UITestCase):
tab.find_fuzzy("OpenVSwitch", "menu item").click()
t = tab.find("Virtual port", "toggle button")
t.click()
t.find("Type:", "text").text = "foo1"
t.find("Managerid:", "text").text = "foo2"
t.find("Typeid:", "text").text = "foo3"
t.find("Typeid version:", "text").text = "foo4"
t.find("Instance id:", "text").text = "foo5"
t.find("Type:", "text").text = "802.1Qbg"
t.find("Managerid:", "text").text = "12"
t.find("Typeid:", "text").text = "1193046"
t.find("Typeid version:", "text").text = "1"
t.find("Instance id:", "text").text = (
"09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b")
finish.click()
uiutils.check_in_loop(lambda: details.active)

View File

@ -6,6 +6,34 @@ class Details(uiutils.UITestCase):
UI tests for virt-manager's VM details window
"""
def _select_hw(self, win, hwname, tabname):
c = win.find(hwname, "table cell")
if not c.onscreen:
hwlist = win.find("hw-list")
hwlist.click()
while not c.onscreen:
self.pressKey("Down")
c.click()
tab = win.find(tabname, None)
uiutils.check_in_loop(lambda: tab.showing)
return tab
def _check_alert(self):
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("changes will take effect", "label")
alert.find("OK", "push button").click()
def _stop_vm(self, win):
run = win.find("Run", "push button")
win.find("Shut Down", "push button").click()
uiutils.check_in_loop(lambda: run.sensitive)
def _start_vm(self, win):
run = win.find("Run", "push button")
run.click()
uiutils.check_in_loop(lambda: not run.sensitive)
##############
# Test cases #
##############
@ -56,3 +84,172 @@ class Details(uiutils.UITestCase):
uiutils.check_in_loop(lambda: b.sensitive is False)
self._testRename(origname, "test-new-name")
def testDetailsEdits(self):
win = self._open_details_window(vmname="test-many-devices")
appl = win.find("config-apply", "push button")
hwlist = win.find("hw-list")
"""
# Overview description
tab = self._select_hw(win, "Overview", "overview-tab")
tab.find("Description:", "text").text = "hey new description"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
# CPU hotplug
tab = self._select_hw(win, "CPUs", "cpu-tab")
tab.find("Current allocation:", "spin button").text = "2"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
# Memory balloon
tab = self._select_hw(win, "Memory", "memory-tab")
tab.find("Current allocation:", "spin button").text = "300"
tab.find("Maximum allocation:", "spin button").text = "800"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
"""
self._stop_vm(win)
"""
def check_bootorder(c):
# Click the bootlist checkbox, which is hard to find in the tree
import dogtail.rawinput
x = c.position[0] - 30
y = c.position[1] + c.size[1] / 2
button = 1
dogtail.rawinput.click(x, y, button)
# Boot tweaks
tab = self._select_hw(win, "Boot Options", "boot-tab")
self._stop_vm(win)
tab.find_fuzzy("Start virtual machine on host", "check box").click()
tab.find("Enable boot menu", "check box").click()
check_bootorder(tab.find("SCSI Disk 1", "table cell"))
tab.find("boot-movedown", "push button").click()
tab.find("Floppy 1", "table cell").click()
tab.find("boot-moveup", "push button").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
# Kernel boot
tab.find_fuzzy("Direct kernel boot", "toggle button").click_expander()
tab.find_fuzzy("Enable direct kernel", "check box").click()
tab.find("kernel-browse", "push button").click()
browsewin = self.app.root.find("Choose Storage Volume", "frame")
browsewin.find("default-pool", "table cell").click()
browsewin.find("bochs-vol", "table cell").click()
browsewin.find("Choose Volume", "push button").click()
uiutils.check_in_loop(lambda: win.active)
self.assertTrue("bochs" in tab.find("Kernel path:", "text").text)
tab.find("Initrd path:", "text").text = "/tmp/initrd"
tab.find("DTB path:", "text").text = "/tmp/dtb"
tab.find("Kernel args:", "text").text = "console=ttyS0"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
# Disk options
tab = self._select_hw(win, "IDE Disk 1", "disk-tab")
tab.find("Shareable:", "check box").click()
tab.find("Readonly:", "check box").click()
tab.find("Advanced options", "toggle button").click_expander()
tab.find("Storage format:", "text").text = "vmdk"
tab.find("Serial number:", "text").text = "1234-ABCD"
tab.find("Disk bus:", "text").text = "usb"
tab.find("Performance options", "toggle button").click_expander()
tab.find("IO mode:", "text").text = "threads"
tab.find("Cache mode:", "text").text = "unsafe"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
# Device is now 'USB Disk 1'
c = hwlist.find("USB Disk 1", "table cell")
self.assertTrue(c.state_selected)
tab.find("Removable:", "check box").click()
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
"""
# Network values
tab = self._select_hw(win, "NIC :54:32:10", "network-tab")
src = tab.find(None, "combo box", "Network source:")
tab.find("Device model:", "text").text = "rtl8139"
src.click()
tab.find_fuzzy("macvtap", "menu item").click()
mode = tab.find_fuzzy("Source mode:", "combo box")
mode.click_combo_entry()
self.assertTrue(mode.find("Bridge", "menu item").selected)
self.pressKey("Escape")
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
# Manual bridge
src.click()
tab.find_fuzzy("Specify shared device", "menu item").click()
appl.click()
# Check validation error
alert = self.app.root.find("vmm dialog", "alert")
alert.find_fuzzy("Error changing VM configuration", "label")
alert.find("Close", "push button").click()
tab.find("Bridge name:", "text").text = "zbr0"
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
# Network with portops
src.click()
self.pressKey("Home")
tab.find_fuzzy("plainbridge-portgroups", "menu item").click()
c = tab.find_fuzzy("Portgroup:", "combo box")
c.click_combo_entry()
self.assertTrue(c.find("engineering", "menu item").selected)
self.pressKey("Escape")
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
# Network with vport stuff
src.click()
tab.find_fuzzy("OpenVSwitch", "menu item").click()
t = tab.find("Virtual port", "toggle button")
t.click()
t.find("Type:", "text").text = "802.1Qbg"
t.find("Managerid:", "text").text = "12"
t.find("Typeid:", "text").text = "1193046"
t.find("Typeid version:", "text").text = "1"
t.find("Instance id:", "text").text = (
"09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b")
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)
#appl.click()
#uiutils.check_in_loop(lambda: not appl.sensitive)
tab.print_nodes()
self.sleep(5)
"""
sound model
usb2->usb3
change network source
vnc to spice
video 3d
"""
"""
# Live device removal
self._start_vm(win)
tab = self._select_hw(win, "SCSI Disk 1", "disk-tab")
tab.find("Remove", "push button")
self._check_alert()
c = hwlist.find("SCSI Disk 1", "table cell")
self.assertTrue(lambda: c.showing)
self._stop_vm()
uiutils.check_in_loop(lambda: c.dead)
misc stuff:
make changes, VM change state, changes stay in place
unapplied changes
cancel to reset changes
removing devices
- offline and online
"""

View File

@ -191,6 +191,10 @@ class VMMDogtailNode(dogtail.tree.Node):
def state_selected(self):
return self.getState().contains(pyatspi.STATE_SELECTED)
@property
def onscreen(self):
return self.position[0] > 0 and self.position[1] > 0
def click_combo_entry(self):
"""
Helper for clicking the arrow of a combo entry, to expose the menu.

View File

@ -2921,6 +2921,11 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_boot_initrd_browse_clicked" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="boot-initrd-browse-atkobject">
<property name="AtkObject::accessible-name">initrd-browse</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -2961,6 +2966,11 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_boot_kernel_browse_clicked" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="boot-kernel-browse-atkobject">
<property name="AtkObject::accessible-name">kernel-browse</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -3011,7 +3021,7 @@
<property name="halign">start</property>
<property name="margin_top">8</property>
<property name="margin_bottom">8</property>
<property name="label" translatable="yes">D_TB Path:</property>
<property name="label" translatable="yes">D_TB path:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">boot-dtb</property>
</object>
@ -3047,6 +3057,11 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_boot_dtb_browse_clicked" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="boot-dtb-browse-atkobject">
<property name="AtkObject::accessible-name">dtb-browse</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -3067,20 +3082,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -3197,6 +3198,11 @@
<property name="stock">gtk-go-up</property>
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="boot-moveup-atkobject">
<property name="AtkObject::accessible-name">boot-moveup</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -3220,6 +3226,11 @@
<property name="stock">gtk-go-down</property>
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="boot-movedown-atkobject">
<property name="AtkObject::accessible-name">boot-movedown</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>