diff options
author | minghuan lei <leiminghuan@126.com> | 2019-08-19 18:28:01 +0300 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2019-08-19 18:29:36 +0300 |
commit | cacf128d5d5c7f6ab4f90f66f181057086ad1920 (patch) | |
tree | 15e3eca77131a98489ae0069cb76edf10dff9104 /spec/features/search | |
parent | 4fdc34c10950863ad04a68dc2117371c95db7478 (diff) |
Add feature spec for search with space
Diffstat (limited to 'spec/features/search')
-rw-r--r-- | spec/features/search/user_searches_for_code_spec.rb | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/spec/features/search/user_searches_for_code_spec.rb b/spec/features/search/user_searches_for_code_spec.rb index 5a60991c1bf..4ca79ccaea8 100644 --- a/spec/features/search/user_searches_for_code_spec.rb +++ b/spec/features/search/user_searches_for_code_spec.rb @@ -39,17 +39,16 @@ describe 'User searches for code' do context 'when on a project page', :js do before do visit(search_path) - end - - include_examples 'top right search form' - - it 'finds code' do find('.js-search-project-dropdown').click page.within('.project-filter') do click_link(project.full_name) end + end + include_examples 'top right search form' + + it 'finds code' do fill_in('dashboard_search', with: 'rspec') find('.btn-search').click @@ -57,6 +56,27 @@ describe 'User searches for code' do expect(find(:css, '.search-results')).to have_content('Update capybara, rspec-rails, poltergeist to recent versions') end end + + it 'search mutiple words with refs switching' do + expected_result = 'Use `snake_case` for naming files' + search = 'for naming files' + + fill_in('dashboard_search', with: search) + find('.btn-search').click + + page.within('.results') do + expect(find('.search-results')).to have_content(expected_result) + end + + find('.js-project-refs-dropdown').click + find('.dropdown-page-one .dropdown-content').click_link('v1.0.0') + + page.within('.results') do + expect(find(:css, '.search-results')).to have_content(expected_result) + end + + expect(find_field('dashboard_search').value).to eq(search) + end end context 'search code within refs', :js do |