From a96cbcf33571d65c0c20bb27cbeaf32cb4966cf6 Mon Sep 17 00:00:00 2001
From: Christian Stenger <christian.stenger@nokia.com>
Date: Mon, 2 Apr 2012 15:26:14 +0200
Subject: [PATCH] Squish: Small fixes for utils.py
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* invokeMenuItem(): changed order and additional
  waitFor to be more error-proof on Mac
* logApplicationOutput(): added try/except block
  for cases where no former run/debug could be found

Change-Id: I0d434fbb964e3d85e5ccb2a4c336e14e956f44ce
Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
---
 tests/system/shared/utils.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py
index 1c120e1f1ec..578721959fb 100644
--- a/tests/system/shared/utils.py
+++ b/tests/system/shared/utils.py
@@ -181,9 +181,10 @@ def cleanUpUserFiles(pathsToProFiles=None):
 
 def invokeMenuItem(menu, item, subItem = None):
     menuObject = waitForObjectItem(":Qt Creator.QtCreator.MenuBar_QMenuBar", menu)
+    waitFor("menuObject.visible", 1000)
     activateItem(menuObject)
     itemObject = waitForObjectItem(objectMap.realName(menuObject), item)
-    waitFor("menuObject.visible", 1000)
+    waitFor("itemObject.enabled", 2000)
     activateItem(itemObject)
     if subItem != None:
         sub = itemObject.menu()
@@ -194,8 +195,11 @@ def logApplicationOutput():
     # make sure application output is shown
     ensureChecked("{type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' "
                   "window=':Qt Creator_Core::Internal::MainWindow' occurrence='3'}")
-    output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000)
-    test.log("Application Output:\n%s" % output.plainText)
+    try:
+        output = waitForObject("{type='Core::OutputWindow' visible='1' windowTitle='Application Output Window'}", 20000)
+        test.log("Application Output:\n%s" % output.plainText)
+    except:
+        test.fail("Could not find any Application Output - did the project run?")
 
 # get the output from a given cmdline call
 def getOutputFromCmdline(cmdline):
-- 
GitLab