我一直在试图创建一个简单的页面,包括一个选择框由country_select填充填充水豚测试用例。在我的测试情况下,我遇到的情况,我尝试从选择框选择生日的国家和月份,像这样:水豚选择选项,从:下拉
feature "registering for a new account" do
Capybara.javascript_driver = :poltergeist
scenario "a new user registers with a complete profile", :js => true do
page.visit '/users/sign_up'
select "United States", from: 'user[country]'
select 'January', from: 'birthMonth'
click 'sign up'
expect(response.code).to eq '200'
end
end
水豚或鬼驱人不能看到比我默认选择其他任何选项。有一次我用了一个断言,看看有什么选择我能找到
assert_selector(:css, 'option', minimum: 20) # countries + months should be way more than 20
,我得到了如下回应:
Failure/Error: assert_selector(:css, 'option', minimum: 20)
Capybara::ExpectationNotMet:
expected to find css "option" at least 20 times, found 2 matches: "country", "month"
我不知道我做错了。