Skip to content

[Feature] Don't quit a web server started by Playwright if reuseExistingServer is true #26459

Closed

Description

If I set webServer.reuseExistingServer to true, and the server is not running when I run Playwright, it starts the server for me using webServer.command.

However, the server then seems to exit after the tests complete; this prevents me from navigating in the browser window to use the VSCode extension's "Pick locator" command, and means the server has to be started every time I run a test — making reuseExistingServer somewhat irrelevant!

Changing the way reuseExistingServer works is probably not ideal, as there is bound to be somebody who relies on the current behaviour, but could there be a keepServerAlive option that would prevent any server started by Playwright from terminating when the tests complete?

Activity

  1. mxschmitt commented on Aug 14, 2023

    @mxschmitt
    Contributor

    It seems like you are using it for a development scenario, for that we assume that you run your dev server in a Terminal next to your tests. Then reuseExistingServer: true should just work and running an individual test is also faster (since no server needs to be started). Would that work for you?

  2. unikitty37 commented on Aug 15, 2023

    @unikitty37
    ContributorAuthor

    I think the problem is that I need two servers running: a dev server, and a test server that uses a different API endpoint so the dev database doesn't continually get clobbered.

    Ideally I'd like to start the dev server manually and have VSCode start the test server when I run a test, but then leave it running.

    However, I've done a bit more research, and I think a dev container that starts the two servers automatically might be the best solution here.

  3. mxschmitt commented on Aug 17, 2023

    @mxschmitt
    Contributor

    Amazing, I'm closing it then for now as working as intended. For your scenario with two servers, and one which needs to get started for each test, I'd suggest, that you put only one into the webServer config of your playwright.config.ts and start the other one manually, this should give you the intended development experience.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions