Browser tests: sign in without the form, through one shared helper #720

Closed
opened 2026-10-04 20:43:13 +00:00 by tiagoagueda · 0 comments
Owner

Measured from Forgejo's task API and job logs, runs 561–710 (24 Sep – 4 Oct 2026): wall time per push about 52–55 min, up from about 15; the browser suite grew from 149 to 645 tests in five days and runs serially (29 min); the runner takes two jobs at a time, in the order the workflow file lists them, so the browser job starts 19–22 min after the push; and Forgejo cancels the older push run when a newer push lands, which stopped 18 of 56 browser jobs before they gave a verdict.

Twenty-four browser test files each define their own sign_in, and three more sign in inline (test_identifier_schemes.py:47, test_dialog.py:35, test_password_meter.py:13). Every one opens the sign-in page, fills it, submits it, waits for the dashboard, and then usually goes somewhere else: about two page loads per test, in a fresh context with a cold cache, so app.js and app.css are downloaded again each time. Across 645 tests that is minutes.

Proposal

  • One helper beside tests/e2e/selects.py: sign_in(page_or_context, live_server, user, path=None).
    • Signs in with Client().force_login(user, backend="allauth.account.auth_backends.AuthenticationBackend"), so last_login is set as a real sign-in sets it (Server → People shows it).
    • Writes allauth's record of how the person signed in (account_authentication_methods, a password entry), which the form writes and force_login does not. Without it every page behind a recent-password check redirects to the reauthentication page: deleting the account, TOTP, recovery codes, passkeys, changing an address.
    • Puts settings.SESSION_COOKIE_NAME into the context and goes straight to path.
    • Takes a page or a context, because about twenty tests open their own.
  • The per-file helpers and the inline sign-ins call it. test_accessibility.py keeps exporting sign_in, which about twenty files import from it.
  • The form is still used where the test is about the form: test_smoke.py (the critical path), test_passkeys.py, test_csp.py.
  • The walks keep their fallback that types the password again, because allauth's record is good for five minutes.

Done when

  • Only the tests about signing in fill the sign-in form.
Measured from Forgejo's task API and job logs, runs 561–710 (24 Sep – 4 Oct 2026): wall time per push about 52–55 min, up from about 15; the browser suite grew from 149 to 645 tests in five days and runs serially (29 min); the runner takes **two jobs at a time, in the order the workflow file lists them**, so the browser job starts 19–22 min after the push; and Forgejo cancels the older push run when a newer push lands, which stopped 18 of 56 browser jobs before they gave a verdict. Twenty-four browser test files each define their own `sign_in`, and three more sign in inline (`test_identifier_schemes.py:47`, `test_dialog.py:35`, `test_password_meter.py:13`). Every one opens the sign-in page, fills it, submits it, waits for the dashboard, and then usually goes somewhere else: about two page loads per test, in a fresh context with a cold cache, so `app.js` and `app.css` are downloaded again each time. Across 645 tests that is minutes. ## Proposal - One helper beside `tests/e2e/selects.py`: `sign_in(page_or_context, live_server, user, path=None)`. - Signs in with `Client().force_login(user, backend="allauth.account.auth_backends.AuthenticationBackend")`, so `last_login` is set as a real sign-in sets it (*Server → People* shows it). - Writes allauth's record of how the person signed in (`account_authentication_methods`, a password entry), which the form writes and `force_login` does not. Without it every page behind a recent-password check redirects to the reauthentication page: deleting the account, TOTP, recovery codes, passkeys, changing an address. - Puts `settings.SESSION_COOKIE_NAME` into the context and goes straight to `path`. - Takes a page or a context, because about twenty tests open their own. - The per-file helpers and the inline sign-ins call it. `test_accessibility.py` keeps exporting `sign_in`, which about twenty files import from it. - The form is still used where the test is about the form: `test_smoke.py` (the critical path), `test_passkeys.py`, `test_csp.py`. - The walks keep their fallback that types the password again, because allauth's record is good for five minutes. ## Done when - Only the tests about signing in fill the sign-in form.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#720
No description provided.