uitests: Fix prefs XML editor flakeyness

This commit is contained in:
Cole Robinson 2019-06-13 13:50:13 -04:00
parent 2266b650a5
commit b4cc9c7cea
3 changed files with 13 additions and 6 deletions

View File

@ -1,8 +1,6 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
import dogtail.rawinput
from tests.uitests import utils as uiutils
@ -106,10 +104,7 @@ class Manager(uiutils.UITestCase):
"""
Drag a window so it's not obscuring the manager window
"""
win.click()
clickX = win.position[0] + win.size[0] / 2
clickY = win.position[1] + 10
dogtail.rawinput.drag((clickX, clickY), (1000, 1000))
uiutils.drag(win, 1000, 1000)
manager = self.app.topwin

View File

@ -59,6 +59,7 @@ class VMMPrefs(uiutils.UITestCase):
def testPrefsXMLEditor(self):
managerwin = self.app.topwin
uiutils.drag(managerwin, 0, 200)
detailswin = self._open_details_window(vmname="test-clone-simple")
finish = detailswin.find("config-apply")
xmleditor = detailswin.find("XML editor")
@ -70,6 +71,7 @@ class VMMPrefs(uiutils.UITestCase):
xmleditor.typeText("1234abcd")
self.assertEqual(xmleditor.text, origtext)
managerwin.grabFocus()
managerwin.click()
managerwin.find("Edit", "menu").click()
managerwin.find("Preferences", "menu item").click()

View File

@ -243,6 +243,16 @@ def check_in_loop(func, timeout=2):
time.sleep(interval)
def drag(win, x, y):
"""
Drag a window to the x/y coordinates
"""
win.click()
clickX = win.position[0] + win.size[0] / 2
clickY = win.position[1] + 10
dogtail.rawinput.drag((clickX, clickY), (x, y))
class VMMDogtailNode(dogtail.tree.Node):
"""
Our extensions to the dogtail node wrapper class.