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
319b151e
Commit
319b151e
authored
Apr 30, 2021
by
Eulyeon Ko
Committed by
David O'Regan
May 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply reviewer suggestions
- Use let_it_be over let for performance - Remove repeated, unnecessary code
parent
13065180
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
150 deletions
+131
-150
ee/spec/features/boards/sidebar_deprecated_spec.rb
ee/spec/features/boards/sidebar_deprecated_spec.rb
+45
-58
ee/spec/features/boards/sidebar_spec.rb
ee/spec/features/boards/sidebar_spec.rb
+85
-92
spec/support/helpers/board_helpers.rb
spec/support/helpers/board_helpers.rb
+1
-0
No files found.
ee/spec/features/boards/sidebar_deprecated_spec.rb
View file @
319b151e
...
@@ -8,19 +8,20 @@ require 'spec_helper'
...
@@ -8,19 +8,20 @@ require 'spec_helper'
RSpec
.
describe
'Issue Boards'
,
:js
do
RSpec
.
describe
'Issue Boards'
,
:js
do
include
BoardHelpers
include
BoardHelpers
let
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let_it_be
(
:user2
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let_it_be
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let_it_be
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let!
(
:stretch
)
{
create
(
:label
,
project:
project
,
name:
'Stretch'
)
}
let_it_be
(
:stretch
)
{
create
(
:label
,
project:
project
,
name:
'Stretch'
)
}
let!
(
:issue1
)
{
create
(
:labeled_issue
,
project:
project
,
assignees:
[
user
],
milestone:
milestone
,
labels:
[
development
],
weight:
3
,
relative_position:
2
)
}
let_it_be
(
:issue1
)
{
create
(
:labeled_issue
,
project:
project
,
assignees:
[
user
],
milestone:
milestone
,
labels:
[
development
],
weight:
3
,
relative_position:
2
)
}
let!
(
:issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
stretch
],
relative_position:
1
)
}
let_it_be
(
:issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
stretch
],
relative_position:
1
)
}
let!
(
:scoped_label_1
)
{
create
(
:label
,
project:
project
,
name:
'Scoped1::Label1'
)
}
let_it_be
(
:board
)
{
create
(
:board
,
project:
project
)
}
let!
(
:scoped_label_2
)
{
create
(
:label
,
project:
project
,
name:
'Scoped2::Label2'
)
}
let_it_be
(
:list
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let_it_be
(
:scoped_label_1
)
{
create
(
:label
,
project:
project
,
name:
'Scoped1::Label1'
)
}
let!
(
:list
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let_it_be
(
:scoped_label_2
)
{
create
(
:label
,
project:
project
,
name:
'Scoped2::Label2'
)
}
let
(
:card1
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(2)'
)
}
let
(
:card1
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(2)'
)
}
let
(
:card2
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(1)'
)
}
let
(
:card2
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(1)'
)
}
...
@@ -79,8 +80,10 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -79,8 +80,10 @@ RSpec.describe 'Issue Boards', :js do
click_button
(
'Apply'
)
click_button
(
'Apply'
)
wait_for_requests
wait_for_requests
expect
(
page
).
to
have_link
(
nil
,
title:
user
.
name
)
aggregate_failures
do
expect
(
page
).
to
have_link
(
nil
,
title:
assignee
)
expect
(
page
).
to
have_link
(
nil
,
title:
user
.
name
)
expect
(
page
).
to
have_link
(
nil
,
title:
assignee
)
end
end
end
expect
(
card1
.
all
(
'.avatar'
).
length
).
to
eq
(
2
)
expect
(
card1
.
all
(
'.avatar'
).
length
).
to
eq
(
2
)
...
@@ -91,14 +94,12 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -91,14 +94,12 @@ RSpec.describe 'Issue Boards', :js do
page
.
within
(
'.assignee'
)
do
page
.
within
(
'.assignee'
)
do
click_button
(
'Edit'
)
click_button
(
'Edit'
)
wait_for_requests
page
.
within
(
'.dropdown-menu-user'
)
do
page
.
within
(
'.dropdown-menu-user'
)
do
find
(
'[data-testid="unassign"]'
).
click
find
(
'[data-testid="unassign"]'
).
click
end
end
click_button
(
'Apply'
)
click_button
(
'Apply'
)
wait_for_requests
expect
(
page
).
to
have_content
(
'None'
)
expect
(
page
).
to
have_content
(
'None'
)
end
end
...
@@ -109,9 +110,7 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -109,9 +110,7 @@ RSpec.describe 'Issue Boards', :js do
it
'assignees to current user'
do
it
'assignees to current user'
do
click_card
(
card2
)
click_card
(
card2
)
wait_for_requests
page
.
within
(
'.assignee'
)
do
page
.
within
(
find
(
'.assignee'
))
do
expect
(
page
).
to
have_content
(
'None'
)
expect
(
page
).
to
have_content
(
'None'
)
click_button
'assign yourself'
click_button
'assign yourself'
...
@@ -143,9 +142,7 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -143,9 +142,7 @@ RSpec.describe 'Issue Boards', :js do
expect
(
page
).
to
have_content
(
assignee
)
expect
(
page
).
to
have_content
(
assignee
)
end
end
page
.
within
(
find
(
'.board:nth-child(2)'
))
do
click_card
(
card1
)
find
(
'.board-card:nth-child(2)'
).
click
end
page
.
within
(
'.assignee'
)
do
page
.
within
(
'.assignee'
)
do
click_button
(
'Edit'
)
click_button
(
'Edit'
)
...
@@ -167,7 +164,6 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -167,7 +164,6 @@ RSpec.describe 'Issue Boards', :js do
context
'when the issue is not associated with an epic'
do
context
'when the issue is not associated with an epic'
do
it
'displays `None` for value of epic'
do
it
'displays `None` for value of epic'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
expect
(
find
(
'.js-epic-label'
).
text
).
to
have_content
(
'None'
)
expect
(
find
(
'.js-epic-label'
).
text
).
to
have_content
(
'None'
)
end
end
...
@@ -180,16 +176,14 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -180,16 +176,14 @@ RSpec.describe 'Issue Boards', :js do
it
'displays name of epic and links to it'
do
it
'displays name of epic and links to it'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
expect
(
find
(
'.js-epic-label'
)).
to
have_link
(
epic1
.
title
,
href:
epic_path
(
epic1
))
expect
(
find
(
'.js-epic-label'
)).
to
have_link
(
epic1
.
title
,
href:
epic_path
(
epic1
))
end
end
it
'updates the epic associated with the issue'
do
it
'updates the epic associated with the issue'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
page
.
within
(
find
(
'.js-epic-block'
)
)
do
page
.
within
(
'.js-epic-block'
)
do
page
.
find
(
'.sidebar-dropdown-toggle'
).
click
page
.
find
(
'.sidebar-dropdown-toggle'
).
click
wait_for_requests
wait_for_requests
...
@@ -201,10 +195,8 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -201,10 +195,8 @@ RSpec.describe 'Issue Boards', :js do
# Ensure that boards_store is also updated the epic associated with the issue.
# Ensure that boards_store is also updated the epic associated with the issue.
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
expect
(
find
(
'.js-epic-label'
)).
to
have_content
(
epic2
.
title
)
expect
(
find
(
'.js-epic-label'
)).
to
have_content
(
epic2
.
title
)
end
end
...
@@ -214,14 +206,12 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -214,14 +206,12 @@ RSpec.describe 'Issue Boards', :js do
context
'weight'
do
context
'weight'
do
it
'displays weight async'
do
it
'displays weight async'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
expect
(
find
(
'.js-weight-weight-label'
).
text
).
to
have_content
(
issue1
.
weight
)
expect
(
find
(
'.js-weight-weight-label'
).
text
).
to
have_content
(
issue1
.
weight
)
end
end
it
'updates weight in sidebar to 1'
do
it
'updates weight in sidebar to 1'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
page
.
within
'.weight'
do
page
.
within
'.weight'
do
click_link
'Edit'
click_link
'Edit'
...
@@ -237,18 +227,14 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -237,18 +227,14 @@ RSpec.describe 'Issue Boards', :js do
wait_for_requests
wait_for_requests
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
page
.
within
'.weight'
do
page
.
within
'.weight .value'
do
page
.
within
'.value'
do
expect
(
page
).
to
have_content
'1'
expect
(
page
).
to
have_content
'1'
end
end
end
end
end
it
'updates weight in sidebar to no weight'
do
it
'updates weight in sidebar to no weight'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
page
.
within
'.weight'
do
page
.
within
'.weight'
do
click_link
'remove weight'
click_link
'remove weight'
...
@@ -263,12 +249,9 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -263,12 +249,9 @@ RSpec.describe 'Issue Boards', :js do
wait_for_requests
wait_for_requests
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
page
.
within
'.weight'
do
page
.
within
'.weight .value'
do
page
.
within
'.value'
do
expect
(
page
).
to
have_content
'None'
expect
(
page
).
to
have_content
'None'
end
end
end
end
end
...
@@ -281,7 +264,6 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -281,7 +264,6 @@ RSpec.describe 'Issue Boards', :js do
it
'hides weight'
do
it
'hides weight'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
expect
(
page
).
not_to
have_selector
(
'.js-weight-weight-label'
)
expect
(
page
).
not_to
have_selector
(
'.js-weight-weight-label'
)
end
end
...
@@ -315,18 +297,19 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -315,18 +297,19 @@ RSpec.describe 'Issue Boards', :js do
find
(
'.dropdown-menu-close-icon'
).
click
find
(
'.dropdown-menu-close-icon'
).
click
page
.
within
(
'.value'
)
do
page
.
within
(
'.value'
)
do
expect
(
page
).
to
have_selector
(
'.gl-label-scoped'
,
count:
2
)
aggregate_failures
do
expect
(
page
).
to
have_content
(
scoped_label_1
.
scoped_label_key
)
expect
(
page
).
to
have_selector
(
'.gl-label-scoped'
,
count:
2
)
expect
(
page
).
to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_1
.
scoped_label_key
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
page
).
to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
end
end
end
end
end
end
end
context
'with scoped label assigned'
do
context
'with scoped label assigned'
do
let!
(
:issue3
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
scoped_label_1
,
scoped_label_2
],
relative_position:
3
)
}
let!
(
:issue3
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
scoped_label_1
,
scoped_label_2
],
relative_position:
3
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let
(
:card3
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(1)'
)
}
let
(
:card3
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(1)'
)
}
before
do
before
do
...
@@ -351,18 +334,22 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -351,18 +334,22 @@ RSpec.describe 'Issue Boards', :js do
find
(
'.dropdown-menu-close-icon'
).
click
find
(
'.dropdown-menu-close-icon'
).
click
page
.
within
(
'.value'
)
do
page
.
within
(
'.value'
)
do
expect
(
page
).
to
have_selector
(
'.gl-label-scoped'
,
count:
1
)
aggregate_failures
do
expect
(
page
).
not_to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
page
).
to
have_selector
(
'.gl-label-scoped'
,
count:
1
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
page
).
not_to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
end
end
end
end
end
expect
(
card3
).
to
have_selector
(
'.gl-label-scoped'
,
count:
1
)
aggregate_failures
do
expect
(
card3
).
not_to
have_content
(
scoped_label_1
.
scoped_label_key
)
expect
(
card3
).
to
have_selector
(
'.gl-label-scoped'
,
count:
1
)
expect
(
card3
).
not_to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
card3
).
not_to
have_content
(
scoped_label_1
.
scoped_label_key
)
expect
(
card3
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
card3
).
not_to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
card3
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
expect
(
card3
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
card3
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
end
end
end
end
end
end
end
...
...
ee/spec/features/boards/sidebar_spec.rb
View file @
319b151e
...
@@ -5,24 +5,29 @@ require 'spec_helper'
...
@@ -5,24 +5,29 @@ require 'spec_helper'
RSpec
.
describe
'Issue Boards'
,
:js
do
RSpec
.
describe
'Issue Boards'
,
:js
do
include
BoardHelpers
include
BoardHelpers
let
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let_it_be
(
:user2
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let!
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let!
(
:stretch
)
{
create
(
:label
,
project:
project
,
name:
'Stretch'
)
}
let_it_be
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:issue1
)
{
create
(
:labeled_issue
,
project:
project
,
assignees:
[
user
],
milestone:
milestone
,
labels:
[
development
],
weight:
3
,
relative_position:
2
)
}
let_it_be
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let!
(
:issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
stretch
],
relative_position:
1
)
}
let_it_be
(
:stretch
)
{
create
(
:label
,
project:
project
,
name:
'Stretch'
)
}
let!
(
:scoped_label_1
)
{
create
(
:label
,
project:
project
,
name:
'Scoped1::Label1'
)
}
let_it_be
(
:scoped_label_1
)
{
create
(
:label
,
project:
project
,
name:
'Scoped1::Label1'
)
}
let!
(
:scoped_label_2
)
{
create
(
:label
,
project:
project
,
name:
'Scoped2::Label2'
)
}
let_it_be
(
:scoped_label_2
)
{
create
(
:label
,
project:
project
,
name:
'Scoped2::Label2'
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let!
(
:list
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let_it_be
(
:issue1
)
{
create
(
:labeled_issue
,
project:
project
,
assignees:
[
user
],
milestone:
milestone
,
labels:
[
development
],
weight:
3
,
relative_position:
2
)
}
let_it_be
(
:issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
stretch
],
relative_position:
1
)
}
let_it_be
(
:epic1
)
{
create
(
:epic
,
group:
group
,
title:
'Foo'
)
}
let_it_be
(
:epic2
)
{
create
(
:epic
,
group:
group
,
title:
'Bar'
)
}
let_it_be
(
:epic_issue
)
{
create
(
:epic_issue
,
issue:
issue2
,
epic:
epic1
)
}
let_it_be
(
:board
)
{
create
(
:board
,
project:
project
)
}
let_it_be
(
:list
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let
(
:card1
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(2)'
)
}
let
(
:card1
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(2)'
)
}
let
(
:card2
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(1)'
)
}
let
(
:card2
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(1)'
)
}
let
(
:epic1
)
{
create
(
:epic
,
group:
group
,
title:
'Foo'
)
}
let!
(
:epic2
)
{
create
(
:epic
,
group:
group
,
title:
'Bar'
)
}
let!
(
:epic_issue
)
{
create
(
:epic_issue
,
issue:
issue2
,
epic:
epic1
)
}
before
do
before
do
stub_licensed_features
(
multiple_issue_assignees:
true
)
stub_licensed_features
(
multiple_issue_assignees:
true
)
...
@@ -32,15 +37,16 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -32,15 +37,16 @@ RSpec.describe 'Issue Boards', :js do
sign_in
user
sign_in
user
visit
project_board_path
(
project
,
board
)
visit_project_board
wait_for_requests
end
end
context
'assignee'
do
context
'assignee'
do
let
(
:assignee_widget
)
{
'[data-testid="issue-boards-sidebar"] [data-testid="assignees-widget"]'
}
it
'updates the issues assignee'
do
it
'updates the issues assignee'
do
click_card
(
card2
)
click_card
(
card2
)
page
.
within
(
'.assignee'
)
do
page
.
within
(
assignee_widget
)
do
click_button
(
'Edit'
)
click_button
(
'Edit'
)
wait_for_requests
wait_for_requests
...
@@ -62,7 +68,7 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -62,7 +68,7 @@ RSpec.describe 'Issue Boards', :js do
it
'adds multiple assignees'
do
it
'adds multiple assignees'
do
click_card
(
card1
)
click_card
(
card1
)
page
.
within
(
'.assignee'
)
do
page
.
within
(
assignee_widget
)
do
click_button
(
'Edit'
)
click_button
(
'Edit'
)
wait_for_requests
wait_for_requests
...
@@ -78,8 +84,10 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -78,8 +84,10 @@ RSpec.describe 'Issue Boards', :js do
click_button
(
'Apply'
)
click_button
(
'Apply'
)
wait_for_requests
wait_for_requests
expect
(
page
).
to
have_link
(
nil
,
title:
user
.
name
)
aggregate_failures
do
expect
(
page
).
to
have_link
(
nil
,
title:
assignee
)
expect
(
page
).
to
have_link
(
nil
,
title:
user
.
name
)
expect
(
page
).
to
have_link
(
nil
,
title:
assignee
)
end
end
end
expect
(
card1
.
all
(
'.avatar'
).
length
).
to
eq
(
2
)
expect
(
card1
.
all
(
'.avatar'
).
length
).
to
eq
(
2
)
...
@@ -88,7 +96,7 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -88,7 +96,7 @@ RSpec.describe 'Issue Boards', :js do
it
'removes the assignee'
do
it
'removes the assignee'
do
click_card
(
card1
)
click_card
(
card1
)
page
.
within
(
'.assignee'
)
do
page
.
within
(
assignee_widget
)
do
click_button
(
'Edit'
)
click_button
(
'Edit'
)
wait_for_requests
wait_for_requests
...
@@ -108,9 +116,7 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -108,9 +116,7 @@ RSpec.describe 'Issue Boards', :js do
it
'assignees to current user'
do
it
'assignees to current user'
do
click_card
(
card2
)
click_card
(
card2
)
wait_for_requests
page
.
within
(
assignee_widget
)
do
page
.
within
(
find
(
'.assignee'
))
do
expect
(
page
).
to
have_content
(
'None'
)
expect
(
page
).
to
have_content
(
'None'
)
click_button
'assign yourself'
click_button
'assign yourself'
...
@@ -126,7 +132,7 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -126,7 +132,7 @@ RSpec.describe 'Issue Boards', :js do
it
'updates assignee dropdown'
do
it
'updates assignee dropdown'
do
click_card
(
card2
)
click_card
(
card2
)
page
.
within
(
'.assignee'
)
do
page
.
within
(
assignee_widget
)
do
click_button
(
'Edit'
)
click_button
(
'Edit'
)
wait_for_requests
wait_for_requests
...
@@ -142,11 +148,9 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -142,11 +148,9 @@ RSpec.describe 'Issue Boards', :js do
expect
(
page
).
to
have_content
(
assignee
)
expect
(
page
).
to
have_content
(
assignee
)
end
end
page
.
within
(
find
(
'.board:nth-child(2)'
))
do
click_card
(
card1
)
find
(
'.board-card:nth-child(2)'
).
click
end
page
.
within
(
'.assignee'
)
do
page
.
within
(
assignee_widget
)
do
click_button
(
'Edit'
)
click_button
(
'Edit'
)
expect
(
find
(
'.dropdown-menu'
)).
to
have_selector
(
'.gl-new-dropdown-item-check-icon'
)
expect
(
find
(
'.dropdown-menu'
)).
to
have_selector
(
'.gl-new-dropdown-item-check-icon'
)
...
@@ -155,119 +159,100 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -155,119 +159,100 @@ RSpec.describe 'Issue Boards', :js do
end
end
context
'epic'
do
context
'epic'
do
let
(
:epic_widget
)
{
find
(
'[data-testid="sidebar-epic"]'
)
}
before
do
before
do
stub_licensed_features
(
epics:
true
)
stub_licensed_features
(
epics:
true
)
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
visit
project_board_path
(
project
,
board
)
visit_project_board
wait_for_requests
end
end
context
'when the issue is not associated with an epic'
do
context
'when the issue is not associated with an epic'
do
it
'displays `None` for value of epic'
do
it
'displays `None` for value of epic'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
expect
(
find
(
'[data-testid="sidebar-epic"]'
)
.
text
).
to
have_content
(
'None'
)
expect
(
epic_widget
.
text
).
to
have_content
(
'None'
)
end
end
end
end
context
'when the issue is associated with an epic'
do
context
'when the issue is associated with an epic'
do
it
'displays name of epic and links to it'
do
it
'displays name of epic and links to it'
do
click_card
(
card2
)
click_card
(
card2
)
wait_for_requests
expect
(
find
(
'[data-testid="sidebar-epic"]'
)
).
to
have_link
(
epic1
.
title
,
href:
epic_path
(
epic1
))
expect
(
epic_widget
).
to
have_link
(
epic1
.
title
,
href:
epic_path
(
epic1
))
end
end
it
'updates the epic associated with the issue'
do
it
'updates the epic associated with the issue'
do
click_card
(
card2
)
click_card
(
card2
)
wait_for_requests
page
.
within
(
find
(
'[data-testid="sidebar-epic"]'
)
)
do
within
(
epic_widget
)
do
click_button
'Edit'
click_button
'Edit'
wait_for_requests
wait_for_requests
find
(
'.gl-new-dropdown-item'
,
text:
epic2
.
title
).
click
find
(
'.gl-new-dropdown-item'
,
text:
epic2
.
title
).
click
wait_for_requests
wait_for_requests
expect
(
page
.
find
(
'.value'
)
).
to
have_content
(
epic2
.
title
)
expect
(
page
).
to
have_content
(
epic2
.
title
)
end
end
end
end
end
end
end
end
context
'weight'
do
context
'weight'
do
let
(
:weight_widget
)
{
find
(
'[data-testid="sidebar-weight"]'
)
}
let
(
:weight_value
)
{
find
(
'[data-testid="sidebar-weight"] .value'
)
}
it
'displays weight async'
do
it
'displays weight async'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
expect
(
find
(
'[data-testid="sidebar-weight"]'
).
text
).
to
have_content
(
issue1
.
weight
)
expect
(
weight_value
).
to
have_content
(
issue1
.
weight
)
end
end
it
'updates weight in sidebar to 1'
do
it
'updates weight in sidebar to 1'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
page
.
within
'[data-testid="sidebar-weight"]'
do
within
weight_widget
do
click_button
'Edit'
click_button
'Edit'
find
(
'.weight input'
).
send_keys
1
,
:enter
find
(
'.weight input'
).
send_keys
1
,
:enter
page
.
within
'.value'
do
expect
(
page
).
to
have_content
'1'
end
end
end
expect
(
weight_value
).
to
have_content
'1'
# Ensure the request was sent and things are persisted
# Ensure the request was sent and things are persisted
visit
project_board_path
(
project
,
board
)
visit_project_board
wait_for_requests
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
page
.
within
'[data-testid="sidebar-weight"]'
do
expect
(
weight_value
).
to
have_content
'1'
page
.
within
'.value'
do
expect
(
page
).
to
have_content
'1'
end
end
end
end
it
'updates weight in sidebar to no weight'
do
it
'updates weight in sidebar to no weight'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
page
.
within
'[data-testid="sidebar-weight"]'
do
within
weight_widget
do
click_button
'remove weight'
click_button
'remove weight'
page
.
within
'.value'
do
expect
(
page
).
to
have_content
'None'
end
end
end
expect
(
weight_value
).
to
have_content
'None'
# Ensure the request was sent and things are persisted
# Ensure the request was sent and things are persisted
visit
project_board_path
(
project
,
board
)
visit_project_board
wait_for_requests
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
page
.
within
'.weight'
do
expect
(
weight_value
).
to
have_content
'None'
page
.
within
'.value'
do
expect
(
page
).
to
have_content
'None'
end
end
end
end
context
'unlicensed'
do
context
'unlicensed'
do
before
do
before
do
stub_licensed_features
(
issue_weights:
false
)
stub_licensed_features
(
issue_weights:
false
)
visit
project_board_path
(
project
,
board
)
wait_for_requests
visit_project_board
end
end
it
'hides weight'
do
it
'hides weight'
do
click_card
(
card1
)
click_card
(
card1
)
wait_for_requests
expect
(
page
).
not_to
have_selector
(
'[data-testid="sidebar-weight"]'
)
expect
(
page
).
not_to
have_selector
(
'[data-testid="sidebar-weight"]'
)
end
end
...
@@ -278,8 +263,7 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -278,8 +263,7 @@ RSpec.describe 'Issue Boards', :js do
before
do
before
do
stub_licensed_features
(
scoped_labels:
true
)
stub_licensed_features
(
scoped_labels:
true
)
visit
project_board_path
(
project
,
board
)
visit_project_board
wait_for_requests
end
end
it
'adds multiple scoped labels'
do
it
'adds multiple scoped labels'
do
...
@@ -301,25 +285,25 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -301,25 +285,25 @@ RSpec.describe 'Issue Boards', :js do
find
(
'[data-testid="close-icon"]'
).
click
find
(
'[data-testid="close-icon"]'
).
click
page
.
within
(
'.value'
)
do
page
.
within
(
'.value'
)
do
expect
(
page
).
to
have_selector
(
'.gl-label-scoped'
,
count:
2
)
aggregate_failures
do
expect
(
page
).
to
have_content
(
scoped_label_1
.
scoped_label_key
)
expect
(
page
).
to
have_selector
(
'.gl-label-scoped'
,
count:
2
)
expect
(
page
).
to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_1
.
scoped_label_key
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
page
).
to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
end
end
end
end
end
end
end
context
'with scoped label assigned'
do
context
'with scoped label assigned'
do
let!
(
:issue3
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
scoped_label_1
,
scoped_label_2
],
relative_position:
3
)
}
let!
(
:issue3
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
scoped_label_1
,
scoped_label_2
],
relative_position:
3
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let
(
:card3
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(1)'
)
}
let
(
:card3
)
{
find
(
'.board:nth-child(2)'
).
find
(
'.board-card:nth-child(1)'
)
}
before
do
before
do
stub_licensed_features
(
scoped_labels:
true
)
stub_licensed_features
(
scoped_labels:
true
)
visit
project_board_path
(
project
,
board
)
visit_project_board
wait_for_requests
end
end
it
'removes existing scoped label'
do
it
'removes existing scoped label'
do
...
@@ -337,18 +321,22 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -337,18 +321,22 @@ RSpec.describe 'Issue Boards', :js do
find
(
'[data-testid="close-icon"]'
).
click
find
(
'[data-testid="close-icon"]'
).
click
page
.
within
(
'.value'
)
do
page
.
within
(
'.value'
)
do
expect
(
page
).
to
have_selector
(
'.gl-label-scoped'
,
count:
1
)
aggregate_failures
do
expect
(
page
).
not_to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
page
).
to
have_selector
(
'.gl-label-scoped'
,
count:
1
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
page
).
not_to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
page
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
end
end
end
end
end
expect
(
card3
).
to
have_selector
(
'.gl-label-scoped'
,
count:
1
)
aggregate_failures
do
expect
(
card3
).
not_to
have_content
(
scoped_label_1
.
scoped_label_key
)
expect
(
card3
).
to
have_selector
(
'.gl-label-scoped'
,
count:
1
)
expect
(
card3
).
not_to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
card3
).
not_to
have_content
(
scoped_label_1
.
scoped_label_key
)
expect
(
card3
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
card3
).
not_to
have_content
(
scoped_label_1
.
scoped_label_value
)
expect
(
card3
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
expect
(
card3
).
to
have_content
(
scoped_label_2
.
scoped_label_key
)
expect
(
card3
).
to
have_content
(
scoped_label_2
.
scoped_label_value
)
end
end
end
end
end
end
end
...
@@ -378,4 +366,9 @@ RSpec.describe 'Issue Boards', :js do
...
@@ -378,4 +366,9 @@ RSpec.describe 'Issue Boards', :js do
expect
(
page
).
not_to
have_selector
(
'.js-board-settings-sidebar'
)
expect
(
page
).
not_to
have_selector
(
'.js-board-settings-sidebar'
)
end
end
end
end
def
visit_project_board
visit
project_board_path
(
project
,
board
)
wait_for_requests
end
end
end
spec/support/helpers/board_helpers.rb
View file @
319b151e
...
@@ -4,6 +4,7 @@ module BoardHelpers
...
@@ -4,6 +4,7 @@ module BoardHelpers
def
click_card
(
card
)
def
click_card
(
card
)
within
card
do
within
card
do
first
(
'.board-card-number'
).
click
first
(
'.board-card-number'
).
click
wait_for_requests
end
end
end
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