Commit 5ff3eed4 authored by Scott Hampton's avatar Scott Hampton

Format test report times to adjust for ms

The test report duration times were showing `00:00:00` when
the time was in milliseconds. Now the time is formatted in seconds
or milliseconds depending on how small the number is.
parent b2c63b0b
<script>
import { GlDeprecatedButton, GlProgressBar } from '@gitlab/ui';
import { __ } from '~/locale';
import { formatTime, secondsToMilliseconds } from '~/lib/utils/datetime_utility';
import Icon from '~/vue_shared/components/icon.vue';
import { formattedTime } from '../../stores/test_reports/utils';
export default {
name: 'TestSummary',
......@@ -39,7 +39,7 @@ export default {
return 0;
},
formattedDuration() {
return formatTime(secondsToMilliseconds(this.report.total_time));
return formattedTime(this.report.total_time);
},
progressBarVariant() {
if (this.successPercentage < 33) {
......
import { TestStatus } from '~/pipelines/constants';
import { formatTime, secondsToMilliseconds } from '~/lib/utils/datetime_utility';
import { secondsToMilliseconds } from '~/lib/utils/datetime_utility';
import { __, sprintf } from '../../../locale';
export function iconForTestStatus(status) {
switch (status) {
......@@ -12,7 +13,13 @@ export function iconForTestStatus(status) {
}
}
export const formattedTime = timeInSeconds => formatTime(secondsToMilliseconds(timeInSeconds));
export const formattedTime = seconds => {
if (seconds < 1) {
const milliseconds = secondsToMilliseconds(seconds);
return sprintf(__('%{milliseconds}ms'), { milliseconds: milliseconds.toFixed(2) });
}
return sprintf(__('%{seconds}s'), { seconds: seconds.toFixed(2) });
};
export const addIconStatus = testCase => ({
...testCase,
......
---
title: Adjust format for JUnit report duration times
merge_request: 39644
author:
type: changed
......@@ -551,6 +551,9 @@ msgstr ""
msgid "%{milestone} (expired)"
msgstr ""
msgid "%{milliseconds}ms"
msgstr ""
msgid "%{mrText}, this issue will be closed automatically."
msgstr ""
......@@ -663,6 +666,9 @@ msgstr ""
msgid "%{retryButtonStart}Try again%{retryButtonEnd} or %{newFileButtonStart}attach a new file%{newFileButtonEnd}"
msgstr ""
msgid "%{seconds}s"
msgstr ""
msgid "%{securityScanner} is not enabled for this project. %{linkStart}More information%{linkEnd}"
msgid_plural "%{securityScanner} are not enabled for this project. %{linkStart}More information%{linkEnd}"
msgstr[0] ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment