2019-07-25 01:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-10-16 04:37:53 -04:00
|
|
|
require 'io/console'
|
|
|
|
|
|
|
|
module LiveDebugger
|
|
|
|
def live_debug
|
2017-11-02 07:02:51 -04:00
|
|
|
puts
|
|
|
|
puts "Current example is paused for live debugging."
|
2019-12-10 07:07:55 -05:00
|
|
|
|
|
|
|
if ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i
|
|
|
|
puts "Switch to the Chrome window that was automatically opened to run the test in order to view current page"
|
|
|
|
else
|
|
|
|
puts "Opening #{current_url} in your default browser..."
|
|
|
|
end
|
|
|
|
|
2017-11-02 07:02:51 -04:00
|
|
|
puts "The current user credentials are: #{@current_user.username} / #{@current_user.password}" if @current_user
|
2017-10-26 12:03:33 -04:00
|
|
|
puts "Press any key to resume the execution of the example!!"
|
2017-10-16 04:37:53 -04:00
|
|
|
|
2019-12-10 07:07:55 -05:00
|
|
|
`open #{current_url}` if ENV['CHROME_HEADLESS'] !~ /^(false|no|0)$/i
|
2017-10-17 11:42:21 -04:00
|
|
|
|
2017-10-26 12:03:33 -04:00
|
|
|
loop until $stdin.getch
|
2017-10-17 11:42:21 -04:00
|
|
|
|
2017-10-16 04:37:53 -04:00
|
|
|
puts "Back to the example!"
|
|
|
|
end
|
|
|
|
end
|