summaryrefslogtreecommitdiff
path: root/qa/qa/page/project/issue/show.rb
blob: 364a2c616653511618fbceaf5b6692a6e1abb633 (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
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: nil)
            fill_in(with: text, name: 'note[note]')

            unless attachment.nil?
              QA::Page::Component::Dropzone.new(page, '.new-note')
                .attach_file(attachment)
            end

            click_on 'Comment'
          end
        end
      end
    end
  end
end