Describe the feature
I think we should consider reworking the host and port options for the e2e setup() function.
In my opinion, it is currently not possible to specify a base URL with the default setup dev/test server. Sometimes e2e needs a non-localhost base URL to be able to implement csrf token/session cookies.
The current workaround would be to start the dev server before testing.
Proposal
await setup({
runner: 'vitest',
// testServer: false // run against an already running server
testServer: {
build: true, // boolean
host: '0.0.0.0', // or whatever
port: 80,
},
baseURL: 'http://frontend.local.test', // https://playwright.dev/docs/api/class-testoptions#test-options-base-url
browser: true,
})
baseURL can be different form testServer.host. (echo "127.0.0.1 frontend.local.test" >> /etc/hosts)
Additional information
Final checks
Describe the feature
I think we should consider reworking the
hostandportoptions for the e2esetup()function.In my opinion, it is currently not possible to specify a base URL with the default setup dev/test server. Sometimes e2e needs a non-localhost base URL to be able to implement csrf token/session cookies.
The current workaround would be to start the dev server before testing.
Proposal
baseURLcan be different formtestServer.host. (echo "127.0.0.1 frontend.local.test" >> /etc/hosts)Additional information
Final checks