Merge pull request #6490 from openfoodfoundation/dependabot/bundler/capybara-3.15.1

Bump capybara from 2.18.0 to 3.15.1
This commit is contained in:
Andy Brett
2020-12-12 13:16:04 -08:00
committed by GitHub
17 changed files with 59 additions and 40 deletions

View File

@@ -126,7 +126,7 @@ group :test, :development do
# Pretty printed test output
gem 'atomic'
gem 'awesome_print'
gem 'capybara', '>= 2.18.0' # 3.0 requires rack 1.6 that only works with Rails 4.2
gem 'capybara'
gem 'database_cleaner', require: false
gem "factory_bot_rails", '5.2.0', require: false
gem 'fuubar', '~> 2.5.0'

View File

@@ -132,13 +132,14 @@ GEM
builder (3.2.4)
byebug (11.0.1)
cancan (1.6.10)
capybara (2.18.0)
capybara (3.15.1)
addressable
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0, < 4.0)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
xpath (~> 3.2)
childprocess (3.0.0)
chronic (0.10.2)
chunky_png (1.3.14)
@@ -550,6 +551,7 @@ GEM
nokogiri (~> 1.5)
optimist (~> 3.0)
redcarpet (3.5.0)
regexp_parser (1.8.2)
request_store (1.5.0)
rack (>= 1.4)
responders (2.4.1)
@@ -737,7 +739,7 @@ DEPENDENCIES
bugsnag
byebug (~> 11.0.0)
cancan (~> 1.6.10)
capybara (>= 2.18.0)
capybara
catalog!
coffee-rails (~> 4.2.2)
combine_pdf

View File

@@ -135,7 +135,9 @@ module Spree
return unless @payment.payment_method.class == Spree::Gateway::StripeSCA
@payment.authorize!
raise Spree::Core::GatewayError, I18n.t('authorization_failure') unless @payment.pending?
return if @payment.pending? && @payment.cvv_response_message.nil?
raise Spree::Core::GatewayError, I18n.t('authorization_failure')
end
end
end

View File

@@ -329,7 +329,7 @@ feature '
expect(page).to have_field "variant_price", with: "3.0"
expect(page).to have_field "variant_unit_value_with_description", with: "250 (bottle)"
expect(page).to have_field "variant_on_hand", with: "9"
expect(page).to have_selector "span[name='on_hand']", "9"
expect(page).to have_selector "span[name='on_hand']", text: "9"
select "Volume (L)", from: "variant_unit_with_scale"
fill_in "variant_sku", with: "NEWSKU"

View File

@@ -26,10 +26,9 @@ feature '
# Then I should see the relationships
within('table#enterprise-relationships') do
expect(page).to have_relationship e1, e2, ['to add to order cycle']
expect(page).to have_relationship e2, e3, ['to manage products']
expect(page).to have_relationship e3, e4,
['to add to order cycle', 'to manage products']
expect(page).to have_relationship e1, e2, 'to add to order cycle'
expect(page).to have_relationship e2, e3, 'to manage products'
expect_relationship_with_permissions e3, e4, ['to add to order cycle', 'to manage products']
end
end
@@ -50,7 +49,7 @@ feature '
# Wait for row to appear since have_relationship doesn't wait
expect(page).to have_selector 'tr', count: 2
expect(page).to have_relationship e1, e2, ['to add to order cycle', 'to add products to inventory', 'to edit profile']
expect_relationship_with_permissions e1, e2, ['to add to order cycle', 'to add products to inventory', 'to edit profile']
er = EnterpriseRelationship.where(parent_id: e1, child_id: e2).first
expect(er).to be_present
expect(er.permissions.map(&:name)).to match_array ['add_to_order_cycle', 'edit_profile', 'create_variant_overrides']
@@ -79,7 +78,7 @@ feature '
er = create(:enterprise_relationship, parent: e1, child: e2, permissions_list: [:add_to_order_cycle])
visit admin_enterprise_relationships_path
expect(page).to have_relationship e1, e2, ['to add to order cycle']
expect(page).to have_relationship e1, e2, 'to add to order cycle'
accept_alert do
first("a.delete-enterprise-relationship").click
@@ -119,9 +118,24 @@ feature '
private
def have_relationship(parent, child, perms = [])
perms = perms.join(' ')
def have_relationship(parent, child, permission = "")
have_table_row [parent.name, 'permits', child.name, permission, '']
end
have_table_row [parent.name, 'permits', child.name, perms, '']
def expect_relationship_with_permissions(parent, child, permissions = [])
tr = find_relationship(parent, child)
td = tr.find('td:nth-child(4)')
permissions.each_with_index do |permission, index|
expect(td.find("li:nth-child(#{index + 1})").text).to eq permission
end
end
def find_relationship(parent, child)
page.all('tr').each do |tr|
return tr if tr.find('td:first-child').text == parent.name &&
tr.find('td:nth-child(2)').text == "permits" &&
tr.find('td:nth-child(3)').text == child.name
end
raise "relationship not found"
end
end

