diff options
Diffstat (limited to 'spec/features/search/user_searches_for_code_spec.rb')
-rw-r--r-- | spec/features/search/user_searches_for_code_spec.rb | 55 |
1 files changed, 5 insertions, 50 deletions
diff --git a/spec/features/search/user_searches_for_code_spec.rb b/spec/features/search/user_searches_for_code_spec.rb index 976324a5032..9329b1f2a5e 100644 --- a/spec/features/search/user_searches_for_code_spec.rb +++ b/spec/features/search/user_searches_for_code_spec.rb @@ -40,7 +40,7 @@ RSpec.describe 'User searches for code', :js, :disable_rate_limiter, feature_cat wait_for_requests page.within('[data-testid="project-filter"]') do - click_on(project.name) + select_listbox_item(project.name) end end @@ -53,8 +53,8 @@ RSpec.describe 'User searches for code', :js, :disable_rate_limiter, feature_cat let(:expected_result) { 'Update capybara, rspec-rails, poltergeist to recent versions' } before do - fill_in('dashboard_search', with: 'rspec') - find('.gl-search-box-by-click-search-button').click + submit_dashboard_search('rspec') + select_search_scope('Code') end it 'finds code and links to blob' do @@ -81,8 +81,8 @@ RSpec.describe 'User searches for code', :js, :disable_rate_limiter, feature_cat search = 'for naming files' ref_selector = 'v1.0.0' - fill_in('dashboard_search', with: search) - find('.gl-search-box-by-click-search-button').click + submit_dashboard_search(search) + select_search_scope('Code') expect(page).to have_selector('.results', text: expected_result) @@ -99,51 +99,6 @@ RSpec.describe 'User searches for code', :js, :disable_rate_limiter, feature_cat end end - context 'when header search' do - context 'search code within refs' do - let(:ref_name) { 'v1.0.0' } - - before do - visit(project_tree_path(project, ref_name)) - - submit_search('gitlab-grack') - select_search_scope('Code') - end - - it 'shows ref switcher in code result summary' do - expect(find('.ref-selector')).to have_text(ref_name) - end - - it 'persists branch name across search' do - find('.gl-search-box-by-click-search-button').click - expect(find('.ref-selector')).to have_text(ref_name) - end - - # this example is use to test the design that the refs is not - # only represent the branch as well as the tags. - it 'ref switcher list all the branches and tags' do - find('.ref-selector').click - wait_for_requests - - page.within('.ref-selector') do - expect(page).to have_selector('li', text: 'add-ipython-files') - expect(page).to have_selector('li', text: 'v1.0.0') - end - end - - it 'search result changes when refs switched' do - expect(find('.results')).not_to have_content('path = gitlab-grack') - - find('.ref-selector').click - wait_for_requests - - select_listbox_item('add-ipython-files') - - expect(page).to have_selector('.results', text: 'path = gitlab-grack') - end - end - end - it 'no ref switcher shown in issue result summary' do issue = create(:issue, title: 'test', project: project) visit(project_tree_path(project)) |