Sha256: 34b9b746f883e3f3c2680b01eb4881f56a091f786883942e61bf4eb184ebfacc

Contents?: true

Size: 495 Bytes

Versions: 23

Compression:

Stored size: 495 Bytes

Contents

module JavascriptMacro
  def wait_until(seconds = 5, &block)
    timeout(seconds) do
      loop do
        begin
          ret = block.call
          break ret if ret
        rescue Capybara::Poltergeist::JavascriptError
        end
        sleep 0.01
      end
    end
  end

  def confirm_dialog(ret, &block)
    page.execute_script "__backup = window.confirm; window.confirm = function(){return #{ret};}"
    block.call
  ensure
    page.execute_script "window.confirm = __backup;"
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
fluentd-ui-1.0.0.beta.1 spec/support/javascript_macro.rb
fluentd-ui-1.0.0.alpha.3 spec/support/javascript_macro.rb
fluentd-ui-1.0.0.alpha.2 spec/support/javascript_macro.rb
fluentd-ui-1.0.0.alpha.1 spec/support/javascript_macro.rb
fluentd-ui-0.4.5 spec/support/javascript_macro.rb
fluentd-ui-0.4.4 spec/support/javascript_macro.rb
fluentd-ui-0.4.3 spec/support/javascript_macro.rb
fluentd-ui-0.4.2 spec/support/javascript_macro.rb
fluentd-ui-0.4.1 spec/support/javascript_macro.rb
fluentd-ui-0.4.0 spec/support/javascript_macro.rb
fluentd-ui-0.3.21 spec/support/javascript_macro.rb
fluentd-ui-0.3.20 spec/support/javascript_macro.rb
fluentd-ui-0.3.19 spec/support/javascript_macro.rb
fluentd-ui-0.3.18 spec/support/javascript_macro.rb
fluentd-ui-0.3.17 spec/support/javascript_macro.rb
fluentd-ui-0.3.16 spec/support/javascript_macro.rb
fluentd-ui-0.3.15 spec/support/javascript_macro.rb
fluentd-ui-0.3.14 spec/support/javascript_macro.rb
fluentd-ui-0.3.13 spec/support/javascript_macro.rb
fluentd-ui-0.3.12 spec/support/javascript_macro.rb