Replace 'source/search_code.feature' spinach test with an rspec analog
This commit is contained in:
parent
0f006dc069
commit
ec1ec9b67a
|
@ -1,4 +0,0 @@
|
||||||
---
|
|
||||||
title: Add index on ci_runners.contacted_at
|
|
||||||
merge_request: 10876
|
|
||||||
author: blackst0ne
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Replace 'source/search_code.feature' spinach test with an rspec analog
|
||||||
|
merge_request: 13697
|
||||||
|
author: blackst0ne
|
||||||
|
type: other
|
|
@ -1,15 +0,0 @@
|
||||||
Feature: Project Source Search Code
|
|
||||||
Background:
|
|
||||||
Given I sign in as a user
|
|
||||||
|
|
||||||
Scenario: Search for term "coffee"
|
|
||||||
Given I own project "Shop"
|
|
||||||
And I visit project source page
|
|
||||||
When I search for term "coffee"
|
|
||||||
Then I should see files from repository containing "coffee"
|
|
||||||
|
|
||||||
Scenario: Search on empty project
|
|
||||||
Given I own an empty project
|
|
||||||
And I visit my project's home page
|
|
||||||
When I search for term "coffee"
|
|
||||||
Then I should see empty result
|
|
|
@ -1,19 +0,0 @@
|
||||||
class Spinach::Features::ProjectSourceSearchCode < Spinach::FeatureSteps
|
|
||||||
include SharedAuthentication
|
|
||||||
include SharedProject
|
|
||||||
include SharedPaths
|
|
||||||
|
|
||||||
step 'I search for term "coffee"' do
|
|
||||||
fill_in "search", with: "coffee"
|
|
||||||
click_button "Go"
|
|
||||||
end
|
|
||||||
|
|
||||||
step 'I should see files from repository containing "coffee"' do
|
|
||||||
expect(page).to have_content 'coffee'
|
|
||||||
expect(page).to have_content 'CONTRIBUTING.md'
|
|
||||||
end
|
|
||||||
|
|
||||||
step 'I should see empty result' do
|
|
||||||
expect(page).to have_content "We couldn't find any"
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -304,10 +304,6 @@ module SharedPaths
|
||||||
visit project_commits_path(@project, 'stable', { limit: 5 })
|
visit project_commits_path(@project, 'stable', { limit: 5 })
|
||||||
end
|
end
|
||||||
|
|
||||||
step 'I visit project source page' do
|
|
||||||
visit project_tree_path(@project, root_ref)
|
|
||||||
end
|
|
||||||
|
|
||||||
step 'I visit blob file from repo' do
|
step 'I visit blob file from repo' do
|
||||||
visit project_blob_path(@project, File.join(sample_commit.id, sample_blob.path))
|
visit project_blob_path(@project, File.join(sample_commit.id, sample_blob.path))
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
feature 'Find files button in the tree header' do
|
|
||||||
given(:user) { create(:user) }
|
|
||||||
given(:project) { create(:project, :repository) }
|
|
||||||
|
|
||||||
background do
|
|
||||||
sign_in(user)
|
|
||||||
project.team << [user, :developer]
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'project main screen' do
|
|
||||||
visit project_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_selector('.tree-controls .shortcuts-find-file')
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'project tree screen' do
|
|
||||||
visit project_tree_path(project, project.default_branch)
|
|
||||||
|
|
||||||
expect(page).to have_selector('.tree-controls .shortcuts-find-file')
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'User searches for files' do
|
||||||
|
let(:user) { create(:user) }
|
||||||
|
let(:project) { create(:project, :repository) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'project main screen' do
|
||||||
|
context 'when project is empty' do
|
||||||
|
let(:empty_project) { create(:project) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
empty_project.add_developer(user)
|
||||||
|
visit project_path(empty_project)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not show any result' do
|
||||||
|
fill_in('search', with: 'coffee')
|
||||||
|
click_button('Go')
|
||||||
|
|
||||||
|
expect(page).to have_content("We couldn't find any")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when project is not empty' do
|
||||||
|
before do
|
||||||
|
project.add_developer(user)
|
||||||
|
visit project_path(project)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows "Find file" button' do
|
||||||
|
expect(page).to have_selector('.tree-controls .shortcuts-find-file')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'project tree screen' do
|
||||||
|
before do
|
||||||
|
project.add_developer(user)
|
||||||
|
visit project_tree_path(project, project.default_branch)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows "Find file" button' do
|
||||||
|
expect(page).to have_selector('.tree-controls .shortcuts-find-file')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows found files' do
|
||||||
|
fill_in('search', with: 'coffee')
|
||||||
|
click_button('Go')
|
||||||
|
|
||||||
|
expect(page).to have_content('coffee')
|
||||||
|
expect(page).to have_content('CONTRIBUTING.md')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue