Smart Reusable Rules | Bondar Academy
Course: AI-based testing with testRigor
Module: Reusability and Optimization
Instructor: Artem Bondar
Lesson Summary
In this lesson, we enhance our reusable rules for navigating a test application to make them smarter and more adaptable to different UI conditions. Key Concepts Previously created rules were too straightforward, leading to failures when the UI state changed. For instance, navigating to the Form layouts page failed because the menu collapsed, preventing access to the Date picker option. Improving Navigation Logic To address this issue, we need to implement logic that checks whether the menu is expanded or collapsed . The steps include: Inspect the menu icon to determine its state (e.g., Chevron down for expanded, Chevron left for collapsed). Create a condition in the reusable rule: If page contains "Chevron left" to the right of "Forms" then click on "Forms" and then the menu item; else click the menu item directly. Update the logic for both Form layouts and Date picker pages. Handling DOM Structure We also addressed a DOM structure issue where the icon was not correctly identified as being to the right of the Forms menu item. The solution involved specifying the second instance of Forms in the logic. Final Testing After implementing these changes, we successfully reran the tests, confirming that navigation across various pages now functions correctly. The reusable rules are now capable of handling UI logic effectively. In summary, enhancing reusable rules with conditional logic allows for more robust navigation in applications with complex UI states.