public interface AutoTestLocator
Regardless of which automated testing tools you are using, you should be using AutoTestLocators to locate interactive DOM elements in your tests.
When running an automated test, you can obtain a specific DOM element using an AutoTestLocator via AutoTest.getElement()
. When designing tests, a locator for any element
can be obtained using AutoTest.getLocator(element)
or via visual
tools such as the "Show AutoTest Locators" link on the initial tab (titled "Results") of the Smart GWT Developer Console
.
The use of AutoTestLocators is required because the DOM structure generated by Smart GWT components may differ by browser, browser version, Smart GWT version, skin, and settings (such as auto-sizing). Different DOM structures are required to work around browser bugs, for performance reasons, or in order to render a different visual appearance for a functionality-equivalent component.
The DOM structure generated by Smart GWT is considered an internal detail, so, if you build tests that rely on any particular DOM structure instead of using AutoTestLocators, those tests will likely not work across browsers, and may also be broken by switching skins, changing settings, or even broken even by minor Smart GWT bug fixes within the same Smart GWT version.