mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Wait for angular to load in BOM spec
This commit is contained in:
@@ -45,6 +45,7 @@ feature %q{
|
||||
|
||||
before :each do
|
||||
visit '/admin/orders/bulk_management'
|
||||
wait_for_angular_requests
|
||||
end
|
||||
|
||||
it "displays a column for user's full name" do
|
||||
@@ -456,6 +457,7 @@ feature %q{
|
||||
|
||||
before :each do
|
||||
visit '/admin/orders/bulk_management'
|
||||
wait_for_angular_requests
|
||||
end
|
||||
|
||||
it "displays date fields for filtering orders, with default values set" do
|
||||
|
||||
@@ -152,8 +152,16 @@ module WebHelper
|
||||
page.driver.browser.switch_to.alert.accept
|
||||
end
|
||||
|
||||
def wait_for_angular_requests
|
||||
wait_until { angular_requests_finished }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def angular_requests_finished
|
||||
page.evaluate_script('angular.element(".ng-scope").injector().get("$http").pendingRequests.length === 0')
|
||||
end
|
||||
|
||||
def wait_for_ajax
|
||||
wait_until { page.evaluate_script("$.active") == 0 }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user