Skip to content

Page 62: Integration tests fail #7

Open
@neeklamy

Description

@neeklamy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions