Skip to content

Instantly share code, notes, and snippets.

@ohrite
Created July 15, 2021 19:09
Show Gist options
  • Save ohrite/ffb979063e0d970f2037e2981970ce9e to your computer and use it in GitHub Desktop.
Save ohrite/ffb979063e0d970f2037e2981970ce9e to your computer and use it in GitHub Desktop.
Setting up Teaspoon with Webpacker
# Gemfile
group :test do
gem 'webdrivers'
end
# app/packs/spec.js
const specContext = require.context("../../spec/javascript", true, /_spec\.js$/)
specContext.keys().forEach(specContext)
# spec/teaspoon_env.rb
require 'webdrivers'
Teaspoon.configure do |config|
...
config.suite do |suite|
...
suite.boot_partial = '/boot'
...
end
...
config.driver = :selenium
config.driver_options = {
client_driver: :chrome,
selenium_options: {
options: Selenium::WebDriver::Chrome::Options.new(args: ['headless', 'disable-gpu'])
}
}
end
# spec/javascript/fixtures/_boot.html.erb
<%= javascript_pack_tag 'spec', debug: @suite.config.expand_assets %>
<script type="text/javascript">
Teaspoon.onWindowLoad(Teaspoon.execute);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment