diff options
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/group/show.rb | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/qa/qa/page/group/show.rb b/qa/qa/page/group/show.rb index 6747f7f10b6..74d20df76ba 100644 --- a/qa/qa/page/group/show.rb +++ b/qa/qa/page/group/show.rb @@ -5,14 +5,11 @@ module QA include Page::Component::GroupsFilter view 'app/views/groups/show.html.haml' do - element :new_project_or_subgroup_dropdown, '.new-project-subgroup' - element :new_project_or_subgroup_dropdown_toggle, '.dropdown-toggle' - element :new_project_option, /%li.*data:.*value: "new-project"/ - element :new_project_button, /%input.*data:.*action: "new-project"/ - element :new_subgroup_option, /%li.*data:.*value: "new-subgroup"/ - - # data-value and data-action get modified by JS for subgroup - element :new_subgroup_button, /%input.*\.js-new-group-child/ + element :new_project_or_subgroup_dropdown + element :new_project_or_subgroup_dropdown_toggle + element :new_project_option + element :new_subgroup_option + element :new_in_group_button end view 'app/assets/javascripts/groups/constants.js' do @@ -24,7 +21,7 @@ module QA end 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 def has_subgroup?(name) @@ -36,31 +33,29 @@ module QA end 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 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 private - def click_new(kind) - within '.new-project-subgroup' do - css = "li[data-value='new-#{kind}']" - + def select_kind(kind) + within_element(:new_project_or_subgroup_dropdown) do # May need to click again because it is possible to click the button quicker than the JS is bound wait(reload: false) do - find('.dropdown-toggle').click + click_element :new_project_or_subgroup_dropdown_toggle - page.has_css?(css) + has_element?(kind) end - find(css).click + click_element kind end end end |