mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #8384 from filipefurtad0/fix_flaky_checkout_spec
Adds context to helper to assure actions are successful
This commit is contained in:
@@ -33,17 +33,29 @@ module CheckoutRequestsHelper
|
||||
end
|
||||
|
||||
def fill_out_form(shipping_method_name, payment_method_name, save_default_addresses: true)
|
||||
choose shipping_method_name
|
||||
choose payment_method_name
|
||||
|
||||
within "#shipping" do
|
||||
choose shipping_method_name
|
||||
end
|
||||
|
||||
within "#payment" do
|
||||
choose payment_method_name
|
||||
end
|
||||
|
||||
fill_out_details
|
||||
check "Save as default billing address" if save_default_addresses
|
||||
|
||||
within "#billing" do
|
||||
check "Save as default billing address" if save_default_addresses
|
||||
end
|
||||
|
||||
fill_out_billing_address
|
||||
|
||||
return unless save_default_addresses
|
||||
|
||||
check "Shipping address same as billing address?"
|
||||
check "Save as default shipping address"
|
||||
within "#shipping" do
|
||||
find(:xpath, '//*[@id="shipping"]/ng-form/dd').click
|
||||
check "Shipping address same as billing address?"
|
||||
check "Save as default shipping address"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -313,8 +313,11 @@ describe "As a consumer I want to check out my cart", js: true do
|
||||
|
||||
it "checks out successfully" do
|
||||
visit checkout_path
|
||||
|
||||
expect(page).to have_content "Shipping info"
|
||||
find(:xpath, '//*[@id="shipping"]/ng-form/dd').click
|
||||
find("input[value='#{shipping_with_fee.id}'").click
|
||||
click_button "Next"
|
||||
expect(page).to have_content "Payment"
|
||||
find("input[value='#{check_without_fee.id}'").click
|
||||
|
||||
|
||||
Reference in New Issue
Block a user