Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
90760c1d
Commit
90760c1d
authored
Mar 15, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate elasticsearch-using spinach features to rspec
parent
c43e0cf7
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
128 additions
and
216 deletions
+128
-216
ee/spec/features/search/elastic/global_search_spec.rb
ee/spec/features/search/elastic/global_search_spec.rb
+0
-0
ee/spec/features/search/elastic/group_search_spec.rb
ee/spec/features/search/elastic/group_search_spec.rb
+0
-0
ee/spec/features/search/elastic/project_search_spec.rb
ee/spec/features/search/elastic/project_search_spec.rb
+84
-0
ee/spec/features/search/elastic/snippet_search_spec.rb
ee/spec/features/search/elastic/snippet_search_spec.rb
+35
-0
ee/spec/support/elastic.rb
ee/spec/support/elastic.rb
+9
-0
features/project/elastic/global_search.feature
features/project/elastic/global_search.feature
+0
-13
features/project/elastic/project_search.feature
features/project/elastic/project_search.feature
+0
-19
features/project/elastic/snippets_search.feature
features/project/elastic/snippets_search.feature
+0
-13
features/steps/project/elastic/global_search.rb
features/steps/project/elastic/global_search.rb
+0
-30
features/steps/project/elastic/project_search.rb
features/steps/project/elastic/project_search.rb
+0
-61
features/steps/project/elastic/snippets_search.rb
features/steps/project/elastic/snippets_search.rb
+0
-46
features/steps/shared/elastic.rb
features/steps/shared/elastic.rb
+0
-34
No files found.
ee/spec/features/
es_
global_search_spec.rb
→
ee/spec/features/
search/elastic/
global_search_spec.rb
View file @
90760c1d
File moved
ee/spec/features/
es_
group_search_spec.rb
→
ee/spec/features/
search/elastic/
group_search_spec.rb
View file @
90760c1d
File moved
ee/spec/features/search/elastic/project_search_spec.rb
0 → 100644
View file @
90760c1d
require
'spec_helper'
describe
'Project elastic search'
,
:js
,
:elastic
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
project
.
add_master
(
user
)
sign_in
(
user
)
end
describe
'searching'
do
it
'finds issues'
do
create
(
:issue
,
project:
project
,
title:
'Test searching for an issue'
)
expect_search_result
(
scope:
'Issues'
,
term:
'Test'
,
result:
'Test searching for an issue'
)
end
it
'finds merge requests'
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
title:
'Test searching for an MR'
)
expect_search_result
(
scope:
'Merge requests'
,
term:
'Test'
,
result:
'Test searching for an MR'
)
end
it
'finds milestones'
do
create
(
:milestone
,
project:
project
,
title:
'Test searching for a milestone'
)
expect_search_result
(
scope:
'Milestones'
,
term:
'Test'
,
result:
'Test searching for a milestone'
)
end
it
'finds wiki pages'
do
project
.
wiki
.
create_page
(
'test.md'
,
'Test searching for a wiki page'
)
expect_search_result
(
scope:
'Wiki'
,
term:
'Test'
,
result:
'Test searching for a wiki page'
)
end
it
'finds notes'
do
create
(
:note
,
project:
project
,
note:
'Test searching for a note'
)
search
(
scope:
'Comments'
,
term:
'Test'
)
expect
(
page
).
to
have_content
(
/showing (\d+) - (\d+) of (\d+) notes/i
)
expect
(
page
).
to
have_content
(
'Test searching for a note'
)
end
it
'finds commits'
do
project
.
repository
.
index_commits
search
(
scope:
'Commits'
,
term:
'initial'
)
expect
(
page
).
to
have_content
(
/showing (\d+) - (\d+) of (\d+) commits/i
)
expect
(
page
).
to
have_content
(
'Initial commit'
)
end
it
'finds blobs'
do
project
.
repository
.
index_blobs
search
(
scope:
'Code'
,
term:
'def'
)
expect
(
page
).
to
have_content
(
/showing (\d+) - (\d+) of (\d+) blobs/i
)
expect
(
page
).
to
have_content
(
'def username_regex'
)
end
end
def
search
(
scope
:,
term
:)
visit
project_path
(
project
)
fill_in
(
'search'
,
with:
term
)
find
(
'#search'
).
native
.
send_keys
(
:enter
)
page
.
within
'.search-filter'
do
click_link
scope
end
end
def
expect_search_result
(
scope
:,
term
:,
result
:)
search
(
scope:
scope
,
term:
term
)
expect
(
page
).
to
have_content
(
/showing (\d+) - (\d+) of (\d+)
#{
Regexp
.
escape
(
scope
)
}
/i
)
expect
(
page
).
to
have_content
(
result
)
end
end
ee/spec/features/search/elastic/snippet_search_spec.rb
0 → 100644
View file @
90760c1d
require
'spec_helper'
describe
'Snippet elastic search'
,
:js
,
:elastic
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
project
.
add_master
(
user
)
sign_in
(
user
)
end
describe
'searching'
do
it
'finds a personal snippet'
do
create
(
:personal_snippet
,
author:
user
,
content:
'Test searching for personal snippets'
)
visit
explore_snippets_path
fill_in
'search'
,
with:
'Test'
click_button
'Go'
expect
(
page
).
to
have_content
(
'Test searching for personal snippets'
)
end
it
'finds a project snippet'
do
create
(
:project_snippet
,
project:
project
,
content:
'Test searching for personal snippets'
)
visit
explore_snippets_path
fill_in
'search'
,
with:
'Test'
click_button
'Go'
expect
(
page
).
to
have_content
(
'Test searching for personal snippets'
)
end
end
end
ee/spec/support/elastic.rb
0 → 100644
View file @
90760c1d
RSpec
.
configure
do
|
config
|
config
.
before
(
:each
,
:elastic
)
do
Gitlab
::
Elastic
::
Helper
.
create_empty_index
end
config
.
after
(
:each
,
:elastic
)
do
Gitlab
::
Elastic
::
Helper
.
delete_index
end
end
features/project/elastic/global_search.feature
deleted
100644 → 0
View file @
c43e0cf7
Feature
:
Global Search
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And
Elasticsearch is enabled
Scenario
:
I
search through the all projects
Given
project has all data available for the search
And
I visit dashboard page
Then
I search
"initial"
And
I find an Issue
And
I find a Merge Request
And
I find a Milestone
\ No newline at end of file
features/project/elastic/project_search.feature
deleted
100644 → 0
View file @
c43e0cf7
Feature
:
Project Search
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And
Elasticsearch is enabled
Scenario
:
I
search through the all project items
Given
project has all data available for the search
And
I visit my project's home page
Then
I search
"initial"
And
I find an Issue
And
I find a Merge Request
And
I find a Milestone
And
I find a Comment
And
I find a Commit
And
I find a Wiki Page
Then
I visit my project's home page
Then
I search
"def"
And
I find a Code
features/project/elastic/snippets_search.feature
deleted
100644 → 0
View file @
c43e0cf7
Feature
:
Snippets Search
Background
:
Given
I sign in as a user
And
Elasticsearch is enabled
Scenario
:
I
search through the snippets
Given
there is a snippet
"index"
with
"php rocks"
string
And
there is a snippet
"php"
with
"benefits"
string
And
I visit snippets page
Then
I search
"php"
And
I find
"index"
snippet
Then
I select search by titles and filenames
And
I find
"php"
snippet
\ No newline at end of file
features/steps/project/elastic/global_search.rb
deleted
100644 → 0
View file @
c43e0cf7
require_dependency
Rails
.
root
.
join
(
'spec'
,
'support'
,
'stub_configuration'
)
class
Spinach::Features::GlobalSearch
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
include
SharedElastic
include
StubConfiguration
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
Gitlab
::
Elastic
::
Helper
.
create_empty_index
end
after
do
Gitlab
::
Elastic
::
Helper
.
delete_index
stub_ee_application_setting
(
elasticsearch_search:
false
,
elasticsearch_indexing:
false
)
end
step
'project has all data available for the search'
do
@project
=
create
:project
@project
.
add_master
(
current_user
)
@issue
=
create
:issue
,
title:
'bla-bla initial'
,
project:
@project
@merge_request
=
create
:merge_request
,
title:
'bla-bla initial'
,
source_project:
@project
@milestone
=
create
:milestone
,
title:
'bla-bla initial'
,
project:
@project
end
end
features/steps/project/elastic/project_search.rb
deleted
100644 → 0
View file @
c43e0cf7
class
Spinach::Features::ProjectSearch
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
include
SharedElastic
include
StubConfiguration
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
Gitlab
::
Elastic
::
Helper
.
create_empty_index
end
after
do
Gitlab
::
Elastic
::
Helper
.
delete_index
stub_ee_application_setting
(
elasticsearch_search:
false
,
elasticsearch_indexing:
false
)
end
step
'project has all data available for the search'
do
@project
=
create
:project
,
:repository
@project
.
add_master
(
current_user
)
@issue
=
create
:issue
,
title:
'bla-bla initial'
,
project:
@project
@merge_request
=
create
:merge_request
,
title:
'bla-bla initial'
,
source_project:
@project
@milestone
=
create
:milestone
,
title:
'bla-bla initial'
,
project:
@project
@note
=
create
:note
,
note:
'bla-bla initial'
,
project:
@project
,
noteable:
@issue
@project
.
repository
.
index_blobs
@project
.
repository
.
index_commits
@project
.
wiki
.
create_page
(
"index_page"
,
"Bla bla initial"
)
end
step
'I search "def"'
do
fill_in
"search"
,
with:
"def"
click_button
"Go"
end
step
'I find a Comment'
do
select_filter
(
"Comments"
)
expect
(
page
.
find
(
'.search-result-row'
)).
to
have_content
(
@note
.
note
)
end
step
'I find a Wiki Page'
do
select_filter
(
"Wiki"
)
expect
(
page
.
find
(
'.blob-result'
)).
to
have_content
(
'Bla bla init'
)
end
step
'I find a Commit'
do
select_filter
(
"Commits"
)
expect
(
page
.
find
(
'.commit-content .item-title'
)).
to
have_content
(
"Initial commit"
)
end
step
'I find a Code'
do
expect
(
page
.
first
(
'.blob-result'
)).
to
have_content
(
"def"
)
end
end
features/steps/project/elastic/snippets_search.rb
deleted
100644 → 0
View file @
c43e0cf7
class
Spinach::Features::SnippetsSearch
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
include
SharedElastic
include
StubConfiguration
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
Gitlab
::
Elastic
::
Helper
.
create_empty_index
end
after
do
Gitlab
::
Elastic
::
Helper
.
delete_index
stub_ee_application_setting
(
elasticsearch_search:
false
,
elasticsearch_indexing:
false
)
end
step
'there is a snippet "index" with "php rocks" string'
do
create
:personal_snippet
,
:public
,
content:
"php rocks"
,
title:
"index"
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
step
'there is a snippet "php" with "benefits" string'
do
create
:personal_snippet
,
:public
,
content:
"benefits"
,
title:
"php"
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
step
'I search "php"'
do
fill_in
"search"
,
with:
"php"
click_button
"Go"
end
step
'I find "index" snippet'
do
expect
(
page
.
find
(
'.file-holder'
)).
to
have_content
(
"php rocks"
)
end
step
'I select search by titles and filenames'
do
select_filter
(
"Titles and Filenames"
)
end
step
'I find "php" snippet'
do
expect
(
page
.
find
(
'.search-result-row'
)).
to
have_content
(
"php"
)
end
end
features/steps/shared/elastic.rb
deleted
100644 → 0
View file @
c43e0cf7
module
SharedElastic
include
Spinach
::
DSL
step
'I search "initial"'
do
fill_in
"search"
,
with:
"initial"
click_button
"Go"
end
step
'I find an Issue'
do
select_filter
(
"Issues"
)
expect
(
page
.
find
(
'.search-result-row'
)).
to
have_content
(
@issue
.
title
)
end
step
'I find a Merge Request'
do
select_filter
(
"Merge requests"
)
expect
(
page
.
find
(
'.search-result-row'
)).
to
have_content
(
@merge_request
.
title
)
end
step
'I find a Milestone'
do
select_filter
(
"Milestones"
)
expect
(
page
.
find
(
'.search-result-row'
)).
to
have_content
(
@milestone
.
title
)
end
step
'Elasticsearch is enabled'
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
end
def
select_filter
(
name
)
find
(
:xpath
,
"//ul[contains(@class, 'search-filter')]//a[contains(.,'
#{
name
}
')]"
).
click
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment