Skip to content

Browser suite fails when one worker runs a test outside browser/ between two browser tests #282

Closed

Description

@PorkChopExpress86

Goal

Make the browser suite pass when a pytest command names a file outside server/ui/tests/browser/ between two browser files. Today that command fails every later browser test's setup with SynchronousOnlyOperation. The implementer found that pytest 9.1.x binds the browser conftest's fixtures at collection (pytest-dev/pytest#14635, fixed in 9.2.0), so CI's -n auto -m browser ui cannot hit it and the run order does not matter; the PR carries the --collect-only evidence.

Current PHP behavior

  • PHP has no counterpart. This is the Django port's browser test harness.
  • During kiosk_screens.py reports overlapping elements and text cut short with an ellipsis #256 (master d2355a0), one command run from server/ gave 52 SynchronousOnlyOperation errors at the setup of test_kiosk_names.py's tests. The command is uv run pytest -m browser -p no:xdist ui/tests/browser/test_shell.py ui/tests/test_kiosk_screens_tool.py ui/tests/browser/test_kiosk_names.py. It was observed once and has not been reproduced since.
  • The order that failed is a test under browser/, then a test outside it (ui/tests/test_kiosk_screens_tool.py), then browser/ again, all in one worker.
  • The first suspect, refuted by the implementer, was that server/ui/tests/browser/conftest.py sets DJANGO_ALLOW_ASYNC_UNSAFE in its _async_unsafe fixture (around line 165), and that the setting is not in force for the later browser tests once a test outside that folder has run.

Scope

  • Reproduce the failure with the command above on current master, and record the first error.
  • Find the cause, and state the hypothesis that proved true in the PR.
  • Fix it, with a regression check that goes red before the fix and green after it.

Out of scope

  • Other browser flakes, such as the photo race in test_photos.py and test_kiosk_thumbnails.py.

Acceptance criteria

  • The command above passes. Evidence is its output in the PR.
  • A regression check fails on master and passes with the fix. Evidence is the check.
  • The full browser suite passes on SQLite and on Postgres, since the browser conftest is shared. Evidence is both runs' summaries in the PR.

Risks and notes

  • If the command passes on current master, look for an order that does fail, such as another test outside browser/ run between two browser tests, before calling it fixed, or close the ticket with the evidence.
  • A fix that turns off Django's async safety check for the whole suite would hide real bugs in non-browser tests; scope it to the browser tests.

Dependencies

References

  • server/ui/tests/browser/conftest.py, server/ui/tests/test_kiosk_screens_tool.py, server/ui/tests/browser/test_kiosk_names.py, server/README.md

Activity

  1. added 3 commits that reference this issue on Nov 11, 2026
  2. added 4 commits that reference this issue on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:testingArea: testingdjango-migrationPHP to Django migration programkind:ticketImplementable unit of workready-for-agentFully specified, with an agent brief; ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions