Commit 4dec0635 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '22205-live_debug-shouldn-t-open-new-page-if-chrome_headless-is-false' into 'master'

Resolve "live_debug shouldn't open new page if CHROME_HEADLESS is false"

Closes #22205

See merge request gitlab-org/gitlab!20755
parents 8ee8722f ef55d493
...@@ -133,6 +133,8 @@ CHROME_HEADLESS=0 bundle exec rspec some_spec.rb ...@@ -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. 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) You can also add `byebug` or `binding.pry` to pause execution and [step through](../pry_debugging.md#stepping)
the test. the test.
......
...@@ -6,11 +6,17 @@ module LiveDebugger ...@@ -6,11 +6,17 @@ module LiveDebugger
def live_debug def live_debug
puts puts
puts "Current example is paused for live debugging." 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 "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!!" 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 loop until $stdin.getch
......
Markdown is supported
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