Skip to content

Commit 00fb7a9

Browse files
authored
chore: implement shard weights feedback (#38902)
1 parent 42d4f18 commit 00fb7a9

File tree

28 files changed

+297
-527
lines changed

28 files changed

+297
-527
lines changed

.github/workflows/tests_primary.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,15 @@ jobs:
139139
- uses: ./.github/actions/run-test
140140
with:
141141
node-version: ${{matrix.node-version}}
142-
command: npm run ttest -- --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --shard-weights=${{ matrix.shardWeights }}
142+
command: npm run ttest -- --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
143143
bot-name: "${{ matrix.os }}-node${{ matrix.node-version }}"
144144
shard-index: ${{ matrix.shardIndex }}
145145
flakiness-client-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_CLIENT_ID }}
146146
flakiness-tenant-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_TENANT_ID }}
147147
flakiness-subscription-id: ${{ secrets.AZURE_FLAKINESS_DASHBOARD_SUBSCRIPTION_ID }}
148148
env:
149149
PWTEST_CHANNEL: firefox-beta
150+
PWTEST_SHARD_WEIGHTS: ${{ matrix.shardWeights }}
150151

151152
test_vscode_extension:
152153
name: VSCode Extension
-552 KB
Binary file not shown.

docs/src/test-reporter-api/class-reporter.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ Reporter is allowed to override the status and hence affect the exit code of the
132132
- `status` <[FullStatus]<"passed"|"failed"|"timedout"|"interrupted">> Test run status.
133133
- `startTime` <[Date]> Test run start wall time.
134134
- `duration` <[int]> Test run duration in milliseconds.
135-
- `shards` <[Array]<[Object]>> Only present on merged reports
136-
- `shardIndex` ?<[int]> The index of the shard, one-based.
137-
- `tag` ?<[Array]<[string]>> Global [`property: TestConfig.tag`] that differentiates CI environments
138-
- `startTime` <[Date]> Start wall time of shard.
139-
- `duration` <[int]> Shard run duration in milliseconds.
140135

141136
Result of the full test run, `status` can be one of:
142137
* `'passed'` - Everything went as expected.

docs/src/test-reporter-api/class-testresult.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,3 @@ Learn more about [parallelism and sharding](../test-parallel.md) with Playwright
100100
- type: <[int]>
101101

102102
The index of the worker between `0` and `workers - 1`. It is guaranteed that workers running at the same time have a different `parallelIndex`.
103-
104-
## property: TestResult.shardIndex
105-
* since: v1.58
106-
- type: ?<[int]>
107-
108-
The index of the shard between `1` and [`shards`](../test-sharding.md).

docs/src/test-sharding-js.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,6 @@ Without the fullyParallel setting, Playwright Test defaults to file-level granul
4545
- **Without** `fullyParallel`: Tests are split at the file level, so to balance the shards, it's important to keep your test files small and evenly sized.
4646
- To ensure the most effective use of sharding, especially in CI environments, it is recommended to use `fullyParallel: true` when aiming for balanced distribution across shards. Otherwise, you may need to manually organize your test files to avoid imbalances.
4747

48-
### Rebalancing Shards
49-
50-
If tests in one of your shards take longer, you can manually assign less work to it using the `--shard-weights` option:
51-
52-
```bash
53-
npx playwright test --shard=x/4 --shard-weights=3:2:3:3
54-
```
55-
56-
Make sure you pass the same `--shard-weights` value to all shards.
57-
In this example, Shard 2 gets assigned less tests because they take longer, evening out the full duration.
58-
59-
In the Speedboard section of the combined HTML report, you can see a visualisation of your individual shard durations, and a recommendation for how to set your shard weights.
60-
61-
![Speedboard Shard Diagram](./images/speedboard-shards.png)
62-
6348
## Merging reports from multiple shards
6449

6550
In the previous example, each test shard has its own test report. If you want to have a combined report showing all the test results from all the shards, you can merge them.

packages/html-reporter/src/barchart.tsx

Lines changed: 0 additions & 233 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
limitations under the License.
1515
*/
1616

17-
.barchart-bar {
17+
.gantt-bar {
1818
transition: opacity 0.2s;
1919
cursor: pointer;
2020
outline: none;
2121
}
2222

23-
.barchart-bar:hover,
24-
.barchart-bar:focus {
23+
.gantt-bar:hover,
24+
.gantt-bar:focus {
2525
opacity: 0.8;
2626
stroke: var(--color-fg-default);
2727
stroke-width: 2;

0 commit comments

Comments
 (0)