Issue 1:
System info

Playwright Version: 1.34.3

Operating System: Mac

Browser: All

Other info:

Source code

I provided exact source code that allows reproducing the issue locally.

Link to the GitHub repository with the repro

bug-repo

Steps

Run the script npm run all. This runs the tests in parallel in two shards

Expected

The global teardown should run only once similar to global setup

Actual

The global teardown runs in both the shards.

Running 4 tests using 1 worker, shard 2 of 2

Running 4 tests using 1 worker, shard 1 of 2

1 [setup] › global.setup.ts:3:5 › run global setup
✓ 1 [setup] › global.setup.ts:3:5 › run global setup (1.6s)
✓ 1 [setup] › global.setup.ts:3:5 › run global setup (1.9s)
**global setup ran** //Global setup runs once
2 [webkit] › example.spec.ts:4:7 › has title @smoke › has title
✓ 2 [webkit] › example.spec.ts:4:7 › has title @smoke › has title (1.0s)
✓ 2 [chromium] › example.spec.ts:4:7 › has title @smoke › has title (1.6s)
3 [chromium] › example.spec.ts:9:7 › has title @smoke › has 12123
✓ 3 [chromium] › example.spec.ts:9:7 › has title @smoke › has 12123 (809ms)
✓ 4 [teardown] › global.teardown.ts:3:5 › run global teardown (1.6s)
**global teardown ran** //Global teardown runs on one shard

✓ 4 [teardown] › global.teardown.ts:3:5 › run global teardown (1.4s)
**global teardown ran** //Global teardown runs on another shard

Issue 2:
Hello,

I am using Playwright in JavaScript and due to project requirements, the parallelization is done by grouping and using npm concurrent (to avoid double user sessions, can't control test data)

Locally when I run the suite I get served two reports but at the end have only one index.html in my playwright-report, but when this is run on Jenkins, the htmlpublisher plugin serves everything within playwright-report and it only contains the last report, as the new index.html overrides the old one.

So I am looking to generate separate reports per concurrent script run.

I've been researching this a lot today and can't seem to find a solution:

tried using just the CLI parameters --output="reports-uk" and in the other npm script --output="reports-de" -> what happens is the webm files usually located in test-results are generated in these new folders, but then the report is still one index.html from playwright-report

I tried using outputPath in my configs reporter property as: process.env.OUTPUT_PATH || 'playwright-local/report.html',

Then in my scripts I have:

"scripts": {
"test": "cross-env test_env=staging npx playwright test",
"run-de": "cross-env test_env=%environment_name% OUTPUT_PATH=playwright-report/de npx playwright test --project=de %scope%",
"run-uk": "cross-env test_env=%environment_name% OUTPUT_PATH=playwright-report/uk npx playwright test --project=uk %scope%",
"execute-all": "concurrently %runCountries%"
},

But I still only get one report named index.html at playwright-report folder.

Since documentation is a little bit scarce on the html reporter, is there a way for me to make the 2 reports have different names over CLI and have them in one folder? Whatever I do I always end up with index.html somehow.

If not, how could I specify two folders for reports that would each have one of index.html so as not to override the reports?