diff options
Diffstat (limited to 'spec/frontend/reports/components/grouped_test_reports_app_spec.js')
-rw-r--r-- | spec/frontend/reports/components/grouped_test_reports_app_spec.js | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/spec/frontend/reports/components/grouped_test_reports_app_spec.js b/spec/frontend/reports/components/grouped_test_reports_app_spec.js index 6a402277f52..017e0335569 100644 --- a/spec/frontend/reports/components/grouped_test_reports_app_spec.js +++ b/spec/frontend/reports/components/grouped_test_reports_app_spec.js @@ -15,20 +15,29 @@ localVue.use(Vuex); describe('Grouped test reports app', () => { const endpoint = 'endpoint.json'; + const pipelinePath = '/path/to/pipeline'; const Component = localVue.extend(GroupedTestReportsApp); let wrapper; let mockStore; - const mountComponent = () => { + const mountComponent = ({ + glFeatures = { junitPipelineView: false }, + props = { pipelinePath }, + } = {}) => { wrapper = mount(Component, { store: mockStore, localVue, propsData: { endpoint, + pipelinePath, + ...props, }, methods: { fetchReports: () => {}, }, + provide: { + glFeatures, + }, }); }; @@ -39,6 +48,7 @@ describe('Grouped test reports app', () => { }; const findHeader = () => wrapper.find('[data-testid="report-section-code-text"]'); + const findFullTestReportLink = () => wrapper.find('[data-testid="group-test-reports-full-link"]'); const findSummaryDescription = () => wrapper.find('[data-testid="test-summary-row-description"]'); const findIssueDescription = () => wrapper.find('[data-testid="test-issue-body-description"]'); const findAllIssueDescriptions = () => @@ -67,6 +77,39 @@ describe('Grouped test reports app', () => { }); }); + describe('`View full report` button', () => { + it('should not render the full test report link', () => { + expect(findFullTestReportLink().exists()).toBe(false); + }); + + describe('With junitPipelineView feature flag enabled', () => { + beforeEach(() => { + mountComponent({ glFeatures: { junitPipelineView: true } }); + }); + + it('should render the full test report link', () => { + const fullTestReportLink = findFullTestReportLink(); + + expect(fullTestReportLink.exists()).toBe(true); + expect(pipelinePath).not.toBe(''); + expect(fullTestReportLink.attributes('href')).toBe(`${pipelinePath}/test_report`); + }); + }); + + describe('Without a pipelinePath', () => { + beforeEach(() => { + mountComponent({ + glFeatures: { junitPipelineView: true }, + props: { pipelinePath: '' }, + }); + }); + + it('should not render the full test report link', () => { + expect(findFullTestReportLink().exists()).toBe(false); + }); + }); + }); + describe('with new failed result', () => { beforeEach(() => { setReports(newFailedTestReports); |