summaryrefslogtreecommitdiff
path: root/qa/qa/page/dashboard/snippet/edit.rb
blob: 37c0747aea4c0fd959625d240b49f5b6cd31e1e7 (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
# frozen_string_literal: true

module QA
  module Page
    module Dashboard
      module Snippet
        class Edit < Page::Base
          view 'app/assets/javascripts/snippets/components/edit.vue' do
            element :submit_button, required: true
          end

          def add_to_file_content(content)
            text_area.set content
            text_area.has_text?(content) # wait for changes to take effect
          end

          def change_visibility_to(visibility_type)
            choose(visibility_type)
          end

          def save_changes
            click_element(:submit_button, Page::Dashboard::Snippet::Show)
          end

          private

          def text_area
            find('.monaco-editor textarea', visible: false)
          end
        end
      end
    end
  end
end