OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/spec/features/notifications/reminder_mail_spec.rb

66 lines
2.0 KiB

require 'spec_helper'
require_relative '../users/notifications/shared_examples'
describe "Reminder email", type: :feature, js: true do
shared_examples 'reminder settings' do
it 'allows to configure the reminder settings' do
# Configure the digest
reminders_settings_page.visit!
# By default a reminder timed for 8:00 should be configured
reminders_settings_page.expect_active_daily_times("08:00 am")
reminders_settings_page.add_time
# The next suggested time is taken: 12:00
reminders_settings_page.expect_active_daily_times("08:00 am", "12:00 pm")
reminders_settings_page.set_time "Time 2", "03:00 pm"
reminders_settings_page.expect_active_daily_times("08:00 am", "03:00 pm")
reminders_settings_page.save
reminders_settings_page.expect_and_dismiss_notification(message: I18n.t('js.notice_successful_update'))
reminders_settings_page.reload!
# Deactivate the second time but then remove the first one will activate the second (then only) one
# so that one time is always enabled.
reminders_settings_page.expect_active_daily_times("08:00 am", "03:00 pm")
reminders_settings_page.deactivate_time("Time 2")
reminders_settings_page.remove_time("Time 1")
reminders_settings_page.save
reminders_settings_page.expect_and_dismiss_notification(message: I18n.t('js.notice_successful_update'))
reminders_settings_page.reload!
reminders_settings_page.expect_active_daily_times("03:00 pm")
end
end
context 'with the my page' do
let(:reminders_settings_page) { Pages::My::Reminders.new(current_user) }
current_user do
FactoryBot.create :user
end
it_behaves_like 'reminder settings'
end
context 'with the user administration page' do
let(:reminders_settings_page) { Pages::Reminders::Settings.new(other_user) }
let(:other_user) { FactoryBot.create :user }
current_user do
FactoryBot.create :admin
end
it_behaves_like 'reminder settings'
end
end