Visual Test Automation with Python and Applitools: Using Ignore Regions

Introduction

Visual test automation is essential to ensure that the user interfaces (UIs) of web applications are correct and visually consistent. By using Applitools, we can perform automated visual comparisons, identifying subtle differences that mi…


This content originally appeared on DEV Community and was authored by Jeissy GuimarĂŁes

Introduction

Visual test automation is essential to ensure that the user interfaces (UIs) of web applications are correct and visually consistent. By using Applitools, we can perform automated visual comparisons, identifying subtle differences that might be missed in manual tests. A useful feature of Applitools is the ability to define "Ignore Regions" - areas of the page that are ignored during visual comparison, such as dynamic elements that change frequently (e.g., banners, ads, etc.).

In this article, we will explore how to configure and use "Ignore Regions" in automated visual tests with Python and Applitools.

Advantages of Applitools for Layout and Visual Testing

🔍 Visual Difference Detection: Applitools uses AI to detect visual differences that might not be captured by traditional code checks. This is crucial to ensure that the user interface is correct and free from visual regressions.

🔧 Ease of Integration: It can be easily integrated with various test automation tools like Selenium, Cypress, among others. This allows you to add visual checks to your existing test flows without major rewrites.

đź›  Simplified Test Maintenance: With Applitools' "Baseline" approach, it is easy to update and maintain visual tests. When a UI change is intentional, you can update the baseline with a click.

đźš« Ignore Regions: Allows you to specify areas of the page to be ignored during visual comparison. This is useful for dynamic areas that change frequently and are not relevant to the visual test.

Code Implementation EyesLibrary Class The EyesLibrary class manages the integration with Applitools. Let's focus specifically on the function that defines the regions to be ignored during visual tests.

Image description

Advantages of the check_window_with_ignore Function

The check_window_with_ignore function is crucial for the robustness of visual tests, allowing specific areas of the page to be ignored. This is particularly useful in scenarios where dynamic elements, such as ads or notifications, can introduce visual variations that are not relevant to the test.

Example of Use

In the login test, we use this functionality to ignore specific elements of the page that might vary between test runs.

Image description

Image description

Conclusion
By using Applitools with Python, we can efficiently perform automated visual tests. The "Ignore Regions" functionality is especially useful for dynamic areas of the page, ensuring that our visual tests are precise and relevant. With this configuration, you can easily integrate these tests into your CI/CD pipeline, ensuring the continuous visual quality of your application.

For more information, check out the documentation for Applitools

The complete code can be found on GitHub.


This content originally appeared on DEV Community and was authored by Jeissy GuimarĂŁes


Print Share Comment Cite Upload Translate Updates
APA

Jeissy GuimarĂŁes | Sciencx (2024-07-16T14:34:38+00:00) Visual Test Automation with Python and Applitools: Using Ignore Regions. Retrieved from https://www.scien.cx/2024/07/16/visual-test-automation-with-python-and-applitools-using-ignore-regions/

MLA
" » Visual Test Automation with Python and Applitools: Using Ignore Regions." Jeissy GuimarĂŁes | Sciencx - Tuesday July 16, 2024, https://www.scien.cx/2024/07/16/visual-test-automation-with-python-and-applitools-using-ignore-regions/
HARVARD
Jeissy GuimarĂŁes | Sciencx Tuesday July 16, 2024 » Visual Test Automation with Python and Applitools: Using Ignore Regions., viewed ,<https://www.scien.cx/2024/07/16/visual-test-automation-with-python-and-applitools-using-ignore-regions/>
VANCOUVER
Jeissy GuimarĂŁes | Sciencx - » Visual Test Automation with Python and Applitools: Using Ignore Regions. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/16/visual-test-automation-with-python-and-applitools-using-ignore-regions/
CHICAGO
" » Visual Test Automation with Python and Applitools: Using Ignore Regions." Jeissy GuimarĂŁes | Sciencx - Accessed . https://www.scien.cx/2024/07/16/visual-test-automation-with-python-and-applitools-using-ignore-regions/
IEEE
" » Visual Test Automation with Python and Applitools: Using Ignore Regions." Jeissy GuimarĂŁes | Sciencx [Online]. Available: https://www.scien.cx/2024/07/16/visual-test-automation-with-python-and-applitools-using-ignore-regions/. [Accessed: ]
rf:citation
» Visual Test Automation with Python and Applitools: Using Ignore Regions | Jeissy GuimarĂŁes | Sciencx | https://www.scien.cx/2024/07/16/visual-test-automation-with-python-and-applitools-using-ignore-regions/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.