Sha256: 7cacc43d1ec2c9027a5eaa86fd9db9069497785ceb27c93ae6868644a0d69ff8

Contents?: true

Size: 1.53 KB

Versions: 13

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'

feature 'Notifications Flow', organization_workspace: :test do
  let!(:chapter) { create(:chapter) }
  let(:organization) { Organization.current }
  let(:user) { create(:user) }

  before { reindex_current_organization! }
  before { set_current_user!(user) }

  def notifications_bell
    find '.badge-notifications'
  end

  def find_notification_number(number)
    find('#notificationsDropdown').click
    find "#notificationsPanel li:nth-child(#{number}) a"
  end

  context 'user with notifications' do
    let(:exam_registration) { create(:exam_registration, description: 'Mid term exam 2020') }
    let(:exam_authorization_request) { create(:exam_authorization_request, exam_registration: exam_registration, user: user) }

    let!(:notifications) do
      [exam_registration, exam_authorization_request].map { |target| create(:notification, user: user, target: target ) }
    end

    before { visit '/' }

    scenario 'displays count on navigation bar' do
      expect(notifications_bell).to have_text('2')
    end

    scenario 'navigates to target on notification click' do
      find_notification_number(2).click
      expect(page).to have_text 'Registration to Mid term exam 2020'
      expect(page).to have_text 'Choose date and time to attend to the exam'
    end

    scenario 'removes notification after target is processed' do
      # Notification for exam authorization request is considered read after user click
      find_notification_number(1).click
      expect(notifications_bell).to have_text('1')
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mumuki-laboratory-9.1.3 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.1.2 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.1.1 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.1.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.0.6 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.0.5 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.0.4 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.0.3 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.0.2 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.0.1 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.0.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-8.6.1 spec/features/notifications_flow_spec.rb
mumuki-laboratory-8.6.0 spec/features/notifications_flow_spec.rb