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
e8f93d93
Commit
e8f93d93
authored
Dec 10, 2021
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidate milestone sidebar rspec tests
Unify test for issue board and issue page
parent
f42bdfa9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
97 deletions
+68
-97
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+1
-1
spec/features/boards/sidebar_milestones_spec.rb
spec/features/boards/sidebar_milestones_spec.rb
+0
-65
spec/features/issues/issue_sidebar_spec.rb
spec/features/issues/issue_sidebar_spec.rb
+1
-31
spec/support/shared_examples/features/sidebar/sidebar_milestone_shared_examples.rb
...les/features/sidebar/sidebar_milestone_shared_examples.rb
+61
-0
spec/support/shared_examples/features/sidebar_shared_examples.rb
...pport/shared_examples/features/sidebar_shared_examples.rb
+5
-0
No files found.
app/views/shared/issuable/_sidebar.html.haml
View file @
e8f93d93
...
...
@@ -29,7 +29,7 @@
=
render_if_exists
'shared/issuable/sidebar_item_epic'
,
issuable_sidebar:
issuable_sidebar
,
group_path:
@project
.
group
.
full_path
,
project_path:
issuable_sidebar
[
:project_full_path
],
issue_iid:
issuable_sidebar
[
:iid
],
issuable_type:
issuable_type
-
if
issuable_sidebar
[
:supports_milestone
]
.block.milestone
{
:class
=>
(
"gl-border-b-0!"
if
in_group_context_with_iterations
),
data:
{
qa_selector:
'milestone_block'
}
}
.block.milestone
{
:class
=>
(
"gl-border-b-0!"
if
in_group_context_with_iterations
),
data:
{
qa_selector:
'milestone_block'
,
testid:
'sidebar-milestones'
}
}
.js-milestone-select
{
data:
{
can_edit:
can_edit_issuable
.
to_s
,
project_path:
issuable_sidebar
[
:project_full_path
],
issue_iid:
issuable_sidebar
[
:iid
]
}
}
-
if
in_group_context_with_iterations
...
...
spec/features/boards/sidebar_milestones_spec.rb
deleted
100644 → 0
View file @
f42bdfa9
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Project issue boards sidebar milestones'
,
:js
do
include
BoardHelpers
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
)
}
let_it_be
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let_it_be
(
:issue1
)
{
create
(
:issue
,
project:
project
,
relative_position:
1
)
}
let_it_be
(
:issue2
)
{
create
(
:issue
,
project:
project
,
milestone:
milestone
,
relative_position:
2
)
}
let_it_be
(
:board
)
{
create
(
:board
,
project:
project
)
}
let_it_be
(
:list
)
{
create
(
:list
,
board:
board
,
position:
0
)
}
let
(
:card1
)
{
find
(
'.board:nth-child(1) .board-card:nth-of-type(1)'
)
}
let
(
:card2
)
{
find
(
'.board:nth-child(1) .board-card:nth-of-type(2)'
)
}
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
project_board_path
(
project
,
board
)
wait_for_requests
end
context
'milestone'
do
it
'adds a milestone'
do
click_card
(
card1
)
page
.
within
(
'[data-testid="sidebar-milestones"]'
)
do
click_button
'Edit'
wait_for_requests
click_button
milestone
.
title
wait_for_requests
page
.
within
(
'[data-testid="select-milestone"]'
)
do
expect
(
page
).
to
have_content
(
milestone
.
title
)
end
end
end
it
'removes a milestone'
do
click_card
(
card2
)
page
.
within
(
'[data-testid="sidebar-milestones"]'
)
do
click_button
'Edit'
wait_for_requests
click_button
"No milestone"
wait_for_requests
page
.
within
(
'[data-testid="select-milestone"]'
)
do
expect
(
page
).
not_to
have_content
(
milestone
.
title
)
end
end
end
end
end
spec/features/issues/issue_sidebar_spec.rb
View file @
e8f93d93
...
...
@@ -259,37 +259,7 @@ RSpec.describe 'Issue Sidebar' do
end
context
'editing issue milestone'
,
:js
do
let_it_be
(
:milestone_expired
)
{
create
(
:milestone
,
project:
project
,
title:
'Foo - expired'
,
due_date:
5
.
days
.
ago
)
}
let_it_be
(
:milestone_no_duedate
)
{
create
(
:milestone
,
project:
project
,
title:
'Foo - No due date'
)
}
let_it_be
(
:milestone1
)
{
create
(
:milestone
,
project:
project
,
title:
'Milestone-1'
,
due_date:
20
.
days
.
from_now
)
}
let_it_be
(
:milestone2
)
{
create
(
:milestone
,
project:
project
,
title:
'Milestone-2'
,
due_date:
15
.
days
.
from_now
)
}
let_it_be
(
:milestone3
)
{
create
(
:milestone
,
project:
project
,
title:
'Milestone-3'
,
due_date:
10
.
days
.
from_now
)
}
before
do
page
.
within
(
'.block.milestone'
)
do
click_button
'Edit'
end
wait_for_all_requests
end
it
'shows milestones list in the dropdown'
do
page
.
within
(
'.block.milestone'
)
do
# 5 milestones + "No milestone" = 6 items
expect
(
page
.
find
(
'.gl-new-dropdown-contents'
)).
to
have_selector
(
'li.gl-new-dropdown-item'
,
count:
6
)
end
end
it
'shows expired milestone at the bottom of the list and milestone due earliest at the top of the list'
,
:aggregate_failures
do
page
.
within
(
'.block.milestone .gl-new-dropdown-contents'
)
do
expect
(
page
.
find
(
'li:last-child'
)).
to
have_content
milestone_expired
.
title
expect
(
page
.
all
(
'li.gl-new-dropdown-item'
)[
1
]).
to
have_content
milestone3
.
title
expect
(
page
.
all
(
'li.gl-new-dropdown-item'
)[
2
]).
to
have_content
milestone2
.
title
expect
(
page
.
all
(
'li.gl-new-dropdown-item'
)[
3
]).
to
have_content
milestone1
.
title
expect
(
page
.
all
(
'li.gl-new-dropdown-item'
)[
4
]).
to
have_content
milestone_no_duedate
.
title
end
end
it_behaves_like
'milestone sidebar widget'
end
context
'editing issue labels'
,
:js
do
...
...
spec/support/shared_examples/features/sidebar/sidebar_milestone_shared_examples.rb
0 → 100644
View file @
e8f93d93
# frozen_string_literal: true
RSpec
.
shared_examples
'milestone sidebar widget'
do
context
'editing milestone'
do
let_it_be
(
:milestone_expired
)
{
create
(
:milestone
,
project:
project
,
title:
'Foo - expired'
,
due_date:
5
.
days
.
ago
)
}
let_it_be
(
:milestone_no_duedate
)
{
create
(
:milestone
,
project:
project
,
title:
'Foo - No due date'
)
}
let_it_be
(
:milestone1
)
{
create
(
:milestone
,
project:
project
,
title:
'Milestone-1'
,
due_date:
20
.
days
.
from_now
)
}
let_it_be
(
:milestone2
)
{
create
(
:milestone
,
project:
project
,
title:
'Milestone-2'
,
due_date:
15
.
days
.
from_now
)
}
let_it_be
(
:milestone3
)
{
create
(
:milestone
,
project:
project
,
title:
'Milestone-3'
,
due_date:
10
.
days
.
from_now
)
}
let
(
:milestone_widget
)
{
find
(
'[data-testid="sidebar-milestones"]'
)
}
before
do
within
(
milestone_widget
)
do
click_button
'Edit'
end
wait_for_all_requests
end
it
'shows milestones list in the dropdown'
do
# 5 milestones + "No milestone" = 6 items
expect
(
milestone_widget
.
find
(
'.gl-new-dropdown-contents'
)).
to
have_selector
(
'li.gl-new-dropdown-item'
,
count:
6
)
end
it
'shows expired milestone at the bottom of the list and milestone due earliest at the top of the list'
,
:aggregate_failures
do
within
(
milestone_widget
,
'.gl-new-dropdown-contents'
)
do
expect
(
page
.
find
(
'li:last-child'
)).
to
have_content
milestone_expired
.
title
expect
(
page
.
all
(
'li.gl-new-dropdown-item'
)[
1
]).
to
have_content
milestone3
.
title
expect
(
page
.
all
(
'li.gl-new-dropdown-item'
)[
2
]).
to
have_content
milestone2
.
title
expect
(
page
.
all
(
'li.gl-new-dropdown-item'
)[
3
]).
to
have_content
milestone1
.
title
expect
(
page
.
all
(
'li.gl-new-dropdown-item'
)[
4
]).
to
have_content
milestone_no_duedate
.
title
end
end
it
'adds a milestone'
do
within
(
milestone_widget
)
do
click_button
milestone1
.
title
wait_for_requests
page
.
within
(
'[data-testid="select-milestone"]'
)
do
expect
(
page
).
to
have_content
(
milestone1
.
title
)
end
end
end
it
'removes a milestone'
do
within
(
milestone_widget
)
do
click_button
"No milestone"
wait_for_requests
page
.
within
(
'[data-testid="select-milestone"]'
)
do
expect
(
page
).
not_to
have_content
(
milestone1
.
title
)
end
end
end
end
end
spec/support/shared_examples/features/sidebar_shared_examples.rb
View file @
e8f93d93
...
...
@@ -5,6 +5,7 @@ RSpec.shared_examples 'issue boards sidebar' do
before
do
first_card
.
click
wait_for_requests
end
it
'shows sidebar when clicking issue'
do
...
...
@@ -41,6 +42,10 @@ RSpec.shared_examples 'issue boards sidebar' do
end
end
context
'editing issue milestone'
,
:js
do
it_behaves_like
'milestone sidebar widget'
end
context
'in notifications subscription'
do
it
'displays notifications toggle'
,
:aggregate_failures
do
page
.
within
(
'[data-testid="sidebar-notifications"]'
)
do
...
...
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