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
|
# frozen_string_literal: true
module QA
module Page
module Project
module Issue
class Show < Page::Base
include Page::Component::Issuable::Common
include Page::Component::Note
include Page::Component::DesignManagement
include Page::Component::Issuable::Sidebar
view 'app/assets/javascripts/notes/components/comment_form.vue' do
element :comment_button
element :comment_field
end
view 'app/assets/javascripts/notes/components/discussion_filter.vue' do
element :discussion_filter, required: true
element :filter_options
end
view 'app/assets/javascripts/notes/components/noteable_note.vue' do
element :noteable_note_item
end
view 'app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue' do
element :remove_related_issue_button
end
view 'app/views/shared/issuable/_close_reopen_button.html.haml' do
element :close_issue_button
element :reopen_issue_button
end
view 'app/views/shared/notes/_form.html.haml' do
element :new_note_form, 'new-note' # rubocop:disable QA/ElementWithPattern
element :new_note_form, 'attr: :note' # rubocop:disable QA/ElementWithPattern
end
view 'app/assets/javascripts/related_issues/components/add_issuable_form.vue' do
element :add_issue_button
end
view 'app/assets/javascripts/related_issues/components/related_issuable_input.vue' do
element :add_issue_field
end
view 'app/assets/javascripts/related_issues/components/related_issues_block.vue' do
element :related_issues_plus_button
end
view 'app/assets/javascripts/related_issues/components/related_issues_list.vue' do
element :related_issuable_item
element :related_issues_loading_icon
end
def relate_issue(issue)
click_element(:related_issues_plus_button)
fill_element(:add_issue_field, issue.web_url)
send_keys_to_element(:add_issue_field, :enter)
end
def related_issuable_item
find_element(:related_issuable_item)
end
def wait_for_related_issues_to_load
has_no_element?(:related_issues_loading_icon, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)
end
def click_remove_related_issue_button
retry_until(sleep_interval: 5) do
click_element(:remove_related_issue_button)
has_no_element?(:remove_related_issue_button, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)
end
end
def click_close_issue_button
click_element :close_issue_button
end
# Adds a comment to an issue
# attachment option should be an absolute path
def comment(text, attachment: nil, filter: :all_activities)
method("select_#{filter}_filter").call
fill_element :comment_field, "#{text}\n"
unless attachment.nil?
QA::Page::Component::Dropzone.new(self, '.new-note')
.attach_file(attachment)
end
click_element :comment_button
end
def has_comment?(comment_text)
has_element?(:noteable_note_item, text: comment_text, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)
end
def noteable_note_item
find_element(:noteable_note_item)
end
def select_all_activities_filter
select_filter_with_text('Show all activity')
end
def select_comments_only_filter
select_filter_with_text('Show comments only')
end
def select_history_only_filter
select_filter_with_text('Show history only')
end
def has_metrics_unfurled?
has_element?(:prometheus_graph_widgets, wait: 30)
end
private
def select_filter_with_text(text)
retry_on_exception do
click_element(:title)
click_element :discussion_filter
find_element(:filter_options, text: text).click
wait_for_loading
end
end
end
end
end
end
end
QA::Page::Project::Issue::Show.prepend_if_ee('QA::EE::Page::Project::Issue::Show')
|