I am using the latest Capybara (2.0.2), Capybara-Webkit (0.14.2), and Qt (4.8.4).
I have a form which gets displayed in a Twitter Bootstrap modal dialog after the user clicks a link. In my integration test I am loading the page, checking that the modal form is not visible, clicking the link, and then attempting to assert that the form is visible.
The form #eligibility_question is added to the DOM and made visible as a result of an ajax call. It can be found:
(rdb:1) nq_modal = find '#eligibility_question'
#<Capybara::Element tag="form" path="/html/body[@id='users_matches']/div[2]/div[@id='content']/div[@id='seach_results']/div[1]/div[@id='next_question']/form[@id='eligibility_question']">
But is not visible:
(rdb:1) nq_modal.visible?
false
However, if I search for the xpath used by the default implementation of visible? in Capybara, no hidden elements are found:
(rdb:1) find(:xpath, ".//form[@id='eligibility_question']/ancestor-or-self::*[contains(@style, 'display:none') or contains(@style, 'display: none') or name()='script' or name()='head']")
Capybara::ElementNotFound Exception: Unable to find xpath ".//form[@id='eligibility_question']/ancestor-or-self::*[contains(@style, 'display:none') or contains(@style, 'display: none') or name()='script' or name()='head']"
And if I run the test using selenium instead of webkit, I see the form get displayed and the tests pass. The desired behavior is also observed running the app in a regular browser.
I am a little bit at a loss here and would appreciate any insight...
-Jesse