The "Assert UI element's image matches" command checks if the difference between the stored image of a UI element, which can be stored by the Store image of UI element command, and the image of a selected UI element falls within the predetermined threshold.
Reference: Command list
This article introduces examples of how to use this command.
Usage examples
Since this command can compare against an image saved within the same test case, it can be used for purposes such as the following:
-
Verifying product thumbnails on an e-commerce site
Save the thumbnail image of a specific product on the product list page → add it to the cart → verify that the thumbnail displayed on the cart screen matches the image saved from the list page.
-
Verifying the display of a profile icon
Save the user icon displayed after login → navigate to the settings screen → verify that the icon in the profile section of the settings screen matches the one saved from the header.
-
Verifying a toggle switch change
Save the image of a toggle switch → turn the toggle switch ON → use the "Assert UI element's image does not match" command to verify that the toggle switch's state has changed.
For another use case, the following help page introduces an example of using this command to test video play and stop functions.
How can I test video playback and pause functionality?
Comparison with other similar commands
Assert there is no visual diff command
With this command, you can exclude parts of the screen from the image comparison by configuring an "exclusion area".
The differences from the "Assert UI element's image matches" command are as follows:
- The expected image is the one set during previous test runs.
- Differences in the on-screen position of elements are also detected as visual differences.
Reference: Visual diff checks
Assert with AI command
This command uses generative AI to verify that the displayed image is as expected.
It can be used for checks that require understanding the meaning of data, such as "consistency between search conditions and results".
Reference: AI assertion
Assert UI element's attribute satisfies condition command
This command verifies that a UI element's attribute and its value satisfy a specified condition.
It can be used when the aspect you want to check on the target element appears as an attribute in the UI tree.
For example, the following help page introduces an example of checking colors using the color attribute.
Reference: Command list