diff options
Diffstat (limited to 'spec/features/users')
-rw-r--r-- | spec/features/users/login_spec.rb | 11 | ||||
-rw-r--r-- | spec/features/users/show_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/users/signup_spec.rb | 33 |
3 files changed, 31 insertions, 17 deletions
diff --git a/spec/features/users/login_spec.rb b/spec/features/users/login_spec.rb index 0f086af227c..87ed4ced684 100644 --- a/spec/features/users/login_spec.rb +++ b/spec/features/users/login_spec.rb @@ -578,7 +578,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions, feature_category: :system_ fill_in 'user_password', with: user.password click_button 'Sign in' - expect(page).to have_current_path(new_profile_password_path, ignore_query: true) + expect(page).to have_current_path(new_user_settings_password_path, ignore_query: true) end end end @@ -785,6 +785,13 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions, feature_category: :system_ ensure_no_tabs end + it 'renders logo', :js do + visit new_user_session_path + + image = find('img.js-portrait-logo-detection') + expect(image['class']).to include('gl-h-9') + end + it 'renders link to sign up path' do visit new_user_session_path @@ -1048,7 +1055,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions, feature_category: :system_ expect_to_be_on_terms_page click_button 'Accept terms' - expect(page).to have_current_path(new_profile_password_path, ignore_query: true) + expect(page).to have_current_path(new_user_settings_password_path, ignore_query: true) new_password = User.random_password diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb index 2821e8286a4..c56b261fe28 100644 --- a/spec/features/users/show_spec.rb +++ b/spec/features/users/show_spec.rb @@ -410,7 +410,7 @@ RSpec.describe 'User page', feature_category: :user_profile do subject - page.within '.navbar-gitlab' do + within_testid('navbar') do expect(page).to have_link('Sign in') expect(page).not_to have_link('Register') end @@ -423,7 +423,7 @@ RSpec.describe 'User page', feature_category: :user_profile do subject - page.within '.navbar-gitlab' do + within_testid('navbar') do expect(page).to have_link(_('Sign in'), exact: true) expect(page).to have_link(_('Register'), exact: true) end diff --git a/spec/features/users/signup_spec.rb b/spec/features/users/signup_spec.rb index d873c4846fd..bb08ed7d07d 100644 --- a/spec/features/users/signup_spec.rb +++ b/spec/features/users/signup_spec.rb @@ -62,17 +62,11 @@ RSpec.describe 'Signup', :js, feature_category: :user_management do let(:terms_text) do <<~TEXT.squish By clicking Register or registering through a third party you accept the - Terms of Use and acknowledge the Privacy Policy and Cookie Policy + Terms of Use and acknowledge the Privacy Statement and Cookie Policy TEXT end shared_examples 'signup process' do - def confirm_email - new_user_token = User.find_by_email(new_user.email).confirmation_token - - visit user_confirmation_path(confirmation_token: new_user_token) - end - before do stub_feature_flags(arkose_labs_signup_challenge: false) stub_application_setting(require_admin_approval_after_user_signup: false) @@ -220,7 +214,7 @@ RSpec.describe 'Signup', :js, feature_category: :user_management do expect(page).to have_current_path users_almost_there_path, ignore_query: true expect(page).to have_content("Please check your email (#{new_user.email}) to confirm your account") - confirm_email + confirm_email(new_user) expect(find_field('Username or primary email').value).to eq(new_user.email) end @@ -345,11 +339,24 @@ RSpec.describe 'Signup', :js, feature_category: :user_management do end context 'when invisible captcha detects malicious behaviour' do - it 'prevents from signing up' do - visit new_user_registration_path + context 'with form submitted quicker than timestamp_threshold', :freeze_time do + it 'prevents from signing up' do + visit new_user_registration_path - expect { fill_in_sign_up_form(new_user) }.not_to change { User.count } - expect(page).to have_content('That was a bit too quick! Please resubmit.') + expect { fill_in_sign_up_form(new_user) }.not_to change { User.count } + expect(page).to have_content('That was a bit too quick! Please resubmit.') + end + end + + context 'with honeypot field is filled' do + it 'prevents from signing up' do + visit new_user_registration_path + + find_field('If you are human, please ignore this field.', + visible: false).execute_script("this.value = 'bot'") + + expect { fill_in_sign_up_form(new_user) }.not_to change { User.count } + end end end end @@ -389,7 +396,7 @@ RSpec.describe 'Signup', :js, feature_category: :user_management do let(:terms_text) do <<~TEXT.squish By clicking Register, I agree that I have read and accepted the Terms of - Use and Privacy Policy + Use and Privacy Statement TEXT end |