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