Created
August 14, 2019 16:16
-
-
Save twalpole/ce436a537b2aedc0136eb6880c69a56c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'selenium-webdriver', '3.142.3' | |
gem 'webdrivers' | |
gem 'capybara', '3.28.0' | |
gem 'byebug' | |
end | |
require "capybara/dsl" | |
require 'byebug' | |
sess = Capybara::Session.new(:selenium_chrome) | |
sess.visit("https://stripe.com/docs/stripe-js/elements/quickstart") | |
sess.within_frame do # only one outer frame - no locator necessary | |
frame = sess.find('#card-element iframe') | |
sess.within_frame(frame) do | |
sess.fill_in('cardnumber', with: '4242' * 4) | |
sess.fill_in('exp-date', with: '1220') | |
sess.fill_in('cvc', with: '111') | |
sess.fill_in('postal', with: '92054') | |
sess.assert_selector(:field, 'cardnumber', with: '4242 4242 4242 4242') | |
sess.assert_selector(:field, 'exp-date', with: '12 / 20') | |
sess.assert_selector(:field, 'cvc', with: '111') | |
sess.assert_selector(:field, 'postal', with: '92054') | |
end | |
end | |
sleep 30 # delay to look at browser |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment