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
08b05d0c
Commit
08b05d0c
authored
Sep 05, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor filters reset test to re-use issues.
parent
87f6209c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
26 deletions
+40
-26
spec/features/issues/reset_filters_spec.rb
spec/features/issues/reset_filters_spec.rb
+40
-26
No files found.
spec/features/issues/reset_filters_spec.rb
View file @
08b05d0c
...
@@ -3,16 +3,19 @@ require 'rails_helper'
...
@@ -3,16 +3,19 @@ require 'rails_helper'
feature
'Issues filter reset button'
,
feature:
true
,
js:
true
do
feature
'Issues filter reset button'
,
feature:
true
,
js:
true
do
include
WaitForAjax
include
WaitForAjax
let
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:user
)
{
create
(
:user
)}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:bug
)
{
create
(
:label
,
project:
project
,
name:
'bug'
)}
# maybe switch back to title
let!
(
:issue1
)
{
create
(
:issue
,
project:
project
,
milestone:
milestone
,
author:
user
,
assignee:
user
,
title:
'Feature'
)}
let!
(
:issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
],
title:
'Bugfix1'
)}
before
do
visit_issues
(
project
)
end
context
'when a milestone filter has been applied'
do
context
'when a milestone filter has been applied'
do
it
'resets the milestone filter'
do
it
'resets the milestone filter'
do
create
(
:issue
,
project:
project
,
milestone:
milestone
)
create
(
:issue
,
project:
project
)
visit_issues
(
project
)
filter_by_milestone
(
milestone
.
title
)
filter_by_milestone
(
milestone
.
title
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
...
@@ -23,14 +26,6 @@ feature 'Issues filter reset button', feature: true, js: true do
...
@@ -23,14 +26,6 @@ feature 'Issues filter reset button', feature: true, js: true do
context
'when a label filter has been applied'
do
context
'when a label filter has been applied'
do
it
'resets the label filter'
do
it
'resets the label filter'
do
bug
=
create
(
:label
,
project:
project
,
title:
'bug'
)
issue1
=
create
(
:issue
,
title:
'Bugfix1'
,
project:
project
)
issue1
.
labels
<<
bug
create
(
:issue
,
title:
'Feature'
,
project:
project
)
visit_issues
(
project
)
filter_by_label
(
bug
.
title
)
filter_by_label
(
bug
.
title
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
...
@@ -41,10 +36,6 @@ feature 'Issues filter reset button', feature: true, js: true do
...
@@ -41,10 +36,6 @@ feature 'Issues filter reset button', feature: true, js: true do
context
'when a text search has been conducted'
do
context
'when a text search has been conducted'
do
it
'resets the text search filter'
do
it
'resets the text search filter'
do
create
(
:issue
,
title:
'Bugfix1'
,
project:
project
)
create
(
:issue
,
title:
'Feature'
,
project:
project
)
visit_issues
(
project
)
fill_in
'issue_search'
,
with:
'Bug'
fill_in
'issue_search'
,
with:
'Bug'
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
...
@@ -54,15 +45,28 @@ feature 'Issues filter reset button', feature: true, js: true do
...
@@ -54,15 +45,28 @@ feature 'Issues filter reset button', feature: true, js: true do
end
end
end
end
context
'when label and text filters have been dually applied'
do
context
'when author filter has been applied'
do
it
'resets both filters'
do
it
'resets the author filter'
do
bug
=
create
(
:label
,
project:
project
,
title:
'bug'
)
filter_by_author
(
user
.
name
)
issue1
=
create
(
:issue
,
title:
'Bugfix1'
,
project:
project
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
issue1
.
labels
<<
bug
create
(
:issue
,
project:
project
,
title:
'Feature1'
)
visit_issues
(
project
)
reset_filters
expect
(
page
).
to
have_css
(
'.issue'
,
count:
2
)
end
end
context
'when assignee filter has been applied'
do
it
'resets the assignee filter'
do
filter_by_assignee
(
user
.
name
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
reset_filters
expect
(
page
).
to
have_css
(
'.issue'
,
count:
2
)
end
end
context
'when label and text filters have been dually applied'
do
it
'resets both filters'
do
fill_in
'issue_search'
,
with:
'Feat'
fill_in
'issue_search'
,
with:
'Feat'
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
expect
(
page
).
to
have_css
(
'.issue'
,
count:
1
)
...
@@ -87,6 +91,16 @@ feature 'Issues filter reset button', feature: true, js: true do
...
@@ -87,6 +91,16 @@ feature 'Issues filter reset button', feature: true, js: true do
find
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
find
(
'.labels-filter .dropdown-title .dropdown-menu-close-icon'
).
click
end
end
def
filter_by_author
(
name
)
find
(
'.js-author-search'
).
click
find
(
'.dropdown-menu-author .dropdown-content a'
,
text:
name
).
click
end
def
filter_by_assignee
(
name
)
find
(
'.js-assignee-search'
).
click
find
(
'.dropdown-menu-assignee .dropdown-content a'
,
text:
name
).
click
end
def
reset_filters
def
reset_filters
find
(
'.reset-filters'
).
click
find
(
'.reset-filters'
).
click
wait_for_ajax
wait_for_ajax
...
...
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