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

module QA
  module Page
    module Component
      module WikiSidebar
        extend QA::Page::PageConcern

        def self.included(base)
          super

          base.view 'app/views/shared/wikis/_sidebar.html.haml' do
            element :clone_repository_link
            element :view_all_pages_button
          end

          base.view 'app/views/shared/wikis/_sidebar_wiki_page.html.haml' do
            element :wiki_page_link
          end

          base.view 'app/views/shared/wikis/_wiki_directory.html.haml' do
            element :wiki_directory_content
          end
        end

        def click_clone_repository
          click_element(:clone_repository_link)
        end

        def click_view_all_pages
          click_element(:view_all_pages_button)
        end

        def click_page_link(page_title)
          click_element(:wiki_page_link, page_name: page_title)
        end

        def has_page_listed?(page_title)
          has_element?(:wiki_page_link, page_name: page_title)
        end

        def has_directory?(directory)
          has_element?(:wiki_directory_content, text: directory)
        end
      end
    end
  end
end