Ask Cucumber with Capybara for inline HTML... now with CSS Selectors!
Two very useful cucumber steps:
When you're remoting in to your dev machine, you can't use "Then show me the page" because there is no desktop in which to open the browser... so I created "Then display the page". It outputs the HTML to the screen for your examination. This becomes very tedious when pages get long... after some help on the capybara mailing list, I created the second entry, which accepts a CSS selector.
1 2 3 4 5 6 7 |
Then 'display the page' do
puts "\n\n\n#{page.body.to_s}\n\n\n"
end
Then /^display "([^"]*)"$/ do |selector|
puts "\n\n\n#{find(selector).native.to_html}\n\n\n"
end
|
When you're remoting in to your dev machine, you can't use "Then show me the page" because there is no desktop in which to open the browser... so I created "Then display the page". It outputs the HTML to the screen for your examination. This becomes very tedious when pages get long... after some help on the capybara mailing list, I created the second entry, which accepts a CSS selector.