summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-08-07 13:44:29 +0000
committerPhil Hughes <me@iamphill.com>2018-08-07 13:44:29 +0000
commit84f24dcef0d44e7447d3f3de4ec91668e5d9d3a3 (patch)
tree12a9b057473a9359025f4e4700ef88aeb20c7467
parentf3b36ac1171f6d170d008c52a0a324a438f3e886 (diff)
parent0f0e70bc13a680efb438c0e6b6007c3f5fc98eca (diff)
downloadgitlab-ce-84f24dcef0d44e7447d3f3de4ec91668e5d9d3a3.tar.gz
Merge branch '49966-improve-junit-fe' into 'master'
Resolve "Improve JUnit support" See merge request gitlab-org/gitlab-ce!21067
-rw-r--r--app/assets/javascripts/reports/components/grouped_test_reports_app.vue2
-rw-r--r--app/assets/javascripts/reports/store/mutations.js2
-rw-r--r--changelogs/unreleased/49966-improve-junit-fe.yml5
-rw-r--r--spec/javascripts/reports/components/grouped_test_reports_app_spec.js36
-rw-r--r--spec/javascripts/reports/mock_data/resolved_failures.json37
-rw-r--r--spec/javascripts/reports/store/mutations_spec.js4
6 files changed, 85 insertions, 1 deletions
diff --git a/app/assets/javascripts/reports/components/grouped_test_reports_app.vue b/app/assets/javascripts/reports/components/grouped_test_reports_app.vue
index 5bc3c2c4d21..140475b4dfa 100644
--- a/app/assets/javascripts/reports/components/grouped_test_reports_app.vue
+++ b/app/assets/javascripts/reports/components/grouped_test_reports_app.vue
@@ -69,7 +69,7 @@
return (
report.existing_failures.length > 0 ||
report.new_failures.length > 0 ||
- report.resolved_failures > 0
+ report.resolved_failures.length > 0
);
},
},
diff --git a/app/assets/javascripts/reports/store/mutations.js b/app/assets/javascripts/reports/store/mutations.js
index e806d120b51..1983a8c9e56 100644
--- a/app/assets/javascripts/reports/store/mutations.js
+++ b/app/assets/javascripts/reports/store/mutations.js
@@ -9,6 +9,8 @@ export default {
state.isLoading = true;
},
[types.RECEIVE_REPORTS_SUCCESS](state, response) {
+ // Make sure to clean previous state in case it was an error
+ state.hasError = false;
state.isLoading = false;
diff --git a/changelogs/unreleased/49966-improve-junit-fe.yml b/changelogs/unreleased/49966-improve-junit-fe.yml
new file mode 100644
index 00000000000..48971d3bfd6
--- /dev/null
+++ b/changelogs/unreleased/49966-improve-junit-fe.yml
@@ -0,0 +1,5 @@
+---
+title: Renders test reports for resolved failures and resets error state
+merge_request:
+author:
+type: fixed
diff --git a/spec/javascripts/reports/components/grouped_test_reports_app_spec.js b/spec/javascripts/reports/components/grouped_test_reports_app_spec.js
index d86e565036c..333cefe5f8a 100644
--- a/spec/javascripts/reports/components/grouped_test_reports_app_spec.js
+++ b/spec/javascripts/reports/components/grouped_test_reports_app_spec.js
@@ -7,6 +7,7 @@ import mountComponent from '../../helpers/vue_mount_component_helper';
import newFailedTestReports from '../mock_data/new_failures_report.json';
import successTestReports from '../mock_data/no_failures_report.json';
import mixedResultsTestReports from '../mock_data/new_and_fixed_failures_report.json';
+import resolvedFailures from '../mock_data/resolved_failures.json';
describe('Grouped Test Reports App', () => {
let vm;
@@ -123,6 +124,41 @@ describe('Grouped Test Reports App', () => {
});
});
+ describe('with resolved failures', () => {
+ beforeEach(() => {
+ mock.onGet('test_results.json').reply(200, resolvedFailures, {});
+ vm = mountComponent(Component, {
+ endpoint: 'test_results.json',
+ });
+ });
+
+ it('renders summary text', done => {
+ setTimeout(() => {
+ expect(vm.$el.querySelector('.fa-spinner')).toBeNull();
+ expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
+ 'Test summary contained 2 fixed test results out of 11 total tests',
+ );
+
+ expect(vm.$el.textContent).toContain(
+ 'rspec:pg found 2 fixed test results out of 8 total tests',
+ );
+ done();
+ }, 0);
+ });
+
+ it('renders resolved failures', done => {
+ setTimeout(() => {
+ expect(vm.$el.querySelector('.js-mr-code-resolved-issues').textContent).toContain(
+ resolvedFailures.suites[0].resolved_failures[0].name,
+ );
+ expect(vm.$el.querySelector('.js-mr-code-resolved-issues').textContent).toContain(
+ resolvedFailures.suites[0].resolved_failures[1].name,
+ );
+ done();
+ }, 0);
+ });
+ });
+
describe('with error', () => {
beforeEach(() => {
mock.onGet('test_results.json').reply(500, {}, {});
diff --git a/spec/javascripts/reports/mock_data/resolved_failures.json b/spec/javascripts/reports/mock_data/resolved_failures.json
new file mode 100644
index 00000000000..d1f347ce5e6
--- /dev/null
+++ b/spec/javascripts/reports/mock_data/resolved_failures.json
@@ -0,0 +1,37 @@
+{
+ "status": "success",
+ "summary": { "total": 11, "resolved": 2, "failed": 0 },
+ "suites": [
+ {
+ "name": "rspec:pg",
+ "status": "success",
+ "summary": { "total": 8, "resolved": 2, "failed": 0 },
+ "new_failures": [],
+ "resolved_failures": [
+ {
+ "status": "success",
+ "name": "Test#sum when a is 1 and b is 2 returns summary",
+ "execution_time": 0.000411,
+ "system_output": null,
+ "stack_trace": null
+ },
+ {
+ "status": "success",
+ "name": "Test#sum when a is 100 and b is 200 returns summary",
+ "execution_time": 7.6e-5,
+ "system_output": null,
+ "stack_trace": null
+ }
+ ],
+ "existing_failures": []
+ },
+ {
+ "name": "java ant",
+ "status": "success",
+ "summary": { "total": 3, "resolved": 0, "failed": 0 },
+ "new_failures": [],
+ "resolved_failures": [],
+ "existing_failures": []
+ }
+ ]
+}
diff --git a/spec/javascripts/reports/store/mutations_spec.js b/spec/javascripts/reports/store/mutations_spec.js
index 8f99d2675a5..7d19b16efb9 100644
--- a/spec/javascripts/reports/store/mutations_spec.js
+++ b/spec/javascripts/reports/store/mutations_spec.js
@@ -72,6 +72,10 @@ describe('Reports Store Mutations', () => {
expect(stateCopy.isLoading).toEqual(false);
});
+ it('should reset hasError', () => {
+ expect(stateCopy.hasError).toEqual(false);
+ });
+
it('should set summary counts', () => {
expect(stateCopy.summary.total).toEqual(mockedResponse.summary.total);
expect(stateCopy.summary.resolved).toEqual(mockedResponse.summary.resolved);