2018-04-06 08:40:33 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-04-09 13:26:29 -04:00
|
|
|
describe 'Projects > Show > User manages notifications', :js do
|
2018-04-06 08:40:33 -04:00
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
|
2018-04-09 13:26:29 -04:00
|
|
|
before do
|
|
|
|
sign_in(project.owner)
|
|
|
|
visit project_path(project)
|
|
|
|
end
|
2018-04-06 08:40:33 -04:00
|
|
|
|
2018-12-07 09:11:42 -05:00
|
|
|
def click_notifications_button
|
2018-04-09 13:26:29 -04:00
|
|
|
first('.notifications-btn').click
|
2018-12-07 09:11:42 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'changes the notification setting' do
|
|
|
|
click_notifications_button
|
2018-04-09 13:26:29 -04:00
|
|
|
click_link 'On mention'
|
2018-04-06 08:40:33 -04:00
|
|
|
|
2018-12-07 09:11:42 -05:00
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
click_notifications_button
|
|
|
|
expect(find('.update-notification.is-active')).to have_content('On mention')
|
2018-04-06 08:40:33 -04:00
|
|
|
end
|
2018-07-10 10:29:27 -04:00
|
|
|
|
|
|
|
context 'custom notification settings' do
|
|
|
|
let(:email_events) do
|
|
|
|
[
|
|
|
|
:new_note,
|
|
|
|
:new_issue,
|
|
|
|
:reopen_issue,
|
|
|
|
:close_issue,
|
|
|
|
:reassign_issue,
|
|
|
|
:issue_due,
|
|
|
|
:new_merge_request,
|
|
|
|
:push_to_merge_request,
|
|
|
|
:reopen_merge_request,
|
|
|
|
:close_merge_request,
|
|
|
|
:reassign_merge_request,
|
|
|
|
:merge_merge_request,
|
|
|
|
:failed_pipeline,
|
|
|
|
:success_pipeline
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows notification settings checkbox' do
|
2018-12-07 09:11:42 -05:00
|
|
|
click_notifications_button
|
2018-07-10 10:29:27 -04:00
|
|
|
page.find('a[data-notification-level="custom"]').click
|
|
|
|
|
|
|
|
page.within('.custom-notifications-form') do
|
|
|
|
email_events.each do |event_name|
|
|
|
|
expect(page).to have_selector("input[name='notification_setting[#{event_name}]']")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-04-06 08:40:33 -04:00
|
|
|
end
|