diff options
Diffstat (limited to 'spec/features/alert_management/alert_management_list_spec.rb')
-rw-r--r-- | spec/features/alert_management/alert_management_list_spec.rb | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/features/alert_management/alert_management_list_spec.rb b/spec/features/alert_management/alert_management_list_spec.rb new file mode 100644 index 00000000000..c2514d80474 --- /dev/null +++ b/spec/features/alert_management/alert_management_list_spec.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Alert Management index', :js do + let_it_be(:project) { create(:project) } + let_it_be(:developer) { create(:user) } + let_it_be(:alert) { create(:alert_management_alert, project: project, status: 'triggered') } + + before_all do + project.add_developer(developer) + end + + before do + sign_in(developer) + + visit project_alert_management_index_path(project) + wait_for_requests + end + + context 'when a developer displays the alert list and the alert service is not enabled' do + it 'shows the alert page title' do + expect(page).to have_content('Alerts') + end + + it 'shows the empty state by default' do + expect(page).to have_content('Surface alerts in GitLab') + end + + it 'does not show the filtered search' do + page.within('.layout-page') do + expect(page).not_to have_css('[data-testid="search-icon"]') + end + end + + it 'does not show the alert table' do + expect(page).not_to have_selector('.gl-table') + end + end + + context 'when a developer displays the alert list and the alert service is enabled' do + let_it_be(:alerts_service) { create(:alerts_service, project: project) } + + it 'shows the alert page title' do + expect(page).to have_content('Alerts') + end + + it 'shows the filtered search' do + page.within('.layout-page') do + expect(page).to have_css('[data-testid="search-icon"]') + end + end + + it 'shows the alert table' do + expect(page).to have_selector('.gl-table') + end + end +end |