Sha256: eb2fe99db4f2a2e08f779cd7f592a0121910d8ed1e9e2c3470019a9d53e00bb9

Contents?: true

Size: 786 Bytes

Versions: 31

Compression:

Stored size: 786 Bytes

Contents

module WaitForStripe
  def wait_for_stripe
    Timeout.timeout(Capybara.default_max_wait_time) do
      loop until page.evaluate_script('window.activeStripeRequests').zero?
    end
  end

  def setup_stripe_watcher
    page.evaluate_script <<-JS
      window.activeStripeRequests = 0;
      $('#checkout_form_payment [data-hook=buttons]').on('click', function() {
        window.activeStripeRequests = window.activeStripeRequests + 1;
      });
      stripeResponseHandler = (function() {
        var _f = stripeResponseHandler;
        return function() {
          window.activeStripeRequests = window.activeStripeRequests - 1;
          _f.apply(this, arguments);
        }
      })();
    JS
  end
end

RSpec.configure do |config|
  config.include WaitForStripe, type: :feature
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
spree_gateway-3.11.0 spec/support/wait_for_stripe.rb
spree_gateway-3.10.0 spec/support/wait_for_stripe.rb
archetype_spree_gateway-3.9.5.1 spec/support/wait_for_stripe.rb
archetype_spree_gateway-3.9.5 spec/support/wait_for_stripe.rb
spree_gateway-3.9.4 spec/support/wait_for_stripe.rb
spree_gateway-3.9.3 spec/support/wait_for_stripe.rb
spree_gateway-3.9.2 spec/support/wait_for_stripe.rb
spree_gateway-3.9.0 spec/support/wait_for_stripe.rb
spree_gateway-3.8.0 spec/support/wait_for_stripe.rb
spree_gateway-3.7.5 spec/support/wait_for_stripe.rb
spree_gateway-3.7.4 spec/support/wait_for_stripe.rb
spree_gateway-3.7.3 spec/support/wait_for_stripe.rb
spree_gateway-3.7.2 spec/support/wait_for_stripe.rb
spree_gateway-3.7.1 spec/support/wait_for_stripe.rb
spree_gateway-3.7.0 spec/support/wait_for_stripe.rb
spree_gateway-3.6.7 spec/support/wait_for_stripe.rb
spree_gateway-3.3.7 spec/support/wait_for_stripe.rb
spree_gateway-3.6.5 spec/support/wait_for_stripe.rb
spree_gateway-3.6.4 spec/support/wait_for_stripe.rb
spree_gateway-3.3.5 spec/support/wait_for_stripe.rb