Maybe using Capybara finders all, first and the selector input. Something like this:
visit new_resource_path
click_link "Add a Nested Resource"
first("input[name='nested_resource[name]']").set("Nested Resource")
click_button "submit"
Or
visit new_resource_path
click_link "Add a Nested Resource"
click_link "Add a Nested resource"
all("input[name='nested_resource[name]']").each do |input|
input.set("Nested Resource")
end
click_button "submit
This is only an approach, I've never worked with cocoon. This is however, a form to test dynamic inputs.