-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic notification reminder feature spec
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
spec/features/notifications/notification_center/notification_center_reminder_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
require "spec_helper" | ||
require "features/page_objects/notification" | ||
|
||
RSpec.describe "Notification center reminder, mention and date alert", | ||
:js, | ||
:with_cuprite, | ||
with_settings: { journal_aggregation_time_minutes: 0 } do | ||
shared_let(:project) { create(:project) } | ||
shared_let(:actor) { create(:user, firstname: "Actor", lastname: "User") } | ||
shared_let(:user) do | ||
create(:user, | ||
member_with_permissions: { project => %w[view_work_packages] }) | ||
end | ||
shared_let(:work_package) { create(:work_package, project:, due_date: 1.day.ago) } | ||
|
||
shared_let(:notification_mention) do | ||
create(:notification, | ||
reason: :mentioned, | ||
recipient: user, | ||
resource: work_package, | ||
actor:) | ||
end | ||
|
||
shared_let(:notification_date_alert) do | ||
create(:notification, | ||
reason: :date_alert_due_date, | ||
recipient: user, | ||
resource: work_package) | ||
end | ||
|
||
shared_let(:notification_reminder) do | ||
reminder = create(:reminder, remindable: work_package, creator: user, note: "This is an important reminder") | ||
notification = create(:notification, | ||
reason: :reminder, | ||
recipient: user, | ||
resource: work_package) | ||
create(:reminder_notification, reminder:, notification:) | ||
notification | ||
end | ||
|
||
let(:center) { Pages::Notifications::Center.new } | ||
|
||
before do | ||
login_as user | ||
visit notifications_center_path | ||
wait_for_reload | ||
end | ||
|
||
context "with reminders", with_ee: %i[date_alerts] do | ||
it "shows only the reminder alert time and note" do | ||
center.within_item(notification_reminder) do | ||
expect(page).to have_text("Date alert, Mentioned, Reminder") | ||
expect(page).to have_no_text("Actor user") | ||
expect(page).to have_text("a few seconds ago\nNote: “This is an important reminder”") | ||
end | ||
end | ||
end | ||
end |