A platform for community discussion. Free, open, simple.
DEV: Improve performance of system test `sign_in` helper (#19579)
David Taylorb1b53da71d9d
diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rbindex ce1a97a616a..ecc653c88d6 100644--- a/app/controllers/session_controller.rb+++ b/app/controllers/session_controller.rb@@ -113,7 +113,12 @@ class SessionController < ApplicationControllerraise "User #{params[:session_id]} not found" if user.blank?log_on_user(user)- redirect_to path("/")++ if params[:redirect] == "false"+ render plain: "Signed in to #{params[:session_id]} successfully"+ else+ redirect_to path("/")+ endendenddiff --git a/plugins/chat/spec/system/channel_selector_modal_spec.rb b/plugins/chat/spec/system/channel_selector_modal_spec.rbindex 5aa834362b5..2cb9f5713fb 100644--- a/plugins/chat/spec/system/channel_selector_modal_spec.rb+++ b/plugins/chat/spec/system/channel_selector_modal_spec.rb@@ -9,6 +9,7 @@ RSpec.describe "Channel selector modal", type: :system, js: true dobefore dochat_system_bootstrapsign_in(current_user)+ visit("/")endKEY_MODIFIER = RUBY_PLATFORM =~ /darwin/i ? :meta : :controldiff --git a/plugins/chat/spec/system/navigation_spec.rb b/plugins/chat/spec/system/navigation_spec.rbindex 50f83a87073..7c86250da1d 100644--- a/plugins/chat/spec/system/navigation_spec.rb+++ b/plugins/chat/spec/system/navigation_spec.rb@@ -19,6 +19,8 @@ RSpec.describe "Navigation", type: :system, js: true docontext "when clicking chat icon and drawer is viewing channel" doit "navigates to index" do+ visit("/")+chat_page.open_from_headerchat_drawer_page.open_channel(category_channel_2)chat_page.open_from_headerdiff --git a/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb b/plugins/chat/spec/system/sidebar_navigation_menu_spec.rbindex 11616a6a4e0..33f7a9b78dd 100644--- a/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb+++ b/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb@@ -158,6 +158,7 @@ RSpec.describe "Sidebar navigation menu", type: :system, js: true doendit "displays all participants names" do+ visit("/")expect(page.find(".sidebar-section-chat-dms a.sidebar-section-link:nth-child(1) .sidebar-section-link-content-text",diff --git a/plugins/chat/spec/system/unfollow_dm_channel_spec.rb b/plugins/chat/spec/system/unfollow_dm_channel_spec.rbindex 361e7412970..aff4a419009 100644--- a/plugins/chat/spec/system/unfollow_dm_channel_spec.rb+++ b/plugins/chat/spec/system/unfollow_dm_channel_spec.rb@@ -16,6 +16,7 @@ RSpec.describe "Unfollow dm channel", type: :system, js: true docontext "when receiving a message after unfollowing" doit "correctly shows the channel" do+ visit("/")find(".channel-#{dm_channel_1.id}").hoverfind(".channel-#{dm_channel_1.id} .sidebar-section-link-hover").clickdiff --git a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rbindex 7ef58ab2fbd..1c4e2a71e00 100644--- a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb+++ b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb@@ -175,6 +175,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true dousing_session(:user_1) dosign_in(other_user)+ visit("/")find(".header-dropdown-toggle.current-user").clickexpect(find("#user-menu-button-chat-notifications")).to have_content(1)diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rbindex ee9faba604b..9d5054a75d5 100644--- a/spec/support/system_helpers.rb+++ b/spec/support/system_helpers.rb@@ -12,7 +12,7 @@ module SystemHelpersenddef sign_in(user)- visit "/session/#{user.encoded_username}/become"+ visit "/session/#{user.encoded_username}/become.json?redirect=false"enddef sign_out