diff --git a/app/views/dashboard/groups/_groups.html.haml b/app/views/dashboard/groups/_groups.html.haml index 94d53b78c0f..db856ef7d7b 100644 --- a/app/views/dashboard/groups/_groups.html.haml +++ b/app/views/dashboard/groups/_groups.html.haml @@ -1,4 +1,4 @@ .js-groups-list-holder #js-groups-tree{ data: { hide_projects: 'true', endpoint: dashboard_groups_path(format: :json), path: dashboard_groups_path, form_sel: 'form#group-filter-form', filter_sel: '.js-groups-list-filter', holder_sel: '.js-groups-list-holder', dropdown_sel: '.js-group-filter-dropdown-wrap' } } .loading-container.text-center - = icon('spinner spin 2x', class: 'loading-animation prepend-top-20 qa-loading-animation') + = icon('spinner spin 2x', class: 'loading-animation prepend-top-20') diff --git a/app/views/shared/groups/_empty_state.html.haml b/app/views/shared/groups/_empty_state.html.haml index c35f6f5a3c1..f6b3a49eacb 100644 --- a/app/views/shared/groups/_empty_state.html.haml +++ b/app/views/shared/groups/_empty_state.html.haml @@ -1,4 +1,4 @@ -.group-empty-state.row.align-items-center.justify-content-center.qa-groups-empty-state +.group-empty-state.row.align-items-center.justify-content-center .icon.text-center.order-md-2 = custom_icon("icon_empty_groups") diff --git a/qa/qa/page/component/groups_filter.rb b/qa/qa/page/component/groups_filter.rb index 4c1c3953db6..cc50bb439b4 100644 --- a/qa/qa/page/component/groups_filter.rb +++ b/qa/qa/page/component/groups_filter.rb @@ -9,52 +9,26 @@ module QA element :groups_filter end - base.view 'app/views/shared/groups/_empty_state.html.haml' do - element :groups_empty_state - end - base.view 'app/assets/javascripts/groups/components/groups.vue' do element :groups_list_tree_container end - - base.view 'app/views/dashboard/groups/_groups.html.haml' do - element :loading_animation - end end private - # Filter the list of groups/projects by name - # If submit is true the return key will be sent to the browser to reload - # the page and fetch only the filtered results - def filter_by_name(name, submit: false) - wait(reload: false) do - # Wait 0 for the empty state element because it is there immediately - # if there are no groups. Otherwise there's a loading indicator and - # then groups_list_tree_container appears, which might take longer - page.has_css?(element_selector_css(:groups_empty_state), wait: 0) || - page.has_css?(element_selector_css(:groups_list_tree_container)) - end - - field = find_element :groups_filter - field.set(name) - field.send_keys(:return) if submit - end - def has_filtered_group?(name) # Filter and submit to reload the page and only retrieve the filtered results - filter_by_name(name, submit: true) + find_element(:groups_filter).set(name).send_keys(:return) - # Since we submitted after filtering the absence of the loading - # animation and the presence of groups_list_tree_container means we - # have the complete filtered list of groups + # Since we submitted after filtering, the presence of + # groups_list_tree_container means we have the complete filtered list + # of groups wait(reload: false) do - page.has_no_css?(element_selector_css(:loading_animation)) && - page.has_css?(element_selector_css(:groups_list_tree_container)) + page.has_css?(element_selector_css(:groups_list_tree_container)) end # If there are no groups we'll know immediately because we filtered the list - return if page.has_text?(/No groups or projects matched your search/, wait: 0) + return false if page.has_text?('No groups or projects matched your search', wait: 0) # The name will be present as filter input so we check for a link, not text page.has_link?(name, wait: 0)