diff options
Diffstat (limited to 'spec/features/users/login_spec.rb')
-rw-r--r-- | spec/features/users/login_spec.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/spec/features/users/login_spec.rb b/spec/features/users/login_spec.rb index 7010059a7ff..6c38d5d8b24 100644 --- a/spec/features/users/login_spec.rb +++ b/spec/features/users/login_spec.rb @@ -97,6 +97,8 @@ RSpec.describe 'Login' do describe 'with an unconfirmed email address' do let!(:user) { create(:user, confirmed_at: nil) } let(:grace_period) { 2.days } + let(:alert_title) { 'Please confirm your email address' } + let(:alert_message) { "To continue, you need to select the link in the confirmation email we sent to verify your email address. If you didn't get our email, select Resend confirmation email" } before do stub_application_setting(send_user_confirmation_email: true) @@ -109,13 +111,14 @@ RSpec.describe 'Login' do gitlab_sign_in(user) - expect(page).not_to have_content(I18n.t('devise.failure.unconfirmed')) + expect(page).not_to have_content(alert_title) + expect(page).not_to have_content(alert_message) expect(page).not_to have_link('Resend confirmation email', href: new_user_confirmation_path) end end context 'when the confirmation grace period is expired' do - it 'prevents the user from logging in and renders a resend confirmation email link' do + it 'prevents the user from logging in and renders a resend confirmation email link', :js do travel_to((grace_period + 1.day).from_now) do expect(authentication_metrics) .to increment(:user_unauthenticated_counter) @@ -123,7 +126,8 @@ RSpec.describe 'Login' do gitlab_sign_in(user) - expect(page).to have_content(I18n.t('devise.failure.unconfirmed')) + expect(page).to have_content(alert_title) + expect(page).to have_content(alert_message) expect(page).to have_link('Resend confirmation email', href: new_user_confirmation_path) end end @@ -889,6 +893,8 @@ RSpec.describe 'Login' do context 'when sending confirmation email and not yet confirmed' do let!(:user) { create(:user, confirmed_at: nil) } let(:grace_period) { 2.days } + let(:alert_title) { 'Please confirm your email address' } + let(:alert_message) { "To continue, you need to select the link in the confirmation email we sent to verify your email address. If you didn't get our email, select Resend confirmation email" } before do stub_application_setting(send_user_confirmation_email: true) @@ -906,7 +912,7 @@ RSpec.describe 'Login' do end context "when not having confirmed within Devise's allow_unconfirmed_access_for time" do - it 'does not allow login and shows a flash alert to confirm the email address' do + it 'does not allow login and shows a flash alert to confirm the email address', :js do travel_to((grace_period + 1.day).from_now) do expect(authentication_metrics) .to increment(:user_unauthenticated_counter) @@ -915,7 +921,9 @@ RSpec.describe 'Login' do gitlab_sign_in(user) expect(current_path).to eq new_user_session_path - expect(page).to have_content(I18n.t('devise.failure.unconfirmed')) + expect(page).to have_content(alert_title) + expect(page).to have_content(alert_message) + expect(page).to have_link('Resend confirmation email', href: new_user_confirmation_path) end end end |