Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2018-09-28 21:36:49 +0300
committerMark Lapierre <mlapierre@gitlab.com>2018-09-28 21:36:49 +0300
commit8589fa871ee5dd94f821e1f5cbbcee269b46acf9 (patch)
tree4894dbebe97d3f6ffd41bc58fe49661bfd95772d /qa
parent1ed5ab50c7931cee1283b21512784a487668a27f (diff)
Optimize groups filter
When searching for a group, submit a request that returns only the filtered list of groups. This makes the state of the page more reliable because it avoids having to wait for the list of groups to dynamically refresh.
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/component/groups_filter.rb40
-rw-r--r--qa/qa/page/dashboard/groups.rb6
-rw-r--r--qa/qa/page/group/show.rb8
3 files changed, 41 insertions, 13 deletions
diff --git a/qa/qa/page/component/groups_filter.rb b/qa/qa/page/component/groups_filter.rb
index e647d368f0f..4c1c3953db6 100644
--- a/qa/qa/page/component/groups_filter.rb
+++ b/qa/qa/page/component/groups_filter.rb
@@ -6,8 +6,7 @@ module QA
module GroupsFilter
def self.included(base)
base.view 'app/views/shared/groups/_search_form.html.haml' do
- element :groups_filter, 'search_field_tag :filter'
- element :groups_filter_placeholder, 'Search by name'
+ element :groups_filter
end
base.view 'app/views/shared/groups/_empty_state.html.haml' do
@@ -17,17 +16,48 @@ module QA
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
- def filter_by_name(name)
+ # 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)
+
+ # 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
wait(reload: false) do
- page.has_css?(element_selector_css(:groups_empty_state)) ||
+ page.has_no_css?(element_selector_css(:loading_animation)) &&
page.has_css?(element_selector_css(:groups_list_tree_container))
end
- fill_in 'Search by name', with: name
+ # 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)
+
+ # The name will be present as filter input so we check for a link, not text
+ page.has_link?(name, wait: 0)
end
end
end
diff --git a/qa/qa/page/dashboard/groups.rb b/qa/qa/page/dashboard/groups.rb
index 70c5f996ff8..c6ef932e33f 100644
--- a/qa/qa/page/dashboard/groups.rb
+++ b/qa/qa/page/dashboard/groups.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module QA
module Page
module Dashboard
@@ -14,9 +16,7 @@ module QA
end
def has_group?(name)
- filter_by_name(name)
-
- page.has_link?(name)
+ has_filtered_group?(name)
end
def go_to_group(name)
diff --git a/qa/qa/page/group/show.rb b/qa/qa/page/group/show.rb
index 74d20df76ba..58a9e861971 100644
--- a/qa/qa/page/group/show.rb
+++ b/qa/qa/page/group/show.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module QA
module Page
module Group
@@ -25,11 +27,7 @@ module QA
end
def has_subgroup?(name)
- filter_by_name(name)
-
- page.has_text?(/#{name}|No groups or projects matched your search/, wait: 60)
-
- page.has_text?(name, wait: 0)
+ has_filtered_group?(name)
end
def go_to_new_subgroup