tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

Feature testing with capybara and rspec does not work #432

Closed sstgithub closed 8 years ago

sstgithub commented 8 years ago

I've been trying to add Capybara feature tests (using rspec) to my app but none of the drivers seem to work. I have tried poltergeist, capybara-webkit, and selenium webdriver (chromedriver).

Every time, it seems to run but it fails because it receives an empty string for the page it's on. Using the selenium chromedriver should create a chrome browser window when it runs the test but it doesn't even do that.

Is there some configuration I am missing or is Capybara end-to-end feature testing just not supported with ember-cli-rails?

I've created a sample repo with this issue by forking the ember-cli-rails-heroku example app and adding in Capybara and a simple feature test here: repo

seanpdoyle commented 8 years ago

@sstgithub thanks for opening this issue!

I've looked over that repo and it seems to be that you haven't enabled JavaScript for the ember-cli-rails test:

https://github.com/jnicklas/capybara#using-capybara-with-rspec

Could you try with the following:

RSpec.feature "IndexPages", type: :feature, javascript: true do
  # ....
end
sstgithub commented 8 years ago

@seanpdoyle Turns out the syntax was actually js: true, but that fixed it, thanks!

The test is running extremely slow though, 1 minute and 20 seconds just for that simple test. Is this due to it having to spin up ember server and is there any way to lower this time?

seanpdoyle commented 8 years ago

@sstgithub that's good to hear!

The test is running extremely slow though, 1 minute and 20 seconds just for that simple test. Is this due to it having to spin up ember server and is there any way to lower this time?

This is a combination of ember building the app and the nature of js: true capybara tests.

is there any way to lower this time?

Nothing comes to mind. Fortunately, subsequent tests shouldn't need to ember build, and would only be as slow as other js: true tests.