Squish/Waiting for a Progress Bar: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(Un-nominate for deletion: Page is no longer a category)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Waiting for a progress bar or progress dialog=
{{LangSwitch}}
[[Category:Squish]]


When you have a calculation or some other work item in your <span class="caps">AUT</span> that takes an arbitrary amount of time to complete, it can be hard to get your test script to be stable by just using snooze() or waitForObject() calls to wait for the work item to finish. Instead, you can use the more powerful waitFor() method, that takes any code statement, executes it until it returns True, or until the optional timeout is reached before it continues the script playback.
When you have a calculation or some other work item in your AUT that takes an arbitrary amount of time to complete, it can be hard to get your test script to be stable by just using snooze() or waitForObject() calls to wait for the work item to finish. Instead, you can use the more powerful waitFor() method, that takes any code statement, executes it until it returns True, or until the optional timeout is reached before it continues the script playback.


Assuming the work item shows a progress bar or a progress dialog while it is running, you can easily use waitFor() to make sure your script does not continue playback until the work item has completed and the progress dialog has gone away:
Assuming the work item shows a progress bar or a progress dialog while it is running, you can easily use waitFor() to make sure your script does not continue playback until the work item has completed and the progress dialog has gone away:


This will wait for the progress dialog to show up for 20 seconds, then wait for it to go away again. So even if the calculation is so quick that the progress dialog never shows up, the script will always continue, although it may take up to 20 seconds for it to do so.
<code>clickButton(waitForObject(":Dialog.Calculate_QPushButton"))
 
waitFor("object.exists(':_QProgressDialog')", 20000)
===Categories:===
waitFor("not object.exists(':_QProgressDialog')")</code>
 
* [[:Category:Tools|Tools]]
** [[:Category:Tools::Squish|Squish]]

Latest revision as of 08:41, 8 December 2018

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

When you have a calculation or some other work item in your AUT that takes an arbitrary amount of time to complete, it can be hard to get your test script to be stable by just using snooze() or waitForObject() calls to wait for the work item to finish. Instead, you can use the more powerful waitFor() method, that takes any code statement, executes it until it returns True, or until the optional timeout is reached before it continues the script playback.

Assuming the work item shows a progress bar or a progress dialog while it is running, you can easily use waitFor() to make sure your script does not continue playback until the work item has completed and the progress dialog has gone away:

clickButton(waitForObject(":Dialog.Calculate_QPushButton"))
waitFor("object.exists(':_QProgressDialog')", 20000)
waitFor("not object.exists(':_QProgressDialog')")