From 394e9a9fb39c7699e85a28b6e6447b19d43cf325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Tue, 23 Apr 2024 13:01:07 +0200 Subject: [PATCH] SquishTests: Don't proceed in hopeless situation When the GenericProposalWidget is not being shown, there's no point in trying to use it. Change-Id: Ibe6f3ed9230fdc41271f5ff8538bd863da3d0ab3 Reviewed-by: Christian Stenger Reviewed-by: --- .../suite_tools/tst_designer_autocomplete/test.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/system/suite_tools/tst_designer_autocomplete/test.py b/tests/system/suite_tools/tst_designer_autocomplete/test.py index b378407f812..c77d4b5f180 100644 --- a/tests/system/suite_tools/tst_designer_autocomplete/test.py +++ b/tests/system/suite_tools/tst_designer_autocomplete/test.py @@ -48,12 +48,15 @@ def main(): snooze(1) type(editor, ">") snooze(1) + proposalExists = lambda: object.exists(':popupFrame_TextEditor::GenericProposalWidget') nativeType("%s" % buttonName[0]) - test.verify(waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500), - "Verify that GenericProposalWidget is being shown.") - nativeType("") - test.verify(waitFor('str(lineUnderCursor(editor)).strip() == "ui->%s" % buttonName', 1000), - 'Comparing line "%s" to expected "%s"' % (lineUnderCursor(editor), "ui->%s" % buttonName)) + if test.verify(waitFor(proposalExists, 4000), + "Verify that GenericProposalWidget is being shown."): + nativeType("") + lineCorrect = lambda: str(lineUnderCursor(editor)).strip() == "ui->%s" % buttonName + test.verify(waitFor(lineCorrect, 1000), + ('Comparing line "%s" to expected "%s"' + % (lineUnderCursor(editor), "ui->%s" % buttonName))) type(editor, "") # Delete line selectFromLocator("mainwindow.ui") saveAndExit()