diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-05 12:08:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-05 12:08:43 +0300 |
commit | 26384c9a61da9922b8fa4b8351d4e42d51661b37 (patch) | |
tree | ef3decbed644db3c97dcdbb5b71d4ade77f3155d /spec/frontend | |
parent | 79cbe31b18159ea394c6f6e3027c1dc69bdabb75 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
6 files changed, 53 insertions, 97 deletions
diff --git a/spec/frontend/diffs/components/compare_versions_spec.js b/spec/frontend/diffs/components/compare_versions_spec.js index 5f919408459..ff92a12eaf6 100644 --- a/spec/frontend/diffs/components/compare_versions_spec.js +++ b/spec/frontend/diffs/components/compare_versions_spec.js @@ -49,8 +49,7 @@ describe('CompareVersions', () => { expect(treeListBtn.exists()).toBe(true); expect(treeListBtn.attributes('title')).toBe('Hide file browser'); - expect(treeListBtn.findAll(Icon).length).not.toBe(0); - expect(treeListBtn.find(Icon).props('name')).toBe('collapse-left'); + expect(treeListBtn.find(Icon).props('name')).toBe('file-tree'); }); it('should render comparison dropdowns with correct values', () => { diff --git a/spec/frontend/diffs/components/diff_stats_spec.js b/spec/frontend/diffs/components/diff_stats_spec.js index 0dffc74f608..5956b478019 100644 --- a/spec/frontend/diffs/components/diff_stats_spec.js +++ b/spec/frontend/diffs/components/diff_stats_spec.js @@ -1,6 +1,6 @@ import { shallowMount } from '@vue/test-utils'; -import Icon from '~/vue_shared/components/icon.vue'; import DiffStats from '~/diffs/components/diff_stats.vue'; +import Icon from '~/vue_shared/components/icon.vue'; describe('diff_stats', () => { it('does not render a group if diffFileLengths is empty', () => { @@ -37,18 +37,18 @@ describe('diff_stats', () => { }, }); + const findFileLine = name => wrapper.find(name); const findIcon = name => wrapper .findAll(Icon) .filter(c => c.attributes('name') === name) .at(0).element.parentNode; - - const additions = findIcon('file-addition'); - const deletions = findIcon('file-deletion'); + const additions = findFileLine('.js-file-addition-line'); + const deletions = findFileLine('.js-file-deletion-line'); const filesChanged = findIcon('doc-code'); - expect(additions.textContent).toContain('100'); - expect(deletions.textContent).toContain('200'); + expect(additions.text()).toBe('100'); + expect(deletions.text()).toBe('200'); expect(filesChanged.textContent).toContain('300'); }); }); diff --git a/spec/frontend/error_tracking/components/error_details_spec.js b/spec/frontend/error_tracking/components/error_details_spec.js index cfb9ce51979..94bf0189c91 100644 --- a/spec/frontend/error_tracking/components/error_details_spec.js +++ b/spec/frontend/error_tracking/components/error_details_spec.js @@ -37,14 +37,13 @@ describe('ErrorDetails', () => { projectPath: '/root/gitlab-test', listPath: '/error_tracking', issueUpdatePath: '/123', - issueDetailsPath: '/123/details', issueStackTracePath: '/stacktrace', projectIssuesPath: '/test-project/issues/', csrfToken: 'fakeToken', }, }); wrapper.setData({ - GQLerror: { + error: { id: 'gid://gitlab/Gitlab::ErrorTracking::DetailedError/129381', sentryId: 129381, title: 'Issue title', @@ -59,7 +58,6 @@ describe('ErrorDetails', () => { beforeEach(() => { actions = { - startPollingDetails: () => {}, startPollingStacktrace: () => {}, updateIgnoreStatus: jest.fn(), updateResolveStatus: jest.fn().mockResolvedValue({ closed_issue_iid: 1 }), @@ -71,8 +69,6 @@ describe('ErrorDetails', () => { }; const state = { - error: {}, - loading: true, stacktraceData: {}, loadingStacktrace: true, }; @@ -93,7 +89,7 @@ describe('ErrorDetails', () => { $apollo: { query, queries: { - GQLerror: { + error: { loading: true, stopPolling: jest.fn(), }, @@ -122,9 +118,7 @@ describe('ErrorDetails', () => { describe('Error details', () => { beforeEach(() => { - store.state.details.loading = false; - store.state.details.error.id = 1; - mocks.$apollo.queries.GQLerror.loading = false; + mocks.$apollo.queries.error.loading = false; mountComponent(); }); @@ -138,16 +132,22 @@ describe('ErrorDetails', () => { describe('Badges', () => { it('should show language and error level badges', () => { - store.state.details.error.tags = { level: 'error', logger: 'ruby' }; - mountComponent(); + wrapper.setData({ + error: { + tags: { level: 'error', logger: 'ruby' }, + }, + }); return wrapper.vm.$nextTick().then(() => { expect(wrapper.findAll(GlBadge).length).toBe(2); }); }); it('should NOT show the badge if the tag is not present', () => { - store.state.details.error.tags = { level: 'error' }; - mountComponent(); + wrapper.setData({ + error: { + tags: { level: 'error' }, + }, + }); return wrapper.vm.$nextTick().then(() => { expect(wrapper.findAll(GlBadge).length).toBe(1); }); @@ -156,8 +156,11 @@ describe('ErrorDetails', () => { it.each(Object.keys(severityLevel))( 'should set correct severity level variant for %s badge', level => { - store.state.details.error.tags = { level: severityLevel[level] }; - mountComponent(); + wrapper.setData({ + error: { + tags: { level: severityLevel[level] }, + }, + }); return wrapper.vm.$nextTick().then(() => { expect(wrapper.find(GlBadge).attributes('variant')).toEqual( severityLevelVariant[severityLevel[level]], @@ -167,8 +170,11 @@ describe('ErrorDetails', () => { ); it('should fallback for ERROR severityLevelVariant when severityLevel is unknown', () => { - store.state.details.error.tags = { level: 'someNewErrorLevel' }; - mountComponent(); + wrapper.setData({ + error: { + tags: { level: 'someNewErrorLevel' }, + }, + }); return wrapper.vm.$nextTick().then(() => { expect(wrapper.find(GlBadge).attributes('variant')).toEqual( severityLevelVariant[severityLevel.ERROR], @@ -180,7 +186,6 @@ describe('ErrorDetails', () => { describe('Stacktrace', () => { it('should show stacktrace', () => { store.state.details.loadingStacktrace = false; - mountComponent(); return wrapper.vm.$nextTick().then(() => { expect(wrapper.find(GlLoadingIcon).exists()).toBe(false); expect(wrapper.find(Stacktrace).exists()).toBe(true); @@ -190,9 +195,10 @@ describe('ErrorDetails', () => { it('should NOT show stacktrace if no entries', () => { store.state.details.loadingStacktrace = false; store.getters = { 'details/sentryUrl': () => 'sentry.io', 'details/stacktrace': () => [] }; - mountComponent(); - expect(wrapper.find(GlLoadingIcon).exists()).toBe(false); - expect(wrapper.find(Stacktrace).exists()).toBe(false); + return wrapper.vm.$nextTick().then(() => { + expect(wrapper.find(GlLoadingIcon).exists()).toBe(false); + expect(wrapper.find(Stacktrace).exists()).toBe(false); + }); }); }); @@ -331,19 +337,18 @@ describe('ErrorDetails', () => { }); describe('GitLab issue link', () => { - const gitlabIssue = 'https://gitlab.example.com/issues/1'; - const findGitLabLink = () => wrapper.find(`[href="${gitlabIssue}"]`); + const gitlabIssuePath = 'https://gitlab.example.com/issues/1'; + const findGitLabLink = () => wrapper.find(`[href="${gitlabIssuePath}"]`); const findCreateIssueButton = () => wrapper.find('[data-qa-selector="create_issue_button"]'); const findViewIssueButton = () => wrapper.find('[data-qa-selector="view_issue_button"]'); describe('is present', () => { beforeEach(() => { - store.state.details.loading = false; - store.state.details.error = { - id: 1, - gitlab_issue: gitlabIssue, - }; - mountComponent(); + wrapper.setData({ + error: { + gitlabIssuePath, + }, + }); }); it('should display the View issue button', () => { @@ -361,12 +366,11 @@ describe('ErrorDetails', () => { describe('is not present', () => { beforeEach(() => { - store.state.details.loading = false; - store.state.details.error = { - id: 1, - gitlab_issue: null, - }; - mountComponent(); + wrapper.setData({ + error: { + gitlabIssuePath: null, + }, + }); }); it('should not display the View issue button', () => { @@ -390,9 +394,9 @@ describe('ErrorDetails', () => { const findGitLabCommitLink = () => wrapper.find(`[href$="${gitlabCommitPath}"]`); it('should display a link', () => { - mocks.$apollo.queries.GQLerror.loading = false; + mocks.$apollo.queries.error.loading = false; wrapper.setData({ - GQLerror: { + error: { gitlabCommit, gitlabCommitPath, }, @@ -403,9 +407,9 @@ describe('ErrorDetails', () => { }); it('should not display a link', () => { - mocks.$apollo.queries.GQLerror.loading = false; + mocks.$apollo.queries.error.loading = false; wrapper.setData({ - GQLerror: { + error: { gitlabCommit: null, }, }); diff --git a/spec/frontend/error_tracking/components/error_tracking_list_spec.js b/spec/frontend/error_tracking/components/error_tracking_list_spec.js index 310cd676ca1..9cf73d54d9b 100644 --- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js +++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js @@ -239,7 +239,7 @@ describe('ErrorTrackingList', () => { expect(actions.updateStatus).toHaveBeenCalledWith( expect.anything(), { - endpoint: '/project/test/-/error_tracking/3.json', + endpoint: `/project/test/-/error_tracking/${errorsList[0].id}.json`, redirectUrl: '/error_tracking', status: 'ignored', }, @@ -267,7 +267,7 @@ describe('ErrorTrackingList', () => { expect(actions.updateStatus).toHaveBeenCalledWith( expect.anything(), { - endpoint: '/project/test/-/error_tracking/3.json', + endpoint: `/project/test/-/error_tracking/${errorsList[0].id}.json`, redirectUrl: '/error_tracking', status: 'resolved', }, diff --git a/spec/frontend/error_tracking/store/details/actions_spec.js b/spec/frontend/error_tracking/store/details/actions_spec.js index fa37886f176..6802300b0f5 100644 --- a/spec/frontend/error_tracking/store/details/actions_spec.js +++ b/spec/frontend/error_tracking/store/details/actions_spec.js @@ -26,53 +26,6 @@ describe('Sentry error details store actions', () => { } }); - describe('startPollingDetails', () => { - const endpoint = '123/details'; - it('should commit SET_ERROR with received response', done => { - const payload = { error: { id: 1 } }; - mockedAdapter.onGet().reply(200, payload); - testAction( - actions.startPollingDetails, - { endpoint }, - {}, - [ - { type: types.SET_ERROR, payload: payload.error }, - { type: types.SET_LOADING, payload: false }, - ], - [], - () => { - done(); - }, - ); - }); - - it('should show flash on API error', done => { - mockedAdapter.onGet().reply(400); - - testAction( - actions.startPollingDetails, - { endpoint }, - {}, - [{ type: types.SET_LOADING, payload: false }], - [], - () => { - expect(createFlash).toHaveBeenCalledTimes(1); - done(); - }, - ); - }); - - it('should not restart polling when receiving an empty 204 response', done => { - mockedRestart = jest.spyOn(Poll.prototype, 'restart'); - mockedAdapter.onGet().reply(204); - - testAction(actions.startPollingDetails, { endpoint }, {}, [], [], () => { - expect(mockedRestart).toHaveBeenCalledTimes(0); - done(); - }); - }); - }); - describe('startPollingStacktrace', () => { const endpoint = '123/stacktrace'; it('should commit SET_ERROR with received response', done => { diff --git a/spec/frontend/jobs/components/log/mock_data.js b/spec/frontend/jobs/components/log/mock_data.js index 587818045eb..cdf5a3e10b1 100644 --- a/spec/frontend/jobs/components/log/mock_data.js +++ b/spec/frontend/jobs/components/log/mock_data.js @@ -34,7 +34,7 @@ export const utilsMockData = [ content: [ { text: - 'Using Docker executor with image dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33', + 'Using Docker executor with image dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.34', }, ], section: 'prepare-executor', |