Does Vitest browser mode support running the browser remotely (e.g. in Docker)? #9306
-
|
Hi Vitest team I’m experimenting with Vitest browser mode using the Playwright provider and wanted to check whether the following setup is intended to be supported. Setup Vitest running locally on the host Playwright + browser running inside a Docker container Vitest connects to Playwright via wsEndpoint What happens When tests start, the browser is instructed to navigate to a URL like: I guess this is a internal Vitest browser/orchestrator server on a random port. From what I can tell, this internal server always binds to and advertises localhost, and I haven’t found a way to configure or override it. Question Is Vitest browser mode designed to work only when the browser runs on the same machine/network namespace as Vitest, or is remote browser execution (e.g. Docker) expected to be supported? Thanks for any clarification! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
This should be possible with import { defineConfig } from "vitest/config";
import { playwright } from "@vitest/browser-playwright";
export default defineConfig({
test: {
browser: {
enabled: true,
provider: playwright({
connectOptions: {
wsEndpoint: "...",
},
}),
},
},
}); |
Beta Was this translation helpful? Give feedback.
Configuring those should be possible via
https://vitest.dev/config/browser.html#browser-apihttps://vitest.dev/config/browser/api.html#browser-api.