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
a7ccf27d
Commit
a7ccf27d
authored
Jun 25, 2017
by
Alexander Randa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaces 'dashboard/merge_requests' spinach with rspec
parent
245be4ce
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
114 additions
and
170 deletions
+114
-170
changelogs/unreleased/23036-replace-dashboard-mr-spinach.yml
changelogs/unreleased/23036-replace-dashboard-mr-spinach.yml
+4
-0
features/dashboard/merge_requests.feature
features/dashboard/merge_requests.feature
+0
-21
features/steps/dashboard/merge_requests.rb
features/steps/dashboard/merge_requests.rb
+0
-121
spec/features/dashboard/merge_requests_spec.rb
spec/features/dashboard/merge_requests_spec.rb
+82
-15
spec/features/dashboard/milestone_filter_spec.rb
spec/features/dashboard/milestone_filter_spec.rb
+9
-13
spec/support/filter_item_select_helper.rb
spec/support/filter_item_select_helper.rb
+19
-0
No files found.
changelogs/unreleased/23036-replace-dashboard-mr-spinach.yml
0 → 100644
View file @
a7ccf27d
---
title
:
Replace 'dashboard/merge_requests' spinach with rspec
merge_request
:
12440
author
:
Alexander Randa (@randaalex)
features/dashboard/merge_requests.feature
deleted
100644 → 0
View file @
245be4ce
@dashboard
Feature
:
Dashboard Merge Requests
Background
:
Given
I sign in as a user
And
I have authored merge requests
And
I have assigned merge requests
And
I have other merge requests
And
I visit dashboard merge requests page
Scenario
:
I
should see assigned merge_requests
Then
I should see merge requests assigned to me
@javascript
Scenario
:
I
should see authored merge_requests
When
I click
"Authored by me"
link
Then
I should see merge requests authored by me
@javascript
Scenario
:
I
should see all merge_requests
When
I click
"All"
link
Then
I should see all merge requests
features/steps/dashboard/merge_requests.rb
deleted
100644 → 0
View file @
245be4ce
class
Spinach::Features::DashboardMergeRequests
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
Select2Helper
step
'I should see merge requests assigned to me'
do
should_see
(
assigned_merge_request
)
should_see
(
assigned_merge_request_from_fork
)
should_not_see
(
authored_merge_request
)
should_not_see
(
authored_merge_request_from_fork
)
should_not_see
(
other_merge_request
)
end
step
'I should see merge requests authored by me'
do
should_see
(
authored_merge_request
)
should_see
(
authored_merge_request_from_fork
)
should_not_see
(
assigned_merge_request
)
should_not_see
(
assigned_merge_request_from_fork
)
should_not_see
(
other_merge_request
)
end
step
'I should see all merge requests'
do
should_see
(
authored_merge_request
)
should_see
(
assigned_merge_request
)
should_see
(
other_merge_request
)
end
step
'I have authored merge requests'
do
authored_merge_request
authored_merge_request_from_fork
end
step
'I have assigned merge requests'
do
assigned_merge_request
assigned_merge_request_from_fork
end
step
'I have other merge requests'
do
other_merge_request
end
step
'I click "Authored by me" link'
do
find
(
"#assignee_id"
).
set
(
""
)
find
(
".js-author-search"
,
match: :first
).
click
find
(
".dropdown-menu-author li a"
,
match: :first
,
text:
current_user
.
to_reference
).
click
end
step
'I click "All" link'
do
find
(
".js-author-search"
).
click
expect
(
page
).
to
have_selector
(
".dropdown-menu-author li a"
)
find
(
".dropdown-menu-author li a"
,
match: :first
).
click
expect
(
page
).
not_to
have_selector
(
".dropdown-menu-author li a"
)
find
(
".js-assignee-search"
).
click
expect
(
page
).
to
have_selector
(
".dropdown-menu-assignee li a"
)
find
(
".dropdown-menu-assignee li a"
,
match: :first
).
click
expect
(
page
).
not_to
have_selector
(
".dropdown-menu-assignee li a"
)
end
def
should_see
(
merge_request
)
expect
(
page
).
to
have_content
(
merge_request
.
title
[
0
..
10
])
end
def
should_not_see
(
merge_request
)
expect
(
page
).
not_to
have_content
(
merge_request
.
title
[
0
..
10
])
end
def
assigned_merge_request
@assigned_merge_request
||=
create
:merge_request
,
assignee:
current_user
,
target_project:
project
,
source_project:
project
end
def
authored_merge_request
@authored_merge_request
||=
create
:merge_request
,
source_branch:
'markdown'
,
author:
current_user
,
target_project:
project
,
source_project:
project
end
def
other_merge_request
@other_merge_request
||=
create
:merge_request
,
source_branch:
'fix'
,
target_project:
project
,
source_project:
project
end
def
authored_merge_request_from_fork
@authored_merge_request_from_fork
||=
create
:merge_request
,
source_branch:
'feature_conflict'
,
author:
current_user
,
target_project:
public_project
,
source_project:
forked_project
end
def
assigned_merge_request_from_fork
@assigned_merge_request_from_fork
||=
create
:merge_request
,
source_branch:
'markdown'
,
assignee:
current_user
,
target_project:
public_project
,
source_project:
forked_project
end
def
project
@project
||=
begin
project
=
create
(
:project
,
:repository
)
project
.
team
<<
[
current_user
,
:master
]
project
end
end
def
public_project
@public_project
||=
create
(
:project
,
:public
,
:repository
)
end
def
forked_project
@forked_project
||=
Projects
::
ForkService
.
new
(
public_project
,
current_user
).
execute
end
end
spec/features/dashboard/merge_requests_spec.rb
View file @
a7ccf27d
require
'spec_helper'
describe
'Dashboard Merge Requests'
do
feature
'Dashboard Merge Requests'
do
include
FilterItemSelectHelper
let
(
:current_user
)
{
create
:user
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project_with_merge_requests_disabled
)
{
create
(
:empty_project
,
:merge_requests_disabled
)
}
before
do
[
project
,
project_with_merge_requests_disabled
].
each
{
|
project
|
project
.
team
<<
[
current_user
,
:master
]
}
let
(
:public_project
)
{
create
(
:empty_project
,
:public
,
:repository
)
}
let
(
:forked_project
)
{
Projects
::
ForkService
.
new
(
public_project
,
current_user
).
execute
}
gitlab_sign_in
(
current_user
)
before
do
project
.
add_master
(
current_user
)
sign_in
(
current_user
)
end
describe
'new merge request dropdown'
do
context
'new merge request dropdown'
do
let
(
:project_with_disabled_merge_requests
)
{
create
(
:empty_project
,
:merge_requests_disabled
)
}
before
do
project_with_disabled_merge_requests
.
add_master
(
current_user
)
visit
merge_requests_dashboard_path
end
...
...
@@ -21,26 +27,87 @@ describe 'Dashboard Merge Requests' do
page
.
within
(
'.select2-results'
)
do
expect
(
page
).
to
have_content
(
project
.
name_with_namespace
)
expect
(
page
).
not_to
have_content
(
project_with_
merge_requests_disabled
.
name_with_namespace
)
expect
(
page
).
not_to
have_content
(
project_with_
disabled_merge_requests
.
name_with_namespace
)
end
end
end
it
'should show an empty state'
do
visit
merge_requests_dashboard_path
(
assignee_id:
current_user
.
id
)
context
'no merge requests exist'
do
it
'shows an empty state'
do
visit
merge_requests_dashboard_path
(
assignee_id:
current_user
.
id
)
expect
(
page
).
to
have_selector
(
'.empty-state'
)
expect
(
page
).
to
have_selector
(
'.empty-state'
)
end
end
context
'if there are merge requests'
do
before
do
create
(
:merge_request
,
assignee:
current_user
,
source_project:
project
)
context
'merge requests exist'
do
let!
(
:assigned_merge_request
)
do
create
(
:merge_request
,
assignee:
current_user
,
target_project:
project
,
source_project:
project
)
end
let!
(
:assigned_merge_request_from_fork
)
do
create
(
:merge_request
,
source_branch:
'markdown'
,
assignee:
current_user
,
target_project:
public_project
,
source_project:
forked_project
)
end
let!
(
:authored_merge_request
)
do
create
(
:merge_request
,
source_branch:
'markdown'
,
author:
current_user
,
target_project:
project
,
source_project:
project
)
end
let!
(
:authored_merge_request_from_fork
)
do
create
(
:merge_request
,
source_branch:
'feature_conflict'
,
author:
current_user
,
target_project:
public_project
,
source_project:
forked_project
)
end
let!
(
:other_merge_request
)
do
create
(
:merge_request
,
source_branch:
'fix'
,
target_project:
project
,
source_project:
project
)
end
before
do
visit
merge_requests_dashboard_path
(
assignee_id:
current_user
.
id
)
end
it
'should not show an empty state'
do
expect
(
page
).
not_to
have_selector
(
'.empty-state'
)
it
'shows assigned merge requests'
do
expect
(
page
).
to
have_content
(
assigned_merge_request
.
title
)
expect
(
page
).
to
have_content
(
assigned_merge_request_from_fork
.
title
)
expect
(
page
).
not_to
have_content
(
authored_merge_request
.
title
)
expect
(
page
).
not_to
have_content
(
authored_merge_request_from_fork
.
title
)
expect
(
page
).
not_to
have_content
(
other_merge_request
.
title
)
end
it
'shows authored merge requests'
,
js:
true
do
filter_item_select
(
'Any Assignee'
,
'.js-assignee-search'
)
filter_item_select
(
current_user
.
to_reference
,
'.js-author-search'
)
expect
(
page
).
to
have_content
(
authored_merge_request
.
title
)
expect
(
page
).
to
have_content
(
authored_merge_request_from_fork
.
title
)
expect
(
page
).
not_to
have_content
(
assigned_merge_request
.
title
)
expect
(
page
).
not_to
have_content
(
assigned_merge_request_from_fork
.
title
)
expect
(
page
).
not_to
have_content
(
other_merge_request
.
title
)
end
it
'shows all merge requests'
,
js:
true
do
filter_item_select
(
'Any Assignee'
,
'.js-assignee-search'
)
filter_item_select
(
'Any Author'
,
'.js-author-search'
)
expect
(
page
).
to
have_content
(
authored_merge_request
.
title
)
expect
(
page
).
to
have_content
(
authored_merge_request_from_fork
.
title
)
expect
(
page
).
to
have_content
(
assigned_merge_request
.
title
)
expect
(
page
).
to
have_content
(
assigned_merge_request_from_fork
.
title
)
expect
(
page
).
to
have_content
(
other_merge_request
.
title
)
end
end
end
spec/features/dashboard/milestone_filter_spec.rb
View file @
a7ccf27d
require
'spec_helper'
describe
'Dashboard > milestone filter'
,
:feature
,
:js
do
feature
'Dashboard > milestone filter'
,
:feature
,
:js
do
include
FilterItemSelectHelper
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
let
(
:milestone
)
{
create
(
:milestone
,
title:
"v1.0"
,
project:
project
)
}
let
(
:milestone2
)
{
create
(
:milestone
,
title:
"v2.0"
,
project:
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
title:
'v1.0'
,
project:
project
)
}
let
(
:milestone2
)
{
create
(
:milestone
,
title:
'v2.0'
,
project:
project
)
}
let!
(
:issue
)
{
create
:issue
,
author:
user
,
project:
project
,
milestone:
milestone
}
let!
(
:issue2
)
{
create
:issue
,
author:
user
,
project:
project
,
milestone:
milestone2
}
...
...
@@ -22,17 +24,11 @@ describe 'Dashboard > milestone filter', :feature, :js do
end
context
'filtering by milestone'
do
milestone_select
=
'.js-milestone-select'
milestone_select
_selector
=
'.js-milestone-select'
before
do
find
(
milestone_select
).
click
wait_for_requests
page
.
within
(
'.dropdown-content'
)
do
click_link
'v1.0'
end
find
(
milestone_select
).
click
filter_item_select
(
'v1.0'
,
milestone_select_selector
)
find
(
milestone_select_selector
).
click
wait_for_requests
end
...
...
@@ -49,7 +45,7 @@ describe 'Dashboard > milestone filter', :feature, :js do
expect
(
find
(
'.milestone-filter'
)).
not_to
have_selector
(
'.dropdown.open'
)
find
(
milestone_select
).
click
find
(
milestone_select
_selector
).
click
expect
(
find
(
'.dropdown-content'
)).
to
have_selector
(
'a.is-active'
,
count:
1
)
expect
(
find
(
'.dropdown-content a.is-active'
)).
to
have_content
(
'v1.0'
)
...
...
spec/support/filter_item_select_helper.rb
0 → 100644
View file @
a7ccf27d
# Helper allows you to select value from filter-items
#
# Params
# value - value for select
# selector - css selector of item
#
# Usage:
#
# filter_item_select('Any Author', '.js-author-search')
#
module
FilterItemSelectHelper
def
filter_item_select
(
value
,
selector
)
find
(
selector
).
click
wait_for_requests
page
.
within
(
'.dropdown-content'
)
do
click_link
value
end
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