blob: e33b2d9a75e7b3ad9128e96fb9d25d94b643c442 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# frozen_string_literal: true
require 'spec_helper'
describe 'Prometheus external alerts', :js do
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:alerts_section_selector) { '.js-prometheus-alerts' }
let(:alerts_section) { page.find(alerts_section_selector) }
before do
sign_in(user)
project.add_maintainer(user)
visit_edit_service
end
context 'with manual configuration' do
before do
create(:prometheus_service, project: project, api_url: 'http://prometheus.example.com', manual_configuration: '1', active: true)
end
it 'shows the Alerts section' do
visit_edit_service
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
wait_for_requests
expect(page).not_to have_css(alerts_section_selector)
end
end
private
def visit_edit_service
visit(project_settings_integrations_path(project))
click_link('Prometheus')
end
end
|