Search code examples
javascriptruby-on-railscucumberruby-enterprise-editionheadless-browser

Headless JavaScript testing in ree + cucumber


Is there a way to do headless javascript testing in ree (Ruby Enterprise Edition)?

I've seen celerity/culerity/capybara, which work with jruby + HTMLUnit, but I can't seem to get it working with ree. When I simply try to annotate my cucumber test with @culerity under ree, I get jruby: command not found, which of course makes sense, because I'm running under ree, not jruby.


Solution

  • I have been looking at different libraries to do headless javascript testing.

    I have tried akephalos, based on HTMLUnit, which was really promising, but I was unable to get tests working that worked with selenium.

    I am now using capybara-webkit, and it works flawlessly. You will need to install Qt before installing the gem. But once that is done (and on ubuntu it is really easy to install), you just add the gem to your Gemfile

    gem "capybara-webkit"
    

    And set your Capybara Javascript driver to webkit:

    Capybara.javascript_driver = :webkit
    

    And you are good to go. Hope this helps.