diff --git a/tests/playwright-test/types.spec.ts b/tests/playwright-test/types.spec.ts index 17906cd006..24f71db782 100644 --- a/tests/playwright-test/types.spec.ts +++ b/tests/playwright-test/types.spec.ts @@ -182,3 +182,29 @@ test('config should allow void/empty options', async ({ runTSC }) => { }); expect(result.exitCode).toBe(0); }); + +test('config should allow ExtraUseOptions', async ({ runTSC }) => { + const result = await runTSC({ + 'playwright.config.ts': ` + const configs: pwt.Config[] = []; + configs.push({ use: { myParam: 'text' }}); + `, + 'extraUseOptions.d.ts': ` + export {}; + declare global { + namespace PlaywrightTest { + export interface ExtraUseOptions { + myParam: string + } + } + } + `, + 'a.spec.ts': ` + const { test } = pwt; + test('my test', async ({ myParam }) => { + console.log(myParam); + }); + ` + }); + expect(result.exitCode).toBe(0); +}); diff --git a/types/test.d.ts b/types/test.d.ts index 0e3faeb9fe..8f2168f824 100644 --- a/types/test.d.ts +++ b/types/test.d.ts @@ -2444,7 +2444,7 @@ export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | * ``` * */ -export interface PlaywrightTestOptions { +export interface PlaywrightTestOptions extends PlaywrightTest.ExtraUseOptions { /** * Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled. */ diff --git a/types/testExpect.d.ts b/types/testExpect.d.ts index a489505e1c..7b0e96e5b7 100644 --- a/types/testExpect.d.ts +++ b/types/testExpect.d.ts @@ -166,4 +166,11 @@ declare global { } } +declare global { + namespace PlaywrightTest { + export interface ExtraUseOptions { + } + } +} + export { }; diff --git a/utils/generate_types/overrides-test.d.ts b/utils/generate_types/overrides-test.d.ts index 57feedfe26..601edd9898 100644 --- a/utils/generate_types/overrides-test.d.ts +++ b/utils/generate_types/overrides-test.d.ts @@ -298,7 +298,7 @@ export interface PlaywrightWorkerOptions { export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | /** deprecated */ 'retry-with-video'; -export interface PlaywrightTestOptions { +export interface PlaywrightTestOptions extends PlaywrightTest.ExtraUseOptions { acceptDownloads: boolean | undefined; bypassCSP: boolean | undefined; colorScheme: ColorScheme | undefined;