Configuration
Webpacker application using Rails 5.1
with Vue.js 2.5
I've been trying to diagnose this bug for 3 days now and I am at my wits end. I've started to add system tests using Capybara
using standard selenium-webdriver
.
Problems occur when I am trying to access authenticatable routes, for example, user settings:
RSpec.describe 'home page', type: :system do
before(:context) do
WebMock.disable_net_connect!(allow_localhost: true)
end
after do
Warden.test_reset!
end
context 'when logged in' do
context 'as an average user' do
before do
@profile = create(:profile)
@user = @profile.user
@user.update(confirmed_at: Time.now)
login_as(@user, scope: :user)
end
it 'redirects to Account Settings page after pressing Account Settings' do
visit '/'
find('.profile-menu').hover
find('.settings').click
expect(page).to have_content 'Account Settings'
end
end
end
end
this is not a link and is handled in my .vue
file, which just redirects to the route I need location.href = "/users/edit";
When I am on the root page, I am signed in, current_user
returns the user and all is great. But as soon as I press that link, at some point it gets reset as I get redirected to the standard Devise
Login page.
If I directly go to that page visit '/users/edit
, but current_user
is set and its all fine.
This is my test devise setup:
require 'devise'
RSpec.configure do |config|
config.include Warden::Test::Helpers
end
Let me know if you need some extra information, I think I've provided all the crucial bits but could have missed something.