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
5ca7001a
Commit
5ca7001a
authored
Mar 24, 2022
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TZ dependent flaky VSA test
parent
539108d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
5 deletions
+34
-5
ee/app/assets/javascripts/analytics/shared/utils.js
ee/app/assets/javascripts/analytics/shared/utils.js
+18
-2
ee/spec/features/groups/analytics/cycle_analytics/filters_and_data_spec.rb
...groups/analytics/cycle_analytics/filters_and_data_spec.rb
+7
-3
ee/spec/frontend/analytics/shared/utils_spec.js
ee/spec/frontend/analytics/shared/utils_spec.js
+9
-0
No files found.
ee/app/assets/javascripts/analytics/shared/utils.js
View file @
5ca7001a
...
...
@@ -70,6 +70,22 @@ export const buildProjectFromDataset = (dataset) => {
return
null
;
};
/**
* Creates a new date object without time zone conversion.
*
* We use this method instead of `new Date(date)`.
* `new Date(date) will assume that the date string is UTC and it
* ant return different date depending on the user's time zone.
*
* @param {String} date - Date string.
* @returns {Date} - Date object.
*/
export
const
toLocalDate
=
(
date
)
=>
{
const
dateParts
=
date
.
split
(
'
-
'
);
return
new
Date
(
dateParts
[
0
],
dateParts
[
1
]
-
1
,
dateParts
[
2
]);
};
/**
* Creates an array of project objects from a json string. Returns null if no projects are present.
*
...
...
@@ -117,8 +133,8 @@ export const buildCycleAnalyticsInitialData = ({
}),
)
:
null
,
createdBefore
:
createdBefore
?
new
Date
(
createdBefore
)
:
null
,
createdAfter
:
createdAfter
?
new
Date
(
createdAfter
)
:
null
,
createdBefore
:
createdBefore
?
toLocal
Date
(
createdBefore
)
:
null
,
createdAfter
:
createdAfter
?
toLocal
Date
(
createdAfter
)
:
null
,
selectedProjects
:
projects
?
buildProjectsFromJSON
(
projects
).
map
(
convertObjectPropsToCamelCase
)
:
null
,
...
...
ee/spec/features/groups/analytics/cycle_analytics/filters_and_data_spec.rb
View file @
5ca7001a
...
...
@@ -243,17 +243,21 @@ RSpec.describe 'Group value stream analytics filters and data', :js do
end
context
'with created_before and created_after set'
do
let
(
:created_after
)
{
'2019-11-01'
}
let
(
:created_before
)
{
'2019-12-31'
}
date_range
=
'.js-daterange-picker'
before
do
visit
"
#{
group_analytics_cycle_analytics_path
(
group
)
}
?created_before=
2019-12-31&created_after=2019-11-01
"
visit
"
#{
group_analytics_cycle_analytics_path
(
group
)
}
?created_before=
#{
created_before
}
&created_after=
#{
created_after
}
"
end
it
'has the date range prepopulated'
do
element
=
page
.
find
(
date_range
)
expect
(
element
.
find
(
'.js-daterange-picker-from input'
).
value
).
to
eq
'2019-11-01'
expect
(
element
.
find
(
'.js-daterange-picker-to input'
).
value
).
to
eq
'2019-12-31'
expect
(
element
.
find
(
'.js-daterange-picker-from input'
).
value
).
to
eq
created_after
expect
(
element
.
find
(
'.js-daterange-picker-to input'
).
value
).
to
eq
created_before
expect
(
page
.
find
(
'.js-tasks-by-type-chart'
)).
to
have_text
(
_
(
"Showing data for group '%{group_name}' from Nov 1, 2019 to Dec 31, 2019"
)
%
{
group_name:
group
.
name
})
end
end
...
...
ee/spec/frontend/analytics/shared/utils_spec.js
View file @
5ca7001a
...
...
@@ -2,6 +2,7 @@ import {
buildGroupFromDataset
,
buildProjectFromDataset
,
buildCycleAnalyticsInitialData
,
toLocalDate
,
}
from
'
ee/analytics/shared/utils
'
;
const
rawValueStream
=
`{
...
...
@@ -80,6 +81,14 @@ describe('buildProjectFromDataset', () => {
});
});
describe
(
'
toLocalDate
'
,
()
=>
{
it
(
'
returns a Date object
'
,
()
=>
{
const
expectedDate
=
new
Date
(
2022
,
1
,
10
);
// month is zero-based
expect
(
toLocalDate
(
'
2022-02-10
'
)).
toEqual
(
expectedDate
);
});
});
describe
(
'
buildCycleAnalyticsInitialData
'
,
()
=>
{
it
.
each
`
field | value
...
...
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