SquishTests: Move waitForObject calls

Before calling clickOnTab we used explicit waitForObject calls
sometimes.
Move these waitForObject calls into clickOnTab as the workaround
inside clickOnTab lets assume that the call of waitForObject
beforehand could fail.

Change-Id: Iba3bd952bfeec3738417ab6e2ea735665acb504d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
This commit is contained in:
Christian Stenger
2024-05-14 07:32:26 +02:00
parent ef4f690cef
commit 22e91fc119
3 changed files with 1 additions and 8 deletions

View File

@@ -265,7 +265,6 @@ def selectFromFileDialog(fileName, waitForFile=False, ignoreFinalSnooze=False):
def addHelpDocumentation(which):
invokeMenuItem("Edit", "Preferences...")
mouseClick(waitForObjectItem(":Options_QListView", "Help"))
waitForObject("{container=':Options.qt_tabwidget_tabbar_QTabBar' type='TabItem' text='Documentation'}")
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Documentation")
# get rid of all docs already registered
listWidget = waitForObject("{type='QListView' name='docsListView' visible='1'}")
@@ -293,7 +292,6 @@ def addCurrentCreatorDocumentation():
return
invokeMenuItem("Edit", "Preferences...")
mouseClick(waitForObjectItem(":Options_QListView", "Help"))
waitForObject("{container=':Options.qt_tabwidget_tabbar_QTabBar' type='TabItem' text='Documentation'}")
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Documentation")
clickButton(waitForObject("{type='QPushButton' name='addButton' visible='1' text='Add...'}"))
selectFromFileDialog(docPath)
@@ -540,6 +538,7 @@ def clickOnTab(tabBarStr, tabText, timeout=5000):
test.log("Using workaround for Mac and Windows.")
setWindowState(tabBar, WindowState.Normal)
tabBar = waitForObject(tabBarStr, 2000)
waitForObject("{container='%s' type='TabItem' text='%s'}" % (tabBarStr, tabText))
clickTab(tabBar, tabText)
waitFor("str(tabBar.tabText(tabBar.currentIndex)) == '%s'" % tabText, timeout)

View File

@@ -111,8 +111,6 @@ def isIgnoredFile(fileName, ignoredFiles):
def ignoredFilesFromSettings():
invokeMenuItem("Edit", "Preferences...")
mouseClick(waitForObjectItem(":Options_QListView", "Text Editor"))
waitForObject("{container=':Options.qt_tabwidget_tabbar_QTabBar' type='TabItem' "
"text='Behavior'}")
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Behavior")
cleanWhiteSpaceCB = "{type='QCheckBox' text='Skip clean whitespace for file types:'}"
ensureChecked(cleanWhiteSpaceCB)

View File

@@ -32,8 +32,6 @@ def getOrModifyFilePatternsFor(mimeType, filter='', toBePresent=None):
result = []
invokeMenuItem("Edit", "Preferences...")
mouseClick(waitForObjectItem(":Options_QListView", "Environment"))
waitForObject("{container=':Options.qt_tabwidget_tabbar_QTabBar' type='TabItem' "
"text='MIME Types'}")
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "MIME Types")
replaceEditorContent(waitForObject("{name='filterLineEdit' type='Utils::FancyLineEdit' "
"visible='1'}"), filter)
@@ -95,8 +93,6 @@ def addHighlighterDefinition(*languages):
test.log("Updating highlighter definitions...")
invokeMenuItem("Edit", "Preferences...")
mouseClick(waitForObjectItem(":Options_QListView", "Text Editor"))
waitForObject("{container=':Options.qt_tabwidget_tabbar_QTabBar' type='TabItem' "
"text='Generic Highlighter'}")
clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Generic Highlighter")
test.log("Trying to download definitions...")