mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
fix for intermittent capybara click failure
This fix might have to be applied at more places. We will see what CI says...
This commit is contained in:
@@ -50,11 +50,12 @@ feature %q{
|
||||
scenario "can add a product to an existing order", js: true do
|
||||
login_to_admin_section
|
||||
visit '/admin/orders'
|
||||
page.find('td.actions a.icon-edit').click
|
||||
|
||||
targetted_select2_search @product.name, from: ".variant_autocomplete", dropdown_css: ".select2-search"
|
||||
click_edit
|
||||
|
||||
click_icon :plus
|
||||
targetted_select2_search @product.name, from: '#add_variant_id', dropdown_css: '.select2-drop'
|
||||
|
||||
click_link 'Add'
|
||||
|
||||
page.should have_selector 'td', text: @product.name
|
||||
@order.line_items(true).map(&:product).should include @product
|
||||
@@ -153,4 +154,21 @@ feature %q{
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Working around intermittent click failing
|
||||
# Possible causes of failure:
|
||||
# - the link moves
|
||||
# - the missing content (font icon only)
|
||||
# - the screen is not big enough
|
||||
# However, some operations before the click or a second click on failure work.
|
||||
#
|
||||
# A lot of people had similar problems:
|
||||
# https://github.com/teampoltergeist/poltergeist/issues/520
|
||||
# https://github.com/thoughtbot/capybara-webkit/issues/494
|
||||
def click_edit
|
||||
click_result = click_icon :edit
|
||||
unless click_result['status'] == 'success'
|
||||
click_icon :edit
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user