Skip to content

Page 62: Integration tests fail #7

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

Open
neeklamy opened this issue Sep 6, 2016 · 3 comments
Open

Page 62: Integration tests fail #7

neeklamy opened this issue Sep 6, 2016 · 3 comments

Comments

@neeklamy
Copy link

neeklamy commented Sep 6, 2016

I can’t get the integration test introduced in Adding Integration Tests to work without modification.

This is the error message reported:

Failures:

  1) Books list page
     Failure/Error: raise ActionController::RoutingError, "No route matches [#{env[ 'REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}"

     ActionController::RoutingError:
       No route matches [GET] "/ember-cli-live-reload.js"

[…]

     # --- Caused by: ---
     # Capybara::ExpectationNotMet:
     #   expected to find text "Books" in "Loading..."

[…]

Before:

# spec/features/books_spec.rb

require 'rails_helper'

feature 'Books', js: true do
  scenario 'list page' do
    visit '/'
    expect(page).to have_content('Books')
  end
end

And here’s the spec after I modified it:

require 'rails_helper'
Capybara.raise_server_errors = false

feature 'Book', js: true do
  scenario 'list page' do
    visit '/'
    sleep 5.second # !important
    expect(page).to have_content('Book')
  end
end

If I leave out the Capybara.raise_server_errors = false, then the RoutingErrors still appear. If I leave out the sleep 5.second, then the browser window pops open and closes before the page has loaded.

@jasonswett
Copy link
Owner

Hmm, I don't like that you have to have a sleep. You shouldn't have to do that. What if you kill the line in index.html that contains ember-cli-live-reload.js?

@neeklamy
Copy link
Author

neeklamy commented Sep 9, 2016

That does it perfectly, thanks Jason. I also got rid of the Capybara override too.

There doesn’t seem to be any implications of doing this, I presume because of the Livereload server?

@jasonswett
Copy link
Owner

I don't know. The ember-cli-live-reload.js thing goes away in Angular CLI 1.0.0-beta.11-webpack.8 anyway, so it will become a non-issue soon. (I'm currently working on updating the book for that CLI version, by the way, which uses Angular 2.0.0RC5.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants