Commit 74d959bf authored by Sanad Liaquat's avatar Sanad Liaquat

Move qa selector to dropdown_class

Also stablize choose_access_level_role method by ensuring it gives
the same output on retry.
parent 72002e21
...@@ -15,7 +15,10 @@ module DropdownsHelper ...@@ -15,7 +15,10 @@ module DropdownsHelper
dropdown_output = dropdown_toggle_link(toggle_text, data_attr, options) dropdown_output = dropdown_toggle_link(toggle_text, data_attr, options)
end end
dropdown_output << content_tag(:div, class: "dropdown-menu dropdown-select #{options[:dropdown_class] if options.key?(:dropdown_class)}") do content_tag_options = { class: "dropdown-menu dropdown-select #{options[:dropdown_class] if options.key?(:dropdown_class)}" }
content_tag_options[:data] = { qa_selector: "#{options[:dropdown_qa_selector]}" } if options[:dropdown_qa_selector]
dropdown_output << content_tag(:div, content_tag_options) do
output = [] output = []
if options.key?(:title) if options.key?(:title)
......
- content_for :create_access_levels do - content_for :create_access_levels do
.create_access_levels-container{ data: { qa_selector: 'access_levels_content' } } .create_access_levels-container
= dropdown_tag('Select', = dropdown_tag('Select',
options: { toggle_class: 'js-allowed-to-create wide', options: { toggle_class: 'js-allowed-to-create wide',
dropdown_class: 'dropdown-menu-selectable capitalize-header', dropdown_class: 'dropdown-menu-selectable capitalize-header',
dropdown_qa_selector: 'access_levels_content',
data: { field_name: 'protected_tag[create_access_levels_attributes][0][access_level]', input_id: 'create_access_levels_attributes', qa_selector: 'access_levels_dropdown' }}) data: { field_name: 'protected_tag[create_access_levels_attributes][0][access_level]', input_id: 'create_access_levels_attributes', qa_selector: 'access_levels_dropdown' }})
= render 'projects/protected_tags/shared/create_protected_tag' = render 'projects/protected_tags/shared/create_protected_tag'
- content_for :create_access_levels do - content_for :create_access_levels do
.create_access_levels-container{ data: { qa_selector: 'access_levels_content' } } .create_access_levels-container
= dropdown_tag('Select', = dropdown_tag('Select',
options: { toggle_class: 'js-allowed-to-create js-multiselect wide', options: { toggle_class: 'js-allowed-to-create js-multiselect wide',
dropdown_class: 'dropdown-menu-user dropdown-menu-selectable capitalize-header', filter: true, dropdown_class: 'dropdown-menu-user dropdown-menu-selectable capitalize-header', filter: true,
dropdown_qa_selector: 'access_levels_content',
data: { input_id: 'create_access_levels_attributes', default_label: 'Select', qa_selector: 'access_levels_dropdown' } }) data: { input_id: 'create_access_levels_attributes', default_label: 'Select', qa_selector: 'access_levels_dropdown' } })
.form-text.text-muted .form-text.text-muted
Only groups that Only groups that
......
...@@ -26,6 +26,8 @@ module QA ...@@ -26,6 +26,8 @@ module QA
end end
def choose_access_level_role(role) def choose_access_level_role(role)
return if find_element(:access_levels_dropdown).text == role
click_element :access_levels_dropdown click_element :access_levels_dropdown
within_element(:access_levels_content) do within_element(:access_levels_content) do
click_on role click_on role
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment