Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialLouis Magnotti
4,402 PointsCapybara::ElementNotFound: Error - Authenticating Rails ODOT
I am stuck and can't get my bin/rake to pass. Here's the failures I'm getting.
''' Failures:
1) Editing todo lists displays an error with no title
Failure/Error: within "#todo_list_#{todo_list.id}" do
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/features/todo_lists/edit_spec.rb:14:in `update_todo_list'
# ./spec/features/todo_lists/edit_spec.rb:54:in `block (2 levels) in <top (required)>'
2) Editing todo lists updates a todo list successfully with correct information
Failure/Error: within "#todo_list_#{todo_list.id}" do
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/features/todo_lists/edit_spec.rb:14:in `update_todo_list'
# ./spec/features/todo_lists/edit_spec.rb:24:in `block (2 levels) in <top (required)>'
3) Editing todo lists displays an error with too short a title
Failure/Error: within "#todo_list_#{todo_list.id}" do
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/features/todo_lists/edit_spec.rb:14:in update_todo_list'
# ./spec/features/todo_lists/edit_spec.rb:44:in
block (2 levels) in <top (required)>'
4) Editing todo lists displays an error with no description
Failure/Error: within "#todo_list_#{todo_list.id}" do
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/features/todo_lists/edit_spec.rb:14:in update_todo_list'
# ./spec/features/todo_lists/edit_spec.rb:49:in
block (2 levels) in <top (required)>'
5) Editing todo lists displays an error with no title
Failure/Error: within "#todo_list_#{todo_list.id}" do
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/features/todo_lists/edit_spec.rb:14:in update_todo_list'
# ./spec/features/todo_lists/edit_spec.rb:36:in
block (2 levels) in <top (required)>'
6) Deleting todo items is successful
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/delete_spec.rb:9:in
block (2 levels) in <top (required)>'
7) Editing todo items is successful with valid content
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/edit_spec.rb:9:in
block (2 levels) in <top (required)>'
8) Editing todo items is unsuccessful with not enough content
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/edit_spec.rb:34:in
block (2 levels) in <top (required)>'
9) Editing todo items is unsuccessful with no content
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/edit_spec.rb:21:in
block (2 levels) in <top (required)>'
10) todo_lists/index renders a list of todo_lists Failure/Error: assert_select "tr>td", :text => "Title".to_s, :count => 2 Minitest::Assertion: Expected exactly 2 elements matching "tr > td", found 0.. Expected: 2 Actual: 0 # ./spec/views/todo_lists/index.html.erb_spec.rb:20:in `block (2 levels) in <top (required)>'
11) Completing todo items is successful when marking a single item complete
Failure/Error: visit_todo_list todo_list
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/complete_spec.rb:9:in
block (2 levels) in <top (required)>'
12) Completing todo items with completed items shows completed items as complete
Failure/Error: visit_todo_list todo_list
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/complete_spec.rb:21:in
block (3 levels) in <top (required)>'
13) Completing todo items with completed items does not give the option to make complete
Failure/Error: visit_todo_list todo_list
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/complete_spec.rb:28:in
block (3 levels) in <top (required)>'
14) Viewing todo items displays the title of the todo list
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/index_spec.rb:8:in
block (2 levels) in <top (required)>'
15) Viewing todo items displays item content when a todo list has items
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/index_spec.rb:23:in
block (2 levels) in <top (required)>'
16) Viewing todo items displays no items when a todo list is empty
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/index_spec.rb:15:in
block (2 levels) in <top (required)>'
17) Deleting todo lists is successful when clicking the destroy link Failure/Error: within "#todo_list_#{todo_list.id}" do Capybara::ElementNotFound: Unable to find css "#todo_list_1" # ./spec/features/todo_lists/destroy_spec.rb:9:in `block (2 levels) in <top (required)>'
18) Adding todo items is successful with valid content
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/create_spec.rb:9:in
block (2 levels) in <top (required)>'
19) Adding todo items displays an error with content les than 2 characters long
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/create_spec.rb:31:in
block (2 levels) in <top (required)>'
20) Adding todo items displays an error with no content
Failure/Error: visit_todo_list(todo_list)
Capybara::ElementNotFound:
Unable to find css "#todo_list_1"
# ./spec/support/todo_list_helpers.rb:4:in visit_todo_list'
# ./spec/features/todo_items/create_spec.rb:20:in
block (2 levels) in <top (required)>'
'''
2 Answers
Kevin Wilbourn
6,333 PointsEach of these hinge on the css id "todo_list_1" is missing. Within app/views/todo_lists/index.html.erb you may be missing a statement on or about line 14:
<tr id="<%= dom_id(todo_list) %>">
Notice that the table row has been augmented with a dom_id referencing the todo_list. This will put the #todo_list_1 CSS id in place and should correct your testing errors.
Louis Magnotti
4,402 PointsGot it! Forgot an = after id
I had id"<%= dom_id
it needed to be
id="<%= dom_id
Louis Magnotti
4,402 PointsLouis Magnotti
4,402 PointsHey Kevin! Thanks for the quick reply.
This is my new problem.
1) Viewing todo items displays the title of the todo list Failure/Error: within("h1") do Capybara::Ambiguous: Ambiguous match, found 2 elements matching css "h1" # ./spec/features/todo_items/index_spec.rb:9:in `block (2 levels) in <top (required)>'
2) Viewing todo items displays item content when a todo list has items Failure/Error: expect(page.all("ul.todo_items li").size).to eq(2)
3) Adding todo items is successful with valid content Failure/Error: within("ul.todo_items") do Capybara::ElementNotFound: Unable to find css "ul.todo_items" # ./spec/features/todo_items/create_spec.rb:14:in `block (2 levels) in <top (required)>'
4) todo_lists/index renders a list of todo_lists Failure/Error: assert_select "tr>td", :text => "Title".to_s, :count => 2 Minitest::Assertion: Expected exactly 2 elements matching "tr > td", found 0.. Expected: 2 Actual: 0 # ./spec/views/todo_lists/index.html.erb_spec.rb:20:in `block (2 levels) in <top (required)>'