summaryrefslogtreecommitdiff
path: root/spec/features/admin
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-12 06:47:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-12 06:47:21 +0000
commitc20ce49bdab650656be01968381f6ee1a5f96e7c (patch)
tree808be3d86edf4e29a5f148aae6bb9817ea3ee9be /spec/features/admin
parent2dd1c1ab9db62a17d8f7ccaa29cec5a5f437d8de (diff)
downloadgitlab-ce-c20ce49bdab650656be01968381f6ee1a5f96e7c.tar.gz
Add latest changes from gitlab-org/gitlab@15-10-stable-ee
Diffstat (limited to 'spec/features/admin')
-rw-r--r--spec/features/admin/broadcast_messages_spec.rb73
1 files changed, 73 insertions, 0 deletions
diff --git a/spec/features/admin/broadcast_messages_spec.rb b/spec/features/admin/broadcast_messages_spec.rb
new file mode 100644
index 00000000000..fca4cdb0ff4
--- /dev/null
+++ b/spec/features/admin/broadcast_messages_spec.rb
@@ -0,0 +1,73 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Admin Broadcast Messages', :js, feature_category: :onboarding do
+ context 'when creating and editing' do
+ it 'previews, creates and edits a broadcast message' do
+ admin = create(:admin)
+ sign_in(admin)
+ gitlab_enable_admin_mode_sign_in(admin)
+
+ # create
+ visit admin_broadcast_messages_path
+
+ fill_in 'Message', with: 'test message'
+
+ wait_for_requests
+
+ page.within(preview_container) do
+ expect(page).to have_content('test message')
+ end
+
+ click_button 'Add broadcast message'
+
+ wait_for_requests
+
+ page.within(preview_container) do
+ expect(page).to have_content('Your message here')
+ end
+
+ page.within(first_message_container) do
+ expect(page).to have_content('test message')
+ end
+
+ # edit
+ page.within(first_message_container) do
+ find('[data-testid="edit-message"]').click
+ end
+
+ wait_for_requests
+
+ expect(find('[data-testid="message-input"]').value).to eq('test message')
+
+ fill_in 'Message', with: 'changed test message'
+
+ wait_for_requests
+
+ page.within(preview_container) do
+ expect(page).to have_content('changed test message')
+ end
+
+ click_button 'Update broadcast message'
+
+ wait_for_requests
+
+ page.within(preview_container) do
+ expect(page).to have_content('Your message here')
+ end
+
+ page.within(first_message_container) do
+ expect(page).to have_content('changed test message')
+ end
+ end
+
+ def preview_container
+ find('[data-testid="preview-broadcast-message"]')
+ end
+
+ def first_message_container
+ find('[data-testid="message-row"]', match: :first)
+ end
+ end
+end