-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testing workflow? #318
Comments
The assets are being compiled in the test environment during controller and system tests: https://github.com/rails/webpacker/blob/master/lib/tasks/webpacker/compile.rake#L30-L31 It seems like it would also make sense that this would happen when bare My workaround at this point is to add the following to the Rake::Task["test"].enhance(["webpacker:compile_before_test"]) Does it make sense to include this by default? |
Ah, I see. We're still on Rails 4.2, but I guess we could add that to our |
I noticed that works too, but having to run a separate process to get tests working is a very non-ideal developer experience. |
The above workaround doesn't work with rspec (frustratingly). Not sure what to do there, and not familiar enough with rspec to recommend an avenue to support it, unfortunately. |
Being that we're more likely than not to have the dev server already running, it isn't too much a pain on our end, and there's the upshot that it will also speed up spec runs by not needing to compile assets on each run. But it would be nice to have something that's a little more transparent. |
maybe you can benefit from this issue: #59. Especially with the latest version of webpacker, you may not be able to use the running webpack-dev-server in your test environment, because webpacker will search for |
No that should work because the manifest is written to file regardless of what binstub you use 👍 Will probably setup a base test helper to address this |
We changed |
thanks @mockdeep, removing the RSpec.configure do |config|
config.before(:each, selenium: true) do
Capybara.server_port = 8080
end
end |
After #360 this seems like a non-issue. Feel free to open another ticket if something else pops up 👍 |
Awesome, thanks @javan, @gauravtiwari! This looks like it'll do the trick. |
Document this in README/guide - #372 |
While the documentation gets updated, can someone tell me what the conclusion here is in terms of using Webpacker to write Capybara tests that rely on JavaScript? Is it as simple as running |
I just fought with this rspec and CircleCI. It came down to simply adding |
We're trying to set up Webpacker in our Rails 4.2 project and we've more or less got it working, but we've got some unanswered questions. In particular, if we're trying to run Capybara feature tests locally, do we always need to run
RAILS_ENV=test ./bin/rails webpacker:compile
beforehand? Or is there some other workflow that makes sense for this? One option we're considering is doing that on CI, but when we're developing locally having the tests fall back to relying on the dev server.The text was updated successfully, but these errors were encountered: