Commit d7403c3f authored by Maxime Orefice's avatar Maxime Orefice Committed by Paul Slaughter

Fix junit test tab if no test reports

parent 46eb6ce2
...@@ -134,6 +134,10 @@ export default () => { ...@@ -134,6 +134,10 @@ export default () => {
axios axios
.get(dataset.testReportsCountEndpoint) .get(dataset.testReportsCountEndpoint)
.then(({ data }) => { .then(({ data }) => {
if (!data.total_count) {
return;
}
document.querySelector('.js-test-report-badge-counter').innerHTML = data.total_count; document.querySelector('.js-test-report-badge-counter').innerHTML = data.total_count;
}) })
.catch(() => {}); .catch(() => {});
......
...@@ -356,7 +356,7 @@ describe 'Pipeline', :js do ...@@ -356,7 +356,7 @@ describe 'Pipeline', :js do
end end
end end
context 'test tabs' do describe 'test tabs' do
let(:pipeline) { create(:ci_pipeline, :with_test_reports, project: project) } let(:pipeline) { create(:ci_pipeline, :with_test_reports, project: project) }
before do before do
...@@ -364,21 +364,31 @@ describe 'Pipeline', :js do ...@@ -364,21 +364,31 @@ describe 'Pipeline', :js do
wait_for_requests wait_for_requests
end end
it 'shows badge counter in Tests tab' do context 'with test reports' do
expect(pipeline.test_reports.total_count).to eq(4) it 'shows badge counter in Tests tab' do
expect(page.find('.js-test-report-badge-counter').text).to eq(pipeline.test_reports.total_count.to_s) expect(pipeline.test_reports.total_count).to eq(4)
end expect(page.find('.js-test-report-badge-counter').text).to eq(pipeline.test_reports.total_count.to_s)
end
it 'does not call test_report.json endpoint by default', :js do
expect(page).to have_selector('.js-no-tests-to-show', visible: :all)
end
it 'does not call test_report.json endpoint by default', :js do it 'does call test_report.json endpoint when tab is selected', :js do
expect(page).to have_selector('.js-no-tests-to-show', visible: :all) find('.js-tests-tab-link').click
wait_for_requests
expect(page).to have_content('Test suites')
expect(page).to have_selector('.js-tests-detail', visible: :all)
end
end end
it 'does call test_report.json endpoint when tab is selected', :js do context 'without test reports' do
find('.js-tests-tab-link').click let(:pipeline) { create(:ci_pipeline, project: project) }
wait_for_requests
expect(page).to have_content('Test suites') it 'shows nothing' do
expect(page).to have_selector('.js-tests-detail', visible: :all) expect(page.find('.js-test-report-badge-counter', visible: :all).text).to eq("")
end
end end
end end
......
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