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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# frozen_string_literal: true
module QA
module Page
module Component
module Issuable
module Sidebar
extend QA::Page::PageConcern
def self.included(base)
super
base.view 'app/assets/javascripts/sidebar/components/assignees/assignee_avatar.vue' do
element :avatar_image
end
base.view 'app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue' do
element :more_assignees_link
end
base.view 'app/assets/javascripts/sidebar/components/labels/sidebar_labels.vue' do
element :labels_block
end
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_value.vue' do
element :selected_label_content
end
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents.vue' do
element :labels_dropdown_content
end
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select/dropdown_title.vue' do
element :labels_edit_button
end
base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_labels_view.vue' do
element :dropdown_input_field
end
base.view 'app/views/shared/issuable/_sidebar.html.haml' do
element :assignee_block
element :edit_milestone_link
element :milestone_block
element :milestone_link
end
end
def assign_milestone(milestone)
click_element(:edit_milestone_link)
within_element(:milestone_block) do
click_link("#{milestone.title}")
end
wait_until(reload: false) do
has_element?(:milestone_block, text: milestone.title, wait: 0)
end
refresh
end
def click_milestone_link
click_element(:milestone_link)
end
def has_assignee?(username)
within_element(:assignee_block) do
has_text?(username, wait: 120)
end
end
def has_no_assignee?(username)
within_element(:assignee_block) do
has_no_text?(username, wait: 120)
end
end
def has_avatar_image_count?(count)
wait_assignees_block_finish_loading do
all_elements(:avatar_image, count: count)
end
end
def has_label?(label)
within_element(:labels_block) do
!!has_element?(:selected_label_content, label_name: label)
end
end
def has_milestone?(milestone_title)
wait_milestone_block_finish_loading do
has_element?(:milestone_link, title: milestone_title)
end
end
def more_assignees_link
find_element(:more_assignees_link)
end
def select_labels_and_refresh(labels)
Support::Retrier.retry_until do
click_element(:labels_edit_button)
has_element?(:labels_dropdown_content, text: labels.first)
end
labels.each do |label|
within_element(:labels_dropdown_content) do
send_keys_to_element(:dropdown_input_field, [label, :enter])
end
end
click_element(:labels_edit_button)
labels.each do |label|
has_element?(:labels_block, text: label, wait: 0)
end
refresh
wait_for_requests
end
def toggle_more_assignees_link
click_element(:more_assignees_link)
end
private
def wait_assignees_block_finish_loading
within_element(:assignee_block) do
wait_until(reload: false, max_duration: 10, sleep_interval: 1) do
finished_loading_block?
yield
end
end
end
def wait_milestone_block_finish_loading
within_element(:milestone_block) do
wait_until(reload: false, max_duration: 10, sleep_interval: 1) do
finished_loading_block?
yield
end
end
end
end
end
end
end
end
|