smparkes / capybara-envjs

Capybara driver for envjs gem
http://github.com/smparkes/capybara-envjs
130 stars 10 forks source link

Can't get simple test to work #14

Open phillipkoebbe opened 14 years ago

phillipkoebbe commented 14 years ago

I'm not sure where the best place is to post this, so if here isn't right, I'm sorry.

I'm trying to get a very simple test of capybara-envjs working, and am not having any success. I have a very simple rails app at http://github.com/phillipkoebbe/envjs_test that has an html page in root (/envjs_test.html). On that page is a button that calls a JS function to hide one div and show another div. There is a cucumber feature in features/a_test.feature that has a non javascript scenario (to prove that the hidden div is not visible) and a javascript scenario that should be visible if JS is working.

The tests all pass when using the @javascript tag (both with the selenium and culerity drivers), but when I try the @envjs tag, it fails with a message that indicates the onclick of the button didn't work, meaning javascript support isn't there.

I have also tried to set the javascript_driver to :envjs, but get the "unknown driver" error from capybara when I do.

I just updated all gems this morning, but here is a list of versions:

capybara (0.3.8) capybara-envjs (0.1.3, 0.1.2) cucumber (0.7.3, 0.7.2, 0.6.3, 0.6.2) cucumber-rails (0.3.1, 0.3.0, 0.2.4) culerity (0.2.10, 0.2.9) envjs (0.3.5, 0.3.4) gherkin (1.0.30, 1.0.26) johnson (2.0.0.pre3) rack-test (0.5.3) rails (2.3.5, 1.2.6) selenium-webdriver (0.0.18)

Does it matter that I'm using Prototype and not JQuery?

Anything else you need to know?

Peace.

drnic commented 14 years ago

Try including the gem like:

config.gem 'capybara-envjs', :lib => 'capybara/envjs', :version => '>= 0.1.3'
phillipkoebbe commented 14 years ago

Hi Dr. Nic,

Thanks. for the suggestion. I added that to cucumber's environment, but got the same result.

Peace.

smparkes commented 14 years ago

Yeah, your project looks okay. You're running into weakness in the support for CSS in envjs and in capybara-envjs. Since envjs doesn't render content, style support has never been a high priority. The display property is kind of a special case that would be nice to support, but, unfortunately, it's not there yet.

Most of the work in envjs is done and much of styling works (to some extent), but I don't think that includes treating the style as a generic attribute, which the capybara driver needs. As far as I can tell, ele.getAttribute("style") doesn't do the right thing (checked against chrome).

http://envjs.lighthouseapp.com/projects/21590-envjs/tickets/172-elgetattributestyle