Once/Within logic


Cycle has the ability to wait for a Step to complete before executing the next Step. Take a look at the following example:

Given I press enter
And I wait 10 seconds
Then I execute scenario "Next Scenario"

The above example contains the Step And I wait 10 seconds with the intention that in 10 seconds, any work being executed as part of the I press enter Step would be finished. Although this approach may work, utilizing the Once keyword can ensure more consistent results.

Given I press enter
Once I see "Image:my_image.png"
Then I execute scenario "Next Scenario"

In the above example, the Then I execute scenario "Next Scenario" Step will not execute until the prior Step has been completed successfully.

Note: You can set a wait time for the Once keyword in Cycle Settings. The default wait time is 120 seconds. If the Step Once I see "Image:my_image.png" does not pass within 120 seconds, it will automatically fail.


In some cases, you may not want certain Steps to wait for the default time saved in Cycle Settings. Many Steps have a version that includes a within <NUMBER> seconds parameter. This parameter serves the same functionality as the Once keyword, but enables you to configure a wait time as part of a given Step.

results matching ""

    No results matching ""