View File

@@ -27,7 +27,7 @@ feature '
expect(page.find('#order_cycle_name').value).to eq(oc.name)
expect(page.find('#order_cycle_orders_open_at').value).to eq(oc.orders_open_at.to_s)
expect(page.find('#order_cycle_orders_close_at').value).to eq(oc.orders_close_at.to_s)
expect(page).to have_content "COORDINATOR #{oc.coordinator.name}"
expect(page).to have_content "COORDINATOR\n#{oc.coordinator.name}"
click_button 'Next'

View File

@@ -81,8 +81,8 @@ feature '
click_button "Update"
expect(page).to have_link "StripeSCA"
expect(page).to have_content "PROCESSING"
expect(OrderPaymentFinder.new(order.reload).last_payment.state).to eq "processing"
expect(page).to have_content "PENDING"
expect(OrderPaymentFinder.new(order.reload).last_payment.state).to eq "pending"
end
end
end

View File

@@ -534,8 +534,8 @@ feature "Product Import", js: true do
proceed_to_validation
# Check that all rows are validated.
heading = "120 #{I18n.t('admin.product_import.import.products_to_create')}"
find(".panel-header", text: heading).click
heading = I18n.t('admin.product_import.import.products_to_create')
find(".header-description", text: heading).click
expect(page).to have_content "Imported Product 10"
expect(page).to have_content "Imported Product 60"
expect(page).to have_content "Imported Product 110"

View File

@@ -304,7 +304,6 @@ feature "
# Clearing values manually
fill_in "variant-overrides-#{variant.id}-price", with: ''
fill_in "variant-overrides-#{variant.id}-count_on_hand", with: ''
select_on_demand variant, :use_producer_settings
fill_in "variant-overrides-#{variant.id}-default_stock", with: ''
within "tr#v_#{variant.id}" do

View File

@@ -33,7 +33,7 @@ feature "Account Settings", js: true do
expect(enqueued_jobs.last.to_s).to match "new@email.com"
expect(find(".alert-box.success").text.strip).to eq "#{I18n.t('spree.account_updated')} ×"
expect(find(".alert-box.success").text.strip).to eq "#{I18n.t('spree.account_updated')}\n×"
user.reload
expect(user.email).to eq 'old@email.com'
expect(user.unconfirmed_email).to eq 'new@email.com'
@@ -49,7 +49,7 @@ feature "Account Settings", js: true do
fill_in 'user_password_confirmation', with: 'NewPassword'
click_button I18n.t(:update)
expect(find(".alert-box.success").text.strip).to eq "#{I18n.t('spree.account_updated')} ×"
expect(find(".alert-box.success").text.strip).to eq "#{I18n.t('spree.account_updated')}\n×"
expect(user.reload.encrypted_password).to_not eq initial_password
end

View File

