When running Playwright tests that involve a database, you can use a custom user agent to help identify requests originating from specific test processes.
To integrate with Phoenix.Ecto.SQL.Sandbox, set the userAgent to the value returned by Phoenix.Ecto.SQL.Sandbox.metadata_for(YourApp.Repo, pid). This allows the database sandbox to correctly associate the browser's requests with the appropriate Elixir process.
# Example pattern for Ecto Sandbox integration
userAgent = Phoenix.Ecto.SQL.Sandbox.metadata_for(YourApp.Repo, self())
context = Browser.new_context(browser, %{"userAgent" => userAgent})