Commit c3e67884 authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch 'qa/group_instance_integration_settings_2' into 'master'

Refactor Project integration settings spec to use shared examples

See merge request gitlab-org/gitlab!80298
parents 56fe6f88 a4f5e481
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Instance integrations', :js do
include_context 'instance integration activation'
it_behaves_like 'integration settings form' do
let(:integrations) { Integration.find_or_initialize_all_non_project_specific(Integration.for_instance) }
def navigate_to_integration(integration)
visit_instance_integration(integration.title)
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Group integrations', :js do
include_context 'group integration activation'
it_behaves_like 'integration settings form' do
let(:integrations) { Integration.find_or_initialize_all_non_project_specific(Integration.for_group(group)) }
def navigate_to_integration(integration)
visit_group_integration(integration.title)
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Project integrations', :js do
include_context 'project integration activation'
it_behaves_like 'integration settings form' do
let(:integrations) { project.find_or_initialize_integrations }
def navigate_to_integration(integration)
visit_project_integration(integration.title)
end
end
end
# frozen_string_literal: true # frozen_string_literal: true
require 'spec_helper' RSpec.shared_examples 'integration settings form' do
RSpec.describe 'Integrations settings form', :js do
include IntegrationsHelper include IntegrationsHelper
include_context 'project integration activation'
# Github integration is EE, so let's remove it here.
integration_names = Integration.available_integration_names - %w[github]
integrations = integration_names.map do |name|
Integration.integration_name_to_model(name).new
end
# Note: these specs don't validate channel fields # Note: these specs don't validate channel fields
# which are present on a few integrations # which are present on a few integrations
it 'displays all the integrations' do
aggregate_failures do
integrations.each do |integration| integrations.each do |integration|
it "shows on #{integration.title}" do navigate_to_integration(integration)
visit_project_integration(integration.title)
aggregate_failures do
page.within('form.integration-settings-form') do page.within('form.integration-settings-form') do
expect(page).to have_field('Active', type: 'checkbox', wait: 0), expect(page).to have_field('Active', type: 'checkbox', wait: 0),
"#{integration.title} active field not present" "#{integration.title} active field not present"
...@@ -43,6 +33,8 @@ RSpec.describe 'Integrations settings form', :js do ...@@ -43,6 +33,8 @@ RSpec.describe 'Integrations settings form', :js do
end end
end end
private
def normalize_title(title, integration) def normalize_title(title, integration)
return 'Merge request' if integration.is_a?(Integrations::Jira) && title == 'merge_request' return 'Merge request' if integration.is_a?(Integrations::Jira) && title == 'merge_request'
......
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