diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/features/profiles | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/features/profiles')
-rw-r--r-- | spec/features/profiles/active_sessions_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/profiles/emails_spec.rb | 17 | ||||
-rw-r--r-- | spec/features/profiles/oauth_applications_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/profiles/personal_access_tokens_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/profiles/two_factor_auths_spec.rb | 25 | ||||
-rw-r--r-- | spec/features/profiles/user_manages_applications_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/profiles/user_manages_emails_spec.rb | 15 | ||||
-rw-r--r-- | spec/features/profiles/user_visits_profile_spec.rb | 8 |
8 files changed, 59 insertions, 13 deletions
diff --git a/spec/features/profiles/active_sessions_spec.rb b/spec/features/profiles/active_sessions_spec.rb index fd64704b7c8..a515c7b1c1f 100644 --- a/spec/features/profiles/active_sessions_spec.rb +++ b/spec/features/profiles/active_sessions_spec.rb @@ -11,6 +11,10 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state do let(:admin) { create(:admin) } + before do + stub_feature_flags(bootstrap_confirmation_modals: false) + end + it 'user sees their active sessions' do travel_to(Time.zone.parse('2018-03-12 09:06')) do Capybara::Session.new(:session1) diff --git a/spec/features/profiles/emails_spec.rb b/spec/features/profiles/emails_spec.rb index 6b6f628e2d5..8f05de60be9 100644 --- a/spec/features/profiles/emails_spec.rb +++ b/spec/features/profiles/emails_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe 'Profile > Emails' do let(:user) { create(:user) } + let(:other_user) { create(:user) } before do sign_in(user) @@ -23,15 +24,25 @@ RSpec.describe 'Profile > Emails' do expect(page).to have_content('Resend confirmation email') end - it 'does not add a duplicate email' do - fill_in('Email', with: user.email) + it 'does not add an email that is the primary email of another user' do + fill_in('Email', with: other_user.email) click_button('Add email address') - email = user.emails.find_by(email: user.email) + email = user.emails.find_by(email: other_user.email) expect(email).to be_nil expect(page).to have_content('Email has already been taken') end + it 'adds an email that is the primary email of the same user' do + fill_in('Email', with: user.email) + click_button('Add email address') + + email = user.emails.find_by(email: user.email) + expect(email).to be_present + expect(page).to have_content("#{user.email} Verified") + expect(page).not_to have_content("#{user.email} Unverified") + end + it 'does not add an invalid email' do fill_in('Email', with: 'test.@example.com') click_button('Add email address') diff --git a/spec/features/profiles/oauth_applications_spec.rb b/spec/features/profiles/oauth_applications_spec.rb index 2735f601307..6827dff5434 100644 --- a/spec/features/profiles/oauth_applications_spec.rb +++ b/spec/features/profiles/oauth_applications_spec.rb @@ -7,6 +7,7 @@ RSpec.describe 'Profile > Applications' do let(:application) { create(:oauth_application, owner: user) } before do + stub_feature_flags(bootstrap_confirmation_modals: false) sign_in(user) end diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index 8f44299b18f..74505633cae 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -34,6 +34,7 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do end before do + stub_feature_flags(bootstrap_confirmation_modals: false) sign_in(user) end diff --git a/spec/features/profiles/two_factor_auths_spec.rb b/spec/features/profiles/two_factor_auths_spec.rb index 3f5789e119a..a9256a73d7b 100644 --- a/spec/features/profiles/two_factor_auths_spec.rb +++ b/spec/features/profiles/two_factor_auths_spec.rb @@ -45,6 +45,19 @@ RSpec.describe 'Two factor auths' do expect(page).to have_content('Status: Enabled') end end + + context 'when invalid pin is provided' do + let_it_be(:user) { create(:omniauth_user) } + + it 'renders a error alert with a link to the troubleshooting section' do + visit profile_two_factor_auth_path + + fill_in 'pin_code', with: '123' + click_button 'Register with two-factor app' + + expect(page).to have_link('Try the troubleshooting steps here.', href: help_page_path('user/profile/account/two_factor_authentication.md', anchor: 'troubleshooting')) + end + end end context 'when user has two-factor authentication enabled' do @@ -57,7 +70,9 @@ RSpec.describe 'Two factor auths' do click_button 'Disable two-factor authentication' - page.accept_alert + page.within('[role="dialog"]') do + click_button 'Disable' + end expect(page).to have_content('You must provide a valid current password') @@ -65,7 +80,9 @@ RSpec.describe 'Two factor auths' do click_button 'Disable two-factor authentication' - page.accept_alert + page.within('[role="dialog"]') do + click_button 'Disable' + end expect(page).to have_content('Two-factor authentication has been disabled successfully!') expect(page).to have_content('Enable two-factor authentication') @@ -95,7 +112,9 @@ RSpec.describe 'Two factor auths' do click_button 'Disable two-factor authentication' - page.accept_alert + page.within('[role="dialog"]') do + click_button 'Disable' + end expect(page).to have_content('Two-factor authentication has been disabled successfully!') expect(page).to have_content('Enable two-factor authentication') diff --git a/spec/features/profiles/user_manages_applications_spec.rb b/spec/features/profiles/user_manages_applications_spec.rb index c76ef2613fd..ea7a6b4b6ba 100644 --- a/spec/features/profiles/user_manages_applications_spec.rb +++ b/spec/features/profiles/user_manages_applications_spec.rb @@ -5,6 +5,7 @@ require 'spec_helper' RSpec.describe 'User manages applications' do let_it_be(:user) { create(:user) } let_it_be(:new_application_path) { applications_profile_path } + let_it_be(:index_path) { oauth_applications_path } before do sign_in(user) diff --git a/spec/features/profiles/user_manages_emails_spec.rb b/spec/features/profiles/user_manages_emails_spec.rb index 373c4f565f2..b037d5048aa 100644 --- a/spec/features/profiles/user_manages_emails_spec.rb +++ b/spec/features/profiles/user_manages_emails_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe 'User manages emails' do let(:user) { create(:user) } + let(:other_user) { create(:user) } before do sign_in(user) @@ -11,7 +12,7 @@ RSpec.describe 'User manages emails' do visit(profile_emails_path) end - it "shows user's emails" do + it "shows user's emails", :aggregate_failures do expect(page).to have_content(user.email) user.emails.each do |email| @@ -19,7 +20,7 @@ RSpec.describe 'User manages emails' do end end - it 'adds an email' do + it 'adds an email', :aggregate_failures do fill_in('email_email', with: 'my@email.com') click_button('Add') @@ -34,21 +35,21 @@ RSpec.describe 'User manages emails' do end end - it 'does not add a duplicate email' do - fill_in('email_email', with: user.email) + it 'does not add an email that is the primary email of another user', :aggregate_failures do + fill_in('email_email', with: other_user.email) click_button('Add') - email = user.emails.find_by(email: user.email) + email = user.emails.find_by(email: other_user.email) expect(email).to be_nil - expect(page).to have_content(user.email) + expect(page).to have_content('Email has already been taken') user.emails.each do |email| expect(page).to have_content(email.email) end end - it 'removes an email' do + it 'removes an email', :aggregate_failures do fill_in('email_email', with: 'my@email.com') click_button('Add') diff --git a/spec/features/profiles/user_visits_profile_spec.rb b/spec/features/profiles/user_visits_profile_spec.rb index 475fda5e7a1..273d52996d3 100644 --- a/spec/features/profiles/user_visits_profile_spec.rb +++ b/spec/features/profiles/user_visits_profile_spec.rb @@ -21,6 +21,14 @@ RSpec.describe 'User visits their profile' do expect(page).to have_content "This information will appear on your profile" end + it 'shows user readme' do + create(:project, :repository, :public, path: user.username, namespace: user.namespace) + + visit(user_path(user)) + + expect(find('.file-content')).to have_content('testme') + end + context 'when user has groups' do let(:group) do create :group do |group| |