2018-04-04 14:35:41 +01:00
# This work is licensed under the GNU GPLv2 or later.
2018-03-20 15:00:02 -04:00
# See the COPYING file in the top-level directory.
2016-04-18 16:42:12 -04:00
from tests . uitests import utils as uiutils
2019-03-26 11:43:12 -04:00
import tests . utils
2016-04-18 16:42:12 -04:00
2015-09-14 14:11:04 -04:00
2018-01-09 10:01:56 -05:00
class Details ( uiutils . UITestCase ) :
2015-09-14 14:11:04 -04:00
"""
UI tests for virt - manager ' s VM details window
"""
2018-01-20 17:25:16 -05:00
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 )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : tab . showing )
2018-01-20 17:25:16 -05:00
return tab
def _stop_vm ( self , win ) :
run = win . find ( " Run " , " push button " )
win . find ( " Shut Down " , " push button " ) . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : run . sensitive )
2018-01-20 17:25:16 -05:00
def _start_vm ( self , win ) :
run = win . find ( " Run " , " push button " )
run . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not run . sensitive )
2018-01-20 17:25:16 -05:00
2015-09-14 14:11:04 -04:00
##############
# Test cases #
##############
2020-08-22 14:21:49 -04:00
def _testSmokeTest ( self , vmname ) :
2015-09-14 14:11:04 -04:00
"""
Open the VM with all the crazy hardware and just verify that each
HW panel shows itself without raising any error .
"""
2020-08-22 14:21:49 -04:00
win = self . _open_details_window ( vmname = vmname , double = True )
2018-01-19 10:51:33 -05:00
lst = win . find ( " hw-list " , " table " )
2018-01-11 09:46:41 -05:00
self . _walkUIList ( win , lst , lambda : False )
2017-03-08 13:08:22 -05:00
2019-05-23 16:14:39 -04:00
# Select XML editor, and reverse walk the list
win . find ( " XML " , " page tab " ) . click ( )
self . _walkUIList ( win , lst , lambda : False , reverse = True )
2020-08-22 14:21:49 -04:00
def testDetailsHardwareSmokeTest ( self ) :
self . _testSmokeTest ( None )
def testDetailsHardwareSmokeTestAlternate ( self ) :
2020-08-23 13:48:59 -04:00
self . app . open ( keyfile = " allstats.ini " )
2020-08-22 14:21:49 -04:00
self . _testSmokeTest ( " test alternate devs title " )
2017-03-08 13:08:22 -05:00
def _testRename ( self , origname , newname ) :
2020-08-23 13:48:59 -04:00
# Enable all stats prefs to hit some extra code
2017-03-08 13:08:22 -05:00
win = self . _open_details_window ( origname )
# Ensure the Overview page is the first selected
2018-01-19 10:51:33 -05:00
win . find ( " Hypervisor Details " , " label " )
win . find ( " Overview " , " table cell " ) . click ( )
2017-03-08 13:08:22 -05:00
2018-01-10 18:57:40 -05:00
oldcell = self . app . root . find_fuzzy ( origname , " table cell " )
2018-01-19 11:16:09 -05:00
win . find ( " Name: " , " text " ) . text = newname
2018-01-19 10:51:33 -05:00
win . find ( " config-apply " , " push button " ) . click ( )
2017-03-08 13:08:22 -05:00
# Confirm lists were updated
2018-01-19 10:51:33 -05:00
self . app . root . find ( " %s on " % newname , " frame " )
2018-01-10 18:57:40 -05:00
self . app . root . find_fuzzy ( newname , " table cell " )
2017-03-08 13:08:22 -05:00
2018-01-10 16:42:53 -05:00
# Make sure the old entry is gone
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : origname not in oldcell . name )
2017-03-08 13:08:22 -05:00
def testDetailsRenameSimple ( self ) :
"""
Rename a simple VM
"""
self . _testRename ( " test-clone-simple " , " test-new-name " )
def testDetailsRenameNVRAM ( self ) :
"""
Rename a VM that will trigger the nvram behavior
"""
origname = " test-many-devices "
# Shutdown the VM
2018-01-10 18:57:40 -05:00
self . app . root . find_fuzzy ( origname , " table cell " ) . click ( )
2018-01-19 10:51:33 -05:00
b = self . app . root . find ( " Shut Down " , " push button " )
2018-01-09 10:45:46 -05:00
b . click ( )
2018-01-10 16:42:53 -05:00
# This insures the VM finished shutting down
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : b . sensitive is False )
2017-03-08 13:08:22 -05:00
self . _testRename ( origname , " test-new-name " )
2018-01-20 17:25:16 -05:00
2020-08-26 18:01:02 -04:00
def testDetailsStateMisc ( self ) :
"""
Test state changes and unapplied changes warnings
"""
self . app . uri = tests . utils . URIs . kvm
win = self . _open_details_window ( vmname = " test " , shutdown = True )
self . app . topwin . click_title ( )
# Double run to hit a show() codepath
win = self . _open_details_window ( vmname = " test " )
uiutils . check ( lambda : win . active )
appl = win . find ( " config-apply " , " push button " )
# View Manager option
win . find ( " File " , " menu " ) . click ( )
win . find ( " View Manager " , " menu item " ) . click ( )
uiutils . check ( lambda : self . app . topwin . active )
self . app . topwin . keyCombo ( " <alt>F4 " )
uiutils . check ( lambda : win . active )
# Make a change and then trigger unapplied change warning
tab = self . _select_hw ( win , " Overview " , " overview-tab " )
tab . find ( " Name: " , " text " ) . text = " "
uiutils . check ( lambda : appl . sensitive )
run = win . find ( " Run " , " push button " )
run . click ( )
# Trigger apply error to hit some code paths
self . _click_alert_button ( " unapplied changes " , " Yes " )
self . _click_alert_button ( " name must be specified " , " Close " )
uiutils . check ( lambda : run . sensitive )
consolebtn = win . find ( " Console " , " radio button " )
consolebtn . click ( )
self . _click_alert_button ( " unapplied changes " , " Yes " )
self . _click_alert_button ( " name must be specified " , " Close " )
uiutils . check ( lambda : not consolebtn . checked )
# Test the pause toggle
win . find ( " config-cancel " ) . click ( )
run . click ( )
uiutils . check ( lambda : not run . sensitive )
pause = win . find ( " Pause " , " toggle button " )
pause . click ( )
uiutils . check ( lambda : pause . checked )
pause . click ( )
uiutils . check ( lambda : not pause . checked )
uiutils . check ( lambda : win . active )
2018-09-29 16:04:05 -04:00
def testDetailsEditDomain1 ( self ) :
"""
Test overview , memory , cpu pages
"""
2020-08-26 18:01:02 -04:00
self . app . uri = tests . utils . URIs . kvm_cpu_insecure
2020-01-25 15:11:02 -05:00
win = self . _open_details_window ( vmname = " test " )
2018-01-20 17:25:16 -05:00
appl = win . find ( " config-apply " , " push button " )
# Overview description
tab = self . _select_hw ( win , " Overview " , " overview-tab " )
tab . find ( " Description: " , " text " ) . text = " hey new description "
2018-01-20 18:21:54 -05:00
tab . find ( " Title: " , " text " ) . text = " hey new title "
2018-01-20 17:25:16 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 17:25:16 -05:00
2020-01-25 15:25:16 -05:00
# There's no hotplug operations after this point
self . _stop_vm ( win )
2018-01-20 17:25:16 -05:00
2020-01-25 15:25:16 -05:00
# Memory
2018-01-20 17:25:16 -05:00
tab = self . _select_hw ( win , " Memory " , " memory-tab " )
2020-01-25 15:25:16 -05:00
tab . find ( " Memory allocation: " , " spin button " ) . text = " 300 "
2018-01-20 17:25:16 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
# Static CPU config
# more cpu config: host-passthrough, copy, clear CPU, manual
2020-08-26 18:01:02 -04:00
tab = self . _select_hw ( win , " CPUs " , " cpu-tab " )
2018-01-20 18:21:54 -05:00
tab . find ( " cpu-model " ) . click_combo_entry ( )
tab . find_fuzzy ( " Clear CPU " , " menu item " ) . click ( )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
tab . find ( " cpu-model " ) . click_combo_entry ( )
tab . find ( " coreduo " , " menu item " ) . click ( )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2020-08-26 18:01:02 -04:00
tab . find_fuzzy ( " CPU security " , " check box " ) . click ( )
appl . click ( )
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
tab . find ( " cpu-model " ) . click_combo_entry ( )
tab . find ( " Application Default " , " menu item " ) . click ( )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2020-08-26 18:01:02 -04:00
copyhost = tab . find ( " Copy host " , " check box " )
uiutils . check ( lambda : copyhost . selected )
copyhost . click ( )
2018-01-20 18:21:54 -05:00
tab . find ( " cpu-model " ) . click_combo_entry ( )
tab . find ( " Hypervisor Default " , " menu item " ) . click ( )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2020-08-26 18:01:02 -04:00
tab . find ( " cpu-model " ) . text = " host-passthrough "
appl . click ( )
uiutils . check ( lambda : not appl . sensitive )
# vCPUs
tab . find ( " vCPU allocation: " , " spin button " ) . text = " 50 "
appl . click ( )
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
# CPU topology
2020-01-25 15:11:02 -05:00
tab . find_fuzzy ( " Topology " , " toggle button " ) . click_expander ( )
2018-01-20 18:21:54 -05:00
tab . find_fuzzy ( " Manually set " , " check " ) . click ( )
2020-08-26 18:01:02 -04:00
sockets = tab . find ( " Sockets: " , " spin button " )
sockets . typeText ( " 8 " )
2018-01-20 18:21:54 -05:00
tab . find ( " Cores: " , " spin button " ) . typeText ( " 2 " )
tab . find ( " Threads: " , " spin button " ) . typeText ( " 2 " )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2020-08-26 18:01:02 -04:00
# Confirm VCPUs were adjusted
2020-08-25 09:48:56 -04:00
vcpualloc = tab . find_fuzzy ( " vCPU allocation " , " spin " )
uiutils . check ( lambda : vcpualloc . text == " 32 " )
2018-01-20 18:21:54 -05:00
2020-08-26 18:01:02 -04:00
# Unset topology
tab . find_fuzzy ( " Manually set " , " check " ) . click ( )
uiutils . check ( lambda : not sockets . sensitive )
appl . click ( )
# Currently generates an error
# uiutils.check(lambda: not appl.sensitive)
2018-01-20 17:25:16 -05:00
2018-09-29 16:04:05 -04:00
def testDetailsEditDomain2 ( self ) :
"""
Test boot and OS pages
"""
win = self . _open_details_window ( vmname = " test-many-devices " )
appl = win . find ( " config-apply " , " push button " )
self . _stop_vm ( win )
# OS edits
tab = self . _select_hw ( win , " OS information " , " os-tab " )
entry = tab . find ( " oslist-entry " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : entry . text == " Fedora " )
2018-09-29 16:04:05 -04:00
entry . click ( )
self . pressKey ( " Down " )
popover = win . find ( " oslist-popover " )
popover . find ( " include-eol " ) . click ( )
entry . text = " fedora12 "
popover . find_fuzzy ( " fedora12 " ) . bring_on_screen ( ) . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not popover . visible )
uiutils . check ( lambda : entry . text == " Fedora 12 " )
2018-09-29 16:04:05 -04:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
uiutils . check ( lambda : entry . text == " Fedora 12 " )
2018-09-29 16:04:05 -04:00
# Boot tweaks
2018-01-20 17:25:16 -05:00
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 )
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 ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 17:25:16 -05:00
# Kernel boot
tab . find_fuzzy ( " Direct kernel boot " , " toggle button " ) . click_expander ( )
tab . find_fuzzy ( " Enable direct kernel " , " check box " ) . click ( )
2020-08-26 18:01:02 -04:00
tab . find ( " Kernel args: " , " text " ) . text = " console=ttyS0 "
appl . click ( )
self . _click_alert_button ( " arguments without specifying " , " OK " )
uiutils . check ( lambda : win . active )
initrd = tab . find ( " Initrd path: " , " text " )
tab . find ( " initrd-browse " , " push button " ) . click ( )
self . _select_storagebrowser_volume ( " default-pool " , " backingl1.img " )
uiutils . check ( lambda : win . active )
uiutils . check ( lambda : " backing " in initrd . text )
appl . click ( )
self . _click_alert_button ( " initrd without specifying " , " OK " )
uiutils . check ( lambda : win . active )
2018-01-20 17:25:16 -05:00
tab . find ( " kernel-browse " , " push button " ) . click ( )
2020-08-25 10:33:20 -04:00
self . _select_storagebrowser_volume ( " default-pool " , " bochs-vol " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : win . active )
kernelpath = tab . find ( " Kernel path: " , " text " )
uiutils . check ( lambda : " bochs " in kernelpath . text )
2020-08-26 18:01:02 -04:00
dtb = tab . find ( " DTB path: " , " text " )
tab . find ( " dtb-browse " , " push button " ) . click ( )
self . _select_storagebrowser_volume ( " default-pool " , " iso-vol " )
uiutils . check ( lambda : win . active )
uiutils . check ( lambda : " iso-vol " in dtb . text )
2018-01-20 17:25:16 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 17:25:16 -05:00
2020-08-26 18:01:02 -04:00
# Now disable kernel, but verify that we keep the values in the UI
tab . find_fuzzy ( " Enable direct kernel " , " check box " ) . click ( )
appl . click ( )
uiutils . check ( lambda : not appl . sensitive )
tab = self . _select_hw ( win , " OS information " , " os-tab " )
tab = self . _select_hw ( win , " Boot Options " , " boot-tab " )
uiutils . check ( lambda : " backing " in initrd . text )
2018-01-20 18:21:54 -05:00
2018-09-29 16:04:05 -04:00
def testDetailsEditDiskNet ( self ) :
"""
Test disk and network devices
"""
win = self . _open_details_window ( vmname = " test-many-devices " )
appl = win . find ( " config-apply " , " push button " )
self . _stop_vm ( win )
2018-01-20 17:25:16 -05:00
# 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 ( " Cache mode: " , " text " ) . text = " unsafe "
2020-01-25 16:04:12 -05:00
tab . find ( " Discard mode: " , " text " ) . text = " unmap "
2020-08-26 18:01:02 -04:00
tab . find ( " Detect zeroes: " , " text " ) . text = " unmap "
2018-01-20 17:25:16 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 17:25:16 -05:00
2020-01-25 19:47:35 -05:00
# Network values w/ macvtap manual
2018-01-20 17:25:16 -05:00
tab = self . _select_hw ( win , " NIC :54:32:10 " , " network-tab " )
2020-08-26 18:01:02 -04:00
tab . find ( " IP address " , " push button " ) . click ( )
2020-08-25 12:46:59 -04:00
src = tab . find ( " net-source " )
2018-01-20 17:25:16 -05:00
src . click ( )
2020-01-25 19:47:35 -05:00
self . pressKey ( " Home " )
tab . find_fuzzy ( " Macvtap device... " ,
" menu item " ) . bring_on_screen ( ) . click ( )
tab . find ( " Device name: " , " text " ) . text = " fakedev12 "
2020-08-25 12:46:59 -04:00
tab . combo_select ( " Device model: " , " rtl8139 " )
2020-08-26 18:01:02 -04:00
tab . find ( " Link state: " , " check box " ) . click ( )
2018-01-20 17:25:16 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 17:25:16 -05:00
# Manual bridge
src . click ( )
2020-01-25 16:48:44 -05:00
tab . find_fuzzy ( " Bridge device... " ,
2018-09-02 01:25:22 +03:00
" menu item " ) . bring_on_screen ( ) . click ( )
2020-01-25 19:47:35 -05:00
tab . find ( " Device name: " , " text " ) . text = " "
2018-01-20 17:25:16 -05:00
appl . click ( )
# Check validation error
2020-08-21 12:55:10 -04:00
self . _click_alert_button ( " Error changing VM configuration " , " Close " )
2020-01-25 19:22:30 -05:00
tab . find ( " Device name: " , " text " ) . text = " zbr0 "
2018-01-20 17:25:16 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 17:25:16 -05:00
2020-08-26 18:01:02 -04:00
def testDetailsEditDevices1 ( self ) :
2018-09-29 16:04:05 -04:00
"""
Test all other devices
"""
2020-08-26 18:01:02 -04:00
win = self . _open_details_window ( vmname = " test-many-devices " ,
shutdown = True )
2018-09-29 16:04:05 -04:00
appl = win . find ( " config-apply " , " push button " )
2020-08-26 18:01:02 -04:00
# Graphics simple VNC -> SPICE
2018-01-20 18:21:54 -05:00
tab = self . _select_hw ( win , " Display VNC " , " graphics-tab " )
2020-08-25 12:46:59 -04:00
tab . combo_select ( " Type: " , " Spice " )
2018-01-20 18:21:54 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
2020-08-26 18:01:02 -04:00
# Spice GL example
tab . combo_select ( " Listen type: " , " None " )
tab . find ( " OpenGL: " , " check box " ) . click ( )
tab . combo_check_default ( " graphics-rendernode " , " 0000 " )
2018-01-20 18:21:54 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
2020-08-26 18:01:02 -04:00
# Switch to VNC with options
tab . combo_select ( " Type: " , " VNC " )
tab . combo_select ( " Listen type: " , " Address " )
tab . find ( " graphics-port-auto " , " check " ) . click ( )
tab . find ( " graphics-port " , " spin button " ) . text = " 6001 "
tab . find ( " Password: " , " check " ) . click ( )
passwd = tab . find_fuzzy ( " graphics-password " , " text " )
newpass = " foobar "
passwd . typeText ( newpass )
appl . click ( )
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
# Sound device
tab = self . _select_hw ( win , " Sound sb16 " , " sound-tab " )
tab . find ( " Model: " , " text " ) . text = " ac97 "
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2020-08-26 18:01:02 -04:00
# Test non-disk removal
win . find ( " config-remove " ) . click ( )
cell = win . find ( " Sound ac97 " , " table cell " )
oldtext = cell . text
self . _click_alert_button ( " Are you sure " , " No " )
uiutils . check ( lambda : cell . state_selected )
cell . click ( button = 3 )
self . app . root . find ( " Remove Hardware " , " menu item " ) . click ( )
self . _click_alert_button ( " Are you sure " , " Yes " )
uiutils . check ( lambda : cell . text != oldtext )
2018-01-20 18:21:54 -05:00
# Host device
tab = self . _select_hw ( win , " PCI 0000:00:19.0 " , " host-tab " )
tab . find ( " ROM BAR: " , " check box " ) . click ( )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
# Video device
tab = self . _select_hw ( win , " Video VMVGA " , " video-tab " )
tab . find ( " Model: " , " text " ) . text = " virtio "
tab . find ( " 3D acceleration: " , " check box " ) . click ( )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
# Watchdog
tab = self . _select_hw ( win , " Watchdog " , " watchdog-tab " )
tab . find ( " Model: " , " text " ) . text = " diag288 "
tab . find ( " Action: " , " text " ) . click ( )
self . pressKey ( " Down " )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
2020-08-26 18:01:02 -04:00
def testDetailsEditDevices2 ( self ) :
win = self . _open_details_window ( vmname = " test-many-devices " ,
shutdown = True )
appl = win . find ( " config-apply " , " push button " )
2018-01-20 18:21:54 -05:00
# Controller SCSI
tab = self . _select_hw (
2020-07-13 13:07:06 -04:00
win , " Controller VirtIO SCSI 9 " , " controller-tab " )
2020-08-25 12:46:59 -04:00
tab . combo_select ( " controller-model " , " Hypervisor " )
2018-01-20 18:21:54 -05:00
tab . find ( " SCSI Disk 1 on 9:0:0:0 " , " table cell " )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
# Controller USB
tab = self . _select_hw ( win , " Controller USB 0 " , " controller-tab " )
2020-08-25 12:46:59 -04:00
tab . combo_select ( " controller-model " , " USB 2 " )
2018-01-20 18:21:54 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
tab = self . _select_hw ( win , " Controller USB 0 " , " controller-tab " )
2020-08-25 12:46:59 -04:00
tab . combo_select ( " controller-model " , " USB 3 " )
2018-01-20 18:21:54 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
# Filesystem tweaks
tab = self . _select_hw ( win , " Filesystem /target/ " , " filesystem-tab " )
2020-08-25 12:46:59 -04:00
tab . combo_select ( " Driver: " , " Path " )
tab . combo_select ( " Write Policy: " , " Immediate " )
2018-01-20 18:21:54 -05:00
tab . find ( " Source path: " , " text " ) . text = " /frib1 "
tab . find ( " Target path: " , " text " ) . text = " newtarget "
tab . find_fuzzy ( " Export filesystem " , " check box " ) . click ( )
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
# Smartcard tweaks
tab = self . _select_hw ( win , " Smartcard " , " smartcard-tab " )
2020-08-25 12:46:59 -04:00
tab . combo_select ( " smartcard-mode " , " Passthrough " )
2018-01-20 18:21:54 -05:00
appl . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
2020-08-26 18:01:02 -04:00
# TPM tweaks
tab = self . _select_hw ( win , " TPM " , " tpm-tab " )
tab . combo_select ( " tpm-model " , " CRB " )
appl . click ( )
uiutils . check ( lambda : not appl . sensitive )
2018-01-20 18:21:54 -05:00
2019-01-08 12:06:02 -05:00
# vsock tweaks
2020-07-13 13:07:06 -04:00
tab = self . _select_hw ( win , " VirtIO VSOCK " , " vsock-tab " )
2019-01-08 12:06:02 -05:00
addr = tab . find ( " vsock-cid " )
auto = tab . find ( " vsock-auto " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : addr . text == " 5 " )
2020-08-26 18:01:02 -04:00
addr . text = " 7 "
appl . click ( )
uiutils . check ( lambda : addr . text == " 7 " )
uiutils . check ( lambda : not appl . sensitive )
2019-01-08 12:06:02 -05:00
auto . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not addr . visible )
2019-01-08 12:06:02 -05:00
appl . click ( )
2020-08-26 18:01:02 -04:00
uiutils . check ( lambda : not appl . sensitive )
2019-01-08 12:06:02 -05:00
2018-01-20 18:21:54 -05:00
def testDetailsMiscEdits ( self ) :
2018-01-20 17:25:16 -05:00
"""
2018-05-21 20:42:50 +01:00
Test misc editing behavior , like checking for unapplied
2018-01-20 18:21:54 -05:00
changes
"""
2018-03-17 18:41:12 -04:00
win = self . _open_details_window ( vmname = " test-many-devices " ,
double = True )
2018-01-20 18:21:54 -05:00
hwlist = win . find ( " hw-list " )
2018-01-20 17:25:16 -05:00
2018-01-20 18:21:54 -05:00
# Live device removal, see results after shutdown
disklabel = " SCSI Disk 1 "
tab = self . _select_hw ( win , disklabel , " disk-tab " )
win . find ( " config-remove " , " push button " ) . click ( )
2020-01-28 11:34:23 -05:00
delete = self . app . root . find_fuzzy ( " Remove Disk " , " frame " )
2020-01-24 14:59:44 -05:00
delete . find_fuzzy ( " Delete " , " button " ) . click ( )
2018-01-20 17:25:16 -05:00
2020-01-24 14:59:44 -05:00
# Will be fixed eventually
2020-08-21 12:55:10 -04:00
self . _click_alert_button ( " Device could not be removed " , " OK " )
2018-01-20 18:21:54 -05:00
c = hwlist . find ( disklabel , " table cell " )
self . _stop_vm ( win )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : c . text != disklabel )
2018-01-20 18:21:54 -05:00
# Remove a device for offline VM
tab = self . _select_hw ( win , " SCSI CDROM 1 " , " disk-tab " )
win . find ( " config-remove " , " push button " ) . click ( )
2020-01-28 11:34:23 -05:00
delete = self . app . root . find_fuzzy ( " Remove Disk " , " frame " )
2020-01-24 14:59:44 -05:00
delete . find_fuzzy ( " Delete " , " button " ) . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : win . active )
2018-01-20 18:21:54 -05:00
2020-08-26 18:01:02 -04:00
# Attempt to apply changes when skipping away, but they fail
tab . find ( " Advanced options " , " toggle button " ) . click_expander ( )
cacheui = tab . find ( " Cache mode: " , " text " )
origcache = cacheui . text
cacheui . text = " badcachemode "
hwlist . find ( " CPUs " , " table cell " ) . click ( )
self . _click_alert_button ( " There are unapplied changes " , " Yes " )
self . _click_alert_button ( " badcachemode " , " Close " )
2018-01-20 18:21:54 -05:00
# Cancelling changes
tab = self . _select_hw ( win , " IDE Disk 1 " , " disk-tab " )
share = tab . find ( " Shareable: " , " check box " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not share . checked )
2018-01-20 18:21:54 -05:00
share . click ( )
win . find ( " config-cancel " ) . click ( )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not share . checked )
2018-01-20 18:21:54 -05:00
# Unapplied, clicking no
share = tab . find ( " Shareable: " , " check box " )
share . click ( )
hwlist . find ( " CPUs " , " table cell " ) . click ( )
2020-08-21 12:55:10 -04:00
self . _click_alert_button ( " There are unapplied changes " , " No " )
2018-01-20 18:21:54 -05:00
tab = self . _select_hw ( win , " IDE Disk 1 " , " disk-tab " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not share . checked )
2018-01-20 18:21:54 -05:00
# Unapplied changes but clicking yes
share . click ( )
hwlist . find ( " CPUs " , " table cell " ) . click ( )
alert = self . app . root . find ( " vmm dialog " , " alert " )
alert . find_fuzzy ( " There are unapplied changes " , " label " )
alert . find_fuzzy ( " Don ' t warn " , " check box " ) . click ( )
alert . find ( " Yes " , " push button " ) . click ( )
tab = self . _select_hw ( win , " IDE Disk 1 " , " disk-tab " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : share . checked )
2018-01-20 18:21:54 -05:00
# Make sure no unapplied changes option sticks
share . click ( )
self . _select_hw ( win , " CPUs " , " cpu-tab " )
tab = self . _select_hw ( win , " IDE Disk 1 " , " disk-tab " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : share . checked )
2018-01-20 18:21:54 -05:00
# VM State change doesn't refresh UI
share . click ( )
2018-01-20 17:25:16 -05:00
self . _start_vm ( win )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not share . checked )
2018-01-20 18:21:54 -05:00
# Now apply changes to running VM, ensure they show up on shutdown
win . find ( " config-apply " ) . click ( )
2020-08-21 12:55:10 -04:00
self . _click_alert_button ( " changes will take effect " , " OK " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : share . checked )
2018-01-20 18:21:54 -05:00
self . _stop_vm ( win )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not share . checked )
2019-05-23 16:14:39 -04:00
2019-06-15 11:58:43 +02:00
# Unapplied changes should warn when switching to XML tab
tab = self . _select_hw ( win , " Overview " , " overview-tab " )
tab . find ( " Description: " , " text " ) . text = " hey new description "
win . find ( " XML " , " page tab " ) . click ( )
# Select 'No', meaning don't abandon changes
2020-08-21 12:55:10 -04:00
self . _click_alert_button ( " changes will be lost " , " No " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : tab . showing )
2019-06-15 11:58:43 +02:00
# Try unapplied changes again, this time abandon our changes
win . find ( " XML " , " page tab " ) . click ( )
2020-08-21 12:55:10 -04:00
self . _click_alert_button ( " changes will be lost " , " Yes " )
2020-08-25 09:48:56 -04:00
uiutils . check ( lambda : not tab . showing )
2019-06-15 11:58:43 +02:00
2020-08-26 18:01:02 -04:00
# Verify addhardware right click works
cell = win . find ( " Overview " , " table cell " ) . click ( button = 3 )
self . app . root . find ( " Add Hardware " , " menu item " ) . click ( )
self . app . root . find ( " Add New Virtual Hardware " , " frame " )
2019-05-23 16:14:39 -04:00
def testDetailsXMLEdit ( self ) :
"""
Test XML editing interaction
"""
2019-06-05 17:40:54 -04:00
self . app . open ( xmleditor_enabled = True )
2019-05-23 16:14:39 -04:00
win = self . _open_details_window ( vmname = " test-clone-simple " )
finish = win . find ( " config-apply " )
xmleditor = win . find ( " XML editor " )
# Edit vcpu count and verify it's reflected in CPU page
tab = self . _select_hw ( win , " CPUs " , " cpu-tab " )
win . find ( " XML " , " page tab " ) . click ( )
xmleditor . text = xmleditor . text . replace ( " >5</vcpu " , " >8</vcpu " )
finish . click ( )
win . find ( " Details " , " page tab " ) . click ( )
2020-08-25 09:48:56 -04:00
vcpualloc = tab . find ( " vCPU allocation: " , " spin button " )
uiutils . check ( lambda : vcpualloc . text == " 8 " )
2019-05-23 16:14:39 -04:00
# Make some disk edits
tab = self . _select_hw ( win , " IDE Disk 1 " , " disk-tab " )
win . find ( " XML " , " page tab " ) . click ( )
origpath = " /dev/default-pool/test-clone-simple.img "
newpath = " /path/FOOBAR "
xmleditor . text = xmleditor . text . replace ( origpath , newpath )
finish . click ( )
win . find ( " Details " , " page tab " ) . click ( )
2020-08-25 09:48:56 -04:00
disksrc = win . find ( " disk-source-path " )
uiutils . check ( lambda : disksrc . text == newpath )
2019-05-23 16:14:39 -04:00
# Do standard xmleditor tests
self . _test_xmleditor_interactions ( win , finish )