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

module QA
  module Page
    module Component
      module ConfirmModal
        extend QA::Page::PageConcern

        def self.included(base)
          super

          base.view 'app/views/shared/_confirm_modal.html.haml' do
            element :confirm_modal
            element :confirm_input
            element :confirm_button
          end
        end

        def fill_confirmation_text(text)
          fill_element :confirm_input, text
        end

        def wait_for_confirm_button_enabled
          wait_until(reload: false) do
            !find_element(:confirm_button).disabled?
          end
        end

        def confirm_transfer
          wait_for_confirm_button_enabled
          click_element :confirm_button
        end
      end
    end
  end
end