Skip to content

Instantly share code, notes, and snippets.

@rchampourlier
Created April 3, 2012 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rchampourlier/2294447 to your computer and use it in GitHub Desktop.
Save rchampourlier/2294447 to your computer and use it in GitHub Desktop.
Hooks for Cucumber, enabling to examine @javascript scenarios and deal with SSL
# features/support/hooks.rb
# This ensure SslRequirement is enabled for all scenarios, except
# if stated otherwise elsewhere (such as within Before('@javascript@'))
Before do
SslRequirement.disable_ssl_check = false
end
Before('@javascript') do
SslRequirement.disable_ssl_check = true
end
# Some hooks/examiners from https://makandracards.com/makandra/1687-prevent-the-selenium-webbrowser-window-from-closing-after-a-failed-javascript-step
AfterStep('@slow_motion') do
sleep 2
end
AfterStep('@single_step') do
print "Single Stepping. Hit enter to continue"
STDIN.getc
end
After('@leave_the_window_open') do |scenario|
if scenario.respond_to?(:status) && scenario.status == :failed
print "Step Failed. Press return to close browser"
STDIN.getc
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment