Automatic Waiting
msg.ZenTestAI automatically waits after each step for the page to be fully idle. This is required for a stable test execution. In case e.g. a step would be executed, while scripts are still running in the background, the test execution might cause different results per execution.
The automatic waiting of msg.ZenTestAI will stop waiting if the page is idle. Idle is defined by:
- No active Network requests
- No active scrolling
- No active animations
- No active setTimeouts with timeouts less than 20ms (this is especially useful to detect smaller scripting timeouts triggering additional network requests)
- No active loading indicator
In case the page is not idle after 30 seconds, the test execution will be stopped and the step will be marked as failed.
After a step is executed it is expected that the page stays idle for at least 15ms before continuing with the next step. This is to ensure that the page is fully loaded and all scripts are executed. After a page is loaded initially or a navigation event occurs it is expected that the page stays idle for at least 250ms before continuing with the next step. This is to ensure that all scripts are executed and the page is fully loaded.
Normally a well-developed application should avoid waiting times at application startup without any further network requests. This means that you should see a constant flow of page activity until the page is fully loaded and ready to be tested. Some pages though need a lot of background activity without network requests or loading indicators. In such a scenario you should increase the mentioned timeouts in the application settings (additional functions). In case your page has a loading indicator (i.E. a loading spinner or similar), you can additionally define an xpath to the loading spinner. In case the loading spinner is visible on the page the automatic waiting will continue.
Timeout Overwrite
You can overwrite the timeout using the following options:
- Explicitly prompt the AI agent to wait for a specific amount of time. This can be done by using the
Waitaction. - Add wait times to a test case step in the details area of a test case. This can be done by clicking on the step and adding a wait time in the details area.
- Overwrite the maximum timeout of 30 seconds in the application settings in the automatic waiting area in the general section. This section allows you to overwrite both the maximum timeout of 30 seconds, and the minimum idle timeout after actions and after page load.
- Using scripting: You can inject your own custom JavaScript code to wait for specific elements or conditions. This can be done in the scripting area of the application.