summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2018-09-28 23:10:49 +0000
committerMark Lapierre <mlapierre@gitlab.com>2018-10-01 16:57:10 -0400
commit3317c4ba07b2b2252e75c53152b42a7b3c90b2c6 (patch)
tree4c383d5f3db4e14a386553d88a0f37db179772be /qa
parent8589fa871ee5dd94f821e1f5cbbcee269b46acf9 (diff)
downloadgitlab-ce-3317c4ba07b2b2252e75c53152b42a7b3c90b2c6.tar.gz
Don't check for the groups list before filtering
Filter immediately because the page is going to reload anyway. And don't check for the loading indicator because it the groups list tree container appears after it disappears.
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/component/groups_filter.rb38
1 files changed, 6 insertions, 32 deletions
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)