nuxt / nuxt/test-utils

e2e | rework setup `host` and `port` option

Open
#1,607 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending triage
Dominant language
TypeScript
Stars
437
Forks
120
Avg merge
22h 52m
Merged PRs (30d)
23

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the e2e setup() entry point and read the current dev/test server option handling. Compare the proposed testServer host, port, build, already-running-server, and baseURL behavior with the Vitest runner and browser flow; done means these options support the stated non-localhost base URL and server configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, playwright, typescript
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.