Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of puffing-billy + VCR concurrent usage in same feature spec (Stripe checkout.js?) #99

Open
eliotsykes opened this issue Nov 28, 2015 · 4 comments

Comments

@eliotsykes
Copy link
Owner

Provide example spec for testing Stripe's checkout.js whilst also communicating with the Stripe API.

Include:

  • VCR to mock Stripe API calls direct from app
  • Puffing Billy to mock Stripe JavaScript in browser
  • js: true feature spec or choose puffing billy driver
  • Demonstrate within_frame ... for Stripe iframe
  • Work around buggy behaviour of stripe input fields with Capybara's fill_in. See fill_in_with_force/fill_in_stripe_field below and http://stackoverflow.com/a/26211723/67834
  ...

  within_frame 'stripe_checkout_app' do
    fill_in 'Email', with: 'a@b.c'
    fill_in_stripe_field '#card_number', with: '4242424242424242'
    fill_in_stripe_field '#cc-exp', with: '12/22'
    fill_in 'CVC', with: '123'
    click_button 'Upgrade $9.99'
  end

  ...

  def fill_in_with_force(locator, options)
    page.execute_script "$('#{locator}').val('#{options[:with]}');"
  end

  alias_method :fill_in_stripe_field, :fill_in_with_force

  ...
@eliotsykes eliotsykes changed the title Example of puffing-billy + VCR usage in same feature spec (Stripe checkout.js?) Example of puffing-billy + VCR concurrent usage in same feature spec (Stripe checkout.js?) Nov 28, 2015
@eliotsykes
Copy link
Owner Author

@eliotsykes
Copy link
Owner Author

This will demo usage of c.ignore_params = [...] for Stripe's cache-busting URLs.

Also demo how to config to ignore unwanted 3rd party requests e.g. Mixpanel in test environment seems to be included by Stripe.

@eliotsykes
Copy link
Owner Author

Puffing Billy, JSONP and Stripe may be relevant: oesmith/puffing-billy#55

@eliotsykes
Copy link
Owner Author

WIP #101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant