summaryrefslogtreecommitdiff
path: root/qa/qa/page/component/clone_panel.rb
blob: 3ea29ff63da24d53a0a6991da6a525ef624f6131 (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
# frozen_string_literal: true

module QA
  module Page
    module Component
      module ClonePanel
        extend QA::Page::PageConcern

        def self.included(base)
          super

          base.view 'app/views/projects/buttons/_clone.html.haml' do
            element :clone_dropdown
            element :clone_dropdown_content
            element :ssh_clone_url_content
            element :http_clone_url_content
          end
        end

        def repository_clone_http_location
          repository_clone_location(:http_clone_url_content)
        end

        def repository_clone_ssh_location
          repository_clone_location(:ssh_clone_url_content)
        end

        private

        def repository_clone_location(kind)
          wait_until(reload: false) do
            click_element :clone_dropdown

            within_element :clone_dropdown_content do
              Git::Location.new(find_element(kind).value)
            end
          end
        end
      end
    end
  end
end