diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/frontend/pipeline_editor | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/frontend/pipeline_editor')
3 files changed, 17 insertions, 8 deletions
diff --git a/spec/frontend/pipeline_editor/components/header/pipeline_status_spec.js b/spec/frontend/pipeline_editor/components/header/pipeline_status_spec.js index b6d49d0d0f8..a95921359cc 100644 --- a/spec/frontend/pipeline_editor/components/header/pipeline_status_spec.js +++ b/spec/frontend/pipeline_editor/components/header/pipeline_status_spec.js @@ -44,6 +44,7 @@ describe('Pipeline Status', () => { const findPipelineCommit = () => wrapper.find('[data-testid="pipeline-commit"]'); const findPipelineErrorMsg = () => wrapper.find('[data-testid="pipeline-error-msg"]'); const findPipelineLoadingMsg = () => wrapper.find('[data-testid="pipeline-loading-msg"]'); + const findPipelineViewBtn = () => wrapper.find('[data-testid="pipeline-view-btn"]'); beforeEach(() => { mockPipelineQuery = jest.fn(); @@ -96,11 +97,15 @@ describe('Pipeline Status', () => { }); it('renders pipeline data', () => { - const { id } = mockProjectPipeline.pipeline; + const { + id, + detailedStatus: { detailsPath }, + } = mockProjectPipeline.pipeline; expect(findCiIcon().exists()).toBe(true); expect(findPipelineId().text()).toBe(`#${id.match(/\d+/g)[0]}`); expect(findPipelineCommit().text()).toBe(mockCommitSha); + expect(findPipelineViewBtn().attributes('href')).toBe(detailsPath); }); }); @@ -121,6 +126,7 @@ describe('Pipeline Status', () => { expect(findCiIcon().exists()).toBe(false); expect(findPipelineId().exists()).toBe(false); expect(findPipelineCommit().exists()).toBe(false); + expect(findPipelineViewBtn().exists()).toBe(false); }); }); }); diff --git a/spec/frontend/pipeline_editor/components/ui/pipeline_editor_messages_spec.js b/spec/frontend/pipeline_editor/components/ui/pipeline_editor_messages_spec.js index 93ebbc648fe..9f910ed4f9c 100644 --- a/spec/frontend/pipeline_editor/components/ui/pipeline_editor_messages_spec.js +++ b/spec/frontend/pipeline_editor/components/ui/pipeline_editor_messages_spec.js @@ -1,5 +1,6 @@ import { GlAlert } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; +import setWindowLocation from 'helpers/set_window_location_helper'; import { TEST_HOST } from 'helpers/test_constants'; import CodeSnippetAlert from '~/pipeline_editor/components/code_snippet_alert/code_snippet_alert.vue'; import { CODE_SNIPPET_SOURCES } from '~/pipeline_editor/components/code_snippet_alert/constants'; @@ -12,6 +13,10 @@ import { LOAD_FAILURE_UNKNOWN, } from '~/pipeline_editor/constants'; +beforeEach(() => { + setWindowLocation(TEST_HOST); +}); + describe('Pipeline Editor messages', () => { let wrapper; @@ -95,9 +100,7 @@ describe('Pipeline Editor messages', () => { describe('code snippet alert', () => { const setCodeSnippetUrlParam = (value) => { - global.jsdom.reconfigure({ - url: `${TEST_HOST}/?code_snippet_copied_from=${value}`, - }); + setWindowLocation(`${TEST_HOST}/?code_snippet_copied_from=${value}`); }; it('does not show by default', () => { diff --git a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js index b0d1a69ee56..0c5c08d7190 100644 --- a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js +++ b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js @@ -2,6 +2,7 @@ import { GlAlert, GlButton, GlLoadingIcon, GlTabs } from '@gitlab/ui'; import { shallowMount, createLocalVue } from '@vue/test-utils'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; +import setWindowLocation from 'helpers/set_window_location_helper'; import waitForPromises from 'helpers/wait_for_promises'; import CommitForm from '~/pipeline_editor/components/commit/commit_form.vue'; import TextEditor from '~/pipeline_editor/components/editor/text_editor.vue'; @@ -348,15 +349,14 @@ describe('Pipeline editor app component', () => { }); describe('when a template parameter is present in the URL', () => { - const { location } = window; + const originalLocation = window.location.href; beforeEach(() => { - delete window.location; - window.location = new URL('https://localhost?template=Android'); + setWindowLocation('?template=Android'); }); afterEach(() => { - window.location = location; + setWindowLocation(originalLocation); }); it('renders the given template', async () => { |