diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-01 15:10:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-01 15:10:48 +0300 |
commit | a21091270d45530468f8ac2f4f926fe1b9840b67 (patch) | |
tree | a641a030521f16e320f1d3559a49956f485c217f /spec/features/projects/files | |
parent | 8700fc108e2c269a4d73530d60662a6aaff14381 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/projects/files')
-rw-r--r-- | spec/features/projects/files/user_find_file_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/features/projects/files/user_find_file_spec.rb b/spec/features/projects/files/user_find_file_spec.rb index 1b53189da83..0a3b8c19cc4 100644 --- a/spec/features/projects/files/user_find_file_spec.rb +++ b/spec/features/projects/files/user_find_file_spec.rb @@ -21,6 +21,10 @@ RSpec.describe 'User find project file', feature_category: :projects do fill_in 'file_find', with: text end + def ref_selector_dropdown + find('.gl-dropdown-toggle > .gl-dropdown-button-text') + end + it 'navigates to find file by shortcut', :js do find('body').native.send_key('t') @@ -65,4 +69,39 @@ RSpec.describe 'User find project file', feature_category: :projects do expect(page).not_to have_content('CHANGELOG') expect(page).not_to have_content('VERSION') end + + context 'when refs are switched', :js do + before do + click_link 'Find file' + end + + specify 'the ref switcher lists all the branches and tags' do + ref = 'add-ipython-files' + expect(ref_selector_dropdown).not_to have_text(ref) + + find('.ref-selector').click + wait_for_requests + + page.within('.ref-selector') do + expect(page).to have_selector('li', text: ref) + expect(page).to have_selector('li', text: 'v1.0.0') + end + end + + specify 'the search result changes when refs switched' do + ref = 'add-ipython-files' + expect(ref_selector_dropdown).not_to have_text(ref) + + find('.ref-selector button').click + wait_for_requests + + page.within('.ref-selector') do + fill_in _('Switch branch/tag'), with: ref + wait_for_requests + + find('.gl-dropdown-item', text: ref).click + end + expect(ref_selector_dropdown).to have_text(ref) + end + end end |