mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-31 21:37:16 +00:00
Replace sleep with wait, add cart_dirty spec helper
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
%span.cart-span{"ng-controller" => "CartCtrl"}
|
||||
%span.cart-span{"ng-controller" => "CartCtrl", "ng-class" => "{ dirty: Cart.dirty }"}
|
||||
%a#cart.icon{cart: true}
|
||||
%span.nav-branded
|
||||
%i.ofn-i_027-shopping-cart
|
||||
|
||||
@@ -139,7 +139,9 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
it "should save group buy data to ze cart" do
|
||||
fill_in "variants[#{product.master.id}]", with: 5
|
||||
fill_in "variant_attributes[#{product.master.id}][max_quantity]", with: 9
|
||||
sleep 5
|
||||
|
||||
wait_until { !cart_dirty }
|
||||
|
||||
li = Spree::Order.order(:created_at).last.line_items.order(:created_at).last
|
||||
li.max_quantity.should == 9
|
||||
li.quantity.should == 5
|
||||
|
||||
@@ -68,6 +68,10 @@ module UIComponentHelper
|
||||
find("#cart").click
|
||||
end
|
||||
|
||||
def cart_dirty
|
||||
page.find("span.cart-span")[:class].include? 'dirty'
|
||||
end
|
||||
|
||||
def wait_for_ajax
|
||||
counter = 0
|
||||
while page.execute_script("return $.active").to_i > 0
|
||||
|
||||
Reference in New Issue
Block a user