A platform for community discussion. Free, open, simple.
DEV: Add remove debugging URLs to system spec helper (#29722)
David Taylor86a2558f5f09
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rbindex 503bfc7f7e4..863bb198741 100644--- a/spec/rails_helper.rb+++ b/spec/rails_helper.rb@@ -1030,6 +1030,7 @@ def apply_base_chrome_options(options)options.add_argument("--no-sandbox")options.add_argument("--disable-dev-shm-usage")options.add_argument("--mute-audio")+ options.add_argument("--remote-allow-origins=*")# A file that contains just a list of paths like so:#diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rbindex 6e6ee1e30c8..55cc4128625 100644--- a/spec/support/system_helpers.rb+++ b/spec/support/system_helpers.rb@@ -5,11 +5,23 @@ module SystemHelpersPLATFORM_KEY_MODIFIER = RUBY_PLATFORM =~ /darwin/i ? :meta : :controldef pause_test- result =- ask(- "\n\e[33mTest paused, press enter to resume, type `d` and press enter to start debugger.\e[0m",- )+ msg = "Test paused. Press enter to resume, or `d` + enter to start debugger.\n\n"+ msg += "Browser inspection URLs:\n"++ # Fetch devtools urls+ base_url = page.driver.browser.send(:devtools_address)+ uri = URI(base_url)+ response = Net::HTTP.get(uri.hostname, "/json/list", uri.port)+ JSON+ .parse(response)+ .each do |result|+ msg +=+ " - (#{result["type"]}) #{base_url}#{result["devtoolsFrontendUrl"]} (#{URI(result["url"]).path})\n"+ end++ result = ask("\n\e[33m#{msg}\e[0m")binding.pry if result == "d" # rubocop:disable Lint/Debugger+ puts "\e[33mResuming...\e[0m"selfend