Skip to content

Commit

Permalink
Fixed tests for the search page
Browse files Browse the repository at this point in the history
  • Loading branch information
pschijven committed Sep 26, 2023
1 parent f5b6c39 commit f100509
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/integration/search_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class SearchTest < ActionDispatch::IntegrationTest
visit search_path(lang: 'en', format: 'html')

[{
type: 'Labels', query: 'Forest', query_type: 'contains',
amount: 1, result: 'Forest'
}].each { |q|
type: 'Labels', query: 'Forest', query_type: 'contain keyword',
amount: 1, result: 'Forest'
}].each { |q|
find('#t').select q[:type]
fill_in 'Search term(s)', with: q[:query]
find('#qt').select q[:query_type]
Expand All @@ -62,7 +62,7 @@ class SearchTest < ActionDispatch::IntegrationTest
click_button('Search')

assert page.has_css?('.search-result', count: q[:amount]),
"Page has #{page.all(:css, '.search-result').count} '.search-result' nodes. Should be #{q[:amount]}."
"Page has #{page.all(:css, '.search-result').count} '.search-result' nodes. Should be #{q[:amount]}."

within('.search-result') do
assert page.has_content?(q[:result]), "Could not find '#{q[:result]}' within '.search-result'."
Expand All @@ -74,7 +74,7 @@ class SearchTest < ActionDispatch::IntegrationTest
visit search_path(lang: 'en', format: 'html')

find('#t').select 'Labels'
find('#qt').select 'contains'
find('#qt').select 'contain keyword'
fill_in 'Search term(s)', with: 'Alpha'
click_button('Search')
assert page.has_css?('.search-result', count: 1)
Expand Down Expand Up @@ -119,7 +119,7 @@ class SearchTest < ActionDispatch::IntegrationTest
visit search_path(lang: 'en', format: 'html')

find('#t').select 'Labels'
find('#qt').select 'contains'
find('#qt').select 'contain keyword'
fill_in 'Search term(s)', with: 'res'
find('#c').select @collection.to_s

Expand Down Expand Up @@ -160,7 +160,7 @@ class SearchTest < ActionDispatch::IntegrationTest
visit search_path(lang: 'en', format: 'html')

find('#t').select 'Notes'
find('#qt').select 'contains'
find('#qt').select 'contain keyword'
fill_in 'Search term(s)', with: 'ipsum'
find('#c').select @collection.to_s

Expand All @@ -179,7 +179,7 @@ class SearchTest < ActionDispatch::IntegrationTest
visit search_path(lang: 'en', format: 'html')

find('#t').select 'Labels'
find('#qt').select 'exact match'
find('#qt').select 'exactly match'
fill_in 'Search term(s)', with: ''
find('#c').select @collection.to_s

Expand Down Expand Up @@ -208,7 +208,7 @@ class SearchTest < ActionDispatch::IntegrationTest
visit search_path(lang: 'en', format: 'html')

find('#t').select 'Labels'
find('#qt').select 'contains'
find('#qt').select 'contain keyword'
fill_in 'Search term(s)', with: 'sample_'

click_button('Search')
Expand Down

0 comments on commit f100509

Please sign in to comment.