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
f1b5d2c7
Commit
f1b5d2c7
authored
Jun 26, 2017
by
Alexander Randa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaces 'dashboard/todos' spinach with rspec
parent
245be4ce
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
399 additions
and
618 deletions
+399
-618
changelogs/unreleased/23036-replace-dashboard-todo-spinach.yml
...elogs/unreleased/23036-replace-dashboard-todo-spinach.yml
+4
-0
features/dashboard/todos.feature
features/dashboard/todos.feature
+0
-28
features/steps/dashboard/todos.rb
features/steps/dashboard/todos.rb
+0
-191
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+0
-4
spec/features/dashboard/todos/target_state_spec.rb
spec/features/dashboard/todos/target_state_spec.rb
+5
-5
spec/features/dashboard/todos/todos_filtering_spec.rb
spec/features/dashboard/todos/todos_filtering_spec.rb
+7
-7
spec/features/dashboard/todos/todos_sorting_spec.rb
spec/features/dashboard/todos/todos_sorting_spec.rb
+28
-28
spec/features/dashboard/todos/todos_spec.rb
spec/features/dashboard/todos/todos_spec.rb
+355
-0
spec/features/todos/todos_spec.rb
spec/features/todos/todos_spec.rb
+0
-355
No files found.
changelogs/unreleased/23036-replace-dashboard-todo-spinach.yml
0 → 100644
View file @
f1b5d2c7
---
title
:
Replace 'dashboard/todos' spinach with rspec
merge_request
:
12453
author
:
Alexander Randa (@randaalex)
features/dashboard/todos.feature
deleted
100644 → 0
View file @
245be4ce
@dashboard
Feature
:
Dashboard Todos
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And
"John Doe"
is a developer of project
"Shop"
And
"Mary Jane"
is a developer of project
"Shop"
And
"Mary Jane"
owns private project
"Enterprise"
And
I am a developer of project
"Enterprise"
And
I have todos
And
I visit dashboard todos page
@javascript
Scenario
:
I
mark todos as done
Then
I should see todos assigned to me
And
I mark the todo as done
Then
I should see the todo marked as done
@javascript
Scenario
:
I
mark all todos as done
Then
I should see todos assigned to me
And
I mark all todos as done
Then
I should see all todos marked as done
@javascript
Scenario
:
I
click on a todo row
Given
I click on the todo
Then
I should be directed to the corresponding page
features/steps/dashboard/todos.rb
deleted
100644 → 0
View file @
245be4ce
class
Spinach::Features::DashboardTodos
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
include
SharedUser
include
WaitForRequests
step
'"John Doe" is a developer of project "Shop"'
do
project
.
team
<<
[
john_doe
,
:developer
]
end
step
'I am a developer of project "Enterprise"'
do
enterprise
.
team
<<
[
current_user
,
:developer
]
end
step
'"Mary Jane" is a developer of project "Shop"'
do
project
.
team
<<
[
john_doe
,
:developer
]
end
step
'I have todos'
do
create
(
:todo
,
user:
current_user
,
project:
project
,
author:
mary_jane
,
target:
issue
,
action:
Todo
::
MENTIONED
)
create
(
:todo
,
user:
current_user
,
project:
project
,
author:
john_doe
,
target:
issue
,
action:
Todo
::
ASSIGNED
)
note
=
create
(
:note
,
author:
john_doe
,
noteable:
issue
,
note:
"
#{
current_user
.
to_reference
}
Wdyt?"
,
project:
project
)
create
(
:todo
,
user:
current_user
,
project:
project
,
author:
john_doe
,
target:
issue
,
action:
Todo
::
MENTIONED
,
note:
note
)
create
(
:todo
,
user:
current_user
,
project:
project
,
author:
john_doe
,
target:
merge_request
,
action:
Todo
::
ASSIGNED
)
end
step
'I should see todos assigned to me'
do
merge_request_reference
=
merge_request
.
to_reference
(
full:
true
)
issue_reference
=
issue
.
to_reference
(
full:
true
)
page
.
within
(
'.todos-count'
)
{
expect
(
page
).
to
have_content
'4'
}
expect
(
page
).
to
have_content
'To do 4'
expect
(
page
).
to
have_content
'Done 0'
expect
(
page
).
to
have_link
project
.
name_with_namespace
should_see_todo
(
1
,
"John Doe assigned you merge request
#{
merge_request_reference
}
"
,
merge_request
.
title
)
should_see_todo
(
2
,
"John Doe mentioned you on issue
#{
issue_reference
}
"
,
"
#{
current_user
.
to_reference
}
Wdyt?"
)
should_see_todo
(
3
,
"John Doe assigned you issue
#{
issue_reference
}
"
,
issue
.
title
)
should_see_todo
(
4
,
"Mary Jane mentioned you on issue
#{
issue_reference
}
"
,
issue
.
title
)
end
step
'I mark the todo as done'
do
page
.
within
(
'.todo:nth-child(1)'
)
do
click_link
'Done'
end
page
.
within
(
'.todos-count'
)
{
expect
(
page
).
to
have_content
'3'
}
expect
(
page
).
to
have_content
'To do 3'
expect
(
page
).
to
have_content
'Done 1'
should_see_todo
(
1
,
"John Doe assigned you merge request
#{
merge_request
.
to_reference
(
full:
true
)
}
"
,
merge_request
.
title
,
state: :done_reversible
)
end
step
'I mark all todos as done'
do
merge_request_reference
=
merge_request
.
to_reference
(
full:
true
)
issue_reference
=
issue
.
to_reference
(
full:
true
)
find
(
'.js-todos-mark-all'
).
trigger
(
'click'
)
page
.
within
(
'.todos-count'
)
{
expect
(
page
).
to
have_content
'0'
}
expect
(
page
).
to
have_content
'To do 0'
expect
(
page
).
to
have_content
'Done 4'
expect
(
page
).
to
have_content
"You're all done!"
expect
(
'.prepend-top-default'
).
not_to
have_link
project
.
name_with_namespace
should_not_see_todo
"John Doe assigned you merge request
#{
merge_request_reference
}
"
should_not_see_todo
"John Doe mentioned you on issue
#{
issue_reference
}
"
should_not_see_todo
"John Doe assigned you issue
#{
issue_reference
}
"
should_not_see_todo
"Mary Jane mentioned you on issue
#{
issue_reference
}
"
end
step
'I should see the todo marked as done'
do
find
(
'.todos-done a'
).
trigger
(
'click'
)
expect
(
page
).
to
have_link
project
.
name_with_namespace
should_see_todo
(
1
,
"John Doe assigned you merge request
#{
merge_request
.
to_reference
(
full:
true
)
}
"
,
merge_request
.
title
,
state: :done_irreversible
)
end
step
'I should see all todos marked as done'
do
merge_request_reference
=
merge_request
.
to_reference
(
full:
true
)
issue_reference
=
issue
.
to_reference
(
full:
true
)
find
(
'.todos-done a'
).
trigger
(
'click'
)
expect
(
page
).
to
have_link
project
.
name_with_namespace
should_see_todo
(
1
,
"John Doe assigned you merge request
#{
merge_request_reference
}
"
,
merge_request
.
title
,
state: :done_irreversible
)
should_see_todo
(
2
,
"John Doe mentioned you on issue
#{
issue_reference
}
"
,
"
#{
current_user
.
to_reference
}
Wdyt?"
,
state: :done_irreversible
)
should_see_todo
(
3
,
"John Doe assigned you issue
#{
issue_reference
}
"
,
issue
.
title
,
state: :done_irreversible
)
should_see_todo
(
4
,
"Mary Jane mentioned you on issue
#{
issue_reference
}
"
,
issue
.
title
,
state: :done_irreversible
)
end
step
'I filter by "Enterprise"'
do
click_button
'Project'
page
.
within
'.dropdown-menu-project'
do
click_link
enterprise
.
name_with_namespace
end
end
step
'I filter by "John Doe"'
do
click_button
'Author'
page
.
within
'.dropdown-menu-author'
do
click_link
john_doe
.
username
end
end
step
'I filter by "Issue"'
do
click_button
'Type'
page
.
within
'.dropdown-menu-type'
do
click_link
'Issue'
end
end
step
'I filter by "Mentioned"'
do
click_button
'Action'
page
.
within
'.dropdown-menu-action'
do
click_link
'Mentioned'
end
end
step
'I should not see todos'
do
expect
(
page
).
to
have_content
"You're all done!"
end
step
'I should not see todos related to "Mary Jane" in the list'
do
should_not_see_todo
"Mary Jane mentioned you on issue
#{
issue
.
to_reference
(
full:
true
)
}
"
end
step
'I should not see todos related to "Merge Requests" in the list'
do
should_not_see_todo
"John Doe assigned you merge request
#{
merge_request
.
to_reference
(
full:
true
)
}
"
end
step
'I should not see todos related to "Assignments" in the list'
do
should_not_see_todo
"John Doe assigned you merge request
#{
merge_request
.
to_reference
(
full:
true
)
}
"
should_not_see_todo
"John Doe assigned you issue
#{
issue
.
to_reference
(
full:
true
)
}
"
end
step
'I click on the todo'
do
find
(
'.todo:nth-child(1)'
).
click
end
step
'I should be directed to the corresponding page'
do
page
.
should
have_css
(
'.identifier'
,
text:
'Merge request !1'
)
# Merge request page loads and issues a number of Ajax requests
wait_for_requests
end
def
should_see_todo
(
position
,
title
,
body
,
state: :pending
)
page
.
within
(
".todo:nth-child(
#{
position
}
)"
)
do
expect
(
page
).
to
have_content
title
expect
(
page
).
to
have_content
body
if
state
==
:pending
expect
(
page
).
to
have_link
'Done'
elsif
state
==
:done_reversible
expect
(
page
).
to
have_link
'Undo'
elsif
state
==
:done_irreversible
expect
(
page
).
not_to
have_link
'Undo'
expect
(
page
).
not_to
have_link
'Done'
else
raise
'Invalid state given, valid states: :pending, :done_reversible, :done_irreversible'
end
end
end
def
should_not_see_todo
(
title
)
expect
(
page
).
not_to
have_visible_content
title
end
def
have_visible_content
(
text
)
have_css
(
'*'
,
text:
text
,
visible:
true
)
end
def
john_doe
@john_doe
||=
user_exists
(
"John Doe"
,
{
username:
"john_doe"
})
end
def
mary_jane
@mary_jane
||=
user_exists
(
"Mary Jane"
,
{
username:
"mary_jane"
})
end
def
enterprise
@enterprise
||=
Project
.
find_by
(
name:
'Enterprise'
)
end
def
issue
@issue
||=
create
(
:issue
,
assignees:
[
current_user
],
project:
project
)
end
def
merge_request
@merge_request
||=
create
(
:merge_request
,
assignee:
current_user
,
source_project:
project
)
end
end
features/steps/shared/paths.rb
View file @
f1b5d2c7
...
...
@@ -112,10 +112,6 @@ module SharedPaths
visit
dashboard_groups_path
end
step
'I visit dashboard todos page'
do
visit
dashboard_todos_path
end
step
'I should be redirected to the dashboard groups page'
do
expect
(
current_path
).
to
eq
dashboard_groups_path
end
...
...
spec/features/todos/target_state_spec.rb
→
spec/features/
dashboard/
todos/target_state_spec.rb
View file @
f1b5d2c7
require
'rails_helper'
feature
'
Todo target states'
,
feature:
true
do
feature
'
Dashboard > Todo target states'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
gitlab_sign_in
user
sign_in
(
user
)
end
scenario
'on a closed issue todo has closed label'
do
...
...
@@ -30,7 +30,7 @@ feature 'Todo target states', feature: true do
end
scenario
'on a merged merge request todo has merged label'
do
mr_merged
=
create
(
:merge_request
,
:simple
,
author:
user
,
state:
'merged'
)
mr_merged
=
create
(
:merge_request
,
:simple
,
:merged
,
author:
user
)
create_todo
mr_merged
visit
dashboard_todos_path
...
...
@@ -40,7 +40,7 @@ feature 'Todo target states', feature: true do
end
scenario
'on a closed merge request todo has closed label'
do
mr_closed
=
create
(
:merge_request
,
:simple
,
author:
user
,
state:
'closed'
)
mr_closed
=
create
(
:merge_request
,
:simple
,
:closed
,
author:
user
)
create_todo
mr_closed
visit
dashboard_todos_path
...
...
spec/features/todos/todos_filtering_spec.rb
→
spec/features/
dashboard/
todos/todos_filtering_spec.rb
View file @
f1b5d2c7
require
'spec_helper'
describe
'Dashboard > User filters todos'
,
feature:
true
,
js:
true
do
feature
'Dashboard > User filters todos'
,
js:
true
do
let
(
:user_1
)
{
create
(
:user
,
username:
'user_1'
,
name:
'user_1'
)
}
let
(
:user_2
)
{
create
(
:user
,
username:
'user_2'
,
name:
'user_2'
)
}
...
...
@@ -17,7 +17,7 @@ describe 'Dashboard > User filters todos', feature: true, js: true do
project_1
.
team
<<
[
user_1
,
:developer
]
project_2
.
team
<<
[
user_1
,
:developer
]
gitlab_
sign_in
(
user_1
)
sign_in
(
user_1
)
visit
dashboard_todos_path
end
...
...
@@ -34,7 +34,7 @@ describe 'Dashboard > User filters todos', feature: true, js: true do
expect
(
page
).
not_to
have_content
project_2
.
name_with_namespace
end
context
"Author filter"
do
context
'Author filter'
do
it
'filters by author'
do
click_button
'Author'
...
...
@@ -49,18 +49,18 @@ describe 'Dashboard > User filters todos', feature: true, js: true do
expect
(
find
(
'.todos-list'
)).
not_to
have_content
'issue'
end
it
"shows only authors of existing todos"
do
it
'shows only authors of existing todos'
do
click_button
'Author'
within
'.dropdown-menu-author'
do
# It should contain two users +
"Any Author"
# It should contain two users +
'Any Author'
expect
(
page
).
to
have_selector
(
'.dropdown-menu-user-link'
,
count:
3
)
expect
(
page
).
to
have_content
(
user_1
.
name
)
expect
(
page
).
to
have_content
(
user_2
.
name
)
end
end
it
"shows only authors of existing done todos"
do
it
'shows only authors of existing done todos'
do
user_3
=
create
:user
user_4
=
create
:user
create
(
:todo
,
user:
user_1
,
author:
user_3
,
project:
project_1
,
target:
issue
,
action:
1
,
state: :done
)
...
...
@@ -74,7 +74,7 @@ describe 'Dashboard > User filters todos', feature: true, js: true do
click_button
'Author'
within
'.dropdown-menu-author'
do
# It should contain two users +
"Any Author"
# It should contain two users +
'Any Author'
expect
(
page
).
to
have_selector
(
'.dropdown-menu-user-link'
,
count:
3
)
expect
(
page
).
to
have_content
(
user_3
.
name
)
expect
(
page
).
to
have_content
(
user_4
.
name
)
...
...
spec/features/todos/todos_sorting_spec.rb
→
spec/features/
dashboard/
todos/todos_sorting_spec.rb
View file @
f1b5d2c7
require
'spec_helper'
describe
"Dashboard > User sorts todos"
,
feature:
true
do
feature
'Dashboard > User sorts todos'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
...
...
@@ -18,7 +18,7 @@ describe "Dashboard > User sorts todos", feature: true do
let
(
:issue_3
)
{
create
(
:issue
,
title:
'issue_3'
,
project:
project
)
}
let
(
:issue_4
)
{
create
(
:issue
,
title:
'issue_4'
,
project:
project
)
}
let!
(
:merge_request_1
)
{
create
(
:merge_request
,
source_project:
project
,
title:
"merge_request_1"
)
}
let!
(
:merge_request_1
)
{
create
(
:merge_request
,
source_project:
project
,
title:
'merge_request_1'
)
}
before
do
create
(
:todo
,
user:
user
,
project:
project
,
target:
issue_4
,
created_at:
5
.
hours
.
ago
)
...
...
@@ -32,41 +32,41 @@ describe "Dashboard > User sorts todos", feature: true do
issue_2
.
labels
<<
label_3
issue_1
.
labels
<<
label_2
gitlab_
sign_in
(
user
)
sign_in
(
user
)
visit
dashboard_todos_path
end
it
"sorts with oldest created todos first"
do
click_link
"Last created"
it
'sorts with oldest created todos first'
do
click_link
'Last created'
results_list
=
page
.
find
(
'.todos-list'
)
expect
(
results_list
.
all
(
'p'
)[
0
]).
to
have_content
(
"merge_request_1"
)
expect
(
results_list
.
all
(
'p'
)[
1
]).
to
have_content
(
"issue_1"
)
expect
(
results_list
.
all
(
'p'
)[
2
]).
to
have_content
(
"issue_3"
)
expect
(
results_list
.
all
(
'p'
)[
3
]).
to
have_content
(
"issue_2"
)
expect
(
results_list
.
all
(
'p'
)[
4
]).
to
have_content
(
"issue_4"
)
expect
(
results_list
.
all
(
'p'
)[
0
]).
to
have_content
(
'merge_request_1'
)
expect
(
results_list
.
all
(
'p'
)[
1
]).
to
have_content
(
'issue_1'
)
expect
(
results_list
.
all
(
'p'
)[
2
]).
to
have_content
(
'issue_3'
)
expect
(
results_list
.
all
(
'p'
)[
3
]).
to
have_content
(
'issue_2'
)
expect
(
results_list
.
all
(
'p'
)[
4
]).
to
have_content
(
'issue_4'
)
end
it
"sorts with newest created todos first"
do
click_link
"Oldest created"
it
'sorts with newest created todos first'
do
click_link
'Oldest created'
results_list
=
page
.
find
(
'.todos-list'
)
expect
(
results_list
.
all
(
'p'
)[
0
]).
to
have_content
(
"issue_4"
)
expect
(
results_list
.
all
(
'p'
)[
1
]).
to
have_content
(
"issue_2"
)
expect
(
results_list
.
all
(
'p'
)[
2
]).
to
have_content
(
"issue_3"
)
expect
(
results_list
.
all
(
'p'
)[
3
]).
to
have_content
(
"issue_1"
)
expect
(
results_list
.
all
(
'p'
)[
4
]).
to
have_content
(
"merge_request_1"
)
expect
(
results_list
.
all
(
'p'
)[
0
]).
to
have_content
(
'issue_4'
)
expect
(
results_list
.
all
(
'p'
)[
1
]).
to
have_content
(
'issue_2'
)
expect
(
results_list
.
all
(
'p'
)[
2
]).
to
have_content
(
'issue_3'
)
expect
(
results_list
.
all
(
'p'
)[
3
]).
to
have_content
(
'issue_1'
)
expect
(
results_list
.
all
(
'p'
)[
4
]).
to
have_content
(
'merge_request_1'
)
end
it
"sorts by label priority"
do
click_link
"Label priority"
it
'sorts by label priority'
do
click_link
'Label priority'
results_list
=
page
.
find
(
'.todos-list'
)
expect
(
results_list
.
all
(
'p'
)[
0
]).
to
have_content
(
"issue_3"
)
expect
(
results_list
.
all
(
'p'
)[
1
]).
to
have_content
(
"merge_request_1"
)
expect
(
results_list
.
all
(
'p'
)[
2
]).
to
have_content
(
"issue_1"
)
expect
(
results_list
.
all
(
'p'
)[
3
]).
to
have_content
(
"issue_2"
)
expect
(
results_list
.
all
(
'p'
)[
4
]).
to
have_content
(
"issue_4"
)
expect
(
results_list
.
all
(
'p'
)[
0
]).
to
have_content
(
'issue_3'
)
expect
(
results_list
.
all
(
'p'
)[
1
]).
to
have_content
(
'merge_request_1'
)
expect
(
results_list
.
all
(
'p'
)[
2
]).
to
have_content
(
'issue_1'
)
expect
(
results_list
.
all
(
'p'
)[
3
]).
to
have_content
(
'issue_2'
)
expect
(
results_list
.
all
(
'p'
)[
4
]).
to
have_content
(
'issue_4'
)
end
end
...
...
@@ -88,12 +88,12 @@ describe "Dashboard > User sorts todos", feature: true do
end
it
"doesn't mix issues and merge requests label priorities"
do
click_link
"Label priority"
click_link
'Label priority'
results_list
=
page
.
find
(
'.todos-list'
)
expect
(
results_list
.
all
(
'p'
)[
0
]).
to
have_content
(
"issue_1"
)
expect
(
results_list
.
all
(
'p'
)[
1
]).
to
have_content
(
"issue_2"
)
expect
(
results_list
.
all
(
'p'
)[
2
]).
to
have_content
(
"merge_request_1"
)
expect
(
results_list
.
all
(
'p'
)[
0
]).
to
have_content
(
'issue_1'
)
expect
(
results_list
.
all
(
'p'
)[
1
]).
to
have_content
(
'issue_2'
)
expect
(
results_list
.
all
(
'p'
)[
2
]).
to
have_content
(
'merge_request_1'
)
end
end
end
spec/features/dashboard/todos/todos_spec.rb
0 → 100644
View file @
f1b5d2c7
This diff is collapsed.
Click to expand it.
spec/features/todos/todos_spec.rb
deleted
100644 → 0
View file @
245be4ce
This diff is collapsed.
Click to expand it.
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