From cdea404957975f8ed354eb814d1abd170096feeb Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 4 Jul 2023 10:36:24 +0200 Subject: [PATCH] SquishTests: Fix welcome page test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the view is populated and sorted it gets its items one by one. If multiple matches for opening an example are possible we may end up using the wrong one which in turn makes the test error out. So, wait for an expected amount of items. Change-Id: If6f6abfa757ede33311a8e617ab7d570df1240a4 Reviewed-by: Robert Löhning --- tests/system/suite_WELP/tst_WELP03/test.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/system/suite_WELP/tst_WELP03/test.py b/tests/system/suite_WELP/tst_WELP03/test.py index 3b60d15a2e2..7c672464eb3 100644 --- a/tests/system/suite_WELP/tst_WELP03/test.py +++ b/tests/system/suite_WELP/tst_WELP03/test.py @@ -18,10 +18,18 @@ def handlePackagingMessageBoxes(): except: break -def openExample(examplesLineEdit, input, exampleRegex, exampleName): + +def openExample(examplesLineEdit, input, exampleRegex, exampleName, waitForChildCount=0): replaceEditorContent(examplesLineEdit, input) listView = waitForObject("{type='QListView' unnamed='1' visible='1' " "window=':Qt Creator_Core::Internal::MainWindow'}") + if waitForChildCount > 0: + + def childCount(view): + return len(__childrenOfType__(view, 'QModelIndex')) + + waitFor("childCount(listView) == waitForChildCount", 3000) + waitFor('findExampleOrTutorial(listView, exampleRegex) is not None', 3000) example = findExampleOrTutorial(listView, exampleRegex, True) if test.verify(example is not None, "Verifying: Example (%s) is shown." % exampleName): @@ -100,7 +108,7 @@ def main(): removePackagingDirectory(os.path.dirname(p)) examplesLineEdit = waitForObject(search %(expect[1][0], expect[1][1])) example = openExample(examplesLineEdit, "address book", "(0000 )?Address Book.*", - "Address Book Example") + "Address Book Example", 3) if example is not None: # close second example application test.verify(checkIfObjectExists("{column='0' container=':Qt Creator_Utils::NavigationTreeView'"