summaryrefslogtreecommitdiff
path: root/spec/features/projects/services/user_activates_alerts_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/services/user_activates_alerts_spec.rb')
-rw-r--r--spec/features/projects/services/user_activates_alerts_spec.rb51
1 files changed, 22 insertions, 29 deletions
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