summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/issue/show.rb
blob: 10644c0fecc6aed358d900fd7938b718112720e1 (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
module QA
  module Page
    module Project
      module Issue
        class Show < Page::Base
          view 'app/views/projects/issues/show.html.haml' do
            element :issue_details, '.issue-details'
            element :title, '.title'
          end

          view 'app/views/shared/notes/_form.html.haml' do
            element :new_note_form, 'new-note'
            element :new_note_form, 'attr: :note'
          end

          view 'app/views/shared/notes/_comment_button.html.haml' do
            element :comment_button, '%strong Comment'
          end

          def issue_title
            find('.issue-details .title').text
          end

          # Adds a comment to an issue
          # attachment option should be an absolute path
          def comment(text, attachment:)
            fill_in(with: text, name: 'note[note]')

            attach_file_to_dropzone(attachment, '.new-note') if attachment

            click_on 'Comment'
          end
        end
      end
    end
  end
end