Avoid alert by waiting until shop loaded

This commit is contained in:
Maikel Linke
2018-07-12 17:46:18 +10:00
committed by luisramos0
parent dd5bd5b616
commit 6a53e5fd3d

View File

@@ -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