Skip to content

e2e | rework setup host and port option #1607

Description

@OrbisK

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

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions