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

54 lines
1.8 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'
2018-11-08 19:23:39 +05:30
describe 'Admin Broadcast Messages' do
2017-08-17 22:00:37 +05:30
before do
2017-09-10 17:25:29 +05:30
sign_in(create(:admin))
2017-08-17 22:00:37 +05:30
create(:broadcast_message, :expired, message: 'Migration to new server')
visit admin_broadcast_messages_path
end
2018-11-08 19:23:39 +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
2018-11-08 19:23:39 +05:30
it 'Create a customized broadcast 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**'
fill_in 'broadcast_message_color', with: '#f2dede'
fill_in 'broadcast_message_font', with: '#b94a48'
select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i'
click_button 'Add broadcast message'
expect(current_path).to eq admin_broadcast_messages_path
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST'
expect(page).to have_selector %(div[style="background-color: #f2dede; color: #b94a48"])
end
2018-11-08 19:23:39 +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'
click_button 'Update broadcast message'
expect(current_path).to eq admin_broadcast_messages_path
expect(page).to have_content 'Application update RIGHT NOW'
end
2018-11-08 19:23:39 +05:30
it 'Remove an existing broadcast message' do
2017-08-17 22:00:37 +05:30
click_link 'Remove'
expect(current_path).to eq admin_broadcast_messages_path
expect(page).not_to have_content 'Migration to new server'
end
2018-11-08 19:23:39 +05:30
it 'Live preview a customized broadcast message', :js do
2017-08-17 22:00:37 +05:30
fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:"
page.within('.broadcast-message-preview') do
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