From 22e91fc119bbca38e2f6cdb8214346283916e44b Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 14 May 2024 07:32:26 +0200 Subject: [PATCH] SquishTests: Move waitForObject calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Reviewed-by: Robert Löhning --- tests/system/shared/utils.py | 3 +-- tests/system/suite_editors/tst_clean_whitespaces/test.py | 2 -- tests/system/suite_editors/tst_generic_highlighter/test.py | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index cb2f6875f38..6921007c7aa 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -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) diff --git a/tests/system/suite_editors/tst_clean_whitespaces/test.py b/tests/system/suite_editors/tst_clean_whitespaces/test.py index 7803027f869..1f5eb7a255e 100644 --- a/tests/system/suite_editors/tst_clean_whitespaces/test.py +++ b/tests/system/suite_editors/tst_clean_whitespaces/test.py @@ -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) diff --git a/tests/system/suite_editors/tst_generic_highlighter/test.py b/tests/system/suite_editors/tst_generic_highlighter/test.py index ea6c7aee406..13dda9badac 100644 --- a/tests/system/suite_editors/tst_generic_highlighter/test.py +++ b/tests/system/suite_editors/tst_generic_highlighter/test.py @@ -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...")