lib/cypress_rails/cli.rb in cypress_rails-0.6.0 vs lib/cypress_rails/cli.rb in cypress_rails-0.7.0
- old
+ new
@@ -4,11 +4,11 @@
require "cypress_rails/runner"
require "cypress_rails/server"
module CypressRails
Config = Struct.new(
- :command, :cypress_bin_path, :host, :log_path, :tests_path, :healthcheck_url
+ :command, :cypress_bin_path, :host, :log_path, :tests_path, :healthcheck_url, :browser
)
class CLI < Thor
class_option :command,
type: :string,
@@ -39,17 +39,24 @@
type: :string,
desc: <<~DESC,
url to ping the server before running tests (you don't need the port, it will be injected)
DESC
aliases: %w(-u)
+ class_option :browser,
+ type: :string,
+ desc: <<~DESC,
+ which browser to use with test command, allowed values: chrome, electron
+ DESC
+ default: "chrome",
+ aliases: %w(-b)
desc "test", "Run all tests in headless mode"
def test
server.start do |host, port|
exit Runner.new(
host: host, port: port, bin_path: config.cypress_bin_path, tests_path: config.tests_path
- ).run
+ ).run(config.browser)
end
end
desc "open", "Start the server and open Cypress Dashboard"
def open
@@ -67,10 +74,10 @@
end
def config
@config ||= Config.new(
*options.values_at(
- :command, :cypress_bin_path, :host, :log_path, :tests_path, :healthcheck_url
+ :command, :cypress_bin_path, :host, :log_path, :tests_path, :healthcheck_url, :browser
)
)
end
end
end