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
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-10-02 15:51:42 +0300
committerRémy Coutable <remy@rymai.me>2018-10-02 15:51:42 +0300
commita1caf4d9096f20b2fe3b3591596fbe3664c442ee (patch)
tree739e6cd9150efa9632d9ee7d2be88ddd665bce4b
parentd581b1d9e88028023663a816479a621375784aef (diff)
parent3317c4ba07b2b2252e75c53152b42a7b3c90b2c6 (diff)
Merge branch 'ml-qa-optimize-group-filter' into 'master'
QA: Optimize groups filter See merge request gitlab-org/gitlab-ce!21994
-rw-r--r--app/views/shared/groups/_empty_state.html.haml2
-rw-r--r--app/views/shared/groups/_search_form.html.haml2
-rw-r--r--qa/qa/page/component/groups_filter.rb24
-rw-r--r--qa/qa/page/dashboard/groups.rb6
-rw-r--r--qa/qa/page/group/show.rb8
5 files changed, 22 insertions, 20 deletions
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/app/views/shared/groups/_search_form.html.haml b/app/views/shared/groups/_search_form.html.haml
index 67e1cd0d67b..49b812baefc 100644
--- a/app/views/shared/groups/_search_form.html.haml
+++ b/app/views/shared/groups/_search_form.html.haml
@@ -1,2 +1,2 @@
= form_tag request.path, method: :get, class: "group-filter-form js-group-filter-form", id: 'group-filter-form' do |f|
- = search_field_tag :filter, params[:filter], placeholder: s_('GroupsTree|Search by name'), class: 'group-filter-form-field form-control js-groups-list-filter', spellcheck: false, id: 'group-filter-form-field', tabindex: "2"
+ = search_field_tag :filter, params[:filter], placeholder: s_('GroupsTree|Search by name'), class: 'group-filter-form-field form-control js-groups-list-filter qa-groups-filter', spellcheck: false, id: 'group-filter-form-field', tabindex: "2"
diff --git a/qa/qa/page/component/groups_filter.rb b/qa/qa/page/component/groups_filter.rb
index e647d368f0f..cc50bb439b4 100644
--- a/qa/qa/page/component/groups_filter.rb
+++ b/qa/qa/page/component/groups_filter.rb
@@ -6,12 +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'
- end
-
- base.view 'app/views/shared/groups/_empty_state.html.haml' do
- element :groups_empty_state
+ element :groups_filter
end
base.view 'app/assets/javascripts/groups/components/groups.vue' do
@@ -21,13 +16,22 @@ module QA
private
- def filter_by_name(name)
+ def has_filtered_group?(name)
+ # Filter and submit to reload the page and only retrieve the filtered results
+ find_element(:groups_filter).set(name).send_keys(:return)
+
+ # 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_css?(element_selector_css(:groups_empty_state)) ||
- page.has_css?(element_selector_css(:groups_list_tree_container))
+ 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 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)
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