Skip to content

Commit

Permalink
Disable :js tests if Chrome is unavailable
Browse files Browse the repository at this point in the history
We use Google Chrome (via Cuprite) to run feature tests with client-side
JavaScript. This updates the `spec_helper` to first detect whether Chrome
is available, and if not, disable `:js` tests. This is because not all
developers will have Chrome available on their machine.

We've only got one test that requires JavaScript so I thought this
would be a simpler approach for now, if we add more then we might want
to consider adding a Selenium WebDriver for Firefox or Safari as an
alternative.
  • Loading branch information
thomasleese committed Dec 16, 2024
1 parent e0f017b commit db37666
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@

config.filter_run_excluding :local_users

if ENV["CI"].blank?
begin
Ferrum::Browser.new
rescue Ferrum::BinaryNotFoundError
config.filter_run_excluding :js
end
end

config.infer_spec_type_from_file_location!

config.define_derived_metadata(file_path: %r{/spec/components/}) do |metadata|
Expand Down

0 comments on commit db37666

Please sign in to comment.