microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.39k stars 3.63k forks source link

[Bug]: json report not generated using merge-reports #33131

Open vvargas90 opened 4 days ago

vvargas90 commented 4 days ago

Version

1.46.1

Steps to reproduce

  1. Generate several blob reports into the /all-blob-reports folder.
  2. Execute npx playwright merge-reports --reporter json ./all-blob-reports to generate a combined json report

Expected behavior

There is a generated report.json file in /playwright-report directory

Actual behavior

The report is displayed as stdout but not stored into any file

Additional context

When running the same command but having as output an html report it does generate all the necessary artifacts in playwright-report folder. Example output:

npx playwright merge-reports --reporter html ./all-blob-reports

merging reports from /Users/my-user/repos/my-project/all-blob-reports
extracting: all-blob-reports/report-chromium.zip
extracting: all-blob-reports/report-ios.zip
extracting: all-blob-reports/report-firefox.zip
extracting: all-blob-reports/report-mobile.zip
merging events
processing test events
building final report
finished building report

Environment

System: OS: macOS 13.5 CPU: (8) arm64 Apple M2 Memory: 75.84 MB / 16.00 GB Binaries: Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm Languages: Bash: 3.2.57 - /bin/bash npmPackages: @playwright/test: ^1.46.1 => 1.46.1

vvargas90 commented 4 days ago

As a workaround I'm doing npx playwright merge-reports --reporter json ./all-blob-reports > playwright-report/report.json

dgozman commented 4 days ago

You need to pass an environment variable to make it write into a file. See docs. Let me know if you have any other questions.