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

Wait for idle between login requests

Oliver Günther6eb478228793
diff --git a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
index 3d97bc10120..72e86cd92ac 100644
--- a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
+++ b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
@@ -1,9 +1,12 @@
require_relative "../../spec_helper"
require_relative "../shared_2fa_examples"
-RSpec.describe "Login with 2FA backup code", :js, with_settings: {
- plugin_openproject_two_factor_authentication: { "active_strategies" => [:developer] }
-} do
+RSpec.describe "Login with 2FA backup code",
+ :js,
+ :with_cuprite,
+ with_settings: {
+ plugin_openproject_two_factor_authentication: { "active_strategies" => [:developer] }
+ } do
let(:user_password) { "bob!" * 4 }
let(:user) do
create(:user,
diff --git a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
index effabe6acc2..6701fd82b24 100644
--- a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
@@ -1,12 +1,15 @@
require_relative "../../spec_helper"
require_relative "../shared_2fa_examples"
-RSpec.describe "Login with enforced 2FA", :js, with_settings: {
- plugin_openproject_two_factor_authentication: {
- "active_strategies" => [:developer],
- "enforced" => true
- }
-} do
+RSpec.describe "Login with enforced 2FA",
+ :js,
+ :with_cuprite,
+ with_settings: {
+ plugin_openproject_two_factor_authentication: {
+ "active_strategies" => [:developer],
+ "enforced" => true
+ }
+ } do
let(:user_password) { "bob!" * 4 }
let(:user) do
create(:user,
diff --git a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
index c1ea5473179..8eff3e7d0be 100644
--- a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
@@ -1,11 +1,14 @@
require_relative "../../spec_helper"
require_relative "../shared_2fa_examples"
-RSpec.describe "Login with 2FA device", :js, with_settings: {
- plugin_openproject_two_factor_authentication: {
- "active_strategies" => [:developer]
- }
-} do
+RSpec.describe "Login with 2FA device",
+ :js,
+ :with_cuprite,
+ with_settings: {
+ plugin_openproject_two_factor_authentication: {
+ "active_strategies" => [:developer]
+ }
+ } do
let(:user_password) { "bob!" * 4 }
let(:user) do
create(:user,
diff --git a/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb
index 0ee982a3e07..34565fca2a2 100644
--- a/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb
@@ -1,7 +1,10 @@
require_relative "../../spec_helper"
require_relative "../shared_2fa_examples"
-RSpec.describe "Login with no required OTP", :js, with_config: { "2fa": { active_strategies: [:developer] } } do
+RSpec.describe "Login with no required OTP",
+ :js,
+ :with_cuprite,
+ with_config: { "2fa": { active_strategies: [:developer] } } do
let(:user_password) { "bob!" * 4 }
let(:user) do
create(:user,
diff --git a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb
index 015a621fc6a..086daa515d8 100644
--- a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb
@@ -1,9 +1,12 @@
require_relative "../../spec_helper"
require_relative "../shared_2fa_examples"
-RSpec.describe "Login by switching 2FA device", :js, with_settings: {
- plugin_openproject_two_factor_authentication: { "active_strategies" => %i[developer totp] }
-} do
+RSpec.describe "Login by switching 2FA device",
+ :js,
+ :with_cuprite,
+ with_settings: {
+ plugin_openproject_two_factor_authentication: { "active_strategies" => %i[developer totp] }
+ } do
let(:user_password) { "bob!" * 4 }
let(:user) do
create(:user,
@@ -21,12 +24,11 @@ RSpec.describe "Login by switching 2FA device", :js, with_settings: {
expect(page).to have_css("input#otp")
- SeleniumHubWaiter.wait
# Toggle device to TOTP
find_by_id("toggle_resend_form").click
- SeleniumHubWaiter.wait
find(".button--link[value='#{device2.redacted_identifier}']").click
+ wait_for_network_idle
expect(page).to have_css("input#otp")
expect(page).to have_css("#submit_otp p", text: device2.redacted_identifier)
diff --git a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
index c7bb9cd65f3..b76eded6d0b 100644
--- a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
@@ -1,8 +1,11 @@
require_relative "../spec_helper"
-RSpec.describe "My Account 2FA configuration", :js, with_settings: {
- plugin_openproject_two_factor_authentication: { "active_strategies" => %i[developer totp] }
-} do
+RSpec.describe "My Account 2FA configuration",
+ :js,
+ :with_cuprite,
+ with_settings: {
+ plugin_openproject_two_factor_authentication: { "active_strategies" => %i[developer totp] }
+ } do
let(:dialog) { Components::PasswordConfirmationDialog.new }
let(:user_password) { "boB!4" * 4 }
let(:user) do
diff --git a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
index 159404baa86..5a02d143809 100644
--- a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
+++ b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
@@ -1,12 +1,15 @@
require_relative "../../spec_helper"
require_relative "../shared_2fa_examples"
-RSpec.describe "Login with 2FA remember cookie", :js, with_settings: {
- plugin_openproject_two_factor_authentication: {
- active_strategies: [:developer],
- allow_remember_for_days: 30
- }
-} do
+RSpec.describe "Login with 2FA remember cookie",
+ :js,
+ :with_cuprite,
+ with_settings: {
+ plugin_openproject_two_factor_authentication: {
+ active_strategies: [:developer],
+ allow_remember_for_days: 30
+ }
+ } do
let(:user_password) do
"user!user!"
end
@@ -16,7 +19,7 @@ RSpec.describe "Login with 2FA remember cookie", :js, with_settings: {
let!(:device) { create(:two_factor_authentication_device_sms, user:, active: true, default: true) }
def login_with_cookie
- page.driver.browser.manage.delete_all_cookies
+ page.driver.clear_cookies
sms_token = nil
allow_any_instance_of(OpenProject::TwoFactorAuthentication::TokenStrategy::Developer)
diff --git a/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb b/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
index 65443b9b57c..3042abf82fa 100644
--- a/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
+++ b/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
@@ -1,23 +1,23 @@
def first_login_step
visit signin_path
- SeleniumHubWaiter.wait
within("#login-form") do
fill_in("username", with: user.login)
fill_in("password", with: user_password)
click_link_or_button I18n.t(:button_login)
end
+ wait_for_network_idle
end
def two_factor_step(token)
expect(page).to have_css("input#otp")
- SeleniumHubWaiter.wait
fill_in "otp", with: token
click_button I18n.t(:button_login)
+ wait_for_network_idle
end
def expect_logged_in
visit my_account_path
- SeleniumHubWaiter.wait
+ wait_for_network_idle
expect(page).to have_css(".form--field-container", text: user.login)
end
diff --git a/spec/features/auth/consent_auth_stage_spec.rb b/spec/features/auth/consent_auth_stage_spec.rb
index 5839c19f495..4888e7e7699 100644
--- a/spec/features/auth/consent_auth_stage_spec.rb
+++ b/spec/features/auth/consent_auth_stage_spec.rb
@@ -50,11 +50,13 @@ RSpec.describe "Authentication Stages" do
def expect_logged_in(path = my_page_path)
expect(page).to have_current_path(path)
visit my_account_path
+ wait_for_network_idle
expect(page).to have_css(".form--field-container", text: user.login)
end
def expect_not_logged_in
visit my_account_path
+ wait_for_netowrk_idle
expect(page).to have_no_css(".form--field-container", text: user.login)
end