Welcome to mirror list, hosted at ThFree Co, Russian Federation.

show.rb « file « page « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28b6b3be154699daa229b023eaeaf65a137c5196 (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
58
59
60
61
62
63
64
65
# 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?(file_content, file_number = nil)
          if file_number
            within_element_by_index(:file_content, file_number - 1) do
              has_text?(file_content)
            end
          else
            within_element(:file_content) do
              has_text?(file_content)
            end
          end
        end
      end
    end
  end
end

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