1
0

log_out_spec.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Log out' do
  4. include ProfileStories
  5. before do
  6. as_a_logged_in_user
  7. end
  8. describe 'Logging out from the preferences' do
  9. it 'logs the user out' do
  10. visit settings_path
  11. within '.sidebar' do
  12. click_on 'Logout'
  13. end
  14. expect(page).to have_title(I18n.t('auth.login'))
  15. expect(page).to have_current_path('/auth/sign_in')
  16. end
  17. end
  18. describe 'Logging out from the JS app', :js, :streaming do
  19. it 'logs the user out' do
  20. # The frontend tries to load announcements after a short delay, but the session might be expired by then, and the browser will output an error.
  21. ignore_js_error(/Failed to load resource: the server responded with a status of 422/)
  22. visit root_path
  23. within '.navigation-bar' do
  24. click_on 'Menu'
  25. end
  26. within '.dropdown-menu' do
  27. click_on 'Logout'
  28. end
  29. click_on 'Log out'
  30. expect(page).to have_title(I18n.t('auth.login'))
  31. expect(page).to have_current_path('/auth/sign_in')
  32. end
  33. end
  34. end