mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
Fix flaky spec by waiting for modal animation
Without waiting, `fill_in` can fail randomly: https://github.com/teamcapybara/capybara/issues/1890
This commit is contained in:
@@ -184,6 +184,7 @@ feature 'Customers' do
|
||||
it 'updates the existing billing address' do
|
||||
expect(page).to have_content 'BILLING ADDRESS'
|
||||
first('#bill-address-link').click
|
||||
wait_for_modal_fade_in
|
||||
|
||||
expect(page).to have_content 'Edit Billing Address'
|
||||
expect(page).to have_select2 'country_id', selected: 'Australia'
|
||||
@@ -211,6 +212,7 @@ feature 'Customers' do
|
||||
expect(page).to have_content 'SHIPPING ADDRESS'
|
||||
|
||||
first('#ship-address-link').click
|
||||
wait_for_modal_fade_in
|
||||
expect(page).to have_content 'Edit Shipping Address'
|
||||
|
||||
fill_in 'firstname', with: "First"
|
||||
@@ -235,6 +237,15 @@ feature 'Customers' do
|
||||
expect(ship_address.phone).to eq '12345678'
|
||||
expect(ship_address.city).to eq 'Melbourne'
|
||||
end
|
||||
|
||||
# Modal animations are defined in:
|
||||
# app/assets/javascripts/admin/utils/services/dialog_defaults.js.coffee
|
||||
#
|
||||
# Without waiting, `fill_in` can fail randomly:
|
||||
# https://github.com/teamcapybara/capybara/issues/1890
|
||||
def wait_for_modal_fade_in(time = 0.4)
|
||||
sleep time
|
||||
end
|
||||
end
|
||||
|
||||
describe "creating a new customer" do
|
||||
|
||||
Reference in New Issue
Block a user