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
Léo-Paul Géneau
gitlab-ce
Commits
15a4cac9
Commit
15a4cac9
authored
Mar 07, 2017
by
George Andrinopoulos
Committed by
Rémy Coutable
Mar 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor dropdown_assignee_spec
parent
668844f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
33 deletions
+45
-33
changelogs/unreleased/27568-refactor-very-slow-dropdown-asignee-spec.yml
...leased/27568-refactor-very-slow-dropdown-asignee-spec.yml
+4
-0
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
...features/issues/filtered_search/dropdown_assignee_spec.rb
+41
-33
No files found.
changelogs/unreleased/27568-refactor-very-slow-dropdown-asignee-spec.yml
0 → 100644
View file @
15a4cac9
---
title
:
Refactor dropdown_assignee_spec
merge_request
:
9711
author
:
George Andrinopoulos
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
View file @
15a4cac9
require
'rails_helper'
require
'rails_helper'
describe
'Dropdown assignee'
,
js:
true
,
feature:
true
do
describe
'Dropdown assignee'
,
:feature
,
:js
do
include
WaitForAjax
let!
(
:project
)
{
create
(
:empty_project
)
}
let!
(
:project
)
{
create
(
:empty_project
)
}
let!
(
:user
)
{
create
(
:user
,
name:
'administrator'
,
username:
'root'
)
}
let!
(
:user
)
{
create
(
:user
,
name:
'administrator'
,
username:
'root'
)
}
let!
(
:user_john
)
{
create
(
:user
,
name:
'John'
,
username:
'th0mas'
)
}
let!
(
:user_john
)
{
create
(
:user
,
name:
'John'
,
username:
'th0mas'
)
}
let!
(
:user_jacob
)
{
create
(
:user
,
name:
'Jacob'
,
username:
'otter32'
)
}
let!
(
:user_jacob
)
{
create
(
:user
,
name:
'Jacob'
,
username:
'otter32'
)
}
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
let
(
:js_dropdown_assignee
)
{
'#js-dropdown-assignee'
}
let
(
:js_dropdown_assignee
)
{
'#js-dropdown-assignee'
}
let
(
:filter_dropdown
)
{
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)
}
def
send_keys_to_filtered_search
(
input
)
input
.
split
(
""
).
each
do
|
i
|
filtered_search
.
send_keys
(
i
)
sleep
5
wait_for_ajax
end
end
def
dropdown_assignee_size
def
dropdown_assignee_size
page
.
all
(
'#js-dropdown-assignee .filter-dropdown
.filter-dropdown-item'
).
size
filter_dropdown
.
all
(
'
.filter-dropdown-item'
).
size
end
end
def
click_assignee
(
text
)
def
click_assignee
(
text
)
...
@@ -56,63 +47,80 @@ describe 'Dropdown assignee', js: true, feature: true do
...
@@ -56,63 +47,80 @@ describe 'Dropdown assignee', js: true, feature: true do
end
end
it
'should hide loading indicator when loaded'
do
it
'should hide loading indicator when loaded'
do
send_keys_to_filtered_search
(
'assignee:'
)
filtered_search
.
set
(
'assignee:'
)
expect
(
page
).
not_to
have_css
(
'#js-dropdown-assignee .filter-dropdown-loading'
)
expect
(
find
(
js_dropdown_assignee
)).
to
have_css
(
'.filter-dropdown-loading'
)
expect
(
find
(
js_dropdown_assignee
)).
not_to
have_css
(
'.filter-dropdown-loading'
)
end
end
it
'should load all the assignees when opened'
do
it
'should load all the assignees when opened'
do
send_keys_to_filtered_search
(
'assignee:'
)
filtered_search
.
set
(
'assignee:'
)
expect
(
dropdown_assignee_size
).
to
eq
(
3
)
expect
(
dropdown_assignee_size
).
to
eq
(
3
)
end
end
it
'shows current user at top of dropdown'
do
it
'shows current user at top of dropdown'
do
send_keys_to_filtered_search
(
'assignee:'
)
filtered_search
.
set
(
'assignee:'
)
expect
(
fi
rst
(
'#js-dropdown-assignee .filter-dropdown li
'
)).
to
have_content
(
user
.
name
)
expect
(
fi
lter_dropdown
.
first
(
'.filter-dropdown-item
'
)).
to
have_content
(
user
.
name
)
end
end
end
end
describe
'filtering'
do
describe
'filtering'
do
before
do
before
do
send_keys_to_filtered_search
(
'assignee:'
)
filtered_search
.
set
(
'assignee:'
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_john
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
end
end
it
'filters by name'
do
it
'filters by name'
do
send_keys_to_filtered_search
(
'j'
)
filtered_search
.
send_keys
(
'j'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_john
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user
.
name
)
end
end
it
'filters by case insensitive name'
do
it
'filters by case insensitive name'
do
send_keys_to_filtered_search
(
'J'
)
filtered_search
.
send_keys
(
'J'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_john
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user
.
name
)
end
end
it
'filters by username with symbol'
do
it
'filters by username with symbol'
do
send_keys_to_filtered_search
(
'@ot'
)
filtered_search
.
send_keys
(
'@ot'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user_john
.
name
)
end
end
it
'filters by case insensitive username with symbol'
do
it
'filters by case insensitive username with symbol'
do
send_keys_to_filtered_search
(
'@OT'
)
filtered_search
.
send_keys
(
'@OT'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user_john
.
name
)
end
end
it
'filters by username without symbol'
do
it
'filters by username without symbol'
do
send_keys_to_filtered_search
(
'ot'
)
filtered_search
.
send_keys
(
'ot'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user_john
.
name
)
end
end
it
'filters by case insensitive username without symbol'
do
it
'filters by case insensitive username without symbol'
do
send_keys_to_filtered_search
(
'OT'
)
filtered_search
.
send_keys
(
'OT'
)
expect
(
dropdown_assignee_size
).
to
eq
(
2
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user_jacob
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_content
(
user
.
name
)
expect
(
find
(
"
#{
js_dropdown_assignee
}
.filter-dropdown"
)).
to
have_no_content
(
user_john
.
name
)
end
end
end
end
...
@@ -129,7 +137,7 @@ describe 'Dropdown assignee', js: true, feature: true do
...
@@ -129,7 +137,7 @@ describe 'Dropdown assignee', js: true, feature: true do
end
end
it
'fills in the assignee username when the assignee has been filtered'
do
it
'fills in the assignee username when the assignee has been filtered'
do
send_keys_to_filtered_search
(
'roo'
)
filtered_search
.
send_keys
(
'roo'
)
click_assignee
(
user
.
name
)
click_assignee
(
user
.
name
)
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
...
@@ -173,7 +181,7 @@ describe 'Dropdown assignee', js: true, feature: true do
...
@@ -173,7 +181,7 @@ describe 'Dropdown assignee', js: true, feature: true do
describe
'caching requests'
do
describe
'caching requests'
do
it
'caches requests after the first load'
do
it
'caches requests after the first load'
do
filtered_search
.
set
(
'assignee'
)
filtered_search
.
set
(
'assignee'
)
send_keys_to_filtered_search
(
':'
)
filtered_search
.
send_keys
(
':'
)
initial_size
=
dropdown_assignee_size
initial_size
=
dropdown_assignee_size
expect
(
initial_size
).
to
be
>
0
expect
(
initial_size
).
to
be
>
0
...
@@ -182,7 +190,7 @@ describe 'Dropdown assignee', js: true, feature: true do
...
@@ -182,7 +190,7 @@ describe 'Dropdown assignee', js: true, feature: true do
project
.
team
<<
[
new_user
,
:master
]
project
.
team
<<
[
new_user
,
:master
]
find
(
'.filtered-search-input-container .clear-search'
).
click
find
(
'.filtered-search-input-container .clear-search'
).
click
filtered_search
.
set
(
'assignee'
)
filtered_search
.
set
(
'assignee'
)
send_keys_to_filtered_search
(
':'
)
filtered_search
.
send_keys
(
':'
)
expect
(
dropdown_assignee_size
).
to
eq
(
initial_size
)
expect
(
dropdown_assignee_size
).
to
eq
(
initial_size
)
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