Commit f8bd9625 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'rs-fix-todos-filtering-spec' into 'master'

Improve validity of spec/features/todos/todos_filtering_spec.rb

Previously, we were checking that a CSS selector string didn't have some
page-related content, which, of course it didn't.

Now we check against the actual content of the selector, we use a more
semantic selector, and we add an additional expectation for the text
that _should_ be there, as an additional sanity check.

See merge request !6356
parents 44a4274c e7e628bf
...@@ -29,8 +29,11 @@ describe 'Dashboard > User filters todos', feature: true, js: true do ...@@ -29,8 +29,11 @@ describe 'Dashboard > User filters todos', feature: true, js: true do
fill_in 'Search projects', with: project_1.name_with_namespace fill_in 'Search projects', with: project_1.name_with_namespace
click_link project_1.name_with_namespace click_link project_1.name_with_namespace
end end
wait_for_ajax wait_for_ajax
expect('.prepend-top-default').not_to have_content project_2.name_with_namespace
expect(page).to have_content project_1.name_with_namespace
expect(page).not_to have_content project_2.name_with_namespace
end end
it 'filters by author' do it 'filters by author' do
...@@ -39,8 +42,11 @@ describe 'Dashboard > User filters todos', feature: true, js: true do ...@@ -39,8 +42,11 @@ describe 'Dashboard > User filters todos', feature: true, js: true do
fill_in 'Search authors', with: user_1.name fill_in 'Search authors', with: user_1.name
click_link user_1.name click_link user_1.name
end end
wait_for_ajax wait_for_ajax
expect('.prepend-top-default').not_to have_content user_2.name
expect(find('.todos-list')).to have_content user_1.name
expect(find('.todos-list')).not_to have_content user_2.name
end end
it 'filters by type' do it 'filters by type' do
...@@ -48,8 +54,11 @@ describe 'Dashboard > User filters todos', feature: true, js: true do ...@@ -48,8 +54,11 @@ describe 'Dashboard > User filters todos', feature: true, js: true do
within '.dropdown-menu-type' do within '.dropdown-menu-type' do
click_link 'Issue' click_link 'Issue'
end end
wait_for_ajax wait_for_ajax
expect('.prepend-top-default').not_to have_content ' merge request !'
expect(find('.todos-list')).to have_content issue.to_reference
expect(find('.todos-list')).not_to have_content merge_request.to_reference
end end
it 'filters by action' do it 'filters by action' do
...@@ -57,7 +66,10 @@ describe 'Dashboard > User filters todos', feature: true, js: true do ...@@ -57,7 +66,10 @@ describe 'Dashboard > User filters todos', feature: true, js: true do
within '.dropdown-menu-action' do within '.dropdown-menu-action' do
click_link 'Assigned' click_link 'Assigned'
end end
wait_for_ajax wait_for_ajax
expect('.prepend-top-default').not_to have_content ' mentioned '
expect(find('.todos-list')).to have_content ' assigned you '
expect(find('.todos-list')).not_to have_content ' mentioned '
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment