Skip to content
Snippets Groups Projects
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
Branches 300400-fix-size-mini-pipeline-mr-widget
No related tags found
No related merge requests found
Loading
Loading
@@ -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](../pry_debugging.md#stepping)
the test.
Loading
Loading
Loading
Loading
@@ -6,11 +6,17 @@ module LiveDebugger
def live_debug
puts
puts "Current example is paused for live debugging."
puts "Opening #{current_url} in your default browser..."
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
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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment