Wait steps in Test Studio allow you to design your automation tests in a stable and reliable manner. With the wait steps you can ensure that each next action won't get executed before the element doesn't exist or is not yet visible.
Find out more about waits steps and how to record these in the below article.
The Test Studio wait steps are using the implementation for verification steps. But instead of passing or failing based on a comparison, the wait step waits until the comparison is true. It fails when the step wait timeout is over and the comparison is still not fulfilled.
The engine for creating the verification sentences allows you to convert any Verification step to Wait or Extracttion step (converting to extraction step is available for text based verifications). Use the Change Role option from the step context menu and choose from the options in the sub-menu.
The Highlighting menu gives quick access to a set of predefined waits, which can be added with a single click while recording. You can follow the below steps to insert a wait step in your test.
1. Create a test and start a recording session. Navigate to the tested application - in this example we use a web test and the Test Studio official page.
2. Enable the highlighting once the recorder is attached to the browser. Hold the mouse over the Download Free Trial button and add a wait step for the element to be visible. Then record the click on the button.
3. Some of the step properties are specific for the wait step and allow you change the interval of checking the expected state and the overall timeout to wait for.
The automated test execution is much faster than a real user and often you find out it is suitable to add an additional wait in the already recorded test to ensure its stability. For such cases Test Studio provides the options for partial test execution, which allow you to get to a certain point of the test and record the additional wait steps.
For the cases when the project and scenarios are quite complex, you can add waits for an already recorded element and without starting a recording session. The below list guide you through the steps for this:
1. Open a test in which you need to add a step. Choose an element from the Elements Explorer. Note: Usually, the wait step to insert is related to an action step and its element. Thus, if you click on that action step, its target element gets highlighted in the Elements Explorer with a red arrow. Select the element and proceed to the Step Builder.
2. Click the Step Builder pane to activate it. Under the Actions and Verification sections, you can see the options corresponding to the type of selected element.
3. Choose the wait type you need and click the Add Step button to insert the step in the test.
Check this short video demonstrating how to add a step for an existing element in Test Studio.