Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRCH-2381 add cucumber test for type-ahead suggestions #749

Merged
merged 1 commit into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
12 changes: 12 additions & 0 deletions features/searches.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
8 changes: 2 additions & 6 deletions features/step_definitions/sayt_suggestions_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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