Skip to content

Commit

Permalink
Switching to chromedriver for tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jejacks0n committed Apr 29, 2019
1 parent 059ad1e commit 1d95ed2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rvm:
- 2.5.0
- 2.6.0
addons:
firefox: latest
chrome: stable
gemfile:
- gemfiles/rails_5.gemfile
- gemfiles/rails_6.gemfile
Expand All @@ -15,10 +15,6 @@ env:
- TEASPOON_DEVELOPMENT=true
before_script:
- sh -e /etc/init.d/xvfb start
- npm install -g istanbul
- wget https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz
- mkdir geckodriver && tar -xzf geckodriver-v0.19.1-linux64.tar.gz -C geckodriver
- export PATH=$PATH:$PWD/geckodriver
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
Expand Down
8 changes: 0 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@ gemspec name: "teaspoon"
gemspec name: "teaspoon-devkit"

gem "rails"
gem "puma"

# frameworks
gem "teaspoon-jasmine", path: "teaspoon-jasmine"
gem "teaspoon-mocha", path: "teaspoon-mocha"
gem "teaspoon-qunit", path: "teaspoon-qunit"

# gems that teaspoon can utilize
gem "selenium-webdriver"

# test dependencies
gem "rspec-rails"
gem "simplecov"

# services
gem "rubocop", require: false
gem "rubocop-rails_config"
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
end

config.before(:each, browser: true) do
Capybara.current_driver = Capybara.javascript_driver
Capybara.current_driver = Capybara.javascript_driver = ENV.fetch("CAPYBARA_DRIVER", "chrome_headless").to_sym
end
end
13 changes: 13 additions & 0 deletions spec/support/capybara.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require "webdrivers"

def register_driver(name, args = [], opts = {})
Capybara.register_driver(name) do |app|
options = { args: args + ["window-size=1440,1080"] }
options[:binary] = ENV.fetch("GOOGLE_CHROME_SHIM", nil)
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: options.compact)
Capybara::Selenium::Driver.new(app, { browser: :chrome, desired_capabilities: capabilities }.merge(opts))
end
end

register_driver(:chrome)
register_driver(:chrome_headless, %w[headless disable-gpu no-sandbox disable-dev-shm-usage])
3 changes: 3 additions & 0 deletions teaspoon-devkit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ Gem::Specification.new do |s|
s.add_dependency "jquery-rails"

# test dependencies
s.add_dependency "puma"
s.add_dependency "rspec-rails"
s.add_dependency "webdrivers"
s.add_dependency "capybara"
s.add_dependency "aruba"
s.add_dependency "appraisal"
s.add_dependency "simplecov"

# for local bundle installs
s.add_dependency "jbuilder"
Expand Down

0 comments on commit 1d95ed2

Please sign in to comment.