Last active
June 22, 2018 10:02
-
-
Save kassi/a6dbe86d085e9eed73c2eec7bb00c8a4 to your computer and use it in GitHub Desktop.
Failing site_prism / capybara test reduced to the relevant parts
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
# frozen_string_literal: true | |
## | |
# Client paydata section containing the client billing address (removed) and the payment method as subsections. | |
# | |
class ClientPaydataSection < SitePrism::Section | |
class ClientPaymentMethodSection < SitePrism::Section | |
element :show, ".payment-method-section .show-layer" | |
element :edit_button, "a#edit_payment_method_button" | |
element :edit_form, ".payment-method-section .edit-layer" | |
element :credit_card_radio_button, "#credit_card_radio_button" | |
# ... unrelevant elements removed | |
# CC Form elements. Must be defined as iframe otherwise no access to fields! | |
class CcIframe < SitePrism::Page | |
# ... unrelevant elements inside ifame removed | |
def update_to_credit_card(credit_card) | |
# should set some values and click, but is never reached | |
end | |
end | |
iframe :cc_iframe, CcIframe, "#credit_card_data" | |
def update_to_credit_card(credit_card) | |
wait_for_cc_iframe | |
cc_iframe do |iframe| # <-- this is where the error happens, original line: 138 | |
iframe.update_to_credit_card(credit_card) | |
end | |
end | |
end | |
section :payment_method, ClientPaymentMethodSection, ".payment-method-section" | |
end |
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
# frozen_string_literal: true | |
class ClientPaydataTestPage < SitePrism::Page | |
# ... unrelevant elements removed | |
section :client_paydata, ClientPaydataSection, "#client-paydata-control" | |
def load_page(options = {}) | |
load(query: { embedded_by: "atest", test_action_allowed: true }.merge(Hash(options[:query]))) | |
end | |
end |
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
feature "Offline sale", "" do | |
Steps "something with the iframe form" do | |
Given "A user creates a client with payment method credit card" do | |
# ... removed: user will be created | |
embedding_page = ClientPaydataTestPage.new | |
embedding_page.load_page | |
# ... removed: client will be created | |
expect(embedding_page.client_paydata.payment_method.edit_form).to be_visible | |
embedding_page.client_paydata.payment_method.credit_card_radio_button.click | |
embedding_page.client_paydata.payment_method.update_to_credit_card(credit_card) # <-- error happens inside this | |
# ... removed: rest | |
end | |
# ... removed: rest of test which is never reached | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment