diff options
Diffstat (limited to 'spec/features/projects/services')
6 files changed, 44 insertions, 57 deletions
diff --git a/spec/features/projects/services/disable_triggers_spec.rb b/spec/features/projects/services/disable_triggers_spec.rb index 8f87d0e7ff1..b3a3d7f0622 100644 --- a/spec/features/projects/services/disable_triggers_spec.rb +++ b/spec/features/projects/services/disable_triggers_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe 'Disable individual triggers', :js do include_context 'project service activation' - let(:checkbox_selector) { 'input[type=checkbox][name$="_events]"]' } + let(:checkbox_selector) { 'input[name$="_events]"]' } before do visit_project_integration(service_name) @@ -18,7 +18,7 @@ RSpec.describe 'Disable individual triggers', :js do event_count = HipchatService.supported_events.count expect(page).to have_content "Trigger" - expect(page).to have_css(checkbox_selector, count: event_count) + expect(page).to have_css(checkbox_selector, visible: :all, count: event_count) end end @@ -27,7 +27,7 @@ RSpec.describe 'Disable individual triggers', :js do it "doesn't show unnecessary Trigger checkboxes" do expect(page).not_to have_content "Trigger" - expect(page).not_to have_css(checkbox_selector) + expect(page).not_to have_css(checkbox_selector, visible: :all) end end end diff --git a/spec/features/projects/services/user_activates_alerts_spec.rb b/spec/features/projects/services/user_activates_alerts_spec.rb index 95642f49d61..8b0acdf3618 100644 --- a/spec/features/projects/services/user_activates_alerts_spec.rb +++ b/spec/features/projects/services/user_activates_alerts_spec.rb @@ -15,35 +15,32 @@ RSpec.describe 'User activates Alerts', :js do end context 'when service is deactivated' do - it 'activates service' do + it 'user cannot activate service' do visit_project_services expect(page).to have_link(service_title) click_link(service_title) + expect(page).to have_callout_message expect(page).not_to have_active_service - - click_activate_service - wait_for_requests - - expect(page).to have_active_service + expect(page).to have_toggle_active_disabled end end context 'when service is activated' do + let_it_be(:activated_alerts_service) do + create(:alerts_service, :active, project: project) + end + before do visit_alerts_service - click_activate_service end - it 're-generates key' do - expect(reset_key.value).to be_blank - - click_reset_key - click_confirm_reset_key - wait_for_requests - - expect(reset_key.value).to be_present + it 'user cannot change settings' do + expect(page).to have_callout_message + expect(page).to have_active_service + expect(page).to have_toggle_active_disabled + expect(page).to have_button_reset_key_disabled end end @@ -57,25 +54,21 @@ RSpec.describe 'User activates Alerts', :js do visit(edit_project_service_path(project, service_name)) end - def click_activate_service - find('#activated').click - end - - def click_reset_key - click_button('Reset key') + def have_callout_message + within('.gl-alert') do + have_content('You can now manage alert endpoint configuration in the Alerts section on the Operations settings page.') + end end - def click_confirm_reset_key - within '.modal-content' do - click_reset_key - end + def have_active_service + have_selector('.js-service-active-status[data-value="true"]') end - def reset_key - find_field('Authorization key') + def have_toggle_active_disabled + have_selector('#activated .project-feature-toggle.is-disabled') end - def have_active_service - have_selector('.js-service-active-status[data-value="true"]') + def have_button_reset_key_disabled + have_button('Reset key', disabled: true) end end diff --git a/spec/features/projects/services/user_activates_issue_tracker_spec.rb b/spec/features/projects/services/user_activates_issue_tracker_spec.rb index a2a2604c610..4f25794d058 100644 --- a/spec/features/projects/services/user_activates_issue_tracker_spec.rb +++ b/spec/features/projects/services/user_activates_issue_tracker_spec.rb @@ -30,7 +30,7 @@ RSpec.describe 'User activates issue tracker', :js do it 'activates the service' do expect(page).to have_content("#{tracker} activated.") - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, tracker.parameterize(separator: '_'))) end it 'shows the link in the menu' do @@ -50,7 +50,7 @@ RSpec.describe 'User activates issue tracker', :js do click_test_then_save_integration expect(page).to have_content("#{tracker} activated.") - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, tracker.parameterize(separator: '_'))) end end end @@ -65,7 +65,7 @@ RSpec.describe 'User activates issue tracker', :js do it 'saves but does not activate the service' do expect(page).to have_content("#{tracker} settings saved, but not activated.") - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, tracker.parameterize(separator: '_'))) end it 'does not show the external tracker link in the menu' do diff --git a/spec/features/projects/services/user_activates_jira_spec.rb b/spec/features/projects/services/user_activates_jira_spec.rb index 1da8a49699b..483671c4b5b 100644 --- a/spec/features/projects/services/user_activates_jira_spec.rb +++ b/spec/features/projects/services/user_activates_jira_spec.rb @@ -4,18 +4,7 @@ require 'spec_helper' RSpec.describe 'User activates Jira', :js do include_context 'project service activation' - - let(:url) { 'http://jira.example.com' } - let(:test_url) { 'http://jira.example.com/rest/api/2/serverInfo' } - - def fill_form(disable: false) - click_active_toggle if disable - - fill_in 'service_url', with: url - fill_in 'service_username', with: 'username' - fill_in 'service_password', with: 'password' - fill_in 'service_jira_issue_transition_id', with: '25' - end + include_context 'project service Jira context' describe 'user sets and activates Jira Service' do context 'when Jira connection test succeeds' do @@ -30,12 +19,17 @@ RSpec.describe 'User activates Jira', :js do it 'activates the Jira service' do expect(page).to have_content('Jira activated.') - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, :jira)) end - it 'shows the Jira link in the menu' do - page.within('.nav-sidebar') do - expect(page).to have_link('Jira', href: url) + unless Gitlab.ee? + it 'adds Jira link to sidebar menu' do + page.within('.nav-sidebar') do + expect(page).not_to have_link('Jira Issues') + expect(page).not_to have_link('Issue List', visible: false) + expect(page).not_to have_link('Open Jira', href: url, visible: false) + expect(page).to have_link('Jira', href: url) + end end end end @@ -61,7 +55,7 @@ RSpec.describe 'User activates Jira', :js do click_test_then_save_integration expect(page).to have_content('Jira activated.') - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, :jira)) end end end @@ -75,7 +69,7 @@ RSpec.describe 'User activates Jira', :js do it 'saves but does not activate the Jira service' do expect(page).to have_content('Jira settings saved, but not activated.') - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, :jira)) end it 'does not show the Jira link in the menu' do diff --git a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb index a6b4aaccfb5..6ddffb710a8 100644 --- a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb +++ b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb @@ -31,7 +31,7 @@ RSpec.describe 'Set up Mattermost slash commands', :js do click_active_toggle click_on 'Save changes' - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, :mattermost_slash_commands)) expect(page).to have_content('Mattermost slash commands settings saved, but not activated.') end @@ -41,7 +41,7 @@ RSpec.describe 'Set up Mattermost slash commands', :js do fill_in 'service_token', with: token click_on 'Save changes' - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, :mattermost_slash_commands)) expect(page).to have_content('Mattermost slash commands activated.') end diff --git a/spec/features/projects/services/user_activates_slack_slash_command_spec.rb b/spec/features/projects/services/user_activates_slack_slash_command_spec.rb index 360e462b935..afe6855d6ad 100644 --- a/spec/features/projects/services/user_activates_slack_slash_command_spec.rb +++ b/spec/features/projects/services/user_activates_slack_slash_command_spec.rb @@ -24,7 +24,7 @@ RSpec.describe 'Slack slash commands', :js do click_active_toggle click_on 'Save' - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, :slack_slash_commands)) expect(page).to have_content('Slack slash commands settings saved, but not activated.') end @@ -32,7 +32,7 @@ RSpec.describe 'Slack slash commands', :js do fill_in 'Token', with: 'token' click_on 'Save' - expect(current_path).to eq(project_settings_integrations_path(project)) + expect(current_path).to eq(edit_project_service_path(project, :slack_slash_commands)) expect(page).to have_content('Slack slash commands activated.') end |