diff options
| author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-11 06:10:03 +0000 |
|---|---|---|
| committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-11 06:10:03 +0000 |
| commit | 7adadf7e5b83c46f7e83051146624719e9b6bf0d (patch) | |
| tree | 3439c6c97d3345ce9ce4e972e39c57eef5dc2d64 /spec | |
| parent | fb8d6a526f0ef2da9fb247e15f9ff19279dba3d6 (diff) | |
| download | gitlab-ce-7adadf7e5b83c46f7e83051146624719e9b6bf0d.tar.gz | |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/features/issues/issue_sidebar_spec.rb | 2 | ||||
| -rw-r--r-- | spec/features/issues/user_edits_issue_spec.rb | 5 | ||||
| -rw-r--r-- | spec/frontend/clusters/components/applications_spec.js | 21 | ||||
| -rw-r--r-- | spec/frontend/clusters/components/fluentd_output_settings_spec.js | 183 | ||||
| -rw-r--r-- | spec/frontend/clusters/services/mock_data.js | 1 | ||||
| -rw-r--r-- | spec/frontend/clusters/stores/clusters_store_spec.js | 18 | ||||
| -rw-r--r-- | spec/frontend/sidebar/assignees_spec.js | 4 | ||||
| -rw-r--r-- | spec/lib/gitlab/import_export/all_models.yml | 1 | ||||
| -rw-r--r-- | spec/models/project_spec.rb | 5 |
9 files changed, 6 insertions, 234 deletions
diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 1512504b93c..d828b1c1f0c 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -266,7 +266,7 @@ RSpec.describe 'Issue Sidebar' do let_it_be(:milestone3) { create(:milestone, project: project, title: 'Milestone-3', due_date: 10.days.from_now) } before do - page.within('.block.milestone > .title') do + page.within('[data-testid="milestone_title"]') do click_on 'Edit' end end diff --git a/spec/features/issues/user_edits_issue_spec.rb b/spec/features/issues/user_edits_issue_spec.rb index cb4a5a32762..c59cc99467c 100644 --- a/spec/features/issues/user_edits_issue_spec.rb +++ b/spec/features/issues/user_edits_issue_spec.rb @@ -187,7 +187,8 @@ RSpec.describe "Issues > User edits issue", :js do click_link 'Edit' click_link 'Unassigned' - first('.title').click + + close_dropdown_menu_if_visible expect(page).to have_content 'None - assign yourself' end @@ -227,7 +228,7 @@ RSpec.describe "Issues > User edits issue", :js do close_dropdown_menu_if_visible - page.within '.value .assign-yourself' do + page.within '[data-testid="no-value"]' do expect(page).to have_content "None" end end diff --git a/spec/frontend/clusters/components/applications_spec.js b/spec/frontend/clusters/components/applications_spec.js index e371ad998d2..511f5fc1d89 100644 --- a/spec/frontend/clusters/components/applications_spec.js +++ b/spec/frontend/clusters/components/applications_spec.js @@ -2,7 +2,6 @@ import { shallowMount, mount } from '@vue/test-utils'; import ApplicationRow from '~/clusters/components/application_row.vue'; import Applications from '~/clusters/components/applications.vue'; import CrossplaneProviderStack from '~/clusters/components/crossplane_provider_stack.vue'; -import FluentdOutputSettings from '~/clusters/components/fluentd_output_settings.vue'; import KnativeDomainEditor from '~/clusters/components/knative_domain_editor.vue'; import { CLUSTER_TYPE, PROVIDER_TYPE } from '~/clusters/constants'; import eventHub from '~/clusters/event_hub'; @@ -71,9 +70,6 @@ describe('Applications', () => { expect(wrapper.find('.js-cluster-application-row-elastic_stack').exists()).toBe(true); }); - it('renders a row for Fluentd', () => { - expect(wrapper.find('.js-cluster-application-row-fluentd').exists()).toBe(true); - }); it('renders a row for Cilium', () => { expect(wrapper.find('.js-cluster-application-row-cilium').exists()).toBe(true); }); @@ -116,10 +112,6 @@ describe('Applications', () => { expect(wrapper.find('.js-cluster-application-row-elastic_stack').exists()).toBe(true); }); - it('renders a row for Fluentd', () => { - expect(wrapper.find('.js-cluster-application-row-fluentd').exists()).toBe(true); - }); - it('renders a row for Cilium', () => { expect(wrapper.find('.js-cluster-application-row-cilium').exists()).toBe(true); }); @@ -162,10 +154,6 @@ describe('Applications', () => { expect(wrapper.find('.js-cluster-application-row-elastic_stack').exists()).toBe(true); }); - it('renders a row for Fluentd', () => { - expect(wrapper.find('.js-cluster-application-row-fluentd').exists()).toBe(true); - }); - it('renders a row for Cilium', () => { expect(wrapper.find('.js-cluster-application-row-cilium').exists()).toBe(true); }); @@ -220,7 +208,6 @@ describe('Applications', () => { jupyter: { title: 'JupyterHub', hostname: '' }, knative: { title: 'Knative', hostname: '' }, elastic_stack: { title: 'Elastic Stack' }, - fluentd: { title: 'Fluentd' }, cilium: { title: 'GitLab Container Network Policies' }, }, }); @@ -514,14 +501,6 @@ describe('Applications', () => { }); }); - describe('Fluentd application', () => { - beforeEach(() => createShallowComponent()); - - it('renders the correct Component', () => { - expect(wrapper.find(FluentdOutputSettings).exists()).toBe(true); - }); - }); - describe('Cilium application', () => { it('shows the correct description', () => { createComponent({ propsData: { ciliumHelpPath: 'cilium-help-path' } }); diff --git a/spec/frontend/clusters/components/fluentd_output_settings_spec.js b/spec/frontend/clusters/components/fluentd_output_settings_spec.js deleted file mode 100644 index fdb67a0426a..00000000000 --- a/spec/frontend/clusters/components/fluentd_output_settings_spec.js +++ /dev/null @@ -1,183 +0,0 @@ -import { GlAlert, GlDropdown, GlFormCheckbox } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import FluentdOutputSettings from '~/clusters/components/fluentd_output_settings.vue'; -import { APPLICATION_STATUS, FLUENTD } from '~/clusters/constants'; -import eventHub from '~/clusters/event_hub'; - -const { UPDATING } = APPLICATION_STATUS; - -describe('FluentdOutputSettings', () => { - let wrapper; - - const defaultSettings = { - protocol: 'tcp', - host: '127.0.0.1', - port: 514, - ciliumLogEnabled: false, - }; - const defaultProps = { - status: 'installable', - updateFailed: false, - ...defaultSettings, - }; - - const createComponent = (props = {}) => { - wrapper = shallowMount(FluentdOutputSettings, { - propsData: { - ...defaultProps, - ...props, - }, - }); - }; - const updateComponentPropsFromEvent = () => { - const { isEditingSettings, ...props } = eventHub.$emit.mock.calls[0][1]; - wrapper.setProps(props); - }; - const findSaveButton = () => wrapper.find({ ref: 'saveBtn' }); - const findCancelButton = () => wrapper.find({ ref: 'cancelBtn' }); - const findProtocolDropdown = () => wrapper.find(GlDropdown); - const findCheckbox = (name) => - wrapper.findAll(GlFormCheckbox).wrappers.find((x) => x.text() === name); - const findHost = () => wrapper.find('#fluentd-host'); - const findPort = () => wrapper.find('#fluentd-port'); - const changeCheckbox = (checkbox) => { - const currentValue = checkbox.attributes('checked')?.toString() === 'true'; - checkbox.vm.$emit('input', !currentValue); - }; - const changeInput = ({ element }, val) => { - element.value = val; - element.dispatchEvent(new Event('input')); - }; - const changePort = (val) => changeInput(findPort(), val); - const changeHost = (val) => changeInput(findHost(), val); - const changeProtocol = (idx) => findProtocolDropdown().vm.$children[idx].$emit('click'); - const toApplicationSettings = ({ ciliumLogEnabled, ...settings }) => ({ - ...settings, - cilium_log_enabled: ciliumLogEnabled, - }); - - describe('when fluentd is installed', () => { - beforeEach(() => { - createComponent({ status: 'installed' }); - jest.spyOn(eventHub, '$emit'); - }); - - it('does not render save and cancel buttons', () => { - expect(findSaveButton().exists()).toBe(false); - expect(findCancelButton().exists()).toBe(false); - }); - - describe.each` - desc | changeFn | key | value - ${'when protocol dropdown is triggered'} | ${() => changeProtocol(1)} | ${'protocol'} | ${'udp'} - ${'when host is changed'} | ${() => changeHost('test-host')} | ${'host'} | ${'test-host'} - ${'when port is changed'} | ${() => changePort(123)} | ${'port'} | ${123} - ${'when ciliumLogEnabled changes'} | ${() => changeCheckbox(findCheckbox('Send Container Network Policies Logs'))} | ${'ciliumLogEnabled'} | ${!defaultSettings.ciliumLogEnabled} - `('$desc', ({ changeFn, key, value }) => { - beforeEach(() => { - changeFn(); - }); - - it('triggers set event to be propagated with the current value', () => { - expect(eventHub.$emit).toHaveBeenCalledWith('setFluentdSettings', { - [key]: value, - isEditingSettings: true, - }); - }); - - describe('when value is updated from store', () => { - beforeEach(() => { - updateComponentPropsFromEvent(); - }); - - it('enables save and cancel buttons', () => { - expect(findSaveButton().exists()).toBe(true); - expect(findSaveButton().attributes().disabled).toBeUndefined(); - expect(findCancelButton().exists()).toBe(true); - expect(findCancelButton().attributes().disabled).toBeUndefined(); - }); - - describe('and the save changes button is clicked', () => { - beforeEach(() => { - eventHub.$emit.mockClear(); - findSaveButton().vm.$emit('click'); - }); - - it('triggers save event and pass current values', () => { - expect(eventHub.$emit).toHaveBeenCalledWith('updateApplication', { - id: FLUENTD, - params: toApplicationSettings({ - ...defaultSettings, - [key]: value, - }), - }); - }); - }); - - describe('and the cancel button is clicked', () => { - beforeEach(() => { - eventHub.$emit.mockClear(); - findCancelButton().vm.$emit('click'); - }); - - it('triggers reset event', () => { - expect(eventHub.$emit).toHaveBeenCalledWith('setFluentdSettings', { - ...defaultSettings, - isEditingSettings: false, - }); - }); - - describe('when value is updated from store', () => { - beforeEach(() => { - updateComponentPropsFromEvent(); - }); - - it('does not render save and cancel buttons', () => { - expect(findSaveButton().exists()).toBe(false); - expect(findCancelButton().exists()).toBe(false); - }); - }); - }); - }); - }); - - describe(`when fluentd status is ${UPDATING}`, () => { - beforeEach(() => { - createComponent({ installed: true, status: UPDATING }); - }); - - it('renders loading spinner in save button', () => { - expect(findSaveButton().props('loading')).toBe(true); - }); - - it('renders disabled save button', () => { - expect(findSaveButton().props('disabled')).toBe(true); - }); - - it('renders save button with "Saving" label', () => { - expect(findSaveButton().text()).toBe('Saving'); - }); - }); - - describe('when fluentd fails to update', () => { - beforeEach(() => { - createComponent({ updateFailed: true }); - }); - - it('displays a error message', () => { - expect(wrapper.find(GlAlert).exists()).toBe(true); - }); - }); - }); - - describe('when fluentd is not installed', () => { - beforeEach(() => { - createComponent(); - }); - - it('does not render the save button', () => { - expect(findSaveButton().exists()).toBe(false); - expect(findCancelButton().exists()).toBe(false); - }); - }); -}); diff --git a/spec/frontend/clusters/services/mock_data.js b/spec/frontend/clusters/services/mock_data.js index 6ab94d6d95b..a75fcb0cb06 100644 --- a/spec/frontend/clusters/services/mock_data.js +++ b/spec/frontend/clusters/services/mock_data.js @@ -161,7 +161,6 @@ const APPLICATIONS_MOCK_STATE = { jupyter: { title: 'JupyterHub', status: 'installable', hostname: '' }, knative: { title: 'Knative ', status: 'installable', hostname: '' }, elastic_stack: { title: 'Elastic Stack', status: 'installable' }, - fluentd: { title: 'Fluentd', status: 'installable' }, cilium: { title: 'GitLab Container Network Policies', status: 'not_installable', diff --git a/spec/frontend/clusters/stores/clusters_store_spec.js b/spec/frontend/clusters/stores/clusters_store_spec.js index 8fa373349b8..cdba6fc6ab8 100644 --- a/spec/frontend/clusters/stores/clusters_store_spec.js +++ b/spec/frontend/clusters/stores/clusters_store_spec.js @@ -122,24 +122,6 @@ describe('Clusters Store', () => { uninstallFailed: false, validationError: null, }, - fluentd: { - title: 'Fluentd', - status: null, - statusReason: null, - requestReason: null, - port: null, - ciliumLogEnabled: null, - host: null, - protocol: null, - installable: true, - installed: false, - isEditingSettings: false, - installFailed: false, - uninstallable: false, - uninstallSuccessful: false, - uninstallFailed: false, - validationError: null, - }, jupyter: { title: 'JupyterHub', status: mockResponseData.applications[4].status, diff --git a/spec/frontend/sidebar/assignees_spec.js b/spec/frontend/sidebar/assignees_spec.js index 74dce499999..be27a800418 100644 --- a/spec/frontend/sidebar/assignees_spec.js +++ b/spec/frontend/sidebar/assignees_spec.js @@ -19,7 +19,7 @@ describe('Assignee component', () => { }); }; - const findComponentTextNoUsers = () => wrapper.find('.assign-yourself'); + const findComponentTextNoUsers = () => wrapper.find('[data-testid="no-value"]'); const findCollapsedChildren = () => wrapper.findAll('.sidebar-collapsed-icon > *'); afterEach(() => { @@ -64,7 +64,7 @@ describe('Assignee component', () => { }); jest.spyOn(wrapper.vm, '$emit'); - wrapper.find('.assign-yourself .btn-link').trigger('click'); + wrapper.find('[data-testid="assign-yourself"]').trigger('click'); return wrapper.vm.$nextTick().then(() => { expect(wrapper.emitted('assign-self')).toBeTruthy(); diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml index b6d89bd13c4..8d27e61450b 100644 --- a/spec/lib/gitlab/import_export/all_models.yml +++ b/spec/lib/gitlab/import_export/all_models.yml @@ -345,7 +345,6 @@ project: - external_approval_rules - taggings - base_tags -- tags - topic_taggings - topics - chat_services diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index f70f4eafb6b..48353323fb2 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -6930,11 +6930,6 @@ RSpec.describe Project, factory_default: :keep do it 'tag_list returns correct string array' do expect(project.tag_list).to match_array(%w[topic1 topic2 topic3]) end - - it 'tags returns correct tag records' do - expect(project.tags.first.class.name).to eq('ActsAsTaggableOn::Tag') - expect(project.tags.map(&:name)).to match_array(%w[topic1 topic2 topic3]) - end end end |
