I just heavily refactored the internals of Capybara, hopefully it
should be better structured and less messy now than it's been before.
These changes enable some major cool new functionality and some
breaking changes:
== All nodes returned by Capybara expose all session methods:
page.locate(:css, '#foo').fill_in('Bar', :with => 'baz')
page.locate(:css, '#foo').tap do |foo|
foo.fill_in('Bar', :with => 'baz')
foo.click_button('Go')
end
This is really the biggest change, hopefully it should make fore much
cleaner and more readable specs.
== Session#click has been renamed to Session#click_link_or_button
Otherwise it would have conflicted with Node#click now that all Nodes
expose all DSL methods. This method has generated some confusion
before, with people trying to pass in CSS/XPath selectors into it, I
think the rename is for the better.
<div class="contact">
<h1 id="foo1">Foo 1</h1>
</div>
<div class="contact">
<h1 id="foo2">Foo 2</h1>
</div>
and then the following code:
within('.contact') do
page.should have_css('#foo2')
end
Previously this would have passed, now it will fail! That's because
within will now grab the first element where it's locator matches, and
then execute the code block within that element.
/Jonas
Might this be the result of another breaking change?
And the "Description" field should contain "Quos (OTC) x 3 [3
times]" # features/step_definitions/web_steps.rb:149
expected: /Quos (OTC) x 3 [3 times]/,
got: "Quos (OTC) x 3 [3 times]" (using =~)
I tried upgrading my cucumber/capybara/webdriver stack to see if I
could alleviate the probolems I'm seeing with ajax scenarios. I see
this with both capybara 0.3.9 and 0.3.8. (I had been using 0.3.5)
And I can't quite figure out where script/cucumber install --capybara
is getting feature/steps/web_steps.rb from.
--
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
the problem is that locate is used internally for all kinds of stuff,
like finding fields for fill_in and friends. It might not make sense
to raise an error for those.
@Rick:
That's a really weird error, but afaik I haven't touched that part of
the code. Also the generated steps come from cucumber/rails not
Capybara.
/Jonas