Try   HackMD

Auto-Wait Mechanisms

Rapi has a powerful and efficient Auto-Wait technology. While replaying recorded test cases, Rapi will dynamically judge waiting time including page change and do an efficient waiting before executing the next command. Using Rapi, playback will look like a real person is helping you do the operations.

Auto-Wait Timeout Adjustment

The default autowait timeout is 10 seconds, but the value is allowed to change. To adjust the amount of autowait timeout for playback, you can do it on the Rapi setting panel or change the value on your Rapi Runner config file. Set this value higher if you see the commands running faster than the website. Set this value lower if your playback is too slow.

pause

In some conditions, user may want to delay a period of time between the two commands for a more flexible testing. Using the pause command will let the playback sleep for some amount of time, then continue to do the next command.

setSpeed

Rapi provides 5 playback speeds. Using the setSpeed command will adjust the playback speed. 5 is the fast speed and means no delay time before executing the next command. Each downgrade adjustment of playback will slow down the playback speed by a default value time.

verify/assertPresence

verifyPresence and assertPresence commands are used to verify or assert if the target element is present in the DOM tree right now even if it's invisible. For example, check if the download button is present on the navigation bar right now.

waitForElementPresent

Unlike verifyPresence or assertPresence, use waitForElementPresent, if the target element is not present in the DOM tree, this command will wait for the target element to be present until the waiting time runs out. If the timeout is expired but the target element is still not present, the validation result will fail. For example, wait for the subscribe button to show up within 5000ms after browsing to some website.

waitForElementNotPresent

Sometimes, check if the target element turns to be not present (removed from the DOM tree) within the specified time is the thing we'd like to do. In order to do so, use waitForElementNotPresent by passing a maximum waiting time. For example, wait for the ad to be removed within 5000ms after clicking the exit button.

verify/assertVisibility

verifyVisibility and assertVisibility commands are used to verify or assert if the target element is visible right now. If the element is fully transparent, hidden, or parts of it are covered by other elements, the element is defined as invisible. For example, check if the FAQ link button is clearly visible right now.

waitForElementVisible

Unlike verifyVisibility or assertVisibility, use waitForElementVisible, if the target element is not visible, this command will wait for the target element to be visible until the waiting time runs out. If the timeout is expired but the target element is still invisible, the validation result will fail. For example, wait for the element's CSS attribute to go from "display:none" to "display:block" within 5000ms after clicking on some button.

waitForElementNotVisible

In some test cases, if the element is still visible after a certain period of time, it means there may exist some bugs. In other words, the target elment is supposed to be not visible and you can use waitForElementNotVisible by passing a maximum waiting time to do so. For example, wait for the element's CSS attribute to go from "display:block" to "display:none" within 5000ms after clicking on some button.

When will the command wait until timeout

Here are the charts showing in which cases the commands, verifyPresence, assertPresence, waitForElementPresent, waitForElementNotPresent, verifyVisibility, assertVisibility, waitForElementVisible, or waitForElementNotVisible will continue to wait until a timeout is expired.

case → Element is present Element is not present
verify/assertPresence execution success execution failure
waitForElementPresent execution success will wait
waitForElementNotPresent will wait execution success
  • When using verify/assertPresence, the execution will check if the element is present in the DOM tree at the moment, and will not wait disregarding the validation result
  • When using waitForElementPresent, the execution will wait until timeout if the element is not present in the DOM tree
  • When using waitForElementNotPresent, the execution will wait until timeout if the element is still present in the DOM, since the command should wait for the element to become not present
case → Element is visible Element is invisible
verify/assertVisibility execution success execution failure
waitForElementVisible execution success will wait
waitForElementNotVisible will wait execution success
  • When using verify/assertVisibility, the execution will check if the element is visible at the moment, and will not wait disregarding the validation result.
  • When using waitForElementVisible, the execution will wait until timeout if the element is invisible
  • When using waitForElementNotVisible, the execution will wait until timeout if the element is still visible