I am using spinach, Capybara, and Poltergeist together to write automated UI tests. I have been trying to speed up running tests locally. I am using Spring which helps a little with the environment loading. However, the first request (visit
) to the app server that Poltergeist starts is slow because Rails has to compile the assets the first time. I have tried starting a locally server in the test environment and then doing this in my spinach env.rb
file:
::Capybara.run_server = false
::Capybara.app_host = "http://localhost:#{ENV['TEST_SERVER_PORT']}"
This makes debugging difficult because the web server is running in a different process than the spinach process. Also, precompiling assets is not a good solution because I don't want to have to run it every time I am tweaking things in a JS file and then running the tests to verify my changes.
Bottom line: has anyone figured out how to make the first test server request be faster?