Commit 23e808f5 authored by mfluharty's avatar mfluharty

Display error count separately from failure count

In test report MR widget, change copy from
"X+Y failed/error" to "X failed, Y errors"
Display errors in expanded widget (with different icon)
parent 9b2857bb
...@@ -10,10 +10,10 @@ import { ...@@ -10,10 +10,10 @@ import {
const textBuilder = results => { const textBuilder = results => {
const { failed, errored, resolved, total } = results; const { failed, errored, resolved, total } = results;
const failedOrErrored = (failed || 0) + (errored || 0); const failedString = failed ? n__('%d failed', '%d failed', failed) : null;
const failedString = failedOrErrored const erroredString = errored ? n__('%d error', '%d errors', errored) : null;
? n__('%d failed/error test result', '%d failed/error test results', failedOrErrored) const combinedString =
: null; failed && errored ? `${failedString}, ${erroredString}` : failedString || erroredString;
const resolvedString = resolved const resolvedString = resolved
? n__('%d fixed test result', '%d fixed test results', resolved) ? n__('%d fixed test result', '%d fixed test results', resolved)
: null; : null;
...@@ -21,14 +21,14 @@ const textBuilder = results => { ...@@ -21,14 +21,14 @@ const textBuilder = results => {
let resultsString = s__('Reports|no changed test results'); let resultsString = s__('Reports|no changed test results');
if (failedOrErrored) { if (failed || errored) {
if (resolved) { if (resolved) {
resultsString = sprintf(s__('Reports|%{failedString} and %{resolvedString}'), { resultsString = sprintf(s__('Reports|%{combinedString} and %{resolvedString}'), {
failedString, combinedString,
resolvedString, resolvedString,
}); });
} else { } else {
resultsString = failedString; resultsString = combinedString;
} }
} else if (resolved) { } else if (resolved) {
resultsString = resolvedString; resultsString = resolvedString;
......
...@@ -101,13 +101,18 @@ msgid_plural "%d contributions" ...@@ -101,13 +101,18 @@ msgid_plural "%d contributions"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "%d error"
msgid_plural "%d errors"
msgstr[0] ""
msgstr[1] ""
msgid "%d exporter" msgid "%d exporter"
msgid_plural "%d exporters" msgid_plural "%d exporters"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "%d failed/error test result" msgid "%d failed"
msgid_plural "%d failed/error test results" msgid_plural "%d failed"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
...@@ -16461,7 +16466,7 @@ msgstr "" ...@@ -16461,7 +16466,7 @@ msgstr ""
msgid "Reporting" msgid "Reporting"
msgstr "" msgstr ""
msgid "Reports|%{failedString} and %{resolvedString}" msgid "Reports|%{combinedString} and %{resolvedString}"
msgstr "" msgstr ""
msgid "Reports|Actions" msgid "Reports|Actions"
......
...@@ -585,10 +585,10 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -585,10 +585,10 @@ describe 'Merge request > User sees merge widget', :js do
within(".js-reports-container") do within(".js-reports-container") do
click_button 'Expand' click_button 'Expand'
expect(page).to have_content('Test summary contained 1 failed/error test result out of 2 total tests') expect(page).to have_content('Test summary contained 1 failed out of 2 total tests')
within(".js-report-section-container") do within(".js-report-section-container") do
expect(page).to have_content('rspec found no changed test results out of 1 total test') expect(page).to have_content('rspec found no changed test results out of 1 total test')
expect(page).to have_content('junit found 1 failed/error test result out of 1 total test') expect(page).to have_content('junit found 1 failed out of 1 total test')
expect(page).to have_content('New') expect(page).to have_content('New')
expect(page).to have_content('addTest') expect(page).to have_content('addTest')
end end
...@@ -630,9 +630,9 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -630,9 +630,9 @@ describe 'Merge request > User sees merge widget', :js do
within(".js-reports-container") do within(".js-reports-container") do
click_button 'Expand' click_button 'Expand'
expect(page).to have_content('Test summary contained 1 failed/error test result out of 2 total tests') expect(page).to have_content('Test summary contained 1 failed out of 2 total tests')
within(".js-report-section-container") do within(".js-report-section-container") do
expect(page).to have_content('rspec found 1 failed/error test result out of 1 total test') expect(page).to have_content('rspec found 1 failed out of 1 total test')
expect(page).to have_content('junit found no changed test results out of 1 total test') expect(page).to have_content('junit found no changed test results out of 1 total test')
expect(page).not_to have_content('New') expect(page).not_to have_content('New')
expect(page).to have_content('Test#sum when a is 1 and b is 3 returns summary') expect(page).to have_content('Test#sum when a is 1 and b is 3 returns summary')
...@@ -718,10 +718,10 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -718,10 +718,10 @@ describe 'Merge request > User sees merge widget', :js do
within(".js-reports-container") do within(".js-reports-container") do
click_button 'Expand' click_button 'Expand'
expect(page).to have_content('Test summary contained 1 failed/error test result out of 2 total tests') expect(page).to have_content('Test summary contained 1 error out of 2 total tests')
within(".js-report-section-container") do within(".js-report-section-container") do
expect(page).to have_content('rspec found no changed test results out of 1 total test') expect(page).to have_content('rspec found no changed test results out of 1 total test')
expect(page).to have_content('junit found 1 failed/error test result out of 1 total test') expect(page).to have_content('junit found 1 error out of 1 total test')
expect(page).to have_content('New') expect(page).to have_content('New')
expect(page).to have_content('addTest') expect(page).to have_content('addTest')
end end
...@@ -762,9 +762,9 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -762,9 +762,9 @@ describe 'Merge request > User sees merge widget', :js do
within(".js-reports-container") do within(".js-reports-container") do
click_button 'Expand' click_button 'Expand'
expect(page).to have_content('Test summary contained 1 failed/error test result out of 2 total tests') expect(page).to have_content('Test summary contained 1 error out of 2 total tests')
within(".js-report-section-container") do within(".js-report-section-container") do
expect(page).to have_content('rspec found 1 failed/error test result out of 1 total test') expect(page).to have_content('rspec found 1 error out of 1 total test')
expect(page).to have_content('junit found no changed test results out of 1 total test') expect(page).to have_content('junit found no changed test results out of 1 total test')
expect(page).not_to have_content('New') expect(page).not_to have_content('New')
expect(page).to have_content('Test#sum when a is 4 and b is 4 returns summary') expect(page).to have_content('Test#sum when a is 4 and b is 4 returns summary')
...@@ -857,10 +857,10 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -857,10 +857,10 @@ describe 'Merge request > User sees merge widget', :js do
within(".js-reports-container") do within(".js-reports-container") do
click_button 'Expand' click_button 'Expand'
expect(page).to have_content('Test summary contained 20 failed/error test results out of 20 total tests') expect(page).to have_content('Test summary contained 20 failed out of 20 total tests')
within(".js-report-section-container") do within(".js-report-section-container") do
expect(page).to have_content('rspec found 10 failed/error test results out of 10 total tests') expect(page).to have_content('rspec found 10 failed out of 10 total tests')
expect(page).to have_content('junit found 10 failed/error test results out of 10 total tests') expect(page).to have_content('junit found 10 failed out of 10 total tests')
expect(page).to have_content('Test#sum when a is 1 and b is 3 returns summary', count: 2) expect(page).to have_content('Test#sum when a is 1 and b is 3 returns summary', count: 2)
end end
......
...@@ -30,9 +30,7 @@ describe('Reports store utils', () => { ...@@ -30,9 +30,7 @@ describe('Reports store utils', () => {
const data = { failed: 3, total: 10 }; const data = { failed: 3, total: 10 };
const result = utils.summaryTextBuilder(name, data); const result = utils.summaryTextBuilder(name, data);
expect(result).toBe( expect(result).toBe('Test summary contained 3 failed out of 10 total tests');
'Test summary contained 3 failed/error test results out of 10 total tests',
);
}); });
it('should render text for multiple errored results', () => { it('should render text for multiple errored results', () => {
...@@ -40,9 +38,7 @@ describe('Reports store utils', () => { ...@@ -40,9 +38,7 @@ describe('Reports store utils', () => {
const data = { errored: 7, total: 10 }; const data = { errored: 7, total: 10 };
const result = utils.summaryTextBuilder(name, data); const result = utils.summaryTextBuilder(name, data);
expect(result).toBe( expect(result).toBe('Test summary contained 7 errors out of 10 total tests');
'Test summary contained 7 failed/error test results out of 10 total tests',
);
}); });
it('should render text for multiple fixed results', () => { it('should render text for multiple fixed results', () => {
...@@ -59,7 +55,7 @@ describe('Reports store utils', () => { ...@@ -59,7 +55,7 @@ describe('Reports store utils', () => {
const result = utils.summaryTextBuilder(name, data); const result = utils.summaryTextBuilder(name, data);
expect(result).toBe( expect(result).toBe(
'Test summary contained 3 failed/error test results and 4 fixed test results out of 10 total tests', 'Test summary contained 3 failed and 4 fixed test results out of 10 total tests',
); );
}); });
...@@ -69,18 +65,17 @@ describe('Reports store utils', () => { ...@@ -69,18 +65,17 @@ describe('Reports store utils', () => {
const result = utils.summaryTextBuilder(name, data); const result = utils.summaryTextBuilder(name, data);
expect(result).toBe( expect(result).toBe(
'Test summary contained 1 failed/error test result and 1 fixed test result out of 10 total tests', 'Test summary contained 1 failed and 1 fixed test result out of 10 total tests',
); );
}); });
it('should render text for singular failed, errored, and fixed results', () => { it('should render text for singular failed, errored, and fixed results', () => {
// these will be singular when the copy is updated
const name = 'Test summary'; const name = 'Test summary';
const data = { failed: 1, errored: 1, resolved: 1, total: 10 }; const data = { failed: 1, errored: 1, resolved: 1, total: 10 };
const result = utils.summaryTextBuilder(name, data); const result = utils.summaryTextBuilder(name, data);
expect(result).toBe( expect(result).toBe(
'Test summary contained 2 failed/error test results and 1 fixed test result out of 10 total tests', 'Test summary contained 1 failed, 1 error and 1 fixed test result out of 10 total tests',
); );
}); });
...@@ -90,7 +85,7 @@ describe('Reports store utils', () => { ...@@ -90,7 +85,7 @@ describe('Reports store utils', () => {
const result = utils.summaryTextBuilder(name, data); const result = utils.summaryTextBuilder(name, data);
expect(result).toBe( expect(result).toBe(
'Test summary contained 5 failed/error test results and 4 fixed test results out of 10 total tests', 'Test summary contained 2 failed, 3 errors and 4 fixed test results out of 10 total tests',
); );
}); });
}); });
...@@ -117,7 +112,7 @@ describe('Reports store utils', () => { ...@@ -117,7 +112,7 @@ describe('Reports store utils', () => {
const data = { failed: 3, total: 10 }; const data = { failed: 3, total: 10 };
const result = utils.reportTextBuilder(name, data); const result = utils.reportTextBuilder(name, data);
expect(result).toBe('Rspec found 3 failed/error test results out of 10 total tests'); expect(result).toBe('Rspec found 3 failed out of 10 total tests');
}); });
it('should render text for multiple errored results', () => { it('should render text for multiple errored results', () => {
...@@ -125,7 +120,7 @@ describe('Reports store utils', () => { ...@@ -125,7 +120,7 @@ describe('Reports store utils', () => {
const data = { errored: 7, total: 10 }; const data = { errored: 7, total: 10 };
const result = utils.reportTextBuilder(name, data); const result = utils.reportTextBuilder(name, data);
expect(result).toBe('Rspec found 7 failed/error test results out of 10 total tests'); expect(result).toBe('Rspec found 7 errors out of 10 total tests');
}); });
it('should render text for multiple fixed results', () => { it('should render text for multiple fixed results', () => {
...@@ -141,9 +136,7 @@ describe('Reports store utils', () => { ...@@ -141,9 +136,7 @@ describe('Reports store utils', () => {
const data = { failed: 3, resolved: 4, total: 10 }; const data = { failed: 3, resolved: 4, total: 10 };
const result = utils.reportTextBuilder(name, data); const result = utils.reportTextBuilder(name, data);
expect(result).toBe( expect(result).toBe('Rspec found 3 failed and 4 fixed test results out of 10 total tests');
'Rspec found 3 failed/error test results and 4 fixed test results out of 10 total tests',
);
}); });
it('should render text for a singular fixed, and a singular failed result', () => { it('should render text for a singular fixed, and a singular failed result', () => {
...@@ -151,19 +144,16 @@ describe('Reports store utils', () => { ...@@ -151,19 +144,16 @@ describe('Reports store utils', () => {
const data = { failed: 1, resolved: 1, total: 10 }; const data = { failed: 1, resolved: 1, total: 10 };
const result = utils.reportTextBuilder(name, data); const result = utils.reportTextBuilder(name, data);
expect(result).toBe( expect(result).toBe('Rspec found 1 failed and 1 fixed test result out of 10 total tests');
'Rspec found 1 failed/error test result and 1 fixed test result out of 10 total tests',
);
}); });
it('should render text for singular failed, errored, and fixed results', () => { it('should render text for singular failed, errored, and fixed results', () => {
// these will be singular when the copy is updated
const name = 'Rspec'; const name = 'Rspec';
const data = { failed: 1, errored: 1, resolved: 1, total: 10 }; const data = { failed: 1, errored: 1, resolved: 1, total: 10 };
const result = utils.reportTextBuilder(name, data); const result = utils.reportTextBuilder(name, data);
expect(result).toBe( expect(result).toBe(
'Rspec found 2 failed/error test results and 1 fixed test result out of 10 total tests', 'Rspec found 1 failed, 1 error and 1 fixed test result out of 10 total tests',
); );
}); });
...@@ -173,7 +163,7 @@ describe('Reports store utils', () => { ...@@ -173,7 +163,7 @@ describe('Reports store utils', () => {
const result = utils.reportTextBuilder(name, data); const result = utils.reportTextBuilder(name, data);
expect(result).toBe( expect(result).toBe(
'Rspec found 5 failed/error test results and 4 fixed test results out of 10 total tests', 'Rspec found 2 failed, 3 errors and 4 fixed test results out of 10 total tests',
); );
}); });
}); });
......
...@@ -84,12 +84,10 @@ describe('Grouped Test Reports App', () => { ...@@ -84,12 +84,10 @@ describe('Grouped Test Reports App', () => {
setTimeout(() => { setTimeout(() => {
expect(vm.$el.querySelector('.gl-spinner')).toBeNull(); expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual( expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary contained 2 failed/error test results out of 11 total tests', 'Test summary contained 2 failed out of 11 total tests',
); );
expect(vm.$el.textContent).toContain( expect(vm.$el.textContent).toContain('rspec:pg found 2 failed out of 8 total tests');
'rspec:pg found 2 failed/error test results out of 8 total tests',
);
expect(vm.$el.textContent).toContain('New'); expect(vm.$el.textContent).toContain('New');
expect(vm.$el.textContent).toContain( expect(vm.$el.textContent).toContain(
...@@ -112,12 +110,10 @@ describe('Grouped Test Reports App', () => { ...@@ -112,12 +110,10 @@ describe('Grouped Test Reports App', () => {
setTimeout(() => { setTimeout(() => {
expect(vm.$el.querySelector('.gl-spinner')).toBeNull(); expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual( expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary contained 2 failed/error test results out of 11 total tests', 'Test summary contained 2 errors out of 11 total tests',
); );
expect(vm.$el.textContent).toContain( expect(vm.$el.textContent).toContain('karma found 2 errors out of 3 total tests');
'karma found 2 failed/error test results out of 3 total tests',
);
expect(vm.$el.textContent).toContain('New'); expect(vm.$el.textContent).toContain('New');
expect(vm.$el.textContent).toContain( expect(vm.$el.textContent).toContain(
...@@ -140,17 +136,15 @@ describe('Grouped Test Reports App', () => { ...@@ -140,17 +136,15 @@ describe('Grouped Test Reports App', () => {
setTimeout(() => { setTimeout(() => {
expect(vm.$el.querySelector('.gl-spinner')).toBeNull(); expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual( expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Test summary contained 2 failed/error test results and 2 fixed test results out of 11 total tests', 'Test summary contained 2 failed and 2 fixed test results out of 11 total tests',
); );
expect(vm.$el.textContent).toContain( expect(vm.$el.textContent).toContain(
'rspec:pg found 1 failed/error test result and 2 fixed test results out of 8 total tests', 'rspec:pg found 1 failed and 2 fixed test results out of 8 total tests',
); );
expect(vm.$el.textContent).toContain('New'); expect(vm.$el.textContent).toContain('New');
expect(vm.$el.textContent).toContain( expect(vm.$el.textContent).toContain(' java ant found 1 failed out of 3 total tests');
' java ant found 1 failed/error test result out of 3 total tests',
);
done(); done();
}, 0); }, 0);
}); });
......
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