Poll URL - operation¶
- on all platforms
This operation triggers an event on an external system or talk to an external API.
To perform this operation in the Suitest Test editor use the Poll URL line:
await suitest.pollUrl('https://example.com/api/installApp', 'STARTED'); await suitest.pollUrl('https://example.com/api/waitForFinish', 'DONE');
Poll URL will send requests to the specified URL every 500 ms awaiting the specified response. In this way Suitest and the remote API can exchange messages and the remote API can trigger the appropriate events.
With every request the following additional headers will be sent:
- suitest-app - application id
- suitest-config - configuration id
- suitest-device - device id
Poll URL is completely independent from the instrumentation library and thus can be used even without initializing the application first. The polling time is capped to 30 seconds. The first 4 KB of response data will be processed.
Sometimes a certain state of the application depends on an external factor which you can not control from within the application. To test usage paths affected by that factor Suitest provides a unified interface called Poll URLs.
Consider the following examples:
User posts a message that awaits an approval from the site administrator or an automated anti-spam system processing messages asynchronously. To recreate this situation in a test scenario you need to be able to trigger the message processing from within the scenario. Furthermore you need to have control over the result of that processing in order to build resilient test cases that depend on the processing result.
A TV application accepts certain commands from a second-screen application running on a mobile phone, for example in response to a video URL it opens the playback page. To recreate this scenario including the part of the mobile phone interaction you need to be able to trigger the post event.