diff --git a/Gemfile b/Gemfile index ea3bccb4f7..4f4fd995f8 100644 --- a/Gemfile +++ b/Gemfile @@ -142,6 +142,8 @@ group :development, :test do gem 'rspec-its', '~> 1.2.0' gem 'email_spec', '~> 2.1.1' gem 'database_cleaner', '~> 1.7.0' + # Capybara 3 includes breaking changes + # https://cm-jira.usa.gov/browse/SRCH-2382 gem 'capybara', '~> 2.18.0' gem 'launchy', '~> 2.4.3' gem 'i18n-tasks', '~> 0.9.19' diff --git a/features/searches.feature b/features/searches.feature index afbe36d52c..0f60bbf5dd 100644 --- a/features/searches.feature +++ b/features/searches.feature @@ -456,3 +456,15 @@ Feature: Search And I press "Search" Then I should be on the search page And I should see "Please enter a search term" + + @javascript + Scenario: Searching with type-ahead suggestions + Given the following Affiliates exist: + | display_name | name | contact_email | first_name | last_name | domains | + | agency site | agency.gov | aff@bar.gov | Jane | Bar | usa.gov | + And the following SAYT Suggestions exist for agency.gov: + | phrase | + | popular search phrase | + When I am on agency.gov's search page + And I fill in "query" with "popular" + Then I should see a suggestion to search for "popular search phrase" diff --git a/features/step_definitions/sayt_suggestions_steps.rb b/features/step_definitions/sayt_suggestions_steps.rb index b2d4808d26..daf0c6ac97 100644 --- a/features/step_definitions/sayt_suggestions_steps.rb +++ b/features/step_definitions/sayt_suggestions_steps.rb @@ -9,10 +9,6 @@ page.should have_selector('#related-searches a', count: count) end -Then /^I should see (\d+) type\-ahead search suggestions$/ do |count| - page.should have_selector("#sayt-suggestions .sayt_suggestion", :count => count) -end - -Then /^I should not see any type\-ahead search suggestion$/ do - page.should_not have_selector("#sayt-suggestions .sayt_suggestion") +Then /^I should see a suggestion to search for "(.*)"/ do |query| + expect(page.find('div.tt-suggestion', visible: :all).text(:all)).to eq query end