uitests: Add manager related tests

This commit is contained in:
Cole Robinson 2018-01-19 18:41:00 -05:00
parent c87bb3937d
commit d3137419d0
3 changed files with 107 additions and 1 deletions

93
tests/uitests/manager.py Normal file
View File

@ -0,0 +1,93 @@
from tests.uitests import utils as uiutils
class Manager(uiutils.UITestCase):
"""
UI tests for manager window, and basic VM lifecycle stuff
"""
##############
# Test cases #
##############
def _testVMLifecycle(self):
"""
Basic VM lifecycle test, shared between standard and --test-no-events
testing
"""
manager = self.app.topwin
shutdown = manager.find("Shut Down", "push button")
pause = manager.find("Pause", "toggle button")
run = manager.find("Run", "push button")
force = manager.find("Force Off", "menu item")
smenu = manager.find("Menu", "toggle button")
save = manager.find("Save", "menu item")
c = manager.find("test-many-devices", "table cell")
c.click()
smenu.click()
force.click()
alert = self.app.root.find("vmm dialog", "alert")
alert.find("Are you sure you want", "label")
alert.find("Yes", "push button").click()
uiutils.check_in_loop(lambda: run.sensitive, timeout=5)
run.click()
uiutils.check_in_loop(lambda: not run.sensitive, timeout=5)
pause.click()
uiutils.check_in_loop(lambda: pause.checked, timeout=5)
smenu.click()
save.click()
uiutils.check_in_loop(lambda: run.sensitive, timeout=5)
self.assertTrue("Saved" in c.text)
run.click()
uiutils.check_in_loop(lambda: shutdown.sensitive, timeout=5)
def testVMLifecycle(self):
self._testVMLifecycle()
def testVMNoEventsLifecycle(self):
self.app.open(extra_opts=["--test-no-events"])
# Change preferences timeout to 1 second
self.app.root.find("Edit", "menu").click()
self.app.root.find("Preferences", "menu item").click()
win = self.app.root.find_fuzzy("Preferences", "frame")
win.find("Polling", "page tab").click()
win.find("cpu-poll").text = "1"
win.find("Close", "push button").click()
self._testVMLifecycle()
def testManagerColumns(self):
# Enable all stat options
self.app.root.find("Edit", "menu").click()
self.app.root.find("Preferences", "menu item").click()
win = self.app.root.find_fuzzy("Preferences", "frame")
win.find("Polling", "page tab").click()
win.find_fuzzy("Poll Disk", "check").click()
win.find_fuzzy("Poll Network", "check").click()
win.find_fuzzy("Poll Memory", "check").click()
win.find("Close", "push button").click()
manager = self.app.topwin
manager.find("View", "menu").click()
manager.find("Graph", "menu").point()
manager.find("Host CPU", "check menu item").click()
manager.find("View", "menu").click()
manager.find("Graph", "menu").point()
manager.find("Memory Usage", "check menu item").click()
manager.find("View", "menu").click()
manager.find("Graph", "menu").point()
manager.find("Disk I/O", "check menu item").click()
manager.find("View", "menu").click()
manager.find("Graph", "menu").point()
manager.find("Network I/O", "check menu item").click()
# Verify columns showed up
manager.find("Name", "table column header")
manager.find("CPU usage", "table column header")
manager.find("Host CPU usage", "table column header")
manager.find("Memory usage", "table column header")
manager.find("Disk I/O", "table column header")
manager.find("Network I/O", "table column header")

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.14"/>
<object class="GtkAccelGroup" id="accelgroup1"/>
@ -394,6 +394,11 @@
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="vm-list-atkobject">
<property name="AtkObject::accessible-name">vm-list</property>
</object>
</child>
</object>
</child>
</object>
@ -445,5 +450,8 @@
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>

View File

@ -213,6 +213,11 @@
<property name="invisible_char">●</property>
<property name="adjustment">adjustment1</property>
<signal name="value-changed" handler="on_prefs_stats_update_interval_changed" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="prefs-stats-update-interval-atkobject">
<property name="AtkObject::accessible-name">cpu-poll</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>