QA: Improve element selection based on dynamic properties
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
The following discussion from gitlab-ee!14746 should be addressed:
-
@zeffmorgan, @tnikic started a discussion: (+6 comments) Won't there be duplicates?
-
Fix existing test that has duplicate data-qa-selector -
Devise implementation of some sort of data-qa-indexor the like
Problem Statement
When elements within a loop are rendered on the page, it would be nice to match on something more unique rather than change the selector based on value
%ul
- %w(public private protected).each do |visibility|
= checkbox_tag 'something', data: { qa_selector: 'visibility_checkbox', qa_visibility: visibility }
Instead of dynamically having qa_selector, we might allow a mechanism in the framework to select based on another data-qa-* data tag.
click_element :visibility_checkbox, visibility: 'public'
# base.rb
def find_element(element, data_props, **kwargs)
find(element_selector_css(name, data_props), kwargs)
end
Edited by 🤖 GitLab Bot 🤖