Recently I started transitioning Compliance tests to use widgetastic PF5 library to be ready for switch. After running some tests I found out that they fail on a wrong locator that I didn't specify. WP5 library also didn't have it specified so I started looking into other plugins and found this piece on iqe-content-source-plugin:
OuiaDropdown.BUTTON_LOCATOR = (
"//button[@data-ouia-component-id='add-selected-dropdown-toggle-no-snap']"
)
In this case content sources plugin import library and overrides Button locator for all plugins, not only for itself.
I understand that you may need to use your own locators that make your life easier but it should be implemented a different way:
You can create your own class of Dropdown, inherit logic from WP5 library and overwrite your own class with some variables like:
fd
from widgetastic_patternfly5 import Dropdown class myOwnDropdown(Dropdown): BUTTON_LOCATOR = ".//my_locator_that_overrides_default_one" def do_something(): # additional method to do something return
so In this case noone is going to be affected because you are going to use your own object.
But better suggestion - you don't need to specify OUIA locators for each sub-component of dropdown (ideally it should work as library tries to take care of it). You just need to have 1 proper locator to instantiate widget. For example:
from widgetastic_patternfly5 import DropdownOUIA class my_view(View): dropdown = DropdownOUIA("my dropdown OUIA ID")
and then when it's going to be invoked, it will take care of buttons and other things inside. In case it doesn't work because your page has something different - override it as I mentioned above or raise it in consoledot qe slack channel + Jira for IQE dashboard so we can take a look.
Currently this is a blocker for Compliance and could be blocker for anyone who has your plugin in dependency