crowdint/rails3-jquery-autocomplete — Issue #139: Testing autocomplete with Cucumber
Author: nicholaspufal
Created: 2012-02-10 12:37:18+00:00
State: open

Is anyone having problems to test it with Cucumber, and with the helper provided?

I try a lot to debug, but I still can't find the root of the problem. The helper acts as follow:

page.execute_script %Q{ $('input[data-autocomplete]').trigger("focus") }
page.execute_script %Q{ $('input[data-autocomplete]').trigger("keydown") }
sleep 1
page.execute_script %Q{ $('.ui-menu-item a:contains("#{value}")').trigger("mouseenter").trigger("click"); }

Which I guess should be working fine, however when I put `save_and_open_page` and also use `debugger` (which allows me to play with the page, check for the XHR, etc) I see that no autocomplete is appearing there.

I have other javascript tests, and they all working fine, however this one isn't. I tried with different javascript drivers also, `selenium` and `webkit`.

Let's say I have this test (as is the example in the main Git page):

@javascript
Scenario: Autocomplete
Given the following brands exists:
| name |
| Alpha |
| Beta |
| Gamma |
And I go to the home page
And I fill in "Brand name" with "al"
And I choose "Alpha" in the autocomplete list
Then the "Brand name" field should contain "Alpha"

The last step would fail, saying that "Alpha" was expected, but instead it was "al" (the user input). Again, means the autocomplete isn't loading (?). Oh, and btw, it works fine when I do `rails s ` and access it via browser.

Any advices or anyone there that had trouble with it?

Thanks