2018-01-11 23:32:18 +03:00
from tests . uitests import utils as uiutils
class CreateNet ( uiutils . UITestCase ) :
"""
UI tests for the createnet wizard
"""
##############
# Test cases #
##############
def testCreateNet ( self ) :
# Open the createnet dialog
hostwin = self . _open_host_window ( " Virtual Networks " )
2018-01-19 18:51:33 +03:00
hostwin . find ( " net-add " , " push button " ) . click ( )
win = self . app . root . find (
2018-01-11 23:32:18 +03:00
" Create a new virtual network " , " frame " )
# Create a simple default network
newname = " a-test-new-net "
2018-01-19 18:51:33 +03:00
forward = win . find ( " Forward " , " push button " )
finish = win . find ( " Finish " , " push button " )
2018-01-19 19:16:09 +03:00
name = win . find ( " Network Name: " , " text " )
2018-01-11 23:32:18 +03:00
name . text = newname
forward . click ( )
forward . click ( )
forward . click ( )
finish . click ( )
# Select the new network in the host window, then do
# stop->start->stop->delete, for lifecycle testing
uiutils . check_in_loop ( lambda : hostwin . active )
2018-01-19 18:51:33 +03:00
cell = hostwin . find ( newname , " table cell " )
delete = hostwin . find ( " net-delete " , " push button " )
start = hostwin . find ( " net-start " , " push button " )
stop = hostwin . find ( " net-stop " , " push button " )
2018-01-11 23:32:18 +03:00
cell . click ( )
stop . click ( )
uiutils . check_in_loop ( lambda : start . sensitive )
start . click ( )
uiutils . check_in_loop ( lambda : stop . sensitive )
stop . click ( )
uiutils . check_in_loop ( lambda : delete . sensitive )
# Delete it
delete . click ( )
2018-01-19 18:51:33 +03:00
alert = self . app . root . find ( " vmm dialog " , " alert " )
2018-01-11 23:32:18 +03:00
alert . find_fuzzy ( " permanently delete the network " , " label " )
2018-01-19 18:51:33 +03:00
alert . find ( " Yes " , " push button " ) . click ( )
2018-01-11 23:32:18 +03:00
# Ensure it's gone
uiutils . check_in_loop ( lambda : cell . dead )
# Ensure host window closes fine
hostwin . click ( )
hostwin . keyCombo ( " <ctrl>w " )
uiutils . check_in_loop ( lambda : not hostwin . showing and
not hostwin . active )