summaryrefslogtreecommitdiff
path: root/qa/qa/page/file/show.rb
blob: 665b3c34dccd3c3541cc97caf915f1f2586b0d57 (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
# frozen_string_literal: true

module QA
  module Page
    module File
      class Show < Page::Base
        include Shared::CommitMessage
        include Project::SubMenus::Settings
        include Project::SubMenus::Common
        include Layout::Flash

        view 'app/helpers/blob_helper.rb' do
          element :edit_button, "_('Edit')" # rubocop:disable QA/ElementWithPattern
          element :delete_button, '_("Delete")' # rubocop:disable QA/ElementWithPattern
        end

        view 'app/views/projects/blob/_header_content.html.haml' do
          element :file_name_content
        end

        view 'app/views/projects/blob/_remove.html.haml' do
          element :delete_file_button, "button_tag 'Delete file'" # rubocop:disable QA/ElementWithPattern
        end

        view 'app/views/shared/_file_highlight.html.haml' do
          element :file_content
        end

        def click_edit
          click_on 'Edit'
        end

        def click_delete
          click_on 'Delete'
        end

        def click_delete_file
          click_on 'Delete file'
        end

        def has_file?(name)
          has_element?(:file_name_content, text: name)
        end

        def has_no_file?(name)
          has_no_element?(:file_name_content, text: name)
        end

        def has_file_content?(text)
          has_element?(:file_content, text: text)
        end
      end
    end
  end
end

QA::Page::File::Show.prepend_if_ee('QA::EE::Page::File::Show')