mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Avoid alert by waiting until shop loaded
This commit is contained in:
@@ -91,10 +91,11 @@ feature "Using embedded shopfront functionality", js: true do
|
||||
|
||||
it "redirects to embedded hub on logout when embedded" do
|
||||
on_embedded_page do
|
||||
|
||||
wait_for_shop_loaded
|
||||
find('ul.right li#login-link a').click
|
||||
login_with_modal
|
||||
|
||||
wait_for_shop_loaded
|
||||
wait_until { page.find('ul.right li.user-menu.has-dropdown').value.present? }
|
||||
logout_via_navigation
|
||||
|
||||
@@ -105,6 +106,14 @@ feature "Using embedded shopfront functionality", js: true do
|
||||
|
||||
private
|
||||
|
||||
# When you have pending changes and try to navigate away from a page, it asks you "Are you sure?".
|
||||
# When we click the "Update" button to save changes, we need to wait
|
||||
# until it is actually saved and "loading" disappears before doing anything else.
|
||||
def wait_for_shop_loaded
|
||||
page.has_no_content? "Loading"
|
||||
page.has_no_css? "input[value='Updating cart...']"
|
||||
end
|
||||
|
||||
def login_with_modal
|
||||
expect(page).to have_selector 'div.login-modal', visible: true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user