DEV: Support --headful to run system test in headful mode in bin/rspec (#31815)

Having to type `SELENIUM_HEADLESS=0` everytime is annoying and hard to
remember.
This commit is contained in:
Alan Guo Xiang Tan
2025-03-14 10:04:31 +08:00
committed by GitHub
parent e9244ebc68
commit ca835a8952

View File

@ -8,16 +8,17 @@
# this file is here to facilitate running it. # this file is here to facilitate running it.
# #
require 'pathname' require "pathname"
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)
Pathname.new(__FILE__).realpath)
require 'rubygems' require "rubygems"
require 'bundler/setup' require "bundler/setup"
if ENV["LOAD_PLUGINS"].nil? && ARGV.any? { |pattern| pattern.include?("plugins/") } if ENV["LOAD_PLUGINS"].nil? && ARGV.any? { |pattern| pattern.include?("plugins/") }
STDERR.puts "Detected plugin spec path, setting LOAD_PLUGINS to 1" STDERR.puts "Detected plugin spec path, setting LOAD_PLUGINS to 1"
ENV["LOAD_PLUGINS"] = "1" ENV["LOAD_PLUGINS"] = "1"
end end
load Gem.bin_path('rspec-core', 'rspec') ENV["SELENIUM_HEADLESS"] = "0" if ARGV.delete("--headful")
load Gem.bin_path("rspec-core", "rspec")