If you are running a cucumber scenario and it fails most of the time you need to inspect what’s wrong and you want to look at the page why it does not work as expected.
Usually you would add the step
Then show me the page
Then run it again and look at the page. Wouldn’t it be better to open the page right away after a failing step?
Just add following snippet in an existing step, I have it in a new file support/open_on_failure_steps.rb
After do |scenario|
if scenario.status == :failed
save_and_open_page
end
end
and it will automatically open the failed page for you.