2015-09-14 19:53:02 +03:00
from tests . uitests import utils as uiutils
2015-09-09 16:49:45 +03:00
2018-01-09 18:01:56 +03:00
class VMMCLI ( uiutils . UITestCase ) :
2015-09-09 16:49:45 +03:00
"""
UI tests for virt - manager ' s command line --show options
"""
##############
# Test cases #
##############
def testShowNewVM ( self ) :
self . app . open ( extra_opts = [ " --show-domain-creator " ] )
2018-01-11 00:42:53 +03:00
self . assertEqual ( self . app . topwin . name , " New VM " )
2015-09-09 16:49:45 +03:00
def testShowHost ( self ) :
self . app . open ( extra_opts = [ " --show-host-summary " ] )
2018-01-11 00:42:53 +03:00
self . assertEqual ( self . app . topwin . name ,
" test testdriver.xml Connection Details " )
2017-05-05 18:39:59 +03:00
self . assertEqual (
2018-01-19 19:16:09 +03:00
self . app . topwin . find_fuzzy ( " Name: " , " text " ) . text ,
2015-09-09 16:49:45 +03:00
" test testdriver.xml " )
def testShowDetails ( self ) :
2017-03-06 23:35:02 +03:00
self . app . open ( extra_opts = [ " --show-domain-editor " , " test-clone-simple " ] )
2015-09-09 16:49:45 +03:00
2018-01-11 00:42:53 +03:00
self . assertTrue ( " test-clone-simple on " in self . app . topwin . name )
2015-09-09 16:49:45 +03:00
self . assertFalse (
2018-01-11 02:57:40 +03:00
self . app . topwin . find_fuzzy (
2018-01-11 00:42:53 +03:00
" Guest is not running " , " label " ) . showing )
2015-09-09 16:49:45 +03:00
self . assertTrue (
2018-01-11 02:57:40 +03:00
self . app . topwin . find_fuzzy (
2018-01-11 00:42:53 +03:00
" add-hardware " , " button " ) . showing )
2015-09-09 16:49:45 +03:00
def testShowPerformance ( self ) :
self . app . open ( extra_opts = [ " --show-domain-performance " ,
2017-03-06 23:35:02 +03:00
" test-clone-simple " ] )
2015-09-09 16:49:45 +03:00
2018-01-11 00:42:53 +03:00
self . assertTrue ( " test-clone-simple on " in self . app . topwin . name )
2015-09-09 16:49:45 +03:00
self . assertFalse (
2018-01-11 02:57:40 +03:00
self . app . topwin . find_fuzzy (
2018-01-11 00:42:53 +03:00
" Guest is not running " , " label " ) . showing )
2015-09-09 16:49:45 +03:00
self . assertTrue (
2018-01-11 02:57:40 +03:00
self . app . topwin . find_fuzzy ( " CPU usage " , " label " ) . showing )
2015-09-09 16:49:45 +03:00
def testShowConsole ( self ) :
2017-03-06 23:35:02 +03:00
self . app . open ( extra_opts = [ " --show-domain-console " , " test-clone-simple " ] )
2015-09-09 16:49:45 +03:00
2018-01-11 00:42:53 +03:00
self . assertTrue ( " test-clone-simple on " in self . app . topwin . name )
2015-09-09 16:49:45 +03:00
self . assertTrue (
2018-01-11 02:57:40 +03:00
self . app . topwin . find_fuzzy (
2018-01-11 00:42:53 +03:00
" Guest is not running " , " label " ) . showing )
2015-09-09 16:49:45 +03:00
self . assertFalse (
2018-01-11 02:57:40 +03:00
self . app . topwin . find_fuzzy (
2018-01-11 00:42:53 +03:00
" add-hardware " , " button " ) . showing )
2018-01-20 02:04:15 +03:00
def testShowRemoteConnect ( self ) :
"""
Test the remote app dbus connection
"""
self . app . open ( )
newapp = uiutils . VMMDogtailApp ( " test:///default " )
newapp . open ( )
uiutils . check_in_loop ( lambda : not newapp . is_running ( ) )
import dogtail . tree
vapps = [ a for a in dogtail . tree . root . applications ( ) if
a . name == " virt-manager " ]
self . assertEqual ( len ( vapps ) , 1 )
self . app . topwin . find ( " test default " , " table cell " )
2018-01-21 22:34:35 +03:00
def testShowError ( self ) :
self . app . open ( extra_opts = [ " --idontexist " ] )
alert = self . app . root . find ( " vmm dialog " )
alert . find_fuzzy ( " Unhandled command line " )