Replace find file project spinach tests with RSpec
This commit is contained in:
parent
a544f6ec58
commit
8ad7cb7788
4 changed files with 66 additions and 118 deletions
|
@ -1,42 +0,0 @@
|
|||
@dashboard
|
||||
Feature: Project Find File
|
||||
Background:
|
||||
Given I sign in as a user
|
||||
And I own a project
|
||||
And I visit my project's files page
|
||||
|
||||
@javascript
|
||||
Scenario: Navigate to find file by shortcut
|
||||
Given I press "t"
|
||||
Then I should see "find file" page
|
||||
|
||||
Scenario: Navigate to find file
|
||||
Given I click Find File button
|
||||
Then I should see "find file" page
|
||||
|
||||
@javascript
|
||||
Scenario: I search file
|
||||
Given I visit project find file page
|
||||
And I fill in file find with "change"
|
||||
Then I should not see ".gitignore" in files
|
||||
And I should not see ".gitmodules" in files
|
||||
And I should see "CHANGELOG" in files
|
||||
And I should not see "VERSION" in files
|
||||
|
||||
@javascript
|
||||
Scenario: I search file that not exist
|
||||
Given I visit project find file page
|
||||
And I fill in file find with "asdfghjklqwertyuizxcvbnm"
|
||||
Then I should not see ".gitignore" in files
|
||||
And I should not see ".gitmodules" in files
|
||||
And I should not see "CHANGELOG" in files
|
||||
And I should not see "VERSION" in files
|
||||
|
||||
@javascript
|
||||
Scenario: I search file that partially matches
|
||||
Given I visit project find file page
|
||||
And I fill in file find with "git"
|
||||
Then I should see ".gitignore" in files
|
||||
And I should see ".gitmodules" in files
|
||||
And I should not see "CHANGELOG" in files
|
||||
And I should not see "VERSION" in files
|
|
@ -1,72 +0,0 @@
|
|||
class Spinach::Features::ProjectFindFile < Spinach::FeatureSteps
|
||||
include SharedAuthentication
|
||||
include SharedPaths
|
||||
include SharedProject
|
||||
include SharedProjectTab
|
||||
|
||||
step 'I press "t"' do
|
||||
find('body').native.send_key('t')
|
||||
end
|
||||
|
||||
step 'I click Find File button' do
|
||||
click_link 'Find file'
|
||||
end
|
||||
|
||||
step 'I should see "find file" page' do
|
||||
ensure_active_main_tab('Repository')
|
||||
expect(page).to have_selector('.file-finder-holder', count: 1)
|
||||
end
|
||||
|
||||
step 'I fill in Find by path with "git"' do
|
||||
ensure_active_main_tab('Repository')
|
||||
expect(page).to have_selector('.file-finder-holder', count: 1)
|
||||
end
|
||||
|
||||
step 'I fill in file find with "git"' do
|
||||
find_file "git"
|
||||
end
|
||||
|
||||
step 'I fill in file find with "change"' do
|
||||
find_file "change"
|
||||
end
|
||||
|
||||
step 'I fill in file find with "asdfghjklqwertyuizxcvbnm"' do
|
||||
find_file "asdfghjklqwertyuizxcvbnm"
|
||||
end
|
||||
|
||||
step 'I should see "VERSION" in files' do
|
||||
expect(page).to have_content("VERSION")
|
||||
end
|
||||
|
||||
step 'I should not see "VERSION" in files' do
|
||||
expect(page).not_to have_content("VERSION")
|
||||
end
|
||||
|
||||
step 'I should see "CHANGELOG" in files' do
|
||||
expect(page).to have_content("CHANGELOG")
|
||||
end
|
||||
|
||||
step 'I should not see "CHANGELOG" in files' do
|
||||
expect(page).not_to have_content("CHANGELOG")
|
||||
end
|
||||
|
||||
step 'I should see ".gitmodules" in files' do
|
||||
expect(page).to have_content(".gitmodules")
|
||||
end
|
||||
|
||||
step 'I should not see ".gitmodules" in files' do
|
||||
expect(page).not_to have_content(".gitmodules")
|
||||
end
|
||||
|
||||
step 'I should see ".gitignore" in files' do
|
||||
expect(page).to have_content(".gitignore")
|
||||
end
|
||||
|
||||
step 'I should not see ".gitignore" in files' do
|
||||
expect(page).not_to have_content(".gitignore")
|
||||
end
|
||||
|
||||
def find_file(text)
|
||||
fill_in 'file_find', with: text
|
||||
end
|
||||
end
|
|
@ -200,10 +200,6 @@ module SharedPaths
|
|||
visit edit_project_path(@project)
|
||||
end
|
||||
|
||||
step "I visit my project's files page" do
|
||||
visit project_tree_path(@project, root_ref)
|
||||
end
|
||||
|
||||
step 'I visit a binary file in the repo' do
|
||||
visit project_blob_path(@project,
|
||||
File.join(root_ref, 'files/images/logo-black.png'))
|
||||
|
|
66
spec/features/projects/files/user_find_file_spec.rb
Normal file
66
spec/features/projects/files/user_find_file_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue