create-vue icon indicating copy to clipboard operation
create-vue copied to clipboard

Playwright webserver command should run build before preview?

Open vincerubinetti opened this issue 2 years ago • 1 comments

Currently, create-vue generates a playwright config that has something like this in it:

{
  webServer: {
    /**
     * use the dev server by default for faster feedback loop. Use the preview
     * server on CI for more realistic testing
     */
    command: process.env.CI
      ? "vite preview --port 5173"
      : "vite dev",
    port: 5173,
    reuseExistingServer: !process.env.CI,
  }
}

Shouldn't we need to run build before preview so that the app actually exists?

I ran into problems running my tests on GitHub Actions, and it took me a while to figure out that this was the cause. See: https://github.com/vitejs/vite/discussions/4572

vincerubinetti avatar May 04 '23 16:05 vincerubinetti

yes you need to run build first.

in the snippet above vite preview is being run in a CI env. you can add a step to run build and then trigger a CI job to run the PW tests.

jonalexander avatar Feb 18 '25 00:02 jonalexander