Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Switch `users/delete_spec` to cuprite

Aaron Contreras74b887fcc234
diff --git a/spec/features/users/delete_spec.rb b/spec/features/users/delete_spec.rb
index d44dde1f692..bcb9de14cb3 100644
--- a/spec/features/users/delete_spec.rb
+++ b/spec/features/users/delete_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'user deletion:', js: true do
+RSpec.describe 'user deletion:', js: true, with_cuprite: true do
let(:dialog) { Components::PasswordConfirmationDialog.new }
before do
@@ -43,7 +43,7 @@ RSpec.describe 'user deletion:', js: true do
password_confirmation: user_password)
end
- it 'can delete their own account', js: true do
+ it 'can delete their own account', signout_via_visit: true do
Setting.users_deletable_by_self = 1
visit delete_my_account_info_path
@@ -70,7 +70,7 @@ RSpec.describe 'user deletion:', js: true do
let!(:user) { create(:user) }
let(:current_user) { create(:user, global_permission: :manage_user) }
- it 'can not delete even if settings allow it', js: true do
+ it 'can not delete even if settings allow it' do
Setting.users_deletable_by_admins = 1
visit edit_user_path(user)
@@ -91,7 +91,7 @@ RSpec.describe 'user deletion:', js: true do
password_confirmation: user_password)
end
- it 'can delete other users if the setting permits it', selenium: true do
+ it 'can delete other users if the setting permits it' do
Setting.users_deletable_by_admins = 1
visit edit_user_path(user)
@@ -115,7 +115,7 @@ RSpec.describe 'user deletion:', js: true do
expect(page).to have_current_path '/users'
end
- it 'can delete and confirm with keyboard (Regression #44499)', selenium: true do
+ it 'can delete and confirm with keyboard (Regression #44499)' do
Setting.users_deletable_by_admins = 1
visit edit_user_path(user)
diff --git a/spec/support/authentication_helpers.rb b/spec/support/authentication_helpers.rb
index a192e46ada1..8609784a379 100644
--- a/spec/support/authentication_helpers.rb
+++ b/spec/support/authentication_helpers.rb
@@ -64,10 +64,12 @@ module AuthenticationHelpers
end
def logout
- if using_cuprite?
- page.driver.cookies.clear
- else
+ # There are a select number of specs that rely on some implementation detail
+ # of `visit signout_path` that a cookie clear just doesn't cut.
+ if !using_cuprite? || RSpec.current_example.metadata[:signout_via_visit]
visit signout_path
+ else
+ page.driver.cookies.clear
end
end