mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Improve performance of system test sign_in helper (#19579)
Previously, calling `sign_in` would cause the browser to be redirected to `/`, and would cause the Ember app to boot. We would then call `visit()`, causing the app to boot for a second time. This commit adds a `redirect=false` option to the `/session/username/become` route. This avoids the unnecessary boot of the app, and leads to significantly faster system spec run times. In local testing, this takes the full system-spec suite for chat from ~6min to ~4min.
This commit is contained in:
@@ -113,7 +113,12 @@ class SessionController < ApplicationController
|
||||
raise "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("/")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user