diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-13 06:09:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-13 06:09:09 +0000 |
commit | 8f71e69fdbb65d2cf95cf16ef5a0add0919edb45 (patch) | |
tree | 0c282e1224b9ff50ba272b698b92919b72973af9 /spec/features/alert_management_spec.rb | |
parent | f645d7e060e85cbf442b4e86009bc776688e4661 (diff) | |
download | gitlab-ce-8f71e69fdbb65d2cf95cf16ef5a0add0919edb45.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/alert_management_spec.rb')
-rw-r--r-- | spec/features/alert_management_spec.rb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/spec/features/alert_management_spec.rb b/spec/features/alert_management_spec.rb new file mode 100644 index 00000000000..2989f72e356 --- /dev/null +++ b/spec/features/alert_management_spec.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Alert management', :js do + let_it_be(:project) { create(:project) } + let_it_be(:developer) { create(:user) } + + before_all do + project.add_developer(developer) + end + + context 'when visiting the alert details page' do + let!(:alert) { create(:alert_management_alert, :resolved, :with_fingerprint, title: 'dos-test', project: project, **options) } + let(:options) { {} } + + before do + sign_in(user) + end + + context 'when actor has permission to see the alert' do + let(:user) { developer } + + it 'shows the alert details' do + visit(details_project_alert_management_path(project, alert)) + + within('.alert-management-details-table') do + expect(page).to have_content(alert.title) + end + end + + context 'when alert belongs to an environment' do + let(:options) { { environment: environment } } + let!(:environment) { create(:environment, name: 'production', project: project) } + + it 'shows the environment name' do + visit(details_project_alert_management_path(project, alert)) + + expect(page).to have_link(environment.name, href: project_environment_path(project, environment)) + within('.alert-management-details-table') do + expect(page).to have_content(environment.name) + end + end + + context 'when expose_environment_path_in_alert_details feature flag is disabled' do + before do + stub_feature_flags(expose_environment_path_in_alert_details: false) + end + + it 'does not show the environment name' do + visit(details_project_alert_management_path(project, alert)) + + within('.alert-management-details-table') do + expect(page).to have_content(alert.title) + expect(page).not_to have_content(environment.name) + end + end + end + end + end + end +end |