Fix feature specs where UI has changed

This commit is contained in:
Matt-Yorkley
2020-04-20 14:40:56 +02:00
parent 6b66787004
commit 14d928c39d
5 changed files with 19 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
.joyride-tip-guide{"ng-class" => "{ in: open }", "ng-show" => "open"}
.cart-dropdown.joyride-tip-guide{"ng-class" => "{ in: open }", "ng-show" => "open"}
%span.joyride-nub.top
.joyride-content-wrapper
%h5

View File

@@ -34,7 +34,7 @@ feature "full-page cart", js: true do
click_link "Continue shopping"
expect(page).to have_no_link "Continue shopping"
expect(page).to have_button "Edit your cart"
expect(page).to have_link "Shop"
expect(page).to have_no_content distributor.preferred_shopfront_message
end
end

View File

@@ -46,9 +46,8 @@ feature "Using embedded shopfront functionality", js: true do
it "allows shopping and checkout" do
on_embedded_page do
fill_in "variants[#{variant.id}]", with: 1
wait_until_enabled 'input.add_to_cart'
first("input.add_to_cart:not([disabled='disabled'])").click
edit_cart
expect(page).to have_text 'Your shopping cart'
find('a#checkout-link').click
@@ -91,11 +90,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
wait_for_cart
find('ul.right li#login-link a').click
login_with_modal
wait_for_shop_loaded
wait_for_cart
wait_until { page.find('ul.right li.user-menu.has-dropdown').value.present? }
logout_via_navigation
@@ -106,14 +105,6 @@ 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
page.has_selector? 'div.login-modal', visible: true

View File

@@ -86,7 +86,7 @@ feature "shopping with variant overrides defined", js: true do
it "shows the correct prices in the shopping cart" do
fill_in "variants[#{product1_variant1.id}]", with: "2"
add_to_cart
edit_cart
expect(page).to have_selector "tr.line-item.variant-#{product1_variant1.id} .cart-item-price", text: with_currency(61.11)
expect(page).to have_field "order[line_items_attributes][0][quantity]", with: '2'

View File

@@ -1,7 +1,17 @@
module ShopWorkflow
def add_to_cart
wait_until_enabled 'input.add_to_cart'
first("input.add_to_cart:not([disabled='disabled'])").click
def wait_for_cart
first("#cart").click
within '.cart-dropdown' do
expect(page).to_not have_link "Updating cart..."
end
end
def edit_cart
wait_for_cart
within '.cart-dropdown' do
expect(page).to have_link "Edit your cart"
end
first("a.add_to_cart").click
end
def have_price(price)