Commit c08875ac authored by Tim Zallmann's avatar Tim Zallmann

Merge branch 'mf-remove-frontend-unit-test-report-case-sorting' into 'master'

Remove frontend unit test report test case sorting

See merge request gitlab-org/gitlab!40885
parents 51c7e790 11d7e9e5
import { addIconStatus, formattedTime, sortTestCases } from './utils';
import { addIconStatus, formattedTime } from './utils';
export const getTestSuites = state => {
const { test_suites: testSuites = [] } = state.testReports;
......@@ -14,5 +14,5 @@ export const getSelectedSuite = state =>
export const getSuiteTests = state => {
const { test_cases: testCases = [] } = getSelectedSuite(state);
return testCases.sort(sortTestCases).map(addIconStatus);
return testCases.map(addIconStatus);
};
import { TestStatus } from '~/pipelines/constants';
import { __, sprintf } from '../../../locale';
export function iconForTestStatus(status) {
......@@ -25,18 +24,3 @@ export const addIconStatus = testCase => ({
icon: iconForTestStatus(testCase.status),
formattedTime: formattedTime(testCase.execution_time),
});
export const sortTestCases = (a, b) => {
if (a.status === b.status) {
return 0;
}
switch (b.status) {
case TestStatus.SUCCESS:
return -1;
case TestStatus.FAILED:
return 1;
default:
return 0;
}
};
---
title: Remove frontend unit test report test case sorting
merge_request: 40885
author:
type: changed
......@@ -23,8 +23,6 @@ describe('Test reports suite table', () => {
const noCasesMessage = () => wrapper.find('.js-no-test-cases');
const allCaseRows = () => wrapper.findAll('.js-case-row');
const findCaseRowAtIndex = index => wrapper.findAll('.js-case-row').at(index);
const allCaseNames = () =>
wrapper.findAll('[data-testid="caseName"]').wrappers.map(el => el.attributes('text'));
const findIconForRow = (row, status) => row.find(`.ci-status-icon-${status}`);
const createComponent = (suite = testSuite) => {
......@@ -63,16 +61,6 @@ describe('Test reports suite table', () => {
expect(allCaseRows().length).toBe(testCases.length);
});
it('renders the failed tests first, skipped tests next, then successful tests', () => {
const expectedCaseOrder = [
...testCases.filter(x => x.status === TestStatus.FAILED),
...testCases.filter(x => x.status === TestStatus.SKIPPED),
...testCases.filter(x => x.status === TestStatus.SUCCESS),
].map(x => x.name);
expect(allCaseNames()).toEqual(expectedCaseOrder);
});
it('renders the correct icon for each status', () => {
const failedTest = testCases.findIndex(x => x.status === TestStatus.FAILED);
const skippedTest = testCases.findIndex(x => x.status === TestStatus.SKIPPED);
......
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