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
e2a63cbd
Commit
e2a63cbd
authored
Mar 08, 2017
by
George Andrinopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor dropdown_milestone_spec.rb
parent
e78a3669
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
27 deletions
+35
-27
changelogs/unreleased/29162-refactor-dropdown-milestone-spec.yml
...ogs/unreleased/29162-refactor-dropdown-milestone-spec.yml
+4
-0
spec/features/issues/filtered_search/dropdown_milestone_spec.rb
...eatures/issues/filtered_search/dropdown_milestone_spec.rb
+31
-27
No files found.
changelogs/unreleased/29162-refactor-dropdown-milestone-spec.yml
0 → 100644
View file @
e2a63cbd
---
title
:
Refactor dropdown_milestone_spec.rb
merge_request
:
author
:
George Andrinopoulos
spec/features/issues/filtered_search/dropdown_milestone_spec.rb
View file @
e2a63cbd
require
'rails_helper'
describe
'Dropdown milestone'
,
js:
true
,
feature:
true
do
describe
'Dropdown milestone'
,
:feature
,
:js
do
include
FilteredSearchHelpers
include
WaitForAjax
let!
(
:project
)
{
create
(
:empty_project
)
}
let!
(
:user
)
{
create
(
:user
)
}
...
...
@@ -15,18 +14,10 @@ describe 'Dropdown milestone', js: true, feature: true do
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:js_dropdown_milestone
)
{
'#js-dropdown-milestone'
}
def
send_keys_to_filtered_search
(
input
)
input
.
split
(
""
).
each
do
|
i
|
filtered_search
.
send_keys
(
i
)
sleep
3
wait_for_ajax
sleep
3
end
end
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)
}
def
dropdown_milestone_size
page
.
all
(
'#js-dropdown-milestone .filter-dropdown
.filter-dropdown-item'
).
size
filter_dropdown
.
all
(
'
.filter-dropdown-item'
).
size
end
def
click_milestone
(
text
)
...
...
@@ -65,13 +56,14 @@ describe 'Dropdown milestone', js: true, feature: true do
end
it
'should hide loading indicator when loaded'
do
send_keys_to_filtered_search
(
'milestone:'
)
filtered_search
.
set
(
'milestone:'
)
expect
(
page
).
not_to
have_css
(
'#js-dropdown-milestone .filter-dropdown-loading'
)
expect
(
find
(
js_dropdown_milestone
)).
to
have_css
(
'.filter-dropdown-loading'
)
expect
(
find
(
js_dropdown_milestone
)).
not_to
have_css
(
'.filter-dropdown-loading'
)
end
it
'should load all the milestones when opened'
do
send_keys_to_filtered_search
(
'milestone:'
)
filtered_search
.
set
(
'milestone:'
)
expect
(
dropdown_milestone_size
).
to
be
>
0
end
...
...
@@ -79,41 +71,48 @@ describe 'Dropdown milestone', js: true, feature: true do
describe
'filtering'
do
before
do
filtered_search
.
set
(
'milestone'
)
filtered_search
.
set
(
'milestone:'
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
uppercase_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
two_words_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
wont_fix_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
special_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
long_milestone
.
title
)
end
it
'filters by name'
do
send_keys_to_filtered_search
(
':
v1'
)
filtered_search
.
send_keys
(
'
v1'
)
expect
(
dropdown_milestone_size
).
to
eq
(
1
)
end
it
'filters by case insensitive name'
do
send_keys_to_filtered_search
(
':
V1'
)
filtered_search
.
send_keys
(
'
V1'
)
expect
(
dropdown_milestone_size
).
to
eq
(
1
)
end
it
'filters by name with symbol'
do
send_keys_to_filtered_search
(
':
%v1'
)
filtered_search
.
send_keys
(
'
%v1'
)
expect
(
dropdown_milestone_size
).
to
eq
(
1
)
end
it
'filters by case insensitive name with symbol'
do
send_keys_to_filtered_search
(
':
%V1'
)
filtered_search
.
send_keys
(
'
%V1'
)
expect
(
dropdown_milestone_size
).
to
eq
(
1
)
end
it
'filters by special characters'
do
send_keys_to_filtered_search
(
':
(+'
)
filtered_search
.
send_keys
(
'
(+'
)
expect
(
dropdown_milestone_size
).
to
eq
(
1
)
end
it
'filters by special characters with symbol'
do
send_keys_to_filtered_search
(
':
%(+'
)
filtered_search
.
send_keys
(
'
%(+'
)
expect
(
dropdown_milestone_size
).
to
eq
(
1
)
end
...
...
@@ -122,6 +121,13 @@ describe 'Dropdown milestone', js: true, feature: true do
describe
'selecting from dropdown'
do
before
do
filtered_search
.
set
(
'milestone:'
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
uppercase_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
two_words_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
wont_fix_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
special_milestone
.
title
)
expect
(
find
(
"
#{
js_dropdown_milestone
}
.filter-dropdown"
)).
to
have_content
(
long_milestone
.
title
)
end
it
'fills in the milestone name when the milestone has not been filled'
do
...
...
@@ -133,7 +139,7 @@ describe 'Dropdown milestone', js: true, feature: true do
end
it
'fills in the milestone name when the milestone is partially filled'
do
send_keys_to_filtered_search
(
'v'
)
filtered_search
.
send_keys
(
'v'
)
click_milestone
(
milestone
.
title
)
expect
(
page
).
to
have_css
(
js_dropdown_milestone
,
visible:
false
)
...
...
@@ -232,16 +238,14 @@ describe 'Dropdown milestone', js: true, feature: true do
describe
'caching requests'
do
it
'caches requests after the first load'
do
filtered_search
.
set
(
'milestone'
)
send_keys_to_filtered_search
(
':'
)
filtered_search
.
set
(
'milestone:'
)
initial_size
=
dropdown_milestone_size
expect
(
initial_size
).
to
be
>
0
create
(
:milestone
,
project:
project
)
find
(
'.filtered-search-input-container .clear-search'
).
click
filtered_search
.
set
(
'milestone'
)
send_keys_to_filtered_search
(
':'
)
filtered_search
.
set
(
'milestone:'
)
expect
(
dropdown_milestone_size
).
to
eq
(
initial_size
)
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