ruby on rails - Integration Tests: Filling Autocomple Dropdown in Rails_Admin using Capybara for -
in rails app, i'm using rails_admin. want fill relationship. say, post belongs author. want set author. rails_admin uses autocomplete form selection of data, i.e. xhr. how select value , submit data using capybara. normal select doesn't work here.
i'm assuming need take following actions
- click on carrot icon,
- select first value dropdown
or there other approach fill such data, i.e execute script etc. how do that?
edit:
as of now, i've started using selenium driver , i'm using following solution
within '#post_user_id_field' find(".input-group-btn").click end page.execute_script(%q{$("ul#ui-id-3").find("li")[1].click()})
suggest better approach.
thanks in advance,
i took @ using capybara rspec found helpful information. without seeing of code, can following (taking link above):
describe 'some stuff requires js', :js => true 'will use default js driver' 'will switch 1 specific driver', :driver => :webkit end
this enable javascript in tests. if still having trouble selection, can debugging placing save_and_open_screenshot
in test code see javascript driver seeing.
Comments
Post a Comment