Sha256: 2e1ac9aa8ef2e5dce3d0c4e6fe935d7466b9d7da74d13fddadc03758457fc756

Contents?: true

Size: 777 Bytes

Versions: 1

Compression:

Stored size: 777 Bytes

Contents

# frozen_string_literal: true

require ::File.expand_path("../util/configuration", File.dirname(__FILE__))
require ::File.expand_path("finder_diagnostics", File.dirname(__FILE__))

require "active_support/concern"

module Cornucopia
  module Capybara
    module Synchronizable
      extend ActiveSupport::Concern

      # This function uses Capybara's synchronize function to evaluate a block until
      # it becomes true.
      def synchronize_test(seconds = nil, options = {}, &block)
        seconds ||= ::Capybara.respond_to?(:default_max_wait_time) ? ::Capybara.default_max_wait_time : ::Capybara.default_wait_time

        document.synchronize(seconds, **options) do
          raise ::Capybara::ElementNotFound unless block.yield
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cornucopia-0.2.0 lib/cornucopia/capybara/synchronizable.rb