Merge pull request #12494 from filipefurtad0/update_paypal_checkout_system_spec

Updates Paypal system spec to consider new checkout flow
This commit is contained in:
Maikel
2024-05-22 10:17:06 +10:00
committed by GitHub

View File

@@ -4,9 +4,9 @@ require "system_helper"
RSpec.describe "Check out with Paypal" do
include ShopWorkflow
include CheckoutRequestsHelper
include AuthenticationHelper
include PaypalHelper
include CheckoutHelper
let(:distributor) { create(:distributor_enterprise) }
let(:supplier) { create(:supplier_enterprise) }
@@ -47,10 +47,12 @@ RSpec.describe "Check out with Paypal" do
end
shared_examples "checking out with paypal" do |user_type|
pending user_type.to_s do
context user_type.to_s do
before do
fill_out_details
fill_out_form(free_shipping.name, paypal.name, save_default_addresses: false)
fill_out_billing_address
proceed_to_payment
proceed_to_summary
end
it "completes the checkout after successful Paypal payment" do
@@ -65,7 +67,7 @@ RSpec.describe "Check out with Paypal" do
)
stub_paypal_confirm
place_order
click_on "Complete order"
expect(page).to have_content "Your order has been processed successfully"
expect(order.reload.state).to eq "complete"
@@ -75,14 +77,14 @@ RSpec.describe "Check out with Paypal" do
it "fails with an error message" do
stub_paypal_response success: false
place_order
click_on "Complete order"
expect(page).to have_content "PayPal failed."
end
end
end
describe "shared_examples" do
pending "as a guest user" do
context "as a guest user" do
before do
visit checkout_path
checkout_as_guest
@@ -90,7 +92,7 @@ RSpec.describe "Check out with Paypal" do
it_behaves_like "checking out with paypal", "as guest"
end
pending "as a logged in user" do
context "as a logged in user" do
before do
login_as user
visit checkout_path