diff options
Diffstat (limited to 'spec/frontend/pipelines/test_reports/test_suite_table_spec.js')
-rw-r--r-- | spec/frontend/pipelines/test_reports/test_suite_table_spec.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/spec/frontend/pipelines/test_reports/test_suite_table_spec.js b/spec/frontend/pipelines/test_reports/test_suite_table_spec.js index 65bffe7039a..3a4aa94571e 100644 --- a/spec/frontend/pipelines/test_reports/test_suite_table_spec.js +++ b/spec/frontend/pipelines/test_reports/test_suite_table_spec.js @@ -23,6 +23,8 @@ 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) => { @@ -61,18 +63,14 @@ describe('Test reports suite table', () => { expect(allCaseRows().length).toBe(testCases.length); }); - it('renders the failed tests first', () => { - const failedCaseNames = testCases - .filter(x => x.status === TestStatus.FAILED) - .map(x => x.name); + 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); - const skippedCaseNames = testCases - .filter(x => x.status === TestStatus.SKIPPED) - .map(x => x.name); - - expect(findCaseRowAtIndex(0).text()).toContain(failedCaseNames[0]); - expect(findCaseRowAtIndex(1).text()).toContain(failedCaseNames[1]); - expect(findCaseRowAtIndex(2).text()).toContain(skippedCaseNames[0]); + expect(allCaseNames()).toEqual(expectedCaseOrder); }); it('renders the correct icon for each status', () => { |