I have a cucumber scenario tagged with @javascript
and i'm testing it with some really basic inline js calls. I'm running this using
Capybara.javascript_driver = :webkit
If i do this on the page, after the element in question (which has id="ajax_test_results", don't worry about the ajax though, for now)
document.getElementById('ajax_test_results').innerHTML = 'Replaced with basic js, ie not jquery, without waiting for pageLoad';
then it works: if i render out the page in my test i can see that the js has run and updated the content. However, if i try to do the same thing with jquery
jQuery("#ajax_test_results").html("updated with basic jquery dom manipulation, without waiting for document.ready");
then it doesn't work. I think that jquery isn't being loaded, but i don't know how to go about debugging it.
Any ideas anyone? I saw this post which looked hopeful https://stackoverflow.com/questions/8428405/cucumber-tests-jquery-does-not-loaded-in-webdriver but config.assets.debug = true
causes an error for me - i think it's rails 3 only. Is there a rails 2 equivalent? or some other solution?
Grateful for any advice - max