2020-04-22 19:07:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Prometheus external alerts', :js do
|
2020-05-24 23:13:21 +05:30
|
|
|
include_context 'project service activation'
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
let(:alerts_section_selector) { '.js-prometheus-alerts' }
|
|
|
|
let(:alerts_section) { page.find(alerts_section_selector) }
|
|
|
|
|
|
|
|
context 'with manual configuration' do
|
|
|
|
before do
|
2021-09-30 23:02:18 +05:30
|
|
|
create(:prometheus_integration, project: project, api_url: 'http://prometheus.example.com', manual_configuration: '1', active: true)
|
2020-04-22 19:07:51 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the Alerts section' do
|
2020-05-24 23:13:21 +05:30
|
|
|
visit_project_integration('Prometheus')
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
expect(alerts_section).to have_content('Alerts')
|
|
|
|
expect(alerts_section).to have_content('Receive alerts from manually configured Prometheus servers.')
|
|
|
|
expect(alerts_section).to have_content('URL')
|
|
|
|
expect(alerts_section).to have_content('Authorization key')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with no configuration' do
|
|
|
|
it 'does not show the Alerts section' do
|
2020-05-24 23:13:21 +05:30
|
|
|
visit_project_integration('Prometheus')
|
2020-04-22 19:07:51 +05:30
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect(page).not_to have_css(alerts_section_selector)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|