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
bd69b794
Commit
bd69b794
authored
Oct 11, 2017
by
Vitaliy @blackst0ne Klachkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the 'features/explore/projects.feature' spinach test with an rspec analog
parent
2a9147b7
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
377 additions
and
390 deletions
+377
-390
changelogs/unreleased/replace_explore_projects-feature.yml
changelogs/unreleased/replace_explore_projects-feature.yml
+5
-0
features/explore/projects.feature
features/explore/projects.feature
+0
-144
features/steps/explore/projects.rb
features/steps/explore/projects.rb
+0
-145
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+0
-13
features/steps/shared/project.rb
features/steps/shared/project.rb
+0
-18
spec/features/explore/user_explores_projects_spec.rb
spec/features/explore/user_explores_projects_spec.rb
+72
-0
spec/features/projects/issues/list_spec.rb
spec/features/projects/issues/list_spec.rb
+0
-20
spec/features/projects/issues/user_views_issues_spec.rb
spec/features/projects/issues/user_views_issues_spec.rb
+56
-0
spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb
...cts/merge_requests/user_views_open_merge_requests_spec.rb
+93
-50
spec/features/projects/user_views_details_spec.rb
spec/features/projects/user_views_details_spec.rb
+151
-0
No files found.
changelogs/unreleased/replace_explore_projects-feature.yml
0 → 100644
View file @
bd69b794
---
title
:
Replace the 'features/explore/projects.feature' spinach test with an rspec analog
merge_request
:
14755
author
:
Vitaliy @blackst0ne Klachkov
type
:
other
features/explore/projects.feature
deleted
100644 → 0
View file @
2a9147b7
@public
Feature
:
Explore Projects
Background
:
Given
public project
"Community"
And
internal project
"Internal"
And
private project
"Enterprise"
Scenario
:
I
visit public area
Given
archived project
"Archive"
When
I visit the public projects area
Then
I should see project
"Community"
And
I should not see project
"Internal"
And
I should not see project
"Enterprise"
And
I should not see project
"Archive"
Scenario
:
I
visit public project page
When
I visit project
"Community"
page
Then
I should see project
"Community"
home page
Scenario
:
I
visit internal project page
When
I visit project
"Internal"
page
Then
I should be redirected to sign in page
Scenario
:
I
visit private project page
When
I visit project
"Enterprise"
page
Then
I should be redirected to sign in page
Scenario
:
I
visit an empty public project page
Given
public empty project
"Empty Public Project"
When
I visit empty project page
Then
I should see empty public project details
And
I should see empty public project details with http clone info
Scenario
:
I
visit an empty public project page as user with no ssh-keys
Given
I sign in as a user
And
I have no ssh keys
And
public empty project
"Empty Public Project"
When
I visit empty project page
Then
I should see empty public project details
And
I should see empty public project details with http clone info
Scenario
:
I
visit an empty public project page as user with an ssh-key
Given
I sign in as a user
And
I have an ssh key
And
public empty project
"Empty Public Project"
When
I visit empty project page
Then
I should see empty public project details
And
I should see empty public project details with ssh clone info
Scenario
:
I
visit public area as user
Given
archived project
"Archive"
And
I sign in as a user
When
I visit the public projects area
Then
I should see project
"Community"
And
I should see project
"Internal"
And
I should not see project
"Enterprise"
And
I should not see project
"Archive"
Scenario
:
I
visit internal project page as user
Given
I sign in as a user
When
I visit project
"Internal"
page
Then
I should see project
"Internal"
home page
Scenario
:
I
visit public project page
When
I visit project
"Community"
page
Then
I should see project
"Community"
home page
And
I should see an http link to the repository
Scenario
:
I
visit public project page as user with no ssh-keys
Given
I sign in as a user
And
I have no ssh keys
When
I visit project
"Community"
page
Then
I should see project
"Community"
home page
And
I should see an http link to the repository
Scenario
:
I
visit public project page as user with an ssh-key
Given
I sign in as a user
And
I have an ssh key
When
I visit project
"Community"
page
Then
I should see project
"Community"
home page
And
I should see an ssh link to the repository
Scenario
:
I
visit an empty public project page
Given
public empty project
"Empty Public Project"
When
I visit empty project page
Then
I should see empty public project details
Scenario
:
I
visit public project issues page as a non authorized user
Given
I visit project
"Community"
page
Then
I should not see command line instructions
And
I visit
"Community"
issues page
Then
I should see list of issues for
"Community"
project
Scenario
:
I
visit public project issues page as authorized user
Given
I sign in as a user
Given
I visit project
"Community"
page
And
I visit
"Community"
issues page
Then
I should see list of issues for
"Community"
project
Scenario
:
I
visit internal project issues page as authorized user
Given
I sign in as a user
Given
I visit project
"Internal"
page
And
I visit
"Internal"
issues page
Then
I should see list of issues for
"Internal"
project
Scenario
:
I
visit public project merge requests page as an authorized user
Given
I sign in as a user
Given
I visit project
"Community"
page
And
I visit
"Community"
merge requests page
And
project
"Community"
has
"Bug fix"
open merge request
Then
I should see list of merge requests for
"Community"
project
Scenario
:
I
visit public project merge requests page as a non authorized user
Given
I visit project
"Community"
page
And
I visit
"Community"
merge requests page
And
project
"Community"
has
"Bug fix"
open merge request
Then
I should see list of merge requests for
"Community"
project
Scenario
:
I
visit internal project merge requests page as an authorized user
Given
I sign in as a user
Given
I visit project
"Internal"
page
And
I visit
"Internal"
merge requests page
And
project
"Internal"
has
"Feature implemented"
open merge request
Then
I should see list of merge requests for
"Internal"
project
Scenario
:
Trending page
Given
archived project
"Archive"
And
project
"Archive"
has comments
And
I sign in as a user
And
project
"Community"
has comments
And
trending projects are refreshed
When
I visit the explore trending projects
Then
I should see project
"Community"
And
I should not see project
"Internal"
And
I should not see project
"Enterprise"
And
I should not see project
"Archive"
Scenario
:
Most starred page
Given
archived project
"Archive"
And
I sign in as a user
When
I visit the explore starred projects
Then
I should see project
"Community"
And
I should see project
"Internal"
And
I should not see project
"Archive"
features/steps/explore/projects.rb
deleted
100644 → 0
View file @
2a9147b7
class
Spinach::Features::ExploreProjects
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
include
SharedUser
step
'I should see project "Empty Public Project"'
do
expect
(
page
).
to
have_content
"Empty Public Project"
end
step
'I should see public project details'
do
expect
(
page
).
to
have_content
'32 branches'
expect
(
page
).
to
have_content
'16 tags'
end
step
'I should see project readme'
do
expect
(
page
).
to
have_content
'README.md'
end
step
'I should see empty public project details'
do
expect
(
page
).
not_to
have_content
'Git global setup'
end
step
'I should see empty public project details with http clone info'
do
project
=
Project
.
find_by
(
name:
'Empty Public Project'
)
page
.
all
(
:css
,
'.git-empty .clone'
).
each
do
|
element
|
expect
(
element
.
text
).
to
include
(
project
.
http_url_to_repo
)
end
end
step
'I should see empty public project details with ssh clone info'
do
project
=
Project
.
find_by
(
name:
'Empty Public Project'
)
page
.
all
(
:css
,
'.git-empty .clone'
).
each
do
|
element
|
expect
(
element
.
text
).
to
include
(
project
.
url_to_repo
)
end
end
step
'I should see project "Community" home page'
do
page
.
within
'.breadcrumbs .breadcrumb-item-text'
do
expect
(
page
).
to
have_content
'Community'
end
end
step
'I should see project "Internal" home page'
do
page
.
within
'.breadcrumbs .breadcrumb-item-text'
do
expect
(
page
).
to
have_content
'Internal'
end
end
step
'I should see an http link to the repository'
do
project
=
Project
.
find_by
(
name:
'Community'
)
expect
(
page
).
to
have_field
(
'project_clone'
,
with:
project
.
http_url_to_repo
)
end
step
'I should see an ssh link to the repository'
do
project
=
Project
.
find_by
(
name:
'Community'
)
expect
(
page
).
to
have_field
(
'project_clone'
,
with:
project
.
url_to_repo
)
end
step
'I visit "Community" issues page'
do
create
(
:issue
,
title:
"Bug"
,
project:
public_project
)
create
(
:issue
,
title:
"New feature"
,
project:
public_project
)
visit
project_issues_path
(
public_project
)
end
step
'I should see list of issues for "Community" project'
do
expect
(
page
).
to
have_content
"Bug"
expect
(
page
).
to
have_content
public_project
.
name
expect
(
page
).
to
have_content
"New feature"
end
step
'I visit "Internal" issues page'
do
create
(
:issue
,
title:
"Internal Bug"
,
project:
internal_project
)
create
(
:issue
,
title:
"New internal feature"
,
project:
internal_project
)
visit
project_issues_path
(
internal_project
)
end
step
'I should see list of issues for "Internal" project'
do
expect
(
page
).
to
have_content
"Internal Bug"
expect
(
page
).
to
have_content
internal_project
.
name
expect
(
page
).
to
have_content
"New internal feature"
end
step
'I visit "Community" merge requests page'
do
visit
project_merge_requests_path
(
public_project
)
end
step
'project "Community" has "Bug fix" open merge request'
do
create
(
:merge_request
,
title:
"Bug fix for public project"
,
source_project:
public_project
,
target_project:
public_project
)
end
step
'I should see list of merge requests for "Community" project'
do
expect
(
page
).
to
have_content
public_project
.
name
expect
(
page
).
to
have_content
public_merge_request
.
source_project
.
name
end
step
'I visit "Internal" merge requests page'
do
visit
project_merge_requests_path
(
internal_project
)
end
step
'project "Internal" has "Feature implemented" open merge request'
do
create
(
:merge_request
,
title:
"Feature implemented"
,
source_project:
internal_project
,
target_project:
internal_project
)
end
step
'I should see list of merge requests for "Internal" project'
do
expect
(
page
).
to
have_content
internal_project
.
name
expect
(
page
).
to
have_content
internal_merge_request
.
source_project
.
name
end
def
internal_project
@internal_project
||=
Project
.
find_by!
(
name:
'Internal'
)
end
def
public_project
@public_project
||=
Project
.
find_by!
(
name:
'Community'
)
end
def
internal_merge_request
@internal_merge_request
||=
MergeRequest
.
find_by!
(
title:
'Feature implemented'
)
end
def
public_merge_request
@public_merge_request
||=
MergeRequest
.
find_by!
(
title:
'Bug fix for public project'
)
end
end
features/steps/shared/paths.rb
View file @
bd69b794
...
...
@@ -454,19 +454,6 @@ module SharedPaths
# ----------------------------------------
# Public Projects
# ----------------------------------------
step
'I visit the public projects area'
do
visit
explore_projects_path
end
step
'I visit the explore trending projects'
do
visit
trending_explore_projects_path
end
step
'I visit the explore starred projects'
do
visit
starred_explore_projects_path
end
step
'I visit the public groups area'
do
visit
explore_groups_path
end
...
...
features/steps/shared/project.rb
View file @
bd69b794
...
...
@@ -112,10 +112,6 @@ module SharedProject
# Visibility of archived project
# ----------------------------------------
step
'archived project "Archive"'
do
create
(
:project
,
:archived
,
:public
,
:repository
,
name:
'Archive'
)
end
step
'I should not see project "Archive"'
do
project
=
Project
.
find_by
(
name:
"Archive"
)
expect
(
page
).
not_to
have_content
project
.
name_with_namespace
...
...
@@ -126,11 +122,6 @@ module SharedProject
expect
(
page
).
to
have_content
project
.
name_with_namespace
end
step
'project "Archive" has comments'
do
project
=
Project
.
find_by
(
name:
"Archive"
)
2
.
times
{
create
(
:note_on_issue
,
project:
project
)
}
end
# ----------------------------------------
# Visibility level
# ----------------------------------------
...
...
@@ -209,15 +200,6 @@ module SharedProject
create
:project_empty_repo
,
:public
,
name:
"Empty Public Project"
end
step
'project "Community" has comments'
do
project
=
Project
.
find_by
(
name:
"Community"
)
2
.
times
{
create
(
:note_on_issue
,
project:
project
)
}
end
step
'trending projects are refreshed'
do
TrendingProject
.
refresh!
end
step
'project "Shop" has labels: "bug", "feature", "enhancement"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
create
(
:label
,
project:
project
,
title:
'bug'
)
...
...
spec/features/explore/user_explores_projects_spec.rb
0 → 100644
View file @
bd69b794
require
'spec_helper'
describe
'User explores projects'
do
set
(
:archived_project
)
{
create
(
:project
,
:archived
)
}
set
(
:internal_project
)
{
create
(
:project
,
:internal
)
}
set
(
:private_project
)
{
create
(
:project
,
:private
)
}
set
(
:public_project
)
{
create
(
:project
,
:public
)
}
shared_examples_for
'shows public projects'
do
it
'shows projects'
do
expect
(
page
).
to
have_content
(
public_project
.
title
)
expect
(
page
).
not_to
have_content
(
internal_project
.
title
)
expect
(
page
).
not_to
have_content
(
private_project
.
title
)
expect
(
page
).
not_to
have_content
(
archived_project
.
title
)
end
end
shared_examples_for
'shows public and internal projects'
do
it
'shows projects'
do
expect
(
page
).
to
have_content
(
public_project
.
title
)
expect
(
page
).
to
have_content
(
internal_project
.
title
)
expect
(
page
).
not_to
have_content
(
private_project
.
title
)
expect
(
page
).
not_to
have_content
(
archived_project
.
title
)
end
end
context
'when not signed in'
do
context
'when viewing public projects'
do
before
do
visit
(
explore_projects_path
)
end
include_examples
'shows public projects'
end
end
context
'when signed in'
do
set
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
end
context
'when viewing public projects'
do
before
do
visit
(
explore_projects_path
)
end
include_examples
'shows public and internal projects'
end
context
'when viewing most starred projects'
do
before
do
visit
(
starred_explore_projects_path
)
end
include_examples
'shows public and internal projects'
end
context
'when viewing trending projects'
do
before
do
[
archived_project
,
public_project
].
each
{
|
project
|
create
(
:note_on_issue
,
project:
project
)
}
TrendingProject
.
refresh!
visit
(
trending_explore_projects_path
)
end
include_examples
'shows public projects'
end
end
end
spec/features/projects/issues/list_spec.rb
deleted
100644 → 0
View file @
2a9147b7
require
'spec_helper'
feature
'Issues List'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
background
do
project
.
team
<<
[
user
,
:developer
]
sign_in
(
user
)
end
scenario
'user does not see create new list button'
do
create
(
:issue
,
project:
project
)
visit
project_issues_path
(
project
)
expect
(
page
).
not_to
have_selector
(
'.js-new-board-list'
)
end
end
spec/features/projects/issues/user_views_issues_spec.rb
0 → 100644
View file @
bd69b794
require
'spec_helper'
describe
'User views issues'
do
set
(
:user
)
{
create
(
:user
)
}
shared_examples_for
'shows issues'
do
it
'shows issues'
do
expect
(
page
).
to
have_content
(
project
.
name
)
.
and
have_content
(
issue1
.
title
)
.
and
have_content
(
issue2
.
title
)
.
and
have_no_selector
(
'.js-new-board-list'
)
end
end
context
'when project is public'
do
set
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
set
(
:issue1
)
{
create
(
:issue
,
project:
project
)
}
set
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
context
'when signed in'
do
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
(
project_issues_path
(
project
))
end
include_examples
'shows issues'
end
context
'when not signed in'
do
before
do
visit
(
project_issues_path
(
project
))
end
include_examples
'shows issues'
end
end
context
'when project is internal'
do
set
(
:project
)
{
create
(
:project_empty_repo
,
:internal
)
}
set
(
:issue1
)
{
create
(
:issue
,
project:
project
)
}
set
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
context
'when signed in'
do
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
(
project_issues_path
(
project
))
end
include_examples
'shows issues'
end
end
end
spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb
View file @
bd69b794
require
'spec_helper'
describe
'User views open merge requests'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
set
(
:user
)
{
create
(
:user
)
}
shared_examples_for
'shows merge requests'
do
it
'shows merge requests'
do
expect
(
page
).
to
have_content
(
project
.
name
).
and
have_content
(
merge_request
.
source_project
.
name
)
end
end
context
'when project is public'
do
set
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
context
'when not signed in'
do
context
"when the target branch is the project's default branch"
do
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let!
(
:closed_merge_request
)
{
create
(
:closed_merge_request
,
source_project:
project
,
target_project:
project
)
}
...
...
@@ -11,6 +21,8 @@ describe 'User views open merge requests' do
visit
(
project_merge_requests_path
(
project
))
end
include_examples
'shows merge requests'
it
'shows open merge requests'
do
expect
(
page
).
to
have_content
(
merge_request
.
title
).
and
have_no_content
(
closed_merge_request
.
title
)
end
...
...
@@ -69,4 +81,35 @@ describe 'User views open merge requests' do
end
end
end
end
context
'when signed in'
do
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
(
project_merge_requests_path
(
project
))
end
include_examples
'shows merge requests'
end
end
context
'when project is internal'
do
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
set
(
:project
)
{
create
(
:project
,
:internal
,
:repository
)
}
context
'when signed in'
do
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
visit
(
project_merge_requests_path
(
project
))
end
include_examples
'shows merge requests'
end
end
end
spec/features/projects/user_views_details_spec.rb
0 → 100644
View file @
bd69b794
require
'spec_helper'
describe
'User views details'
do
set
(
:user
)
{
create
(
:user
)
}
shared_examples_for
'redirects to the sign in page'
do
it
'redirects to the sign in page'
do
expect
(
current_path
).
to
eq
(
new_user_session_path
)
end
end
shared_examples_for
'shows details of empty project'
do
let
(
:user_has_ssh_key
)
{
false
}
it
'shows details'
do
expect
(
page
).
not_to
have_content
(
'Git global setup'
)
page
.
all
(
:css
,
'.git-empty .clone'
).
each
do
|
element
|
expect
(
element
.
text
).
to
include
(
project
.
http_url_to_repo
)
end
expect
(
page
).
to
have_field
(
'project_clone'
,
with:
project
.
http_url_to_repo
)
unless
user_has_ssh_key
end
end
shared_examples_for
'shows details of non empty project'
do
let
(
:user_has_ssh_key
)
{
false
}
it
'shows details'
do
page
.
within
(
'.breadcrumbs .breadcrumb-item-text'
)
do
expect
(
page
).
to
have_content
(
project
.
title
)
end
expect
(
page
).
to
have_field
(
'project_clone'
,
with:
project
.
http_url_to_repo
)
unless
user_has_ssh_key
end
end
context
'when project is public'
do
context
'when project is empty'
do
set
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
context
'when not signed in'
do
before
do
visit
(
project_path
(
project
))
end
include_examples
'shows details of empty project'
end
context
'when signed in'
do
before
do
sign_in
(
user
)
end
context
'when user does not have ssh keys'
do
before
do
visit
(
project_path
(
project
))
end
include_examples
'shows details of empty project'
end
context
'when user has ssh keys'
do
before
do
create
(
:personal_key
,
user:
user
)
visit
(
project_path
(
project
))
end
include_examples
'shows details of empty project'
do
let
(
:user_has_ssh_key
)
{
true
}
end
end
end
end
context
'when project is not empty'
do
set
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
before
do
visit
(
project_path
(
project
))
end
context
'when not signed in'
do
before
do
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:host
).
and_return
(
'www.example.com'
)
end
include_examples
'shows details of non empty project'
end
context
'when signed in'
do
before
do
sign_in
(
user
)
end
context
'when user does not have ssh keys'
do
before
do
visit
(
project_path
(
project
))
end
include_examples
'shows details of non empty project'
end
context
'when user has ssh keys'
do
before
do
create
(
:personal_key
,
user:
user
)
visit
(
project_path
(
project
))
end
include_examples
'shows details of non empty project'
do
let
(
:user_has_ssh_key
)
{
true
}
end
end
end
end
end
context
'when project is internal'
do
set
(
:project
)
{
create
(
:project
,
:internal
,
:repository
)
}
context
'when not signed in'
do
before
do
visit
(
project_path
(
project
))
end
include_examples
'redirects to the sign in page'
end
context
'when signed in'
do
before
do
sign_in
(
user
)
visit
(
project_path
(
project
))
end
include_examples
'shows details of non empty project'
end
end
context
'when project is private'
do
set
(
:project
)
{
create
(
:project
,
:private
)
}
before
do
visit
(
project_path
(
project
))
end
include_examples
'redirects to the sign in page'
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