how find selector on page?

3 views
Skip to first unread message

Zlodiak Zlodiak

unread,
Aug 19, 2015, 4:39:01 AM8/19/15
to rubyonra...@googlegroups.com
please help solve the problem. i use rails4 + rspec2 + pry + capybara.

my test:
describe 'albums?' do
it 'check albums page' do
user = FactoryGirl.create(:user)
visit user_albums_path(user.id)
expect(response.status).to eq(200)
expect(response).to render_template(:index)
binding.pry
expect(page).to have_selector('.albums_list_label')
end
end

i run in console:
rspec spec

and i output DOM response:
[1] pry(#<RSpec::ExampleGroups::PersonsController::Albums>)> puts
page.body

result:
.....
........
<h1>
<span class="albums_list_label" id="albumsListLabel">Список
альбомов</span>
<span class="name">:: us7</span>
</h1>
.........
............

but when i run:
continue

i get follow error message:
.F............
Failures:
1) AlbumsController index action check albums page
Failure/Error: expect(page).to have_selector(".albums_list_label")
expected to find css ".albums_list_label" but there were no
matches


problem: element with class .albums_list_label contains in server
response (DOM), but test is failed

--
Posted via http://www.ruby-forum.com/.
Reply all
Reply to author
Forward
0 new messages