Commit 38b95a4f authored by Mark Lapierre's avatar Mark Lapierre

Update selectors for QA::Page::Group::Show

parent 6c3c76af
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
- new_project_label = _("New project") - new_project_label = _("New project")
- new_subgroup_label = _("New subgroup") - new_subgroup_label = _("New subgroup")
- if can_create_subgroups - if can_create_subgroups
.btn-group.new-project-subgroup.droplab-dropdown.js-new-project-subgroup{ data: { project_path: new_project_path(namespace_id: @group.id), subgroup_path: new_group_path(parent_id: @group.id) } } .btn-group.new-project-subgroup.droplab-dropdown.js-new-project-subgroup.qa-new-project-or-subgroup-dropdown{ data: { project_path: new_project_path(namespace_id: @group.id), subgroup_path: new_group_path(parent_id: @group.id) } }
%input.btn.btn-success.dropdown-primary.js-new-group-child{ type: "button", value: new_project_label, data: { action: "new-project" } } %input.btn.btn-success.dropdown-primary.js-new-group-child.qa-new-in-group-button{ type: "button", value: new_project_label, data: { action: "new-project" } }
%button.btn.btn-success.dropdown-toggle.js-dropdown-toggle{ type: "button", data: { "dropdown-trigger" => "#new-project-or-subgroup-dropdown", 'display' => 'static' } } %button.btn.btn-success.dropdown-toggle.js-dropdown-toggle.qa-new-project-or-subgroup-dropdown-toggle{ type: "button", data: { "dropdown-trigger" => "#new-project-or-subgroup-dropdown", 'display' => 'static' } }
= icon("caret-down", class: "dropdown-btn-icon") = icon("caret-down", class: "dropdown-btn-icon")
%ul#new-project-or-subgroup-dropdown.dropdown-menu.dropdown-menu-right{ data: { dropdown: true } } %ul#new-project-or-subgroup-dropdown.dropdown-menu.dropdown-menu-right{ data: { dropdown: true } }
%li.droplab-item-selected{ role: "button", data: { value: "new-project", text: new_project_label } } %li.droplab-item-selected.qa-new-project-option{ role: "button", data: { value: "new-project", text: new_project_label } }
.menu-item .menu-item
.icon-container .icon-container
= icon("check", class: "list-item-checkmark") = icon("check", class: "list-item-checkmark")
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
%strong= new_project_label %strong= new_project_label
%span= s_("GroupsTree|Create a project in this group.") %span= s_("GroupsTree|Create a project in this group.")
%li.divider.droplap-item-ignore %li.divider.droplap-item-ignore
%li{ role: "button", data: { value: "new-subgroup", text: new_subgroup_label } } %li.qa-new-subgroup-option{ role: "button", data: { value: "new-subgroup", text: new_subgroup_label } }
.menu-item .menu-item
.icon-container .icon-container
= icon("check", class: "list-item-checkmark") = icon("check", class: "list-item-checkmark")
......
...@@ -5,14 +5,11 @@ module QA ...@@ -5,14 +5,11 @@ module QA
include Page::Component::GroupsFilter include Page::Component::GroupsFilter
view 'app/views/groups/show.html.haml' do view 'app/views/groups/show.html.haml' do
element :new_project_or_subgroup_dropdown, '.new-project-subgroup' element :new_project_or_subgroup_dropdown
element :new_project_or_subgroup_dropdown_toggle, '.dropdown-toggle' element :new_project_or_subgroup_dropdown_toggle
element :new_project_option, /%li.*data:.*value: "new-project"/ element :new_project_option
element :new_project_button, /%input.*data:.*action: "new-project"/ element :new_subgroup_option
element :new_subgroup_option, /%li.*data:.*value: "new-subgroup"/ element :new_in_group_button
# data-value and data-action get modified by JS for subgroup
element :new_subgroup_button, /%input.*\.js-new-group-child/
end end
view 'app/assets/javascripts/groups/constants.js' do view 'app/assets/javascripts/groups/constants.js' do
...@@ -24,7 +21,7 @@ module QA ...@@ -24,7 +21,7 @@ module QA
end end
def has_new_project_or_subgroup_dropdown? def has_new_project_or_subgroup_dropdown?
page.has_css?(element_selector_css(:new_project_or_subgroup_dropdown)) has_element?(:new_project_or_subgroup_dropdown)
end end
def has_subgroup?(name) def has_subgroup?(name)
...@@ -36,31 +33,29 @@ module QA ...@@ -36,31 +33,29 @@ module QA
end end
def go_to_new_subgroup def go_to_new_subgroup
click_new('subgroup') select_kind :new_subgroup_option
find("input[data-action='new-subgroup']").click click_element :new_in_group_button
end end
def go_to_new_project def go_to_new_project
click_new('project') select_kind :new_project_option
find("input[data-action='new-project']").click click_element :new_in_group_button
end end
private private
def click_new(kind) def select_kind(kind)
within '.new-project-subgroup' do within_element(:new_project_or_subgroup_dropdown) do
css = "li[data-value='new-#{kind}']"
# May need to click again because it is possible to click the button quicker than the JS is bound # May need to click again because it is possible to click the button quicker than the JS is bound
wait(reload: false) do wait(reload: false) do
find('.dropdown-toggle').click click_element :new_project_or_subgroup_dropdown_toggle
page.has_css?(css) has_element?(kind)
end end
find(css).click click_element kind
end end
end end
end end
......
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