Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

like image 422
Anna Do Avatar asked Sep 11 '25 02:09

Anna Do


2 Answers

You can pass open: 'never' in the config file:

export default defineConfig({
    reporter: [
        ['html', { open: 'never' }],
    ],
}

...or just remove the entire reporter if you don't need the html report at all

like image 172
candre Avatar answered Sep 13 '25 11:09

candre


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
  }
like image 36
Anna Do Avatar answered Sep 13 '25 11:09

Anna Do