mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 17:53:55 +08:00
`SystemHelpers#sign_in` navigated Chrome to `/session/:username/become.json` on every call, a full page load paid roughly 1,800 times per CI run (about one per example, since most system specs sign in). This replaces that navigation with an in-process `Rack::Test` GET to the same endpoint and injects the returned session cookies into the Playwright browser context. Every server-side effect of `SessionController#become` is preserved, since the same request runs through the same controller and full middleware stack. The change only moves the request out of the browser. Two consequences of no longer navigating during sign-in are handled here. The browser can still be on `about:blank` afterwards, so sign_in parks on `/srv/status` (the cheapest app document) when that is the case, restoring the prior contract that specs may run `execute_script` before their first visit. And `Capybara::Session#reset!` only tears down the driver once the session is marked touched, which the old navigation did implicitly, so sign_in now sets it explicitly to keep `Capybara.reset_sessions!` working for specs that sign in and then test anonymous access. |
||
|---|---|---|
| .. | ||
| db | ||
| fabricators | ||
| fixtures | ||
| generator | ||
| helpers | ||
| import_export | ||
| initializers | ||
| integration | ||
| integrity | ||
| jobs | ||
| lib | ||
| mailers | ||
| migrations | ||
| models | ||
| multisite | ||
| queries/reports | ||
| requests | ||
| script | ||
| serializers | ||
| services | ||
| support | ||
| system | ||
| tasks | ||
| views | ||
| rails_helper.rb | ||
| regenerate_swagger_docs | ||
| swagger_helper.rb | ||