From 06d606275a91df6fbc9ae8381450954108885511 Mon Sep 17 00:00:00 2001 From: Mathias Leppich Date: Wed, 15 May 2024 10:42:31 +0200 Subject: [PATCH] run lint and fixes --- docs/src/test-api/class-fullconfig.md | 6 ++++++ packages/playwright/src/common/config.ts | 2 +- .../playwright/src/isomorphic/teleReceiver.ts | 1 + packages/playwright/types/test.d.ts | 21 +++++++++++++++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/src/test-api/class-fullconfig.md b/docs/src/test-api/class-fullconfig.md index e6437ab314..8207d5f6a7 100644 --- a/docs/src/test-api/class-fullconfig.md +++ b/docs/src/test-api/class-fullconfig.md @@ -112,6 +112,12 @@ Base directory for all relative paths used in the reporters. See [`property: TestConfig.shard`]. +## property: FullConfig.shardingSeed +* since: ??? +- type: <[null]|[string]> + +See [`property: TestConfig.shardingSeed`]. + ## property: FullConfig.updateSnapshots * since: v1.10 - type: <[UpdateSnapshots]<"all"|"none"|"missing">> diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index 22d858e368..77238b1f07 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -86,7 +86,7 @@ export class FullConfigInternal { quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false), projects: [], shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null), - shardingSeed: takeFirst(configCLIOverrides.shardingSeed, userConfig.shardingSeed, undefined), + shardingSeed: takeFirst(configCLIOverrides.shardingSeed, userConfig.shardingSeed, null), updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, 'missing'), version: require('../../package.json').version, workers: 0, diff --git a/packages/playwright/src/isomorphic/teleReceiver.ts b/packages/playwright/src/isomorphic/teleReceiver.ts index da377b099f..a5b989afc8 100644 --- a/packages/playwright/src/isomorphic/teleReceiver.ts +++ b/packages/playwright/src/isomorphic/teleReceiver.ts @@ -595,6 +595,7 @@ export const baseFullConfig: reporterTypes.FullConfig = { rootDir: '', quiet: false, shard: null, + shardingSeed: null, updateSnapshots: 'missing', version: '', workers: 0, diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index bdb12aff56..4467abb622 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1411,8 +1411,25 @@ interface TestConfig { * Shuffle the order of test groups with a seed. By default tests are run in the order they are discovered, which is * mostly alphabetical. This could lead to an uneven distribution of slow and fast tests. Shuffling the order of tests * in a deterministic way can help to distribute the load more evenly. + * + * The sharding seed is a string that is used to initialize a random number generator. The configured value needs to + * be the same for all shards, to make sure + * + * Learn more about [parallelism and sharding](https://playwright.dev/docs/test-parallel) with Playwright Test. + * + * **Usage** + * + * ```js + * // playwright.config.ts + * import { defineConfig } from '@playwright/test'; + * + * export default defineConfig({ + * shardingSeed: "string value" + * }); + * ``` + * */ - shardingSeed?: string + shardingSeed?: string; /** * **NOTE** Use @@ -1793,7 +1810,7 @@ export interface FullConfig { /** * See [testConfig.shardingSeed](https://playwright.dev/docs/api/class-testconfig#test-config-sharding-seed). */ - shardingSeed: string; + shardingSeed: null|string; /** * See [testConfig.updateSnapshots](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots).