summaryrefslogtreecommitdiff
path: root/spec/features/callouts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/features/callouts
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
downloadgitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/features/callouts')
-rw-r--r--spec/features/callouts/service_templates_deprecation_spec.rb59
1 files changed, 59 insertions, 0 deletions
diff --git a/spec/features/callouts/service_templates_deprecation_spec.rb b/spec/features/callouts/service_templates_deprecation_spec.rb
new file mode 100644
index 00000000000..b6403b54e29
--- /dev/null
+++ b/spec/features/callouts/service_templates_deprecation_spec.rb
@@ -0,0 +1,59 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Service templates deprecation callout' do
+ let_it_be(:admin) { create(:admin) }
+ let_it_be(:non_admin) { create(:user) }
+ let_it_be(:callout_content) { 'Service templates are deprecated and will be removed in GitLab 14.0.' }
+
+ context 'when a non-admin is logged in' do
+ before do
+ sign_in(non_admin)
+ visit root_dashboard_path
+ end
+
+ it 'does not display callout' do
+ expect(page).not_to have_content callout_content
+ end
+ end
+
+ context 'when an admin is logged in' do
+ before do
+ sign_in(admin)
+ gitlab_enable_admin_mode_sign_in(admin)
+
+ visit root_dashboard_path
+ end
+
+ context 'with no active service templates' do
+ it 'does not display callout' do
+ expect(page).not_to have_content callout_content
+ end
+ end
+
+ context 'with active service template' do
+ before do
+ create(:service, :template, type: 'MattermostService', active: true)
+ visit root_dashboard_path
+ end
+
+ it 'displays callout' do
+ expect(page).to have_content callout_content
+ expect(page).to have_link 'See affected service templates', href: admin_application_settings_services_path
+ end
+
+ context 'when callout is dismissed', :js do
+ before do
+ find('[data-testid="close-service-templates-deprecated-callout"]').click
+
+ visit root_dashboard_path
+ end
+
+ it 'does not display callout' do
+ expect(page).not_to have_content callout_content
+ end
+ end
+ end
+ end
+end