2024-08-13 19:49:23 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 07:12:25 +02:00
|
|
|
RSpec.describe 'Log out' do
|
2024-08-13 19:49:23 +02:00
|
|
|
include ProfileStories
|
|
|
|
|
|
|
|
before do
|
|
|
|
as_a_logged_in_user
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'Logging out from the preferences' do
|
|
|
|
it 'logs the user out' do
|
|
|
|
visit settings_path
|
|
|
|
|
|
|
|
within '.sidebar' do
|
|
|
|
click_on 'Logout'
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_title(I18n.t('auth.login'))
|
|
|
|
expect(page).to have_current_path('/auth/sign_in')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'Logging out from the JS app', :js, :streaming do
|
|
|
|
it 'logs the user out' do
|
2024-08-15 08:44:13 +02:00
|
|
|
# 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.
|
|
|
|
ignore_js_error(/Failed to load resource: the server responded with a status of 422/)
|
|
|
|
|
2024-08-13 19:49:23 +02:00
|
|
|
visit root_path
|
|
|
|
|
|
|
|
within '.navigation-bar' do
|
|
|
|
click_on 'Menu'
|
|
|
|
end
|
|
|
|
|
|
|
|
within '.dropdown-menu' do
|
|
|
|
click_on 'Logout'
|
|
|
|
end
|
|
|
|
|
|
|
|
click_on 'Log out'
|
|
|
|
|
|
|
|
expect(page).to have_title(I18n.t('auth.login'))
|
|
|
|
expect(page).to have_current_path('/auth/sign_in')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|