smparkes / capybara-envjs

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

Couldn't find element inside the FancyBox container #29

Open millisami opened 14 years ago

millisami commented 14 years ago

I'm using FancyBox to load the content via ajax request in a Rails3rc app.

The following is the feature which passes/works in development, testing via browser, but when I try to test it via envjs, it blows up. Then I should see "You are Doing Good" within "#fancybox-inner" # features/step_definitions/websteps.rb:107 scope '//[@id = 'fancybox-inner']' not found on page (Capybara::ElementNotFound) ./features/step_definitions/web_steps.rb:14:in with_scope' ./features/step_definitions/web_steps.rb:108:in/^(?:|I )should see "([^"]_)"(?: within "([^"]*)")?$/' features/homepage.feature:34:in `Then I should see "You are Doing Good" within "#fancybox-inner"' This is the generated link to be clicked. Do Good

And this is the jquery/fancybox hook that makes it work. jQuery(document).ready(function($) { $("a.do_good_order").fancybox({ 'hideOnContentClick': true, 'width': 400, 'height': 300, 'autoScale': false, 'autoDimensions': false }); });

From the error above, its complaining about the scope '//*[@id = 'fancybox-inner']' not found on page (Capybara::ElementNotFound)

So, my question is, does capybara-envjs supports or can detect the elements inside the #fancybox-inner div which is a overlayed container of FancyBox??

smparkes commented 14 years ago

Overlays should be fine: they're still in the DOM.

You could try seeing if it's getting created, by looking at the innerHTML of the container ...

millisami commented 14 years ago

Well, the same code above does work with selenium webdriver when I run the feature. I hope this confirms that the innerHTML is right.

When I change the capybara driver to use envjs, it fails.

smparkes commented 14 years ago

Sorry; didn't mean to imply that the code wasn't right. I actually suspect some event processing isn't working and the overlay DOM elements aren't getting created. But I'm not sure.

Can you put an example somewhere I can try?

millisami commented 14 years ago

Alright, here is the repo http://github.com/millisami/capybara-envjs-experiment It has two branches. master branch has the selenium one which works and another branch named envjs, which uses the envjs modified one which is failing.

smparkes commented 14 years ago

Thanks. I'll try to look at this this weekend.

millisami commented 14 years ago

Sure, I am waiting eagerly coz I don't like the selenium opening firefox everytime. It drgas me.

millisami commented 14 years ago

Hi, did you get any time to look up the problem??

smparkes commented 14 years ago

Still trying. Time's tight.

smparkes commented 14 years ago

Looks like you need style support that's not in envjs.

I had to tweak a couple of things to get the test to work: I had to comment-out the javascript emulation stuff in the config and it looks like the javascript support was turned off (#@javascript?)

When I did that, it caused errors in env-js's timer loop. The fancybox code is trying to do something with the CSS style attribute which is not currently supported (at least in the johnson fork ... not sure where the rhino port stands on this).

millisami commented 14 years ago

So, does that mean I have to abandon it for a while ?

smparkes commented 14 years ago

At this point, I don't see this getting worked on by me in the next month or two. I'd like to, at some point, but I'm not sure when that's going to be possible. So unless someone steps up ...