SquishTests: Wait until exactly one proposal is being shown

...so we don't accidentally use a wrong one.

Change-Id: I4c08e11aab34b8649f40ba14385492b17e656385
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Robert Löhning
2024-05-02 23:42:28 +02:00
parent 95ef7c8ff0
commit 945f0462f8

View File

@@ -77,9 +77,12 @@ def main():
snooze(1) snooze(1)
if test.verify(waitFor(proposalExists, 4000), if test.verify(waitFor(proposalExists, 4000),
"Verify that GenericProposalWidget is being shown."): "Verify that GenericProposalWidget is being shown."):
singleProposal = lambda: (object.exists(':popupFrame_Proposal_QListView')
and findObject(':popupFrame_Proposal_QListView').model().rowCount() == 1)
waitFor(singleProposal, 4000)
type(proposalListView, "<Return>") type(proposalListView, "<Return>")
lineCorrect = lambda: str(lineUnderCursor(editor)).strip() == "ui->%s" % buttonName lineCorrect = lambda: str(lineUnderCursor(editor)).strip() == "ui->%s" % buttonName
test.verify(waitFor(lineCorrect, 1000), test.verify(waitFor(lineCorrect, 4000),
('Comparing line "%s" to expected "%s"' ('Comparing line "%s" to expected "%s"'
% (lineUnderCursor(editor), "ui->%s" % buttonName))) % (lineUnderCursor(editor), "ui->%s" % buttonName)))
type(editor, "<Shift+Delete>") # Delete line type(editor, "<Shift+Delete>") # Delete line