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

wiki.rb « component « page « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ffd31f8d7b73e1bd842706cd32351f2ee19117fb (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# frozen_string_literal: true

module QA
  module Page
    module Component
      module Wiki
        extend QA::Page::PageConcern

        def self.included(base)
          super

          base.view 'app/views/shared/wikis/show.html.haml' do
            element :wiki_page_title
            element :edit_page_button
          end

          base.view 'app/views/shared/wikis/_wiki_content.html.haml' do
            element :wiki_page_content
          end

          base.view 'app/views/shared/wikis/_main_links.html.haml' do
            element :new_page_button
            element :page_history_button
          end

          base.view 'app/views/shared/empty_states/_wikis.html.haml' do
            element :create_first_page_link
          end

          base.view 'app/views/shared/empty_states/_wikis_layout.html.haml' do
            element :svg_content
          end
        end

        def click_create_your_first_page
          # The svg takes a fraction of a second to load after which the
          # "Create your first page" button shifts up a bit. This can cause
          # webdriver to miss the hit so we wait for the svg to load before
          # clicking the button.
          within_element(:svg_content) do
            has_element?(:js_lazy_loaded)
          end

          click_element(:create_first_page_link)
        end

        def click_new_page
          click_element(:new_page_button)
        end

        def click_page_history
          click_element(:page_history_button)
        end

        def click_edit
          click_element(:edit_page_button)
        end

        def has_title?(title)
          has_element?(:wiki_page_title, title)
        end

        def has_content?(content)
          has_element?(:wiki_page_content, content)
        end

        def has_no_content?(content)
          has_no_element?(:wiki_page_content, content)
        end

        def has_no_page?
          has_element?(:create_first_page_link)
        end

        def has_heading?(heading_type, text)
          within_element(:wiki_page_content) do
            has_css?(heading_type, text: text)
          end
        end

        def has_image?(image_file_name)
          within_element(:wiki_page_content) do
            has_css?("img[src$='#{image_file_name}']")
          end
        end
      end
    end
  end
end