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
713facd9
Commit
713facd9
authored
Dec 14, 2021
by
Florie Guibert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidate due date sidebar rspec tests
Unify tests for issue board and issue page
parent
bb224023
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
32 deletions
+45
-32
app/assets/javascripts/sidebar/components/date/sidebar_date_widget.vue
...vascripts/sidebar/components/date/sidebar_date_widget.vue
+1
-1
ee/spec/features/epic_boards/epic_boards_sidebar_spec.rb
ee/spec/features/epic_boards/epic_boards_sidebar_spec.rb
+4
-4
spec/features/issues/issue_sidebar_spec.rb
spec/features/issues/issue_sidebar_spec.rb
+4
-25
spec/features/issues/user_edits_issue_spec.rb
spec/features/issues/user_edits_issue_spec.rb
+2
-2
spec/support/shared_examples/features/sidebar/sidebar_due_date_shared_examples.rb
...ples/features/sidebar/sidebar_due_date_shared_examples.rb
+30
-0
spec/support/shared_examples/features/sidebar_shared_examples.rb
...pport/shared_examples/features/sidebar_shared_examples.rb
+4
-0
No files found.
app/assets/javascripts/sidebar/components/date/sidebar_date_widget.vue
View file @
713facd9
...
...
@@ -154,7 +154,7 @@ export default {
};
},
dataTestId
()
{
return
this
.
dateType
===
dateTypes
.
start
?
'
s
tart-date
'
:
'
due-date
'
;
return
this
.
dateType
===
dateTypes
.
start
?
'
s
idebar-start-date
'
:
'
sidebar-
due-date
'
;
},
},
methods
:
{
...
...
ee/spec/features/epic_boards/epic_boards_sidebar_spec.rb
View file @
713facd9
...
...
@@ -114,7 +114,7 @@ RSpec.describe 'Epic boards sidebar', :js do
wait_for_requests
page
.
within
(
'[data-testid="start-date"]'
)
do
page
.
within
(
'[data-testid="s
idebar-s
tart-date"]'
)
do
edit_fixed_date
end
end
...
...
@@ -124,7 +124,7 @@ RSpec.describe 'Epic boards sidebar', :js do
wait_for_requests
page
.
within
(
'[data-testid="start-date"]'
)
do
page
.
within
(
'[data-testid="s
idebar-s
tart-date"]'
)
do
remove_fixed_date
end
end
...
...
@@ -136,7 +136,7 @@ RSpec.describe 'Epic boards sidebar', :js do
wait_for_requests
page
.
within
(
'[data-testid="due-date"]'
)
do
page
.
within
(
'[data-testid="
sidebar-
due-date"]'
)
do
edit_fixed_date
end
end
...
...
@@ -146,7 +146,7 @@ RSpec.describe 'Epic boards sidebar', :js do
wait_for_requests
page
.
within
(
'[data-testid="due-date"]'
)
do
page
.
within
(
'[data-testid="
sidebar-
due-date"]'
)
do
remove_fixed_date
end
end
...
...
spec/features/issues/issue_sidebar_spec.rb
View file @
713facd9
...
...
@@ -11,7 +11,6 @@ RSpec.describe 'Issue Sidebar' do
let_it_be
(
:label
)
{
create
(
:label
,
project:
project
,
title:
'bug'
)
}
let_it_be
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label
])
}
let_it_be
(
:mock_date
)
{
Date
.
today
.
at_beginning_of_month
+
2
.
days
}
let_it_be
(
:issue_with_due_date
)
{
create
(
:issue
,
project:
project
,
due_date:
mock_date
)
}
let_it_be
(
:xss_label
)
{
create
(
:label
,
project:
project
,
title:
'<script>alert("xss");</script>'
)
}
before
do
...
...
@@ -201,30 +200,6 @@ RSpec.describe 'Issue Sidebar' do
end
end
context
'due date widget'
,
:js
do
let
(
:due_date_value
)
{
find
(
'[data-testid="due-date"] [data-testid="sidebar-date-value"]'
)
}
context
'when no due date exists'
do
before
do
visit_issue
(
project
,
issue
)
end
it
"displays 'None'"
do
expect
(
due_date_value
.
text
).
to
have_content
'None'
end
end
context
'when due date exists'
do
before
do
visit_issue
(
project
,
issue_with_due_date
)
end
it
"displays the due date"
do
expect
(
due_date_value
.
text
).
to
have_content
mock_date
.
strftime
(
'%b %-d, %Y'
)
end
end
end
context
'as an allowed user'
do
before
do
project
.
add_developer
(
user
)
...
...
@@ -262,6 +237,10 @@ RSpec.describe 'Issue Sidebar' do
it_behaves_like
'milestone sidebar widget'
end
context
'editing issue due date'
,
:js
do
it_behaves_like
'date sidebar widget'
end
context
'editing issue labels'
,
:js
do
before
do
issue
.
update!
(
labels:
[
label
])
...
...
spec/features/issues/user_edits_issue_spec.rb
View file @
713facd9
...
...
@@ -417,7 +417,7 @@ RSpec.describe "Issues > User edits issue", :js do
it
'adds due date to issue'
do
date
=
Date
.
today
.
at_beginning_of_month
+
2
.
days
page
.
within
'[data-testid="due-date"]'
do
page
.
within
'[data-testid="
sidebar-
due-date"]'
do
click_button
'Edit'
page
.
within
'.pika-single'
do
click_button
date
.
day
...
...
@@ -432,7 +432,7 @@ RSpec.describe "Issues > User edits issue", :js do
it
'removes due date from issue'
do
date
=
Date
.
today
.
at_beginning_of_month
+
2
.
days
page
.
within
'[data-testid="due-date"]'
do
page
.
within
'[data-testid="
sidebar-
due-date"]'
do
click_button
'Edit'
page
.
within
'.pika-single'
do
...
...
spec/
features/boards/sidebar_due_date_spec
.rb
→
spec/
support/shared_examples/features/sidebar/sidebar_due_date_shared_examples
.rb
View file @
713facd9
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Project issue boards sidebar due date'
,
:js
do
include
BoardHelpers
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
)
}
let_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
,
relative_position:
1
)
}
let_it_be
(
:board
)
{
create
(
:board
,
project:
project
)
}
let_it_be
(
:list
)
{
create
(
:list
,
board:
board
,
position:
0
)
}
let
(
:card
)
{
find
(
'.board:nth-child(1)'
).
first
(
'.board-card'
)
}
RSpec
.
shared_examples
'date sidebar widget'
do
context
'editing due date'
do
let
(
:due_date_value
)
{
find
(
'[data-testid="sidebar-due-date"] [data-testid="sidebar-date-value"]'
)
}
around
do
|
example
|
freeze_time
{
example
.
run
}
end
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
project_board_path
(
project
,
board
)
wait_for_requests
it
'displays "None" when there is no due date'
do
expect
(
due_date_value
.
text
).
to
have_content
'None'
end
context
'due date'
do
it
'updates due date'
do
click_card
(
card
)
page
.
within
(
'[data-testid="sidebar-due-date"]'
)
do
today
=
Date
.
today
.
day
...
...
@@ -40,6 +23,7 @@ RSpec.describe 'Project issue boards sidebar due date', :js do
wait_for_requests
expect
(
page
).
to
have_content
(
today
.
to_s
(
:medium
))
expect
(
due_date_value
.
text
).
to
have_content
Time
.
current
.
strftime
(
'%b %-d, %Y'
)
end
end
end
...
...
spec/support/shared_examples/features/sidebar_shared_examples.rb
View file @
713facd9
...
...
@@ -46,6 +46,10 @@ RSpec.shared_examples 'issue boards sidebar' do
it_behaves_like
'milestone sidebar widget'
end
context
'editing issue due date'
,
:js
do
it_behaves_like
'date 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