Skip to content

not able to write feature test when datapickers are involved #66

@Ana06

Description

@Ana06

I am using bootstrap3-datetimepicker-rails 4.17.47, rspec 3.6.0 and capybara 3.12.0. I have tried several solutions to modify the datapickers in a feature test, but any of them worked:

  • page.execute_script("$('#registration-period-start-datapicker').datepicker('setDate', '01/01/2010')")
  • page.execute_script("$('#registration-period-start-datapicker'').val('21/12/1980')")
  • fill_in 'registration-period-start-datapicker', :with => '21/12/1980'
  • $('#registration-period-start-datapicker').datetimepicker({value: '21/12/1980'})
  • using capybara-bootstrap-datepicker, check Unable to find css ".datepicker" akarzim/capybara-bootstrap-datepicker#14

I have the following code in Rails:

= f.input :start_date, as: :string, input_html: { class: 'form-control', id: 'registration-period-start-datapicker' }

With this JavaScript:

$('#registration-period-start-datapicker').datetimepicker({
     format: 'YYYY-MM-DD',
     minDate : today,
     maxDate : end_conference
});

the generated html:

<div class="string input required stringish form-group" id="cfp_start_date_input"><span class="form-label"><label for="registration-period-start-datapicker" class=" control-label">Start date&nbsp;<span class="text-warning"><abbr title="This field is required">*</abbr></span></label></span><span class="form-wrapper"><input id="registration-period-start-datapicker" class="form-control form-control" type="text" name="cfp[start_date]"></span></div>

Original code in github.com/openSUSE/osem

Related to: #36

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions