Handle retries for auto-captured snapshots
Group retry interactions under consistent snapshot names to maintain reliable visual comparisons across builds.
In automated testing, certain scenarios may require retrying an action such as clicking a button or sending input when the initial attempt fails. For example, a popup might block a target element, and additional steps may be needed to bring the page into a state where the interaction succeeds.
To handle such flows, the Percy introduces a retry boundary feature that helps you group retries as a single logical interaction in your tests.
-
This feature is currently in Beta and can be enabled using a feature flag. Contact us to enable it for your account.
-
Available on Percy with Automate.
-
Supports up to 5 retry attempts per block.
Use Retry blocks to group retries
Percy provides two methods to define the start and end of your retry logic:
PercyUtils.setSeleniumActionRetry();
PercyUtils.unsetSeleniumActionRetry();
Wrap your retry flow within these methods. Percy treats all intermediate actions inside this block as part of a single intent and maintains screenshot consistency across builds.
Example
When your test includes conditional steps or retries based on UI behavior, wrapping those steps in a retry block helps Percy group related screenshots logically. This prevents inconsistencies in visual comparisons across builds and ensures reliable results even when the test flow varies slightly.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!