kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
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.
61 lines
1.7 KiB
61 lines
1.7 KiB
3 years ago
|
require 'spec_helper'
|
||
|
require 'support/components/notifications/center'
|
||
|
|
||
3 years ago
|
describe "Notification center", type: :feature, js: true do
|
||
3 years ago
|
shared_let(:project) { FactoryBot.create :project }
|
||
|
shared_let(:work_package) { FactoryBot.create :work_package, project: project }
|
||
|
shared_let(:recipient) do
|
||
|
FactoryBot.create :user,
|
||
|
member_in_project: project,
|
||
|
member_with_permissions: %i[view_work_packages]
|
||
|
end
|
||
|
shared_let(:notification) do
|
||
|
FactoryBot.create :notification,
|
||
|
recipient: recipient,
|
||
|
project: project,
|
||
|
resource: work_package,
|
||
|
journal: work_package.journals.last
|
||
|
end
|
||
|
|
||
|
let(:center) { ::Components::Notifications::Center.new }
|
||
|
|
||
|
describe 'basic use case' do
|
||
|
current_user { recipient }
|
||
|
|
||
|
it 'can see the notification and dismiss it' do
|
||
|
visit home_path
|
||
|
center.expect_bell_count 1
|
||
|
center.open
|
||
|
|
||
|
center.expect_work_package_item notification
|
||
|
center.mark_all_read
|
||
|
center.expect_closed
|
||
|
|
||
|
center.expect_bell_count 0
|
||
|
notification.reload
|
||
|
expect(notification.read_ian).to be_truthy
|
||
|
end
|
||
3 years ago
|
|
||
|
it 'can expand the notification to mark it as read' do
|
||
|
visit home_path
|
||
|
center.expect_bell_count 1
|
||
|
center.open
|
||
|
|
||
|
center.click_item notification
|
||
|
center.expect_expanded notification
|
||
|
center.expect_read_item notification
|
||
|
|
||
|
retry_block do
|
||
|
notification.reload
|
||
|
raise "Expected notification to be marked read" unless notification.read_ian
|
||
|
end
|
||
|
|
||
|
center.close
|
||
|
center.expect_bell_count 0
|
||
|
|
||
|
center.open
|
||
|
center.expect_empty
|
||
|
end
|
||
3 years ago
|
end
|
||
|
end
|