I need to test if Javascript alert is being displayed in validation proccess after checking one checkbox. I'm using RSpec
, Capybara
with Webkit
and Database Cleaner
.
My test without JS: true
:
it "alerts to choose two players" do
set_and_visit
first("input[type='checkbox']").set(true)
expect(page).to have_content('Remember that you must choose two players to start a game.')
end
Finds a checkbox but cannot find the alert message.
When I add JS - "alerts to choose two players", js: true do
it returns an error
NoMethodError:
undefined method `set' for nil:NilClass
I've tried using check 'John Doe'
and first("input[type='checkbox']").check
but it still didn't work.
Aucun commentaire:
Enregistrer un commentaire