diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-06-07 17:54:29 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-06-07 17:54:29 +0300 |
commit | 50b3b8ce80b3573f53c22ac5ff34391b5bc469d8 (patch) | |
tree | 7e5d1f99ccbdaddc0f0464875d301a731950f960 /spec/features/search_spec.rb | |
parent | 36f67b305f37cdf4eb9f75f12cfde3b0dfc01183 (diff) | |
download | gitlab-ce-50b3b8ce80b3573f53c22ac5ff34391b5bc469d8.tar.gz |
Added tests for categorised search autocomplete.
Diffstat (limited to 'spec/features/search_spec.rb')
-rw-r--r-- | spec/features/search_spec.rb | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb index 029a11ea43c..4f4d4b1e3e9 100644 --- a/spec/features/search_spec.rb +++ b/spec/features/search_spec.rb @@ -47,4 +47,83 @@ describe "Search", feature: true do expect(page).to have_link(snippet.title) end end + + + describe 'Right header search field', feature: true do + + describe 'Search in project page' do + before do + visit namespace_project_path(project.namespace, project) + end + + it 'top right search form is present' do + expect(page).to have_selector('#search') + end + + it 'top right search form contains location badge' do + expect(page).to have_selector('.has-location-badge') + end + + context 'clicking the search field', js: true do + it 'should show category search dropdown' do + page.find('#search').click + + expect(page).to have_selector('.dropdown-header', text: /go to in #{project.name}/i) + end + end + + context 'click the links in the category search dropdown', js: true do + + before do + page.find('#search').click + end + + it 'should take user to her issues page when issues assigned is clicked' do + find('.dropdown-menu').click_link 'Issues assigned to me' + sleep 2 + + expect(page).to have_selector('.issues-holder') + expect(find('.js-assignee-search .dropdown-toggle-text')).to have_content(user.name) + end + + it 'should take user to her issues page when issues authored is clicked' do + find('.dropdown-menu').click_link "Issues I've created" + sleep 2 + + expect(page).to have_selector('.issues-holder') + expect(find('.js-author-search .dropdown-toggle-text')).to have_content(user.name) + end + + it 'should take user to her MR page when MR assigned is clicked' do + find('.dropdown-menu').click_link 'Merge requests assigned to me' + sleep 2 + + expect(page).to have_selector('.merge-requests-holder') + expect(find('.js-assignee-search .dropdown-toggle-text')).to have_content(user.name) + end + + it 'should take user to her MR page when MR authored is clicked' do + find('.dropdown-menu').click_link "Merge requests I've created" + sleep 2 + + expect(page).to have_selector('.merge-requests-holder') + expect(find('.js-author-search .dropdown-toggle-text')).to have_content(user.name) + end + end + + context 'entering text into the search field', js: true do + before do + page.within '.search-input-wrap' do + fill_in "search", with: project.name[0..3] + end + end + + it 'should not display the category search dropdown' do + expect(page).not_to have_selector('.dropdown-header', text: /go to in #{project.name}/i) + end + end + end + end + + end |