Commit ef55d493 authored by Simon Knox's avatar Simon Knox Committed by Rémy Coutable
Browse files

Make live_debug and CHROME_HEADLESS cooperate

When using CHROME_HEADLESS=0 you can already have a logged-in session on
the page, so no need to open the user's browser as well
parent 8ee8722f
......@@ -133,6 +133,8 @@ CHROME_HEADLESS=0 bundle exec rspec some_spec.rb
The test will go by quickly, but this will give you an idea of what's happening.
Using `live_debug` with `CHROME_HEADLESS=0` pauses the open browser, and does not
open the page again. This can be used to debug and inspect elements.
You can also add `byebug` or `binding.pry` to pause execution and [step through](../
the test.
......@@ -6,11 +6,17 @@ module LiveDebugger
def live_debug
puts "Current example is paused for live debugging."
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"
puts "Opening #{current_url} in your default browser..."
puts "The current user credentials are: #{@current_user.username} / #{@current_user.password}" if @current_user
puts "Press any key to resume the execution of the example!!"
`open #{current_url}`
`open #{current_url}` if ENV['CHROME_HEADLESS'] !~ /^(false|no|0)$/i
loop until $stdin.getch
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment