Commit 59353a45 authored by Tom Quirk's avatar Tom Quirk

Address reviewer feedback

- remove _form.haml_spec
- use testid for test selector
parent fa7dbdb8
......@@ -6,7 +6,7 @@
- if integration.operating?
= sprite_icon('check', css_class: 'gl-text-green-500')
= render 'shared/service_settings', integration: integration
= render 'shared/integration_settings', integration: integration
- if lookup_context.template_exists?('show', "projects/services/#{integration.to_param}", true)
%hr
= render "projects/services/#{integration.to_param}/show", integration: integration
= form_errors(integration)
.service-settings
%div{ data: { testid: "integration-settings-form" } }
- if @default_integration
.js-vue-default-integration-settings{ data: integration_form_data(@default_integration, group: @group, project: @project) }
.js-vue-integration-settings{ data: integration_form_data(integration, group: @group, project: @project) }
......
- integration = local_assigns.fetch(:integration)
= render 'shared/service_settings', integration: integration
......@@ -7,4 +7,4 @@
= @integration.title
= render 'shared/integrations/tabs', integration: @integration, active_tab: 'edit' do
= render 'shared/integrations/form', integration: @integration
= render 'shared/integration_settings', integration: @integration
......@@ -22,7 +22,7 @@ RSpec.describe 'Slack application' do
it 'I can edit slack integration' do
visit slack_application_form_path
within '.service-settings' do
within '[data-testid="integration-settings-form"]' do
click_link 'Edit'
end
......@@ -31,7 +31,7 @@ RSpec.describe 'Slack application' do
expect(page).to have_content('The project alias was updated successfully')
within '.service-settings' do
within '[data-testid="integration-settings-form"]' do
expect(page).to have_content('alias-edited')
end
end
......
......@@ -41,7 +41,7 @@ RSpec.describe 'User activates Jira', :js do
fill_in 'service_password', with: 'password'
click_test_integration
page.within('.service-settings') do
page.within('[data-testid="integration-settings-form"]') do
expect(page).to have_content('This field is required.')
end
end
......
......@@ -3,7 +3,7 @@ import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import * as Sentry from '@sentry/browser';
import { setHTMLFixture } from 'helpers/fixtures';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_helper';
import waitForPromises from 'helpers/wait_for_promises';
import ActiveCheckbox from '~/integrations/edit/components/active_checkbox.vue';
import ConfirmationModal from '~/integrations/edit/components/confirmation_modal.vue';
......@@ -42,6 +42,7 @@ describe('IntegrationForm', () => {
featureFlags = {},
initialState = {},
props = {},
mountFn = shallowMountExtended,
} = {}) => {
const store = createStore({
customState: { ...mockIntegrationProps, ...customStateProps },
......@@ -49,7 +50,7 @@ describe('IntegrationForm', () => {
});
dispatch = jest.spyOn(store, 'dispatch').mockImplementation();
wrapper = mountExtended(IntegrationForm, {
wrapper = mountFn(IntegrationForm, {
propsData: { ...props, formSelector: '.test' },
provide: {
glFeatures: featureFlags,
......@@ -218,6 +219,7 @@ describe('IntegrationForm', () => {
createComponent({
customStateProps: { type: 'jira', testPath: '/test' },
mountFn: mountExtended,
});
});
......@@ -378,6 +380,7 @@ describe('IntegrationForm', () => {
showActive: true,
initialActivated: false,
},
mountFn: mountExtended,
});
await findActiveCheckbox().vm.$emit('toggle-integration-active', formActive);
......@@ -399,6 +402,7 @@ describe('IntegrationForm', () => {
canTest: true,
initialActivated: true,
},
mountFn: mountExtended,
});
await findProjectSaveButton().vm.$emit('click', new Event('click'));
......@@ -428,6 +432,7 @@ describe('IntegrationForm', () => {
canTest: true,
initialActivated: integrationActive,
},
mountFn: mountExtended,
});
jest.spyOn(findGlForm().element, 'submit');
jest.spyOn(findGlForm().element, 'checkValidity').mockReturnValue(checkValidityReturn);
......@@ -449,6 +454,7 @@ describe('IntegrationForm', () => {
canTest: true,
initialActivated: true,
},
mountFn: mountExtended,
});
jest.spyOn(findGlForm().element, 'submit');
jest.spyOn(findGlForm().element, 'checkValidity').mockReturnValue(false);
......@@ -482,6 +488,7 @@ describe('IntegrationForm', () => {
showActive: true,
canTest: true,
},
mountFn: mountExtended,
});
jest.spyOn(findGlForm().element, 'checkValidity').mockReturnValue(false);
......@@ -501,6 +508,7 @@ describe('IntegrationForm', () => {
canTest: true,
testPath: mockTestPath,
},
mountFn: mountExtended,
});
jest.spyOn(findGlForm().element, 'checkValidity').mockReturnValue(true);
});
......
......@@ -46,6 +46,7 @@ RSpec.describe IntegrationsHelper do
:can_test,
:test_path,
:reset_path,
:form_path,
:redirect_to
]
end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'projects/services/_form' do
let(:project) { create(:redmine_project) }
let(:user) { create(:admin) }
before do
assign(:project, project)
allow(controller).to receive(:current_user).and_return(user)
allow(view).to receive_messages(
current_user: user,
can?: true,
current_application_settings: Gitlab::CurrentSettings.current_application_settings,
integration: project.redmine_integration,
request: double(referer: '/services')
)
end
context 'commit_events and merge_request_events' do
it 'display merge_request_events and commit_events descriptions' do
allow(Integrations::Redmine).to receive(:supported_events).and_return(%w(commit merge_request))
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment