uitests: Add a fixture for passing in VMMDogtailApp
Reproducing what the custom unittest TestCase does. Convert test_about as a demo Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
ebf76563b8
commit
aa8572048b
|
@ -0,0 +1,17 @@
|
||||||
|
# This work is licensed under the GNU GPLv2 or later.
|
||||||
|
# See the COPYING file in the top-level directory.
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def app():
|
||||||
|
"""
|
||||||
|
Custom pytest fixture to a VMMDogtailApp instance to the testcase
|
||||||
|
"""
|
||||||
|
from .lib.app import VMMDogtailApp
|
||||||
|
testapp = VMMDogtailApp()
|
||||||
|
try:
|
||||||
|
yield testapp
|
||||||
|
finally:
|
||||||
|
testapp.stop()
|
|
@ -6,24 +6,19 @@ import datetime
|
||||||
from . import lib
|
from . import lib
|
||||||
|
|
||||||
|
|
||||||
class VMMAbout(lib.testcase.UITestCase):
|
###################################
|
||||||
"""
|
# UI tests for the 'About' dialog #
|
||||||
UI tests for the 'About' dialog
|
###################################
|
||||||
"""
|
|
||||||
|
|
||||||
##############
|
def testAbout(app):
|
||||||
# Test cases #
|
app.root.find("Help", "menu").click()
|
||||||
##############
|
app.root.find("About", "menu item").click()
|
||||||
|
win = app.root.find_fuzzy("About", "dialog")
|
||||||
|
l = win.find_fuzzy("Copyright", "label")
|
||||||
|
|
||||||
def testAbout(self):
|
curyear = datetime.datetime.today().strftime("%Y")
|
||||||
self.app.root.find("Help", "menu").click()
|
if curyear not in l.text:
|
||||||
self.app.root.find("About", "menu item").click()
|
print("Current year=%s not in about.ui dialog!" % curyear)
|
||||||
win = self.app.root.find_fuzzy("About", "dialog")
|
|
||||||
l = win.find_fuzzy("Copyright", "label")
|
|
||||||
|
|
||||||
curyear = datetime.datetime.today().strftime("%Y")
|
win.keyCombo("<ESC>")
|
||||||
if curyear not in l.text:
|
lib.utils.check(lambda: win.visible is False)
|
||||||
print("Current year=%s not in about.ui dialog!" % curyear)
|
|
||||||
|
|
||||||
win.keyCombo("<ESC>")
|
|
||||||
lib.utils.check(lambda: win.visible is False)
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Details(lib.testcase.UITestCase):
|
||||||
return win
|
return win
|
||||||
|
|
||||||
def testDetailsHardwareSmokeTest(self):
|
def testDetailsHardwareSmokeTest(self):
|
||||||
self._testSmokeTest(None)
|
self._testSmokeTest("test-many-devices")
|
||||||
|
|
||||||
def testDetailsHardwareSmokeTestAlternate(self):
|
def testDetailsHardwareSmokeTestAlternate(self):
|
||||||
self.app.open(keyfile="allstats.ini")
|
self.app.open(keyfile="allstats.ini")
|
||||||
|
|
Loading…
Reference in New Issue