debian-mirror-gitlab/spec/features/admin/admin_broadcast_messages_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

99 lines
3.7 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Admin Broadcast Messages' do
2017-08-17 22:00:37 +05:30
before do
2021-02-22 17:27:13 +05:30
admin = create(:admin)
sign_in(admin)
2022-11-25 23:54:43 +05:30
stub_feature_flags(vue_broadcast_messages: false)
2021-02-22 17:27:13 +05:30
gitlab_enable_admin_mode_sign_in(admin)
2022-05-07 20:08:51 +05:30
create(
:broadcast_message,
:expired,
message: 'Migration to new server',
target_access_levels: [Gitlab::Access::DEVELOPER]
)
2017-08-17 22:00:37 +05:30
visit admin_broadcast_messages_path
end
2021-02-22 17:27:13 +05:30
it 'see broadcast messages list' do
2017-08-17 22:00:37 +05:30
expect(page).to have_content 'Migration to new server'
end
2020-03-13 15:44:24 +05:30
it 'creates a customized broadcast banner message' do
2017-08-17 22:00:37 +05:30
fill_in 'broadcast_message_message', with: 'Application update from **4:00 CST to 5:00 CST**'
2020-01-01 13:55:28 +05:30
fill_in 'broadcast_message_target_path', with: '*/user_onboarded'
2022-06-21 17:19:12 +05:30
select 'light-indigo', from: 'broadcast_message_theme'
2017-08-17 22:00:37 +05:30
select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i'
2022-05-07 20:08:51 +05:30
check 'Guest'
check 'Owner'
2017-08-17 22:00:37 +05:30
click_button 'Add broadcast message'
2022-05-07 20:08:51 +05:30
expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
2017-08-17 22:00:37 +05:30
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
2022-05-07 20:08:51 +05:30
expect(page).to have_content 'Guest, Owner'
2020-01-01 13:55:28 +05:30
expect(page).to have_content '*/user_onboarded'
2017-08-17 22:00:37 +05:30
expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST'
2022-06-21 17:19:12 +05:30
expect(page).to have_selector %(.light-indigo[role=alert])
2017-08-17 22:00:37 +05:30
end
2020-03-13 15:44:24 +05:30
it 'creates a customized broadcast notification message' do
fill_in 'broadcast_message_message', with: 'Application update from **4:00 CST to 5:00 CST**'
fill_in 'broadcast_message_target_path', with: '*/user_onboarded'
select 'Notification', from: 'broadcast_message_broadcast_type'
select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i'
2022-05-07 20:08:51 +05:30
check 'Reporter'
check 'Developer'
check 'Maintainer'
2020-03-13 15:44:24 +05:30
click_button 'Add broadcast message'
2022-05-07 20:08:51 +05:30
expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
2020-03-13 15:44:24 +05:30
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
2022-05-07 20:08:51 +05:30
expect(page).to have_content 'Reporter, Developer, Maintainer'
2020-03-13 15:44:24 +05:30
expect(page).to have_content '*/user_onboarded'
expect(page).to have_content 'Notification'
expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST'
end
2021-02-22 17:27:13 +05:30
it 'edit an existing broadcast message' do
2017-08-17 22:00:37 +05:30
click_link 'Edit'
fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW'
2022-05-07 20:08:51 +05:30
check 'Reporter'
2017-08-17 22:00:37 +05:30
click_button 'Update broadcast message'
2022-05-07 20:08:51 +05:30
expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
2017-08-17 22:00:37 +05:30
expect(page).to have_content 'Application update RIGHT NOW'
2022-05-07 20:08:51 +05:30
page.within('.table-responsive') do
expect(page).to have_content 'Reporter, Developer'
end
2017-08-17 22:00:37 +05:30
end
2021-02-22 17:27:13 +05:30
it 'remove an existing broadcast message' do
2017-08-17 22:00:37 +05:30
click_link 'Remove'
2022-05-07 20:08:51 +05:30
expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
2017-08-17 22:00:37 +05:30
expect(page).not_to have_content 'Migration to new server'
end
2020-03-13 15:44:24 +05:30
it 'updates a preview of a customized broadcast banner message', :js do
fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:"
page.within('.js-broadcast-banner-message-preview') do
expect(page).to have_selector('strong', text: 'Markdown')
expect(page).to have_emoji('tada')
end
end
it 'updates a preview of a customized broadcast notification message', :js do
2017-08-17 22:00:37 +05:30
fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:"
2020-03-13 15:44:24 +05:30
select 'Notification', from: 'broadcast_message_broadcast_type'
2017-08-17 22:00:37 +05:30
2022-06-21 17:19:12 +05:30
page.within('#broadcast-message-preview') do
2017-08-17 22:00:37 +05:30
expect(page).to have_selector('strong', text: 'Markdown')
2018-05-09 12:01:36 +05:30
expect(page).to have_emoji('tada')
2017-08-17 22:00:37 +05:30
end
end
end