1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Admin Broadcast Messages' do
before do
admin = create(:admin)
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
create(
:broadcast_message,
:expired,
message: 'Migration to new server',
target_access_levels: [Gitlab::Access::DEVELOPER]
)
visit admin_broadcast_messages_path
end
it 'see broadcast messages list' do
expect(page).to have_content 'Migration to new server'
end
it 'creates a customized broadcast banner 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 'light-indigo', from: 'broadcast_message_theme'
select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i'
check 'Guest'
check 'Owner'
click_button 'Add broadcast message'
expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_content 'Guest, Owner'
expect(page).to have_content '*/user_onboarded'
expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST'
expect(page).to have_selector %(.light-indigo[role=alert])
end
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'
check 'Reporter'
check 'Developer'
check 'Maintainer'
click_button 'Add broadcast message'
expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_content 'Reporter, Developer, Maintainer'
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
it 'edit an existing broadcast message' do
click_link 'Edit'
fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW'
check 'Reporter'
click_button 'Update broadcast message'
expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
expect(page).to have_content 'Application update RIGHT NOW'
page.within('.table-responsive') do
expect(page).to have_content 'Reporter, Developer'
end
end
it 'remove an existing broadcast message' do
click_link 'Remove'
expect(page).to have_current_path admin_broadcast_messages_path, ignore_query: true
expect(page).not_to have_content 'Migration to new server'
end
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
fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:"
select 'Notification', from: 'broadcast_message_broadcast_type'
page.within('#broadcast-message-preview') do
expect(page).to have_selector('strong', text: 'Markdown')
expect(page).to have_emoji('tada')
end
end
end
|