Uploaded image for project: 'Insights Experiences'
  1. Insights Experiences
  2. HMS-3639

[QE] Wrong widgetastic PF 5 usage that fail other plugin tests

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • hms-1.7
    • None
    • Content, QE
    • None
    • None

      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']"
          )
       

      https://gitlab.cee.redhat.com/insights-qe/iqe-content-sources-plugin/-/blob/master/iqe_content_sources/views/repository.py?ref_type=heads#L79-L81 

      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

       

              swadeley@redhat.com Stephen Wadeley
              eshamard Egor Shamardin
              Michael Shriver Michael Shriver
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: