blob: ec59d01071877679db3803f71aeab0906c328b7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# frozen_string_literal: true
module QA
module Page
module Component
module GroupsFilter
extend QA::Page::PageConcern
def self.included(base)
super
base.view 'app/assets/javascripts/groups/components/overview_tabs.vue' do
element :groups_filter_field
end
base.view 'app/assets/javascripts/groups/components/groups.vue' do
element :groups_list_tree_container
end
base.view 'app/views/dashboard/_groups_head.html.haml' do
element :public_groups_tab
end
end
private
def has_filtered_group?(name)
# Filter and submit to reload the page and only retrieve the filtered results
find_element(:groups_filter_field).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
has_element?(:groups_list_tree_container, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)
# If there are no groups we'll know immediately because we filtered the list
if page.has_text?('No groups or projects matched your search',
wait: 0) || page.has_text?('No groups matched your search', wait: 0)
return false unless has_element?(:public_groups_tab)
# Try for public groups
click_element(:public_groups_tab)
# Filter and submit to reload the page and only retrieve the filtered results
find_element(:groups_filter_field).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
has_element?(:groups_list_tree_container, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)
return false if page.has_text?('No groups or projects matched your search',
wait: 0) || page.has_text?('No groups matched your search', wait: 0)
end
# 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
end
end
|