testingazure-pipelinespipelineplaywrightnpx

How to finish running playwright tests in pipeline?


After running the Playwright tests in command line (e.g. by command npx playwright test), it always shows

  Serving HTML report at http://localhost:0000. Press Ctrl+C to quit.

How to avoid pressing Ctrl+C to quit and quit stream automatically? So I can use playwright in a pipeline (Azure).


Solution

  • I could figure it out.

    In pipeline I added a variable CI=true.

    Locally I fixed it by adding file .env and added CI=true there. In the config I added this reuseExistingServer: true to playwright.config.ts:

      webServer: {
        command: 'ng s',
        url: 'http://localhost:4200/',
        reuseExistingServer: true
      }