TrevorS / bootstrap3-datetimepicker-rails

This gem packages the bootstrap-datetimepicker for the Rails 3.1+ asset pipeline.
MIT License
292 stars 123 forks source link

Test with capybara #36

Closed donv closed 8 years ago

donv commented 8 years ago

Hi good people!

We are using bootstrap3-datetimepicker-rails and it works very well for us. Well done!

I am writing a capybara feature test for our app including using bootstrap3-datetimepicker-rails to select a date, but I am having trouble finding how to click to select a date. My current attempt looks like this:

execute_script %Q{$('#news_item_publish_at').focus()}
click_link('15')

I hoped the click_link('15') would select the 15th of the current month, but it gives me Capybara::ElementNotFound: Unable to find link "15".

The text field #news_item_publish_at has been activated with datetimepicker({format: 'YYYY-MM-DD'}). It works perfectly as far as I can see when using the app manually. When giving the field focus, the calendar pops up as it should and is selectable manually. The only thing missing now is how to navigate the calendar and select a date.

If anybody has written a capybara test to exercise bootstrap3-datetimepicker-rails, please post an example.

Ana06 commented 5 years ago

Why was this closed? I also don't manage to change the date with Capybara and bootstrap3-datetimepicker-rails. I tried using capybara-bootstrap-datepicker, but doesn't work neither. Any clue?