I'm using ui.router and angularjs-rails-resource.
The page I'm visiting has a directive that performs a query to the local API to get some models that populate a select for a form:
CarBrand.query().then(function(carBrands) {
vm.carBrands = carBrands; // this never gets executed, the model is empty
});
I've opened the page with save_and_open_page to check the rendering state of the app, and the route is resolved (even without using the waiter mentioned in this other issue) and the form is rendered, but the select options are not populated.
I've run out of clues. I checked if there are pending requests as suggested here but the answer is no, there are no pending requests.
However, when I quit, in the last second the requests appear en in the network tab of firefox, as if something was holding them.
Test:
require "rails_helper"
describe "CarListing creation", type: :feature do
let!(:car_version) { FactoryGirl.create :car_version }
it "creates a CarListing", js: true do
visit "/#/avisos/nuevo"
wait_until_angular_ready
wait_for_route_changes
save_and_open_page
select_by_ng_model "cL_EC.carListing.car.brand", car_version.brand.name
select_by_ng_model "cL_EC.carListing.car.model", car_version.model.name
select_by_ng_model "cL_EC.carListing.car.versionId", car_version.id
fill_in_by_ng_model "cL_EC.carListing.car.year", 1996
end
def fill_in_by_ng_model(ng_model, value)
find_by_ng_model(ng_model).set value
end
def select_by_ng_model(ng_model, value)
find_by_ng_model(ng_model).
find(:css, "option[value='#{value}']").
select_option
end
def find_by_ng_model(ng_model)
find(:css, "[ng-model='#{ng_model}']")
end
end
I tried https://github.com/kikonen/capybara-ng with the same results. AFAIK, this library angularjs-rails-resource is just a wrapper around $http calls.
Any help is aprettiated!
I'm using ui.router and angularjs-rails-resource.
The page I'm visiting has a directive that performs a query to the local API to get some models that populate a select for a form:
I've opened the page with
save_and_open_pageto check the rendering state of the app, and the route is resolved (even without using the waiter mentioned in this other issue) and the form is rendered, but the select options are not populated.I've run out of clues. I checked if there are pending requests as suggested here but the answer is no, there are no pending requests.
However, when I quit, in the last second the requests appear en in the network tab of firefox, as if something was holding them.
Test:
I tried https://github.com/kikonen/capybara-ng with the same results. AFAIK, this library angularjs-rails-resource is just a wrapper around $http calls.
Any help is aprettiated!