Sha256: fb9a573d074364297ea8db807e4f1a946165ec4b4f10ba259112ed79854f26c9

Contents?: true

Size: 1.46 KB

Versions: 16

Compression:

Stored size: 1.46 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 'does not remove exam authorization notification after click it ' do
      find_notification_number(1).click
      expect(notifications_bell).to have_text('2')
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mumuki-laboratory-9.10.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.9.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.8.2 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.8.1 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.8.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.7.2 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.7.1 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.7.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.6.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.5.1 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.5.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.4.1 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.4.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.3.1 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.3.0 spec/features/notifications_flow_spec.rb
mumuki-laboratory-9.2.0 spec/features/notifications_flow_spec.rb