diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-29 03:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-29 03:09:17 +0300 |
commit | 5fe1957d2bd0c3f969f357b17f4b46f1968d8810 (patch) | |
tree | c3819660f860c4fc87d9ac9f22ad08894bb143fb /spec/frontend/pipelines/test_reports | |
parent | c6c346e8c7f0865f0016a458511e9fabfc8b9c1a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/pipelines/test_reports')
-rw-r--r-- | spec/frontend/pipelines/test_reports/test_case_details_spec.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/frontend/pipelines/test_reports/test_case_details_spec.js b/spec/frontend/pipelines/test_reports/test_case_details_spec.js index bfb8b43778d..42765ca6a32 100644 --- a/spec/frontend/pipelines/test_reports/test_case_details_spec.js +++ b/spec/frontend/pipelines/test_reports/test_case_details_spec.js @@ -11,12 +11,17 @@ describe('Test case details', () => { classname: 'spec.test_spec', name: 'Test#something cool', formattedTime: '10.04ms', + recent_failures: { + count: 2, + base_branch: 'master', + }, system_output: 'Line 42 is broken', }; const findModal = () => wrapper.find(GlModal); const findName = () => wrapper.find('[data-testid="test-case-name"]'); const findDuration = () => wrapper.find('[data-testid="test-case-duration"]'); + const findRecentFailures = () => wrapper.find('[data-testid="test-case-recent-failures"]'); const findSystemOutput = () => wrapper.find('[data-testid="test-case-trace"]'); const createComponent = (testCase = {}) => { @@ -56,6 +61,36 @@ describe('Test case details', () => { }); }); + describe('when test case has recent failures', () => { + describe('has only 1 recent failure', () => { + it('renders the recent failure', () => { + createComponent({ recent_failures: { ...defaultTestCase.recent_failures, count: 1 } }); + + expect(findRecentFailures().text()).toContain( + `Failed 1 time in ${defaultTestCase.recent_failures.base_branch} in the last 14 days`, + ); + }); + }); + + describe('has more than 1 recent failure', () => { + it('renders the recent failures', () => { + createComponent(); + + expect(findRecentFailures().text()).toContain( + `Failed ${defaultTestCase.recent_failures.count} times in ${defaultTestCase.recent_failures.base_branch} in the last 14 days`, + ); + }); + }); + }); + + describe('when test case does not have recent failures', () => { + it('does not render the recent failures', () => { + createComponent({ recent_failures: null }); + + expect(findRecentFailures().exists()).toBe(false); + }); + }); + describe('when test case has system output', () => { it('renders the test case system output', () => { createComponent(); |