goodwill / capybara-select2

Helper for capybara to be able to trigger select on select2 javascript (needed for js enabled test only)
MIT License
80 stars 111 forks source link

Failed to click element #17

Open GCorbel opened 11 years ago

GCorbel commented 11 years ago

Hi,

I create a spec with this line :

select2("A first name A name", from: 'Artiste', search: true) 

And I have this javascript :

$(this).select2(
  placeholder: "Artiste"
  minimumInputLength: 1
  ajax:
    url: '/artists.json'
    data: (term) ->
      q: term
    results: (data) ->
      results: data

It works on production but I have this error when I run my tests :

 Failure/Error: select2("A first name A name", from: 'Artiste', search: true)
 Capybara::Webkit::ClickFailed:
   Failed to click element /html/body/div[@id='page']/div[@id='main-content']/div/div/form[@id='new_painting']/div[2]/div[1]/div/div[@id='s2id_painting_artist_id']/a at position 781, 

The spec fail at this line : https://github.com/goodwill/capybara-select2/blob/master/gem/lib/capybara-select2.rb#L27

Is there something to do?

Thanks!

bertBruynooghe commented 9 years ago

I think the from field should be the content of the label you added to the original input, not the placeholder.