diff --git a/backend/spec/system/scenarios/login_flow_spec.rb b/backend/spec/system/scenarios/login_flow_spec.rb index c579887..6d60434 100644 --- a/backend/spec/system/scenarios/login_flow_spec.rb +++ b/backend/spec/system/scenarios/login_flow_spec.rb @@ -1,14 +1,12 @@ require 'rails_helper' RSpec.describe "login flow", type: :system do - include ActiveJob::TestHelper - before do driven_by(:headless_chrome) end let!(:user) { create(:user) } - it 'me -> login -> me' do + it 'me -> login -> me -> logout -> me -> login' do visit '/me' fill_in "email", with: user.email_address @@ -16,7 +14,11 @@ click_button "Login" expect(page).to have_content("hello, It's me!") - sleep 2 expect(page).to have_content(user.email_address) + accept_alert do + click_button "Logout" + end + expect(page).to have_content("Login") + expect(current_path).to eq("/login") end end