Created
July 15, 2021 19:09
-
-
Save ohrite/ffb979063e0d970f2037e2981970ce9e to your computer and use it in GitHub Desktop.
Setting up Teaspoon with Webpacker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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