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

module QA
  module Page
    module File
      class Edit < Page::Base
        include Shared::CommitMessage
        include Shared::CommitButton
        include Shared::Editor

        view 'app/assets/javascripts/editor/components/source_editor_toolbar_button.vue' do
          element :editor_toolbar_button
        end

        def has_markdown_preview?(component, content)
          within_element(:source_editor_preview_container) do
            has_css?(component, exact_text: content)
          end
        end

        def wait_for_markdown_preview(component, content)
          return if has_markdown_preview?(component, content)

          raise ElementNotFound, %("Couldn't find #{component} element with content '#{content}')
        end

        def click_editor_toolbar
          click_element(:editor_toolbar_button)
        end
      end
    end
  end
end