summaryrefslogtreecommitdiff
path: root/spec/features/users
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 20:02:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 20:02:30 +0000
commit41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch)
tree9c8d89a8624828992f06d892cd2f43818ff5dcc8 /spec/features/users
parent0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff)
downloadgitlab-ce-41fe97390ceddf945f3d967b8fdb3de4c66b7dea.tar.gz
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'spec/features/users')
-rw-r--r--spec/features/users/active_sessions_spec.rb6
-rw-r--r--spec/features/users/login_spec.rb71
-rw-r--r--spec/features/users/logout_spec.rb4
-rw-r--r--spec/features/users/show_spec.rb2
-rw-r--r--spec/features/users/signup_spec.rb16
-rw-r--r--spec/features/users/terms_spec.rb10
6 files changed, 55 insertions, 54 deletions
diff --git a/spec/features/users/active_sessions_spec.rb b/spec/features/users/active_sessions_spec.rb
index 6dc93fe017f..c722a4ec05c 100644
--- a/spec/features/users/active_sessions_spec.rb
+++ b/spec/features/users/active_sessions_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe 'Active user sessions', :clean_gitlab_redis_sessions do
Timecop.freeze(now) do
user = create(:user)
gitlab_sign_in(user)
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
sessions = ActiveSession.list(user)
expect(sessions.count).to eq 1
@@ -59,12 +59,12 @@ RSpec.describe 'Active user sessions', :clean_gitlab_redis_sessions do
it 'logout deletes the active user login' do
user = create(:user)
gitlab_sign_in(user)
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
expect(ActiveSession.list(user).count).to eq 1
gitlab_sign_out
- expect(current_path).to eq new_user_session_path
+ expect(page).to have_current_path new_user_session_path, ignore_query: true
expect(ActiveSession.list(user)).to be_empty
end
diff --git a/spec/features/users/login_spec.rb b/spec/features/users/login_spec.rb
index 2780549eea1..4d06415e203 100644
--- a/spec/features/users/login_spec.rb
+++ b/spec/features/users/login_spec.rb
@@ -28,7 +28,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect(user.reset_password_token).not_to be_nil
gitlab_sign_in(user)
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
user.reload
expect(user.reset_password_token).to be_nil
@@ -46,14 +46,14 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
user = create(:admin, password_automatically_set: true)
visit root_path
- expect(current_path).to eq edit_user_password_path
+ expect(page).to have_current_path edit_user_password_path, ignore_query: true
expect(page).to have_content('Please create a password for your new account.')
fill_in 'user_password', with: Gitlab::Password.test_default
fill_in 'user_password_confirmation', with: Gitlab::Password.test_default
click_button 'Change your password'
- expect(current_path).to eq new_user_session_path
+ expect(page).to have_current_path new_user_session_path, ignore_query: true
expect(page).to have_content(I18n.t('devise.passwords.updated_not_active'))
fill_in 'user_login', with: user.username
@@ -61,7 +61,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
click_button 'Sign in'
expect_single_session_with_authenticated_ttl
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
end
it 'does not show flash messages when login page' do
@@ -145,7 +145,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
fill_in 'user_email', with: user.email
click_button 'Resend'
- expect(current_path).to eq users_almost_there_path
+ expect(page).to have_current_path users_almost_there_path, ignore_query: true
end
end
end
@@ -226,7 +226,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
enter_code(user.current_otp)
expect_single_session_with_authenticated_ttl
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
end
it 'persists remember_me value via hidden field' do
@@ -255,7 +255,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
enter_code(user.current_otp)
expect_single_session_with_authenticated_ttl
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
end
it 'triggers ActiveSession.cleanup for the user' do
@@ -286,7 +286,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
enter_code(codes.sample)
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
end
it 'invalidates the used code' do
@@ -373,7 +373,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_single_session_with_authenticated_ttl
expect(page).not_to have_content('Two-Factor Authentication')
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
end
end
@@ -391,7 +391,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
enter_code(user.current_otp)
expect_single_session_with_authenticated_ttl
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
end
end
@@ -412,7 +412,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
expect_single_session_with_authenticated_ttl
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
expect(page).not_to have_content(I18n.t('devise.failure.already_authenticated'))
end
@@ -437,7 +437,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
context 'when the users password is expired' do
before do
- user.update!(password_expires_at: Time.parse('2018-05-08 11:29:46 UTC'))
+ user.update!(password_expires_at: Time.zone.parse('2018-05-08 11:29:46 UTC'))
end
it 'asks for a new password' do
@@ -450,7 +450,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
fill_in 'user_password', with: Gitlab::Password.test_default
click_button 'Sign in'
- expect(current_path).to eq(new_profile_password_path)
+ expect(page).to have_current_path(new_profile_password_path, ignore_query: true)
end
end
end
@@ -493,7 +493,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content('The global settings require you to enable Two-Factor Authentication for your account. You need to do this before ')
end
@@ -503,9 +503,9 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
click_link 'Configure it later'
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
end
end
@@ -518,7 +518,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The global settings require you to enable Two-Factor Authentication for your account.'
)
@@ -530,7 +530,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).not_to have_link('Configure it later')
end
end
@@ -547,7 +547,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The global settings require you to enable Two-Factor Authentication for your account.'
)
@@ -576,7 +576,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The group settings for Group 1 and Group 2 require you to enable '\
'Two-Factor Authentication for your account. '\
@@ -594,9 +594,9 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
click_link 'Configure it later'
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
end
end
@@ -609,7 +609,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The group settings for Group 1 and Group 2 require you to enable ' \
'Two-Factor Authentication for your account.'
@@ -622,7 +622,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).not_to have_link('Configure it later')
end
end
@@ -639,7 +639,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq profile_two_factor_auth_path
+ expect(page).to have_current_path profile_two_factor_auth_path, ignore_query: true
expect(page).to have_content(
'The group settings for Group 1 and Group 2 require you to enable ' \
'Two-Factor Authentication for your account. '\
@@ -775,7 +775,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
click_button 'Accept terms'
- expect(current_path).to eq(root_path)
+ expect(page).to have_current_path(root_path, ignore_query: true)
expect(page).not_to have_content(I18n.t('devise.failure.already_authenticated'))
end
@@ -792,11 +792,12 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
click_button 'Sign in'
- expect(current_path).to eq(root_path)
+ expect(page).to have_current_path(root_path, ignore_query: true)
end
context 'when 2FA is required for the user' do
before do
+ stub_feature_flags(mr_attention_requests: false)
group = create(:group, require_two_factor_authentication: true)
group.add_developer(user)
end
@@ -816,7 +817,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_to_be_on_terms_page
click_button 'Accept terms'
- expect(current_path).to eq(profile_two_factor_auth_path)
+ expect(page).to have_current_path(profile_two_factor_auth_path, ignore_query: true)
fill_in 'pin_code', with: user.reload.current_otp
fill_in 'current_password', with: user.password
@@ -825,7 +826,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
click_button 'Copy codes'
click_link 'Proceed'
- expect(current_path).to eq(profile_account_path)
+ expect(page).to have_current_path(profile_account_path, ignore_query: true)
expect(page).to have_content('You have set up 2FA for your account! If you lose access to your 2FA device, you can use your recovery codes to access your account. Alternatively, if you upload an SSH key, you can use that key to generate additional recovery codes.')
end
end
@@ -853,14 +854,14 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_to_be_on_terms_page
click_button 'Accept terms'
- expect(current_path).to eq(root_path)
+ expect(page).to have_current_path(root_path, ignore_query: true)
end
end
end
context 'when the users password is expired' do
before do
- user.update!(password_expires_at: Time.parse('2018-05-08 11:29:46 UTC'))
+ user.update!(password_expires_at: Time.zone.parse('2018-05-08 11:29:46 UTC'))
end
it 'asks the user to accept the terms before setting a new password' do
@@ -876,7 +877,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_to_be_on_terms_page
click_button 'Accept terms'
- expect(current_path).to eq(new_profile_password_path)
+ expect(page).to have_current_path(new_profile_password_path, ignore_query: true)
fill_in 'user_password', with: Gitlab::Password.test_default
fill_in 'user_new_password', with: 'new password'
@@ -903,7 +904,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
expect_to_be_on_terms_page
click_button 'Accept terms'
- expect(current_path).to eq(profile_path)
+ expect(page).to have_current_path(profile_path, ignore_query: true)
fill_in 'Email', with: 'hello@world.com'
@@ -931,7 +932,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq root_path
+ expect(page).to have_current_path root_path, ignore_query: true
expect(page).to have_content("Please check your email (#{user.email}) to verify that you own this address and unlock the power of CI/CD.")
end
@@ -944,7 +945,7 @@ RSpec.describe 'Login', :clean_gitlab_redis_sessions do
gitlab_sign_in(user)
- expect(current_path).to eq new_user_session_path
+ expect(page).to have_current_path new_user_session_path, ignore_query: true
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)
diff --git a/spec/features/users/logout_spec.rb b/spec/features/users/logout_spec.rb
index 3129eb5e6f3..596f0dd5a94 100644
--- a/spec/features/users/logout_spec.rb
+++ b/spec/features/users/logout_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe 'Logout/Sign out', :js do
it 'sign out redirects to sign in page' do
gitlab_sign_out
- expect(current_path).to eq new_user_session_path
+ expect(page).to have_current_path new_user_session_path, ignore_query: true
end
it 'sign out does not show signed out flash notice' do
@@ -30,7 +30,7 @@ RSpec.describe 'Logout/Sign out', :js do
it 'sign out redirects to sign in page' do
gitlab_sign_out
- expect(current_path).to eq new_user_session_path
+ expect(page).to have_current_path new_user_session_path, ignore_query: true
end
end
end
diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb
index 8edbf639c81..cb395846b96 100644
--- a/spec/features/users/show_spec.rb
+++ b/spec/features/users/show_spec.rb
@@ -426,7 +426,7 @@ RSpec.describe 'User page' do
end
context 'structured markup' do
- let_it_be(:user) { create(:user, website_url: 'https://gitlab.com', organization: 'GitLab', job_title: 'Frontend Engineer', email: 'public@example.com', public_email: 'public@example.com', location: 'Country', created_at: Time.now, updated_at: Time.now) }
+ let_it_be(:user) { create(:user, website_url: 'https://gitlab.com', organization: 'GitLab', job_title: 'Frontend Engineer', email: 'public@example.com', public_email: 'public@example.com', location: 'Country', created_at: Time.zone.now, updated_at: Time.zone.now) }
it 'shows Person structured markup' do
subject
diff --git a/spec/features/users/signup_spec.rb b/spec/features/users/signup_spec.rb
index a651a6c09c6..3eae4955167 100644
--- a/spec/features/users/signup_spec.rb
+++ b/spec/features/users/signup_spec.rb
@@ -203,7 +203,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
expect { click_button 'Register' }.to change { User.count }.by(1)
- expect(current_path).to eq users_almost_there_path
+ 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
@@ -223,7 +223,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
expect { click_button 'Register' }.to change { User.count }.by(1)
- expect(current_path).to eq users_sign_up_welcome_path
+ expect(page).to have_current_path users_sign_up_welcome_path, ignore_query: true
end
end
end
@@ -239,7 +239,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
click_button "Register"
- expect(current_path).to eq users_sign_up_welcome_path
+ expect(page).to have_current_path users_sign_up_welcome_path, ignore_query: true
end
end
@@ -254,7 +254,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
expect { click_button 'Register' }.to change { User.count }.by(1)
- expect(current_path).to eq new_user_session_path
+ expect(page).to have_current_path new_user_session_path, ignore_query: true
expect(page).to have_content("You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator")
end
end
@@ -268,7 +268,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
click_button "Register"
- expect(current_path).to eq user_registration_path
+ expect(page).to have_current_path user_registration_path, ignore_query: true
expect(page).to have_content("error prohibited this user from being saved")
expect(page).to have_content("Email has already been taken")
end
@@ -280,7 +280,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
click_button "Register"
- expect(current_path).to eq user_registration_path
+ expect(page).to have_current_path user_registration_path, ignore_query: true
expect(page.body).not_to match(/#{new_user.password}/)
end
end
@@ -298,7 +298,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
click_button 'Register'
- expect(current_path).to eq users_sign_up_welcome_path
+ expect(page).to have_current_path users_sign_up_welcome_path, ignore_query: true
end
end
@@ -324,7 +324,7 @@ RSpec.describe 'Signup' do
fill_in_signup_form
expect { click_button 'Register' }.not_to change { User.count }
- expect(page).to have_content('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
+ expect(page).to have_content(_('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'))
end
end
diff --git a/spec/features/users/terms_spec.rb b/spec/features/users/terms_spec.rb
index 7cfe74f8aa9..7a662d24d60 100644
--- a/spec/features/users/terms_spec.rb
+++ b/spec/features/users/terms_spec.rb
@@ -82,7 +82,7 @@ RSpec.describe 'Users > Terms', :js do
click_link 'Continue'
- expect(current_path).to eq(root_path)
+ expect(page).to have_current_path(root_path, ignore_query: true)
end
end
@@ -99,7 +99,7 @@ RSpec.describe 'Users > Terms', :js do
enforce_terms
# Application settings are cached for a minute
- Timecop.travel 2.minutes do
+ travel_to 2.minutes.from_now do
within('.nav-sidebar') do
click_link 'Issues'
end
@@ -108,7 +108,7 @@ RSpec.describe 'Users > Terms', :js do
click_button('Accept terms')
- expect(current_path).to eq(project_issues_path(project))
+ expect(page).to have_current_path(project_issues_path(project), ignore_query: true)
end
end
@@ -123,11 +123,11 @@ RSpec.describe 'Users > Terms', :js do
click_button 'Create issue'
- expect(current_path).to eq(terms_path)
+ expect(page).to have_current_path(terms_path, ignore_query: true)
click_button('Accept terms')
- expect(current_path).to eq(new_project_issue_path(project))
+ expect(page).to have_current_path(new_project_issue_path(project), ignore_query: true)
expect(find_field('issue_title').value).to eq('Hello world, a new issue')
expect(find_field('issue_description').value).to eq("We don't want to lose what the user typed")
end