Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 21:08:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 21:08:17 +0300
commit219eead23f9feb5da9ec378c451d773aea2dfe61 (patch)
treeeec14421a05ca8eb79f3cc782abe99532bb6070c /spec/frontend/error_tracking/components/error_details_spec.js
parent7c38405be9e79099f399aa429503ea7b463bbf5a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/error_tracking/components/error_details_spec.js')
-rw-r--r--spec/frontend/error_tracking/components/error_details_spec.js81
1 files changed, 62 insertions, 19 deletions
diff --git a/spec/frontend/error_tracking/components/error_details_spec.js b/spec/frontend/error_tracking/components/error_details_spec.js
index 2baec5f37fb..72b0466a1f0 100644
--- a/spec/frontend/error_tracking/components/error_details_spec.js
+++ b/spec/frontend/error_tracking/components/error_details_spec.js
@@ -1,6 +1,7 @@
import { createLocalVue, shallowMount } from '@vue/test-utils';
import Vuex from 'vuex';
import { __ } from '~/locale';
+import createFlash from '~/flash';
import {
GlButton,
GlLoadingIcon,
@@ -18,6 +19,8 @@ import {
errorStatus,
} from '~/error_tracking/components/constants';
+jest.mock('~/flash');
+
const localVue = createLocalVue();
localVue.use(Vuex);
@@ -49,18 +52,6 @@ describe('ErrorDetails', () => {
csrfToken: 'fakeToken',
},
});
- wrapper.setData({
- error: {
- id: 'gid://gitlab/Gitlab::ErrorTracking::DetailedError/129381',
- sentryId: 129381,
- title: 'Issue title',
- externalUrl: 'http://sentry.gitlab.net/gitlab',
- firstSeen: '2017-05-26T13:32:48Z',
- lastSeen: '2018-05-26T13:32:48Z',
- count: 12,
- userCount: 2,
- },
- });
}
beforeEach(() => {
@@ -78,6 +69,7 @@ describe('ErrorDetails', () => {
const state = {
stacktraceData: {},
loadingStacktrace: true,
+ errorStatus: '',
};
store = new Vuex.Store({
@@ -99,6 +91,7 @@ describe('ErrorDetails', () => {
error: {
loading: true,
stopPolling: jest.fn(),
+ setOptions: jest.fn(),
},
},
},
@@ -123,10 +116,61 @@ describe('ErrorDetails', () => {
});
});
+ describe('sentry response timeout', () => {
+ const initTime = 300000;
+ const endTime = initTime + 10000;
+
+ beforeEach(() => {
+ mocks.$apollo.queries.error.loading = false;
+ jest.spyOn(Date, 'now').mockReturnValue(initTime);
+ mountComponent();
+ });
+
+ it('when before timeout, still shows loading', () => {
+ Date.now.mockReturnValue(endTime - 1);
+
+ wrapper.vm.onNoApolloResult();
+
+ return wrapper.vm.$nextTick().then(() => {
+ expect(wrapper.find(GlLoadingIcon).exists()).toBe(true);
+ expect(createFlash).not.toHaveBeenCalled();
+ expect(mocks.$apollo.queries.error.stopPolling).not.toHaveBeenCalled();
+ });
+ });
+
+ it('when timeout is hit and no apollo result, stops loading and shows flash', () => {
+ Date.now.mockReturnValue(endTime + 1);
+
+ wrapper.vm.onNoApolloResult();
+
+ return wrapper.vm.$nextTick().then(() => {
+ expect(wrapper.find(GlLoadingIcon).exists()).toBe(false);
+ expect(wrapper.find(GlLink).exists()).toBe(false);
+ expect(createFlash).toHaveBeenCalledWith(
+ 'Could not connect to Sentry. Refresh the page to try again.',
+ 'warning',
+ );
+ expect(mocks.$apollo.queries.error.stopPolling).toHaveBeenCalled();
+ });
+ });
+ });
+
describe('Error details', () => {
beforeEach(() => {
mocks.$apollo.queries.error.loading = false;
mountComponent();
+ wrapper.setData({
+ error: {
+ id: 'gid://gitlab/Gitlab::ErrorTracking::DetailedError/129381',
+ sentryId: 129381,
+ title: 'Issue title',
+ externalUrl: 'http://sentry.gitlab.net/gitlab',
+ firstSeen: '2017-05-26T13:32:48Z',
+ lastSeen: '2018-05-26T13:32:48Z',
+ count: 12,
+ userCount: 2,
+ },
+ });
});
it('should show Sentry error details without stacktrace', () => {
@@ -232,10 +276,6 @@ describe('ErrorDetails', () => {
});
describe('When a user clicks the create issue button', () => {
- beforeEach(() => {
- mountComponent();
- });
-
it('should send sentry_issue_identifier', () => {
const sentryErrorIdInput = findInput(
'issue[sentry_issue_attributes][sentry_issue_identifier]',
@@ -275,7 +315,8 @@ describe('ErrorDetails', () => {
describe('when error is unresolved', () => {
beforeEach(() => {
store.state.details.errorStatus = errorStatus.UNRESOLVED;
- mountComponent();
+
+ return wrapper.vm.$nextTick();
});
it('displays Ignore and Resolve buttons', () => {
@@ -301,7 +342,8 @@ describe('ErrorDetails', () => {
describe('when error is ignored', () => {
beforeEach(() => {
store.state.details.errorStatus = errorStatus.IGNORED;
- mountComponent();
+
+ return wrapper.vm.$nextTick();
});
it('displays Undo Ignore and Resolve buttons', () => {
@@ -327,7 +369,8 @@ describe('ErrorDetails', () => {
describe('when error is resolved', () => {
beforeEach(() => {
store.state.details.errorStatus = errorStatus.RESOLVED;
- mountComponent();
+
+ return wrapper.vm.$nextTick();
});
it('displays Ignore and Unresolve buttons', () => {