error: Add accessible strings for error dialogs

Makes UI testing easier
This commit is contained in:
Cole Robinson 2018-01-09 16:44:09 -05:00
parent 950e8803bc
commit dc344fc8ee
3 changed files with 9 additions and 5 deletions

View File

@ -58,7 +58,8 @@ class NewVM(uiutils.UITestCase):
delete = uiutils.find_fuzzy(self.app.root, "Delete", "frame")
uiutils.find_fuzzy(delete, "Delete", "button").click()
alert = uiutils.find_pattern(self.app.root, "Warning", "alert")
alert = uiutils.find_pattern(self.app.root,
"vmm error dialog", "alert")
uiutils.find_fuzzy(alert, "Yes", "push button").click()
# Verify delete dialog and VM dialog are now gone
@ -215,7 +216,8 @@ class NewVM(uiutils.UITestCase):
uiutils.find_fuzzy(newvm, "Forward", "button").click()
# Disk collision box pops up, hit ok
alert = uiutils.find_pattern(self.app.root, "Warning", "alert")
alert = uiutils.find_pattern(self.app.root,
"vmm simple dialog", "alert")
uiutils.find_fuzzy(alert, "Yes", "push button").click()
uiutils.find_fuzzy(newvm, "Forward", "button").click()

View File

@ -2,18 +2,17 @@ import dogtail
import pyatspi
from tests.uitests import utils as uiutils
import time
# From dogtail 9.9.0 which isn't widely distributed yet
def _holdKey(keyName):
code = dogtail.rawinput.keyNameToKeyCode(keyName)
pyatspi.Registry.generateKeyboardEvent(code, None, pyatspi.KEY_PRESS)
pyatspi.Registry().generateKeyboardEvent(code, None, pyatspi.KEY_PRESS)
def _releaseKey(keyName):
code = dogtail.rawinput.keyNameToKeyCode(keyName)
pyatspi.Registry.generateKeyboardEvent(code, None, pyatspi.KEY_RELEASE)
pyatspi.Registry().generateKeyboardEvent(code, None, pyatspi.KEY_RELEASE)
class VMMPrefs(uiutils.UITestCase):

View File

@ -127,6 +127,7 @@ class vmmErrorDialog(vmmGObject):
if self._simple:
self._simple.destroy()
self._simple = dialog
self._simple.get_accessible().set_name("vmm simple dialog")
return _launch_dialog(self._simple,
text1, text2 or "", title or "",
@ -319,6 +320,8 @@ class _errorDialog (Gtk.MessageDialog):
if hasattr(child, "set_max_width_chars"):
child.set_max_width_chars(40)
self.get_accessible().set_name("vmm error dialog")
self.chk_vbox = None
self.chk_align = None
self.init_chkbox()