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

Fill credit card input with force in checkout spec #2911

Merged
merged 1 commit into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/spec/features/checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
choose "use_existing_card_no"

fill_in "Name on card", with: 'Spree Commerce'
fill_in "Card Number", with: '4111 1111 1111 1111'
fill_in_with_force "Card Number", with: '4111 1111 1111 1111'
fill_in "card_expiry", with: '04 / 20'
fill_in "Card Code", with: '123'

Expand Down
12 changes: 12 additions & 0 deletions frontend/spec/support/features/fill_in_with_force.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module FillInWithForce
def fill_in_with_force(locator, with:)
field_id = find_field(locator)[:id]
page.execute_script "document.getElementById('#{field_id}').value = '#{with}';"
end
end

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