diff options
author | Semyon Pupkov <mail@semyonpupkov.com> | 2018-04-24 12:20:11 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-04-24 12:20:11 +0300 |
commit | 8ad7cb7788b964a7c9e4ca11c4308e0bbc1d4bbc (patch) | |
tree | f1fc234e2ee3054268da0ec3880b4b31876c7376 /spec/features/projects/files | |
parent | a544f6ec58ba5f9cfbff6b59b50bc92bc2274bdb (diff) |
Replace find file project spinach tests with RSpec
Diffstat (limited to 'spec/features/projects/files')
-rw-r--r-- | spec/features/projects/files/user_find_file_spec.rb | 66 |
1 files changed, 66 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 new file mode 100644 index 00000000000..df405e70dd4 --- /dev/null +++ b/spec/features/projects/files/user_find_file_spec.rb @@ -0,0 +1,66 @@ +require 'spec_helper' + +describe 'User find project file' do + let(:user) { create :user } + let(:project) { create :project, :repository } + + before do + sign_in(user) + project.add_master(user) + + visit project_tree_path(project, project.repository.root_ref) + end + + def active_main_tab + find('.sidebar-top-level-items > li.active') + end + + def find_file(text) + fill_in 'file_find', with: text + end + + it 'navigates to find file by shortcut', :js do + find('body').native.send_key('t') + + expect(active_main_tab).to have_content('Repository') + expect(page).to have_selector('.file-finder-holder', count: 1) + end + + it 'navigates to find file' do + click_link 'Find file' + + expect(active_main_tab).to have_content('Repository') + expect(page).to have_selector('.file-finder-holder', count: 1) + end + + it 'searches CHANGELOG file', :js do + click_link 'Find file' + + find_file 'change' + + expect(page).to have_content('CHANGELOG') + expect(page).not_to have_content('.gitignore') + expect(page).not_to have_content('VERSION') + end + + it 'does not find file when search not exist file', :js do + click_link 'Find file' + + find_file 'asdfghjklqwertyuizxcvbnm' + + expect(page).not_to have_content('CHANGELOG') + expect(page).not_to have_content('.gitignore') + expect(page).not_to have_content('VERSION') + end + + it 'searches file by partially matches', :js do + click_link 'Find file' + + find_file 'git' + + expect(page).to have_content('.gitignore') + expect(page).to have_content('.gitmodules') + expect(page).not_to have_content('CHANGELOG') + expect(page).not_to have_content('VERSION') + end +end |