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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
1c84f668
Commit
1c84f668
authored
Jul 14, 2017
by
Alexander Randa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaces dashboard/dashboard.feature spinach with rspec
parent
7fbcdfb0
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
143 additions
and
179 deletions
+143
-179
changelogs/unreleased/23036-replace-dashboard-spinach.yml
changelogs/unreleased/23036-replace-dashboard-spinach.yml
+4
-0
features/dashboard/dashboard.feature
features/dashboard/dashboard.feature
+0
-70
features/steps/dashboard/dashboard.rb
features/steps/dashboard/dashboard.rb
+0
-83
features/steps/shared/project.rb
features/steps/shared/project.rb
+0
-5
spec/features/dashboard/groups_list_spec.rb
spec/features/dashboard/groups_list_spec.rb
+2
-2
spec/features/dashboard/issues_filter_spec.rb
spec/features/dashboard/issues_filter_spec.rb
+51
-9
spec/features/dashboard/merge_requests_spec.rb
spec/features/dashboard/merge_requests_spec.rb
+17
-0
spec/features/dashboard/milestones_spec.rb
spec/features/dashboard/milestones_spec.rb
+0
-0
spec/features/dashboard/projects_spec.rb
spec/features/dashboard/projects_spec.rb
+45
-2
spec/features/projects/merge_request_button_spec.rb
spec/features/projects/merge_request_button_spec.rb
+6
-8
spec/support/sorting_helper.rb
spec/support/sorting_helper.rb
+18
-0
No files found.
changelogs/unreleased/23036-replace-dashboard-spinach.yml
0 → 100644
View file @
1c84f668
---
title
:
Replaces dashboard/dashboard.feature spinach with rspec
merge_request
:
12876
author
:
Alexander Randa (@randaalex)
features/dashboard/dashboard.feature
deleted
100644 → 0
View file @
7fbcdfb0
@dashboard
Feature
:
Dashboard
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And
project
"Shop"
has push event
And
project
"Shop"
has CI enabled
And
project
"Shop"
has CI build
And project "Shop" has labels
:
"bug",
"feature",
"enhancement"
And project "Shop" has issue
:
"bug
report"
And
I visit dashboard page
Scenario
:
I
should see projects list
Then
I should see
"New Project"
link
Then
I should see
"Shop"
project link
Then
I should see
"Shop"
project CI status
@javascript
Scenario
:
I
should see activity list
And
I visit dashboard activity page
Then
I should see project
"Shop"
activity feed
Scenario
:
I
should see groups list
Given
I have group with projects
And
I visit dashboard page
Then
I should see groups list
@javascript
Scenario
:
I
should see last push widget
Then
I should see last push widget
And
I click
"Create Merge Request"
link
Then
I see prefilled new Merge Request page
@javascript
Scenario
:
Sorting Issues
Given
I visit dashboard issues page
And
I sort the list by
"Oldest updated"
And
I visit dashboard activity page
And
I visit dashboard issues page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
Filtering Issues by label
Given
project
"Shop"
has issue
"Bugfix1"
with label
"feature"
When
I visit dashboard issues page
And
I filter the list by label
"feature"
Then
I should see
"Bugfix1"
in issues list
@javascript
Scenario
:
Visiting Project's issues after sorting
Given
I visit dashboard issues page
And
I sort the list by
"Oldest updated"
And
I visit project
"Shop"
issues page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
Sorting Merge Requests
Given
I visit dashboard merge requests page
And
I sort the list by
"Oldest updated"
And
I visit dashboard activity page
And
I visit dashboard merge requests page
Then
The list should be sorted by
"Oldest updated"
@javascript
Scenario
:
Visiting Project's merge requests after sorting
Given
project
"Shop"
has a
"Bugfix MR"
merge request open
And
I visit dashboard merge requests page
And
I sort the list by
"Oldest updated"
And
I visit project
"Shop"
merge requests page
Then
The list should be sorted by
"Oldest updated"
features/steps/dashboard/dashboard.rb
deleted
100644 → 0
View file @
7fbcdfb0
class
Spinach::Features::Dashboard
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
include
SharedIssuable
step
'I should see "New Project" link'
do
expect
(
page
).
to
have_link
"New project"
end
step
'I should see "Shop" project link'
do
expect
(
page
).
to
have_link
"Shop"
end
step
'I should see "Shop" project CI status'
do
expect
(
page
).
to
have_link
"Commit: skipped"
end
step
'I should see last push widget'
do
expect
(
page
).
to
have_content
"You pushed to fix"
expect
(
page
).
to
have_link
"Create merge request"
end
step
'I click "Create merge request" link'
do
find_link
(
"Create merge request"
,
visible:
false
).
trigger
(
'click'
)
end
step
'I see prefilled new Merge Request page'
do
expect
(
page
).
to
have_selector
(
'.merge-request-form'
)
expect
(
current_path
).
to
eq
project_new_merge_request_path
(
@project
)
expect
(
find
(
"#merge_request_target_project_id"
).
value
).
to
eq
@project
.
id
.
to_s
expect
(
find
(
"input#merge_request_source_branch"
).
value
).
to
eq
"fix"
expect
(
find
(
"input#merge_request_target_branch"
).
value
).
to
eq
"master"
end
step
'I have group with projects'
do
@group
=
create
(
:group
)
@project
=
create
(
:empty_project
,
namespace:
@group
)
@event
=
create
(
:closed_issue_event
,
project:
@project
)
@project
.
team
<<
[
current_user
,
:master
]
end
step
'I should see projects list'
do
@user
.
authorized_projects
.
all
.
each
do
|
project
|
expect
(
page
).
to
have_link
project
.
name_with_namespace
end
end
step
'I should see groups list'
do
Group
.
all
.
each
do
|
group
|
expect
(
page
).
to
have_link
group
.
name
end
end
step
'group has a projects that does not belongs to me'
do
@forbidden_project1
=
create
(
:empty_project
,
group:
@group
)
@forbidden_project2
=
create
(
:empty_project
,
group:
@group
)
end
step
'I should see 1 project at group list'
do
expect
(
find
(
'span.last_activity/span'
)).
to
have_content
(
'1'
)
end
step
'I filter the list by label "feature"'
do
page
.
within
".labels-filter"
do
find
(
'.dropdown'
).
click
click_link
"feature"
end
end
step
'I should see "Bugfix1" in issues list'
do
page
.
within
"ul.content-list"
do
expect
(
page
).
to
have_content
"Bugfix1"
end
end
step
'project "Shop" has issue "Bugfix1" with label "feature"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
issue
=
create
(
:issue
,
title:
"Bugfix1"
,
project:
project
,
assignees:
[
current_user
])
issue
.
labels
<<
project
.
labels
.
find_by
(
title:
'feature'
)
end
end
features/steps/shared/project.rb
View file @
1c84f668
...
...
@@ -239,11 +239,6 @@ module SharedProject
create
(
:label
,
project:
project
,
title:
'enhancement'
)
end
step
'project "Shop" has issue: "bug report"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
create
(
:issue
,
project:
project
,
title:
"bug report"
)
end
step
'project "Shop" has CI enabled'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
project
.
enable_ci
...
...
spec/features/dashboard/groups_list_spec.rb
View file @
1c84f668
require
'spec_helper'
describe
'Dashboard Groups page'
,
js:
true
,
feature:
true
do
feature
'Dashboard Groups page'
,
:js
do
let!
(
:user
)
{
create
:user
}
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:nested_group
)
{
create
(
:group
,
:nested
)
}
...
...
@@ -41,7 +41,7 @@ describe 'Dashboard Groups page', js: true, feature: true do
fill_in
'filter_groups'
,
with:
group
.
name
wait_for_requests
fill_in
'filter_groups'
,
with:
""
fill_in
'filter_groups'
,
with:
''
wait_for_requests
expect
(
page
).
to
have_content
(
group
.
full_name
)
...
...
spec/features/dashboard
_issues
_spec.rb
→
spec/features/dashboard
/issues_filter
_spec.rb
View file @
1c84f668
require
'spec_helper'
describe
"Dashboard Issues filtering"
,
feature:
true
,
js:
true
do
feature
'Dashboard Issues filtering'
,
js:
true
do
include
SortingHelper
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
context
'filtering by milestone'
do
before
do
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
user
,
assignees:
[
user
])
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
project
,
author:
user
,
assignees:
[
user
],
milestone:
milestone
)
}
create
(
:issue
,
project:
project
,
author:
user
,
assignees:
[
user
])
create
(
:issue
,
project:
project
,
author:
user
,
assignees:
[
user
],
milestone:
milestone
)
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
visit_issues
end
visit_issues
end
context
'filtering by milestone'
do
it
'shows all issues with no milestone'
do
show_milestone_dropdown
...
...
@@ -62,6 +64,46 @@ describe "Dashboard Issues filtering", feature: true, js: true do
end
end
context
'filtering by label'
do
let
(
:label
)
{
create
(
:label
,
project:
project
)
}
let!
(
:label_link
)
{
create
(
:label_link
,
label:
label
,
target:
issue
)
}
it
'shows all issues without filter'
do
page
.
within
'ul.content-list'
do
expect
(
page
).
to
have_content
issue
.
title
expect
(
page
).
to
have_content
issue2
.
title
end
end
it
'shows all issues with the selected label'
do
page
.
within
'.labels-filter'
do
find
(
'.dropdown'
).
click
click_link
label
.
title
end
page
.
within
'ul.content-list'
do
expect
(
page
).
to
have_content
issue
.
title
expect
(
page
).
not_to
have_content
issue2
.
title
end
end
end
context
'sorting'
do
it
'shows sorted issues'
do
sorting_by
(
'Oldest updated'
)
visit_issues
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Oldest updated'
)
end
it
'keeps sorting issues after visiting Projects Issues page'
do
sorting_by
(
'Oldest updated'
)
visit
project_issues_path
(
project
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Oldest updated'
)
end
end
def
show_milestone_dropdown
click_button
'Milestone'
expect
(
page
).
to
have_selector
(
'.dropdown-content'
,
visible:
true
)
...
...
spec/features/dashboard/merge_requests_spec.rb
View file @
1c84f668
...
...
@@ -2,6 +2,7 @@ require 'spec_helper'
feature
'Dashboard Merge Requests'
do
include
FilterItemSelectHelper
include
SortingHelper
let
(
:current_user
)
{
create
:user
}
let
(
:project
)
{
create
(
:empty_project
)
}
...
...
@@ -109,5 +110,21 @@ feature 'Dashboard Merge Requests' do
expect
(
page
).
to
have_content
(
assigned_merge_request_from_fork
.
title
)
expect
(
page
).
to
have_content
(
other_merge_request
.
title
)
end
it
'shows sorted merge requests'
do
sorting_by
(
'Oldest updated'
)
visit
merge_requests_dashboard_path
(
assignee_id:
current_user
.
id
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Oldest updated'
)
end
it
'keeps sorting merge requests after visiting Projects MR page'
do
sorting_by
(
'Oldest updated'
)
visit
project_merge_requests_path
(
project
)
expect
(
find
(
'.issues-filters'
)).
to
have_content
(
'Oldest updated'
)
end
end
end
spec/features/dashboard
_
milestones_spec.rb
→
spec/features/dashboard
/
milestones_spec.rb
View file @
1c84f668
File moved
spec/features/dashboard/projects_spec.rb
View file @
1c84f668
...
...
@@ -61,7 +61,7 @@ feature 'Dashboard Projects' do
end
end
describe
"with a pipeline"
,
clean_gitlab_redis_shared_state:
true
do
describe
'with a pipeline'
,
clean_gitlab_redis_shared_state:
true
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
sha
)
}
before
do
...
...
@@ -74,7 +74,50 @@ feature 'Dashboard Projects' do
it
'shows that the last pipeline passed'
do
visit
dashboard_projects_path
expect
(
page
).
to
have_xpath
(
"//a[@href='
#{
pipelines_project_commit_path
(
project
,
project
.
commit
)
}
']"
)
page
.
within
(
'.controls'
)
do
expect
(
page
).
to
have_xpath
(
"//a[@href='
#{
pipelines_project_commit_path
(
project
,
project
.
commit
)
}
']"
)
expect
(
page
).
to
have_css
(
'.ci-status-link'
)
expect
(
page
).
to
have_css
(
'.ci-status-icon-success'
)
expect
(
page
).
to
have_link
(
'Commit: passed'
)
end
end
end
context
'last push widget'
do
let
(
:push_event_data
)
do
{
before:
Gitlab
::
Git
::
BLANK_SHA
,
after:
'0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e'
,
ref:
'refs/heads/feature'
,
user_id:
user
.
id
,
user_name:
user
.
name
,
repository:
{
name:
project
.
name
,
url:
'localhost/rubinius'
,
description:
''
,
homepage:
'localhost/rubinius'
,
private:
true
}
}
end
let!
(
:push_event
)
{
create
(
:event
,
:pushed
,
data:
push_event_data
,
project:
project
,
author:
user
)
}
before
do
visit
dashboard_projects_path
end
scenario
'shows "Create merge request" button'
do
expect
(
page
).
to
have_content
'You pushed to feature'
within
(
'#content-body'
)
do
find_link
(
'Create merge request'
,
visible:
false
).
click
end
expect
(
page
).
to
have_selector
(
'.merge-request-form'
)
expect
(
current_path
).
to
eq
project_new_merge_request_path
(
project
)
expect
(
find
(
'#merge_request_target_project_id'
).
value
).
to
eq
project
.
id
.
to_s
expect
(
find
(
'input#merge_request_source_branch'
).
value
).
to
eq
'feature'
expect
(
find
(
'input#merge_request_target_branch'
).
value
).
to
eq
'master'
end
end
end
spec/features/projects/merge_request_button_spec.rb
View file @
1c84f668
require
'spec_helper'
feature
'Merge Request button'
,
feature:
true
do
feature
'Merge Request button'
do
shared_examples
'Merge request button only shown when allowed'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
...
...
@@ -10,16 +10,14 @@ feature 'Merge Request button', feature: true do
it
'does not show Create merge request button'
do
visit
url
within
(
"#content-body"
)
do
expect
(
page
).
not_to
have_link
(
label
)
end
expect
(
page
).
not_to
have_link
(
label
)
end
end
context
'logged in as developer'
do
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
project
.
add_developer
(
user
)
end
it
'shows Create merge request button'
do
...
...
@@ -29,7 +27,7 @@ feature 'Merge Request button', feature: true do
visit
url
within
(
"#content-body"
)
do
within
(
'#content-body'
)
do
expect
(
page
).
to
have_link
(
label
,
href:
href
)
end
end
...
...
@@ -42,7 +40,7 @@ feature 'Merge Request button', feature: true do
it
'does not show Create merge request button'
do
visit
url
within
(
"#content-body"
)
do
within
(
'#content-body'
)
do
expect
(
page
).
not_to
have_link
(
label
)
end
end
...
...
@@ -57,7 +55,7 @@ feature 'Merge Request button', feature: true do
it
'does not show Create merge request button'
do
visit
url
within
(
"#content-body"
)
do
within
(
'#content-body'
)
do
expect
(
page
).
not_to
have_link
(
label
)
end
end
...
...
spec/support/sorting_helper.rb
0 → 100644
View file @
1c84f668
# Helper allows you to sort items
#
# Params
# value - value for sorting
#
# Usage:
# include SortingHelper
#
# sorting_by('Oldest updated')
#
module
SortingHelper
def
sorting_by
(
value
)
find
(
'button.dropdown-toggle'
).
click
page
.
within
(
'.content ul.dropdown-menu.dropdown-menu-align-right li'
)
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