Block the service worker in contexts a browser test opens itself #1047

Merged
tiagoagueda merged 1 commit from 1046-service-worker-contexts into main 2026-10-24 19:02:41 +00:00
Owner

Closes #1046

The browser job of #1041 hung twice in tests/e2e/test_column_filters.py: two live-server threads were stuck in SQLite, one serving the job list and one serving /offline/, which only the service worker asks for.

browser_context_args blocks the worker (#895), but only for the page and context fixtures. The 79 contexts the tests open with browser.new_context() (phone viewports, scripts off) still installed it. Its background fetch of the offline page overlapped the next request on the live server's single shared in-memory SQLite connection.

tests/e2e/conftest.py now defaults service_workers to "block" on Browser.new_context for the session. An explicit value still wins: test_web_app.py passes "allow" through its own browser_context_args, and its tests pass.

Locally: pytest -m e2e --browser chromium tests/e2e/test_column_filters.py tests/e2e/test_web_app.py: 29 passed.

🤖 Generated with Claude Code

Closes #1046 The browser job of #1041 hung twice in `tests/e2e/test_column_filters.py`: two live-server threads were stuck in SQLite, one serving the job list and one serving `/offline/`, which only the service worker asks for. `browser_context_args` blocks the worker (#895), but only for the `page` and `context` fixtures. The 79 contexts the tests open with `browser.new_context()` (phone viewports, scripts off) still installed it. Its background fetch of the offline page overlapped the next request on the live server's single shared in-memory SQLite connection. `tests/e2e/conftest.py` now defaults `service_workers` to `"block"` on `Browser.new_context` for the session. An explicit value still wins: `test_web_app.py` passes `"allow"` through its own `browser_context_args`, and its tests pass. Locally: `pytest -m e2e --browser chromium tests/e2e/test_column_filters.py tests/e2e/test_web_app.py`: 29 passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Block the service worker in contexts a browser test opens itself (#1046)
All checks were successful
CI / Browser tests (Chromium) (pull_request) Successful in 29m43s
CI / Unit tests and coverage (Python 3.14) (pull_request) Successful in 12m32s
CI / Checks: lint, migrations, catalogues, settings, built files (pull_request) Successful in 2m35s
CI / Security audit (pull_request) Successful in 56s
CI / Database tests on PostgreSQL (pull_request) Successful in 4m16s
CI / Unit tests and coverage (Python 3.14) (push) Successful in 12m49s
CI / Checks: lint, migrations, catalogues, settings, built files (push) Successful in 2m29s
CI / Database tests on PostgreSQL (push) Successful in 3m23s
CI / Security audit (push) Successful in 50s
CI / Browser tests (Chromium) (push) Successful in 30m24s
Every Python / Unit tests (Python 3.12) (push) Successful in 12m23s
Every Python / Unit tests (Python 3.13) (push) Successful in 11m50s
d8cd01c082
browser_context_args reaches only the page and context fixtures; the 79
contexts opened with browser.new_context() still let the worker install and
fetch /offline/ in the background. Answered while the next page asked for the
job list, over the live server's one shared in-memory SQLite connection, it
hung both requests until the browser job's timeout, twice in a row on #1041.

Browser.new_context now defaults service_workers to "block" for the session;
a test that wants the worker still passes "allow", as test_web_app.py does.

Closes #1046

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tiagoagueda deleted branch 1046-service-worker-contexts 2026-10-24 19:02:41 +00:00
Sign in to join this conversation.
No reviewers
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!1047
No description provided.