@@ -65,8 +65,8 @@ feature '
href: "#{distributor2.permalink}/shop", count: 1)
expect(page).not_to have_content distributor_without_orders.name
expect(page).to have_content distributor1.name + " " + "Balance due"
expect(page).to have_content distributor_credit.name + " Credit"
expect(page).to have_content distributor1.name + "\n" + "Balance due"
expect(page).to have_content distributor_credit.name + "\nCredit"
# It reveals table of orders for distributors when clicked
expand_active_table_node distributor1.name
@@ -98,7 +98,7 @@ feature '
context "without any completed orders" do
it "displays an appropriate message" do
visit "/account"
expect(page).to have_content { t :you_have_no_orders_yet }
expect(page).to have_content I18n.t(:you_have_no_orders_yet)
end
end
end

View File

@@ -42,7 +42,7 @@ feature "Registration", js: true do
expect(URI.parse(current_url).path).to eq registration_path
# Done reading introduction
page.has_content?
expect(page).to have_text "What do I get?"
click_button "Let's get started!"
expect(page).to have_content 'Woot!'
@@ -53,7 +53,7 @@ feature "Registration", js: true do
fill_in 'enterprise_address', with: '123 Abc Street'
fill_in 'enterprise_city', with: 'Northcote'
fill_in 'enterprise_zipcode', with: '3070'
expect(page).to have_select('enterprise_country', options: %w(Albania Australia), selected: 'Australia')
expect(page).to have_select('enterprise_country', options: ["Albania", "Australia"], selected: 'Australia')
select 'Vic', from: 'enterprise_state'
click_button "Continue"
expect(page).to have_content 'Who is responsible for managing My Awesome Enterprise?'

View File

@@ -239,6 +239,8 @@ feature "Check out with Stripe", js: true do
new_order = create(:order, user: user, order_cycle: order_cycle, distributor: distributor, bill_address_id: nil, ship_address_id: nil)
set_order(new_order)
add_product_to_cart(new_order, product, quantity: 10)
stub_payment_intents_post_request order: new_order
stub_successful_capture_request order: new_order
# Checkout with saved card
visit checkout_path

View File

@@ -188,6 +188,6 @@ feature "Order Management", js: true do
end
def be_confirmed_order_page
have_content /Order #\w+ Confirmed PAID/
have_content "Order ##{order.number} Confirmed"
end
end

View File

@@ -60,8 +60,8 @@ feature "shopping with variant overrides defined", js: true do
it "calculates fees correctly" do
page.find("#variant-#{product1_variant1.id} .graph-button").click
expect(page).to have_selector 'li', text: "#{with_currency(55.55)} Item cost"
expect(page).to have_selector 'li', text: "#{with_currency(5.56)} Packing fee"
expect(page).to have_selector 'li', text: "#{with_currency(55.55)}\nItem cost"
expect(page).to have_selector 'li', text: "#{with_currency(5.56)}\nPacking fee"
expect(page).to have_selector 'li', text: "= #{with_currency(61.11)}"
end

View File

@@ -31,9 +31,9 @@ describe "spree/admin/orders/edit.html.haml" do
it "displays order shipping costs, transaction fee and order total" do
render
expect(rendered).to have_content("Shipping: UPS Ground $6.00")
expect(rendered).to have_content("Transaction fee: $10.00")
expect(rendered).to have_content("Order Total $36.00")
expect(rendered).to have_content("Shipping Method\nUPS Ground $6.00")
expect(rendered).to have_content("Transaction fee:\n\n$10.00")
expect(rendered).to have_content("Order Total\n$36.00")
end
end
end

View File

@@ -21,7 +21,7 @@ describe "spree/shared/_order_details.html.haml" do
render
expect(rendered).to have_content("Paying via: Bartering")
expect(rendered).to have_content("Paying via:\nBartering")
end
it "displays payment methods safely" do
@@ -29,7 +29,7 @@ describe "spree/shared/_order_details.html.haml" do
render
expect(rendered).to have_content("Paying via: Bar<script>evil</script>ter&rarr;ing")
expect(rendered).to have_content("Paying via:\nBar<script>evil</script>ter&rarr;ing")
end
it "shows the last used payment method" do
@@ -51,6 +51,6 @@ describe "spree/shared/_order_details.html.haml" do
render
expect(rendered).to have_content("Paying via: Credit")
expect(rendered).to have_content("Paying via:\nCredit")
end